/* ============================================================
   Arbeitszeiterfassung – Stylesheet (Mobile-First, responsiv)
   ============================================================ */

/* ── Reset & Basis ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary:       #004a7a;
    --primary-dark:  #003d66;
    --primary-light: #e6f0f7;
    --accent:        #005f9e;
    --success:       #1a7a45;
    --success-light: #edfaf3;
    --warning:       #c07a00;
    --warning-light: #fff8e6;
    --danger:        #c0392b;
    --danger-light:  #fdf0ee;
    --gray-50:       #f8f9fa;
    --gray-100:      #f1f3f5;
    --gray-200:      #e9ecef;
    --gray-300:      #ced4da;
    --gray-500:      #868e96;
    --gray-700:      #495057;
    --gray-900:      #212529;
    --white:         #ffffff;
    --header-bg:     #1a2535;   /* Dunkles Schieferblau für den Header */
    --header-hover:  rgba(255,255,255,.08);
    --radius:        0.375rem;
    --radius-lg:     0.5rem;
    --shadow:        0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
    --shadow-md:     0 4px 8px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.05);
    --shadow-lg:     0 10px 20px rgba(0,0,0,.1),  0 4px 8px rgba(0,0,0,.06);
    --font:          'Segoe UI', system-ui, -apple-system, sans-serif;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--gray-100);
    color: var(--gray-900);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ─────────────────────────────────────────────────── */
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 1rem; }

.content { flex: 1; padding: 1.5rem 0; }

/* ── Header / Navigation ─────────────────────────────────────── */
.site-header {
    background: var(--header-bg);
    color: var(--white);
    position: sticky; top: 0; z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,.25);
    border-bottom: 1px solid rgba(255,255,255,.06);
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    height: 3.5rem;
}
.logo {
    color: var(--white);
    font-size: 1.1rem;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}
.nav-toggle {
    background: none; border: none; color: var(--white);
    font-size: 1.5rem; cursor: pointer; display: block;
    line-height: 1; padding: 0.25rem;
}

.main-nav {
    display: none;
    position: absolute;
    top: 3.5rem; left: 0; right: 0;
    background: var(--header-bg);
    padding: 0.5rem 0;
    box-shadow: var(--shadow-md);
    border-top: 1px solid rgba(255,255,255,.06);
}
.main-nav.open { display: block; }

.main-nav a {
    display: block;
    color: var(--white);
    padding: 0.75rem 1.25rem;
    text-decoration: none;
    font-size: 0.95rem;
    border-left: 3px solid transparent;
    transition: background .15s;
}
.main-nav a:hover { background: var(--header-hover); text-decoration: none; }
.main-nav a.active { border-left-color: var(--accent); background: rgba(255,255,255,.1); font-weight: 600; }
.main-nav .nav-logout { color: #fca5a5; }
.main-nav .nav-logout:hover { background: rgba(220,38,38,.2); }

/* ── Footer ─────────────────────────────────────────────────── */
.site-footer {
    background: var(--gray-700);
    color: var(--gray-300);
    padding: 1rem 0;
    font-size: 0.8rem;
    text-align: center;
}

/* ── Karten ─────────────────────────────────────────────────── */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}
.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--gray-200);
}

