/**
 * GLAESS Angebotsgenerator – Custom Styles
 *
 * Ergänzt Bootstrap 5 mit projektspezifischen Styles.
 * Primärfarbe wird über Admin-Einstellungen konfiguriert.
 */

/* ================================================================
   Allgemein
   ================================================================ */

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f8f9fa;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

/* ================================================================
   Login-Seite
   ================================================================ */

.login-container {
    max-width: 420px;
    margin: 80px auto;
}

.login-card {
    border: none;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1);
}

/* ================================================================
   Navbar
   ================================================================ */

.navbar-brand {
    font-weight: 600;
}

/* ================================================================
   Status-Badges
   ================================================================ */

.badge-entwurf {
    background-color: #0dcaf0;
    color: #000;
}

.badge-versendet {
    background-color: #ffc107;
    color: #000;
}

.badge-angenommen {
    background-color: #198754;
    color: #fff;
}

.badge-abgelehnt {
    background-color: #dc3545;
    color: #fff;
}

.badge-abgelaufen {
    background-color: #6c757d;
    color: #fff;
}

/* ================================================================
   Tabellen
   ================================================================ */

.table-actions {
    white-space: nowrap;
    width: 1%;
}

/* ================================================================
   Drag & Drop (Sortable.js)
   ================================================================ */

.sortable-ghost {
    opacity: 0.4;
    background-color: #e3f2fd;
}

.sortable-chosen {
    background-color: #fff3cd;
}

.drag-handle {
    cursor: grab;
    color: #6c757d;
}

.drag-handle:active {
    cursor: grabbing;
}

/* ================================================================
   Hierarchische Positionen (Angebot)
   ================================================================ */

.position-main-row td {
    border-top: 2px solid #dee2e6;
}

.position-sub-row td {
    font-size: 0.9em;
}

.position-subtotal-row td {
    border-bottom: 2px solid #dee2e6;
    padding-top: 0.15rem;
    padding-bottom: 0.5rem;
}

/* ================================================================
   Phasen-basierte Kalkulation
   ================================================================ */

/* Phase Cards */
.phase-card {
    border-left: 3px solid #0d6efd !important;
}

.phase-card .card-header {
    padding: 0.5rem 0.75rem;
}

.phase-card .phase-name {
    font-size: 0.95rem;
    background: transparent;
}

.phase-card .phase-name:focus {
    background: #fff;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}

/* Phase Drag Handle */
.drag-handle-phase {
    font-size: 1.1rem;
    opacity: 0.5;
    transition: opacity 0.15s;
}

.drag-handle-phase:hover {
    opacity: 1;
}

/* Phasensummen-Zeile */
.phase-subtotal-row td {
    border-top: 2px solid #dee2e6;
}

/* Positionszeilen in Phasen */
.calc-position-row td,
.tmpl-position-row td {
    vertical-align: middle;
    padding: 0.25rem 0.35rem;
}

/* Details-Zelle: kompakte Darstellung */
.pos-details-cell {
    min-width: 180px;
}

.pos-details-cell .form-control-sm,
.pos-details-cell .form-select-sm {
    font-size: 0.78rem;
    padding: 0.15rem 0.3rem;
}

/* Kalkulationstabelle: Schmale Zellen */
.calc-table th,
.calc-table td,
.tmpl-table th,
.tmpl-table td {
    white-space: nowrap;
    font-size: 0.85rem;
}

.calc-table input[type="number"],
.tmpl-table input[type="number"] {
    min-width: 50px;
}

.calc-table select,
.tmpl-table select {
    min-width: 80px;
}

/* ================================================================
   Deckungsbeitrag Farbcodierung
   ================================================================ */

.db-positiv {
    color: #198754 !important;
}

.db-neutral {
    color: #ffc107 !important;
}

.db-negativ {
    color: #dc3545 !important;
}

/* ================================================================
   Zusammenfassung (Ergebnis-Card)
   ================================================================ */

.calc-summary {
    background-color: #f8f9fa;
    border-left: 4px solid #0d6efd;
}

.calc-summary .table td {
    padding: 0.35rem 0.5rem;
}

/* ================================================================
   Standardpositions-Katalog
   ================================================================ */

.std-pos-item:hover {
    background-color: #e8f4fd;
}

/* ================================================================
   Alt-Kompatibilitaet: Hierarchische Positionen
   ================================================================ */

.calc-main-row td {
    border-top: 2px solid #adb5bd;
    font-weight: 600;
}

.calc-sub-row td {
    font-size: 0.9em;
}

.calc-subtotal-row td {
    font-weight: 600;
    font-style: italic;
    font-size: 0.88em;
    border-bottom: 2px solid #dee2e6;
    color: #495057;
}

/* ================================================================
   Responsive Anpassungen
   ================================================================ */

@media (max-width: 768px) {
    .container-fluid {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}
