/* ==========================================================================
   Stempeluhr – Light Theme (GLAESS Branding)
   Sauber, professionell, Bootstrap 5.3 Light Mode
   ========================================================================== */

:root {
    --glaess-blue: #005A9C;
    --glaess-blue-light: #0070c0;
    --glaess-gold: #E8A000;
    --glaess-slate: #4a5568;
}

/* --- Reisekosten Section-Header --- */
.card-header-section {
    background-color: var(--glaess-slate);
    color: #fff;
}
.card-header-rk {
    background-color: #f8f9fa;
    color: #1a1a1a;
    border-bottom: 2px solid var(--glaess-blue);
    font-weight: 600;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* --- Navbar --- */
.navbar {
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

/* --- Login-Seite --- */
.login-container {
    max-width: 400px;
    margin: 0 auto;
    padding-top: 10vh;
}

.login-card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.login-logo {
    max-width: 180px;
    height: auto;
}

/* --- Stat-Cards (Dashboard + Stempeluhr) --- */
.stat-card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
}

.stat-card.card-blue::before    { background: linear-gradient(90deg, #005A9C, #0070c0); }
.stat-card.card-green::before   { background: linear-gradient(90deg, #28a745, #20c997); }
.stat-card.card-orange::before  { background: linear-gradient(90deg, #E8A000, #f0b830); }
.stat-card.card-cyan::before    { background: linear-gradient(90deg, #17a2b8, #20c9e0); }
.stat-card.card-gray::before    { background: linear-gradient(90deg, #6c757d, #8e959c); }
.stat-card.card-purple::before  { background: linear-gradient(90deg, #7c3aed, #9333ea); }
.stat-card.card-red::before     { background: linear-gradient(90deg, #dc2626, #ef4444); }
.stat-card.card-indigo::before  { background: linear-gradient(90deg, #4f46e5, #6366f1); }

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.stat-card .stat-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6c757d;
}

/* --- Stempeluhr-Buttons --- */
.btn-clock {
    min-height: 60px;
    font-size: 1.25rem;
    font-weight: 600;
    border-radius: 10px;
    transition: transform 0.1s ease;
}

.btn-clock:active {
    transform: scale(0.97);
}

.btn-clock-start {
    background: linear-gradient(135deg, #28a745, #20c997);
    border: none;
    color: white;
}

.btn-clock-start:hover {
    filter: brightness(1.08);
    color: white;
}

.btn-clock-stop {
    background: linear-gradient(135deg, #dc3545, #fd7e14);
    border: none;
    color: white;
}

.btn-clock-stop:hover {
    filter: brightness(1.08);
    color: white;
}

/* --- Aktive Buchung --- */
.active-booking {
    background: #f0faf3;
    border: 1px solid #c3e6cb;
    border-left: 4px solid #28a745;
    border-radius: 8px;
}

.active-booking .timer {
    font-size: 2rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #28a745;
}

/* --- Formular-Fokus --- */
.form-control:focus, .form-select:focus {
    border-color: var(--glaess-blue);
    box-shadow: 0 0 0 0.2rem rgba(0, 90, 156, 0.2);
}

/* --- Legacy-Selects: Bootstrap-Look --- */
select:not(.form-select) {
    display: block;
    width: 100%;
    padding: 0.375rem 2.25rem 0.375rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #212529;
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    appearance: none;
    transition: border-color 0.15s;
}

select:not(.form-select):focus {
    border-color: var(--glaess-blue);
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 90, 156, 0.2);
}

/* --- Legacy-Buchungstabelle --- */
.table-responsive table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.table-responsive table td {
    padding: 6px 10px;
    vertical-align: middle;
}

/* Tabellenkopf */
.table-responsive table tr[bgcolor="#000000"],
.table-responsive table tr[bgcolor="#000000"] th,
.table-responsive table th[bgcolor="#000000"] {
    background: var(--glaess-blue) !important;
    padding: 8px 10px !important;
}

.table-responsive font[color] {
    color: #fff !important;
}

/* KW-Spalte */
.table-responsive table td[bgcolor="#000000"] {
    background: var(--glaess-blue) !important;
    color: #fff !important;
    font-weight: 700;
    text-align: center;
}

/* KW-Trenner */
.table-responsive table tr[height="3"] {
    height: 3px !important;
}

.table-responsive table tr[height="3"] td {
    padding: 0 !important;
    height: 3px !important;
    background: var(--glaess-blue) !important;
}

/* Negative Überstunden rot */
.table-responsive table font[color="#FF0000"] {
    color: #dc3545 !important;
    font-weight: 600;
}

/* Gantt: Wochenend-Spalten */
.table-responsive table td[bgcolor="#A4A4A4"] {
    background: #f0e6e8 !important;
}

/* --- Tabellen-Klassen (Bootstrap) --- */
.table-bookings th {
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* --- Cards allgemein --- */
.card {
    border-radius: 10px;
    border: 1px solid #e9ecef;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

/* --- Footer --- */
footer {
    background: #f8f9fa;
}

/* --- Responsive Hilfsklassen für Inputs --- */
.input-pause {
    max-width: 120px;
}

.input-korrektur {
    max-width: 80px;
}

.input-group-kw {
    max-width: 350px;
}

.input-kw {
    max-width: 60px;
}

/* --- Responsive --- */
@media (max-width: 575.98px) {
    .btn-clock {
        min-height: 70px;
        font-size: 1.4rem;
    }

    .hide-xs {
        display: none !important;
    }

    .stat-card .stat-value {
        font-size: 1.4rem;
    }

    /* Timer auf Mobile besser lesbar */
    .active-booking .timer {
        font-size: 1.6rem;
    }

    /* Inputs auf volle Breite */
    .input-pause,
    .input-korrektur,
    .input-kw {
        max-width: none;
    }

    .input-group-kw {
        max-width: none;
    }

    /* Legacy-Tabelle kompakter */
    .table-responsive table {
        font-size: 0.75rem;
    }

    .table-responsive table td {
        padding: 4px 6px;
    }

    /* Input-Groups stacken */
    .input-group {
        flex-wrap: wrap;
    }

    /* Container weniger Padding */
    .container-fluid {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    /* Navbar Dropdown besser tippbar */
    .navbar .dropdown-item {
        padding: 0.625rem 1rem;
    }

    .navbar .nav-link {
        padding: 0.625rem 0.5rem;
    }

    /* Footer kompakter */
    footer {
        padding-top: 0.25rem !important;
        padding-bottom: 0.25rem !important;
    }

    footer .small {
        font-size: 0.7rem;
    }

    /* Seitentitel auf Mobile */
    h4 {
        font-size: 1.1rem;
    }
}

@media (min-width: 576px) and (max-width: 991.98px) {
    .hide-md {
        display: none !important;
    }
}

/* Sehr kleine Phones */
@media (max-width: 399.98px) {
    .login-container {
        padding-top: 5vh;
    }

    .login-card {
        padding: 1.25rem !important;
    }

    .stat-card .stat-value {
        font-size: 1.2rem;
    }

    .stat-card .stat-label {
        font-size: 0.65rem;
    }

    .active-booking .timer {
        font-size: 1.4rem;
    }
}

/* --- Druck --- */
/* --- Buchungsübersicht Tabellen-Fix --- */
.buchungen-wrapper {
    min-width: 0;       /* verhindert Flex-Ausdehnung */
    max-width: 100%;
    overflow-x: auto;
}

/* --- Buchungsübersicht Mobile-Optimierung --- */
@media (max-width: 767.98px) {
    /* Tabelle auf Mobile ausblenden, Karten-Ansicht einblenden */
    .buchungen-wrapper .buchungen-table {
        display: none !important;
    }
    .buchungen-cards {
        display: block !important;
    }
}

/* Karten-Ansicht (default: versteckt, nur auf Mobile sichtbar) */
.buchungen-cards {
    display: none;
}
.buchungen-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 10px 12px;
    margin-bottom: 6px;
    font-size: 0.85rem;
}
.buchungen-card .bc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}
.buchungen-card .bc-date {
    font-weight: 600;
    color: #2d3748;
}
.buchungen-card .bc-hours {
    font-weight: 700;
    color: var(--glaess-blue);
    font-size: 0.95rem;
}
.buchungen-card .bc-time {
    color: #718096;
    font-size: 0.8rem;
}
.buchungen-card .bc-projekt {
    font-size: 0.8rem;
    color: #4a5568;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.buchungen-card .bc-bemerkung {
    font-size: 0.78rem;
    color: #718096;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.buchungen-card .bc-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.buchungen-card .bc-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}
.buchungen-card .bc-actions a {
    font-size: 1rem;
    color: var(--glaess-blue);
    text-decoration: none;
    padding: 2px;
}
.buchungen-card .bc-actions .bc-action-delete {
    color: #c53030;
}
.buchungen-card.bc-urlaub { border-left: 4px solid #04B404; }
.buchungen-card.bc-krank { border-left: 4px solid #FE2E2E; }
.buchungen-card.bc-feiertag { border-left: 4px solid #FFCC00; }
.buchungen-card.bc-fahrtzeit { border-left: 4px solid #a0aec0; }
.buchungen-card.bc-schule { border-left: 4px solid #5882FA; }
.buchungen-card.bc-ausgleich { border-left: 4px solid #00CCCC; }
.buchungen-card.bc-kurzarbeit { border-left: 4px solid #df803c; }

/* Tagessummen-Zeile */
.buchungen-day-summary {
    background: #edf2f7;
    border-radius: 4px;
    padding: 5px 12px;
    margin-bottom: 8px;
    font-size: 0.78rem;
    color: #4a5568;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
}
.buchungen-day-summary b {
    color: #2d3748;
}
.buchungen-day-summary .bc-neg {
    color: #c53030;
    font-weight: 600;
}
.buchungen-day-summary .bc-pos {
    color: #276749;
    font-weight: 600;
}

/* Gesamtsumme Footer */
.buchungen-footer {
    background: #2d3748;
    color: #fff;
    border-radius: 6px;
    padding: 10px 12px;
    margin-top: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
}

/* --- Reisekosten Mobile-Optimierung --- */
@media (max-width: 575.98px) {
    /* Beleg-Tabellen scrollbar machen */
    #sectionFahrt .table-responsive,
    #sectionUebernachtung .table-responsive,
    #sectionNebenkosten .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Konfiguration-Toggles vertikal stapeln */
    #rkForm .card-body .form-check-inline {
        display: block;
        margin-bottom: 0.5rem;
    }

    /* Buttons in voller Breite */
    #rkForm .btn-success[id^="btnAdd"],
    #rkForm .btn-success[id="btnSaveAndSubmit"],
    #rkForm > .d-flex > button,
    #rkForm > .d-flex > .btn {
        width: 100%;
    }

    /* Card-Bodies etwas kompakter */
    #rkForm .card-body {
        padding: 0.75rem;
    }

    /* Formular-Labels kompakter */
    #rkForm .form-label {
        font-size: 0.8rem;
        margin-bottom: 0.2rem;
    }
}

@media print {
    .navbar, footer, .no-print {
        display: none !important;
    }

    body {
        font-size: 10pt;
    }

    .container-fluid {
        max-width: 100%;
        padding: 0;
    }
}