/* ── Stat-Kacheln ────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.25rem;
}
.stat-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1rem;
    text-align: center;
    box-shadow: var(--shadow);
}
.stat-card .stat-value { font-size: 1.75rem; font-weight: 700; color: var(--primary); }
.stat-card .stat-label { font-size: 0.78rem; color: var(--gray-500); margin-top: 0.25rem; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius);
    border: none; cursor: pointer;
    font-size: 0.9rem; font-weight: 600;
    text-decoration: none;
    transition: background .15s, transform .1s, box-shadow .15s;
    line-height: 1.2;
}
.btn:active { transform: scale(.98); }

.btn-primary   { background: var(--primary);   color: var(--white); }
.btn-primary:hover { background: var(--primary-dark); text-decoration: none; }

.btn-success   { background: var(--success);   color: var(--white); }
.btn-success:hover { background: #15803d; text-decoration: none; }

.btn-warning   { background: var(--warning);   color: var(--white); }
.btn-warning:hover { background: #b45309; text-decoration: none; }

.btn-danger    { background: var(--danger);    color: var(--white); }
.btn-danger:hover  { background: #b91c1c; text-decoration: none; }

.btn-secondary { background: var(--gray-200);  color: var(--gray-700); }
.btn-secondary:hover { background: var(--gray-300); text-decoration: none; }

.btn-outline {
    background: transparent; color: var(--primary);
    border: 2px solid var(--primary);
}
.btn-outline:hover { background: var(--primary-light); text-decoration: none; }

.btn-lg { padding: 0.85rem 1.75rem; font-size: 1.05rem; border-radius: var(--radius-lg); }
.btn-xl { padding: 1.1rem 2.2rem; font-size: 1.2rem; border-radius: var(--radius-lg); }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }
.btn-block { display: flex; width: 100%; }

/* ── Stempel-Bereich ─────────────────────────────────────────── */
.stamp-area {
    text-align: center;
    padding: 2rem 1rem;
}

/* Buttons auf der Stempel-Seite: gleiche Breite, Abstand auf Mobile */
.stamp-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
}
/* Forms transparent machen damit Flex direkt auf die Buttons wirkt */
.stamp-actions form {
    display: contents;
}
.stamp-actions .btn {
    flex: 1 1 200px;
    max-width: 240px;
    min-width: 0;
}
.stamp-status {
    font-size: 1.1rem;
    color: var(--gray-700);
    margin-bottom: 1.5rem;
}
.stamp-status .badge-in  { color: var(--success); font-weight: 700; }
.stamp-status .badge-out { color: var(--danger);  font-weight: 700; }

.stamp-clock {
    font-size: 3rem;
    font-weight: 700;
    color: var(--gray-900);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
    margin-bottom: 1.5rem;
    font-family: monospace;
}

/* ── Formulare ───────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.35rem;
}
.form-control {
    width: 100%;
    padding: 0.6rem 0.85rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.95rem;
    color: var(--gray-900);
    background: var(--white);
    transition: border-color .15s, box-shadow .15s;
    font-family: var(--font);
}
.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24'%3E%3Cpath fill='%236b7280' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.6rem center; padding-right: 2rem; }

.form-row { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.form-row .form-group { flex: 1 1 140px; min-width: 0; }

/* Auf kleinen Screens (< 480px): immer 2 Felder pro Zeile */
@media (max-width: 479px) {
    .form-row {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.5rem;
    }
    .form-row .form-group {
        flex: none;
        width: 100%;
        max-width: none;
    }
    /* Alle Inputs in form-row gleich hoch, schmaler und einheitlich */
    .form-row .form-group .form-control {
        height: 2.5rem;
        padding: 0.35rem 0.5rem;
        font-size: 0.82rem;
        min-width: 0;
        width: 100%;
        -webkit-appearance: none;
        appearance: none;
    }
    .form-row .form-group label {
        font-size: 0.78rem;
    }
    /* Weniger Card-Padding damit mehr Platz für die Felder bleibt */
    .card {
        padding: 0.875rem;
    }
}

/* iPhone Querformat: 4 Felder nebeneinander, gleich hoch und schmal */
@media (max-height: 500px) and (orientation: landscape) {
    .form-row {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 0.5rem;
    }
    .form-row .form-group {
        flex: none;
        width: 100%;
        max-width: none;
    }
    .form-row .form-group .form-control {
        height: 2.5rem;
        padding: 0.35rem 0.5rem;
        font-size: 0.82rem;
        min-width: 0;
        width: 100%;
        -webkit-appearance: none;
        appearance: none;
    }
    .form-row .form-group label {
        font-size: 0.78rem;
    }
    .card {
        padding: 0.875rem;
    }
}

/* Kompakte Felder (Datum/Zeit/Zahl) nicht zu breit werden lassen */
.form-row .form-group input[type="date"],
.form-row .form-group input[type="time"],
.form-row .form-group input[type="number"] {
    min-width: 0;
    width: 100%;
}

/* ── Tabellen ────────────────────────────────────────────────── */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table th {
    background: var(--gray-50);
    padding: 0.6rem 0.75rem;
    text-align: left;
    font-weight: 600;
    color: var(--gray-700);
    border-bottom: 2px solid var(--gray-200);
    white-space: nowrap;
}
table td {
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid var(--gray-200);
    vertical-align: middle;
}
table tr:last-child td { border-bottom: none; }
table tr:hover td { background: var(--gray-50); }
table .actions { white-space: nowrap; text-align: right; }

/* ── Alerts ──────────────────────────────────────────────────── */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.9rem;
    border-left: 4px solid transparent;
}
.alert-success { background: var(--success-light); color: #166534; border-color: var(--success); }
.alert-error   { background: var(--danger-light);  color: #991b1b; border-color: var(--danger); }
.alert-warning { background: var(--warning-light); color: #92400e; border-color: var(--warning); }
.alert-info    { background: var(--primary-light); color: var(--primary-dark); border-color: var(--primary); }

/* ── Badges ──────────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.4;
}
.badge-success  { background: var(--success-light); color: #166534; }
.badge-danger   { background: var(--danger-light);  color: #991b1b; }
.badge-warning  { background: var(--warning-light); color: #92400e; }
.badge-info     { background: var(--primary-light); color: var(--primary-dark); }
.badge-gray     { background: var(--gray-200);      color: var(--gray-700); }

/* ── Login-Seite ─────────────────────────────────────────────── */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    padding: 1rem;
}
.login-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 2rem 1.5rem;
    width: 100%;
    max-width: 400px;
}
.login-logo {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 0.25rem;
}
.login-title {
    text-align: center;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 1.75rem;
}

/* ── Seiten-Titel ─────────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}
.page-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--gray-900);
}
.page-subtitle {
    font-size: 0.85rem;
    color: var(--gray-500);
    margin-top: 0.15rem;
}

/* ── Monatsreport ────────────────────────────────────────────── */
.report-summary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.25rem;
}
.report-item {
    background: var(--gray-50);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    text-align: center;
}
.report-item .value { font-size: 1.4rem; font-weight: 700; color: var(--primary); }
.report-item .label { font-size: 0.78rem; color: var(--gray-500); }

/* Drucken / PDF */
@media print {
    .site-header, .site-footer, .no-print, .btn { display: none !important; }
    body { background: white; }
    .card { box-shadow: none; border: 1px solid var(--gray-300); }
    .content { padding: 0; }
    .container { max-width: 100%; padding: 0; }
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (min-width: 640px) {
    .stats-grid { grid-template-columns: repeat(4, 1fr); }
    .report-summary { grid-template-columns: repeat(4, 1fr); }
}

@media (min-width: 768px) {
    .nav-toggle { display: none; }
    .main-nav {
        display: flex !important;
        position: static;
        background: transparent;
        padding: 0;
        box-shadow: none;
        align-items: center;
        gap: 0.25rem;
    }
    .main-nav a {
        padding: 0.4rem 0.75rem;
        border-radius: var(--radius);
        border-left: none;
        font-size: 0.88rem;
    }
    .main-nav a.active {
        background: rgba(255,255,255,.12);
        border-left: none;
        border-bottom: 2px solid var(--accent);
    }
    .stamp-clock { font-size: 4.5rem; }
}

@media (min-width: 1024px) {
    .content { padding: 2rem 0; }
    .card { padding: 1.5rem; }
}

/* ── Utility ──────────────────────────────────────────────────── */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: var(--gray-500); font-size: 0.85rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.d-flex { display: flex; }
.gap-1  { gap: 0.5rem; }
.gap-2  { gap: 1rem; }
.align-center { align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.justify-between { justify-content: space-between; }
.w-100 { width: 100%; }
.hidden { display: none; }

/* ── Modal ────────────────────────────────────────────────────── */
.modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.45);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000;
    padding: 1rem;
}
.modal-backdrop.hidden { display: none; }
.modal-box {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(0,0,0,.2);
    max-width: 420px; width: 100%;
    padding: 1.5rem;
}
.modal-title {
    font-size: 1.15rem; font-weight: 700;
    margin-bottom: 1rem;
    display: flex; align-items: center; gap: .5rem;
    color: var(--danger);
}
