/* ====================================================
   Sportverein Verwaltung – Stylesheet
   ==================================================== */

:root {
    --bg:        #0f1117;
    --bg-card:   #1a1d27;
    --bg-input:  #242836;
    --border:    #2e3348;
    --text:      #e4e6ef;
    --text-dim:  #8b8fa3;
    --accent:    #4f8cff;
    --accent-h:  #6ba0ff;
    --green:     #34d399;
    --green-bg:  rgba(52,211,153,.12);
    --red:       #f87171;
    --red-bg:    rgba(248,113,113,.12);
    --yellow:    #fbbf24;
    --radius:    10px;
    --shadow:    0 2px 16px rgba(0,0,0,.3);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* === Layout === */
#app { display: flex; min-height: 100vh; }
#login-screen { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 100vh; padding: 16px; }
#main-screen { display: none; width: 100%; }

.mobile-header { display: none; }
.sidebar-overlay { display: none; }

.sidebar {
    width: 240px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    padding: 24px 0;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 10;
}

.sidebar-logo {
    padding: 0 24px 24px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 12px;
}
.sidebar-logo h2 {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -.3px;
    color: var(--accent);
}
.sidebar-logo small {
    font-size: 11px;
    color: var(--text-dim);
    display: block;
    margin-top: 2px;
}

.sidebar nav { flex: 1; padding: 0 12px; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-dim);
    font-size: 14px;
    font-weight: 500;
    transition: all .15s;
    margin-bottom: 2px;
    text-decoration: none;
}
.nav-item:hover { background: var(--bg-input); color: var(--text); }
.nav-item.active { background: rgba(79,140,255,.12); color: var(--accent); }
.nav-item .icon { font-size: 18px; width: 22px; text-align: center; }

.sidebar-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-dim);
}
.sidebar-footer .user-name { color: var(--text); font-weight: 600; display: block; margin-bottom: 6px; }
.btn-logout {
    background: none; border: none; color: var(--red); cursor: pointer;
    font-size: 12px; padding: 0; text-decoration: underline;
}

.main-content {
    margin-left: 240px;
    flex: 1;
    padding: 32px 40px;
    max-width: 1100px;
}

/* === Login === */
.login-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 48px 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow);
    text-align: center;
}
.login-box h1 { font-size: 22px; margin-bottom: 4px; }
.login-box p { color: var(--text-dim); font-size: 14px; margin-bottom: 28px; }

/* === Typography === */
.page-title {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -.4px;
    margin-bottom: 24px;
}
.section-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-dim);
    margin-bottom: 10px;
    font-weight: 600;
}

/* === Form Elements === */
input, select, textarea {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    padding: 10px 14px;
    font-size: 14px;
    width: 100%;
    outline: none;
    transition: border-color .15s;
    font-family: inherit;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 70px; }
select { cursor: pointer; }

label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-dim);
    margin-bottom: 5px;
}
.form-group { margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all .15s;
    font-family: inherit;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-h); }
.btn-secondary { background: var(--bg-input); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--accent); }
.btn-danger { background: var(--red-bg); color: var(--red); }
.btn-danger:hover { background: rgba(248,113,113,.2); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }

/* === Page Header === */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    gap: 12px;
}
.page-header .page-title { margin-bottom: 0; }

/* === Cards & Tables === */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}
.data-table th {
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: var(--text-dim);
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
}
.data-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(79,140,255,.04); }

.actions { display: flex; gap: 6px; }

/* === Anwesenheit === */
.attendance-controls {
    display: flex;
    gap: 16px;
    align-items: flex-end;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.attendance-controls .form-group { margin-bottom: 0; flex: 1; min-width: 200px; }

.athlete-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
}

.athlete-card {
    background: var(--bg-input);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    cursor: pointer;
    transition: all .2s;
    display: flex;
    align-items: center;
    gap: 12px;
    user-select: none;
}
.athlete-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.athlete-card.present {
    border-color: var(--green);
    background: var(--green-bg);
}
.athlete-card .status-dot {
    width: 14px; height: 14px;
    border-radius: 50%;
    background: var(--border);
    flex-shrink: 0;
    transition: background .2s;
}
.athlete-card.present .status-dot { background: var(--green); }
.athlete-card .athlete-name { font-weight: 600; font-size: 15px; }

/* === Übersicht === */
.stat-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(79,140,255,.1);
    color: var(--accent);
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

/* === Chip / Tag === */
.chip {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    background: var(--bg-input);
    color: var(--text-dim);
    border: 1px solid var(--border);
}

/* === Modal === */
.modal-backdrop {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,.6);
    display: flex; align-items: center; justify-content: center;
    z-index: 100;
}
.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 32px;
    width: 500px;
    max-width: 90vw;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,.4);
}
.modal h3 { font-size: 18px; margin-bottom: 20px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; }

/* === Checkbox List === */
.checkbox-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px;
}
.checkbox-list label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text);
    margin-bottom: 0;
}
.checkbox-list label:hover { background: var(--bg-input); }
.checkbox-list input[type="checkbox"] {
    width: 16px; height: 16px;
    accent-color: var(--accent);
}

/* === Toast / Alert === */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--bg-card);
    border: 1px solid var(--green);
    border-radius: 10px;
    padding: 14px 20px;
    font-size: 14px;
    z-index: 200;
    box-shadow: var(--shadow);
    animation: slideUp .3s ease;
}
.toast.error { border-color: var(--red); color: var(--red); }

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* === Responsive === */

/* Tablet: Icon-Sidebar */
@media (max-width: 768px) {
    .sidebar { width: 60px; }
    .sidebar-logo h2, .sidebar-logo small, .nav-item span:not(.icon), .sidebar-footer .user-name { display: none; }
    .sidebar-footer { padding: 12px; text-align: center; }
    .nav-item { justify-content: center; padding: 12px; }
    .main-content { margin-left: 60px; padding: 20px 16px; }
    .form-row { grid-template-columns: 1fr; }
    .attendance-controls { flex-direction: column; }
    .attendance-controls .btn { width: 100%; }
}

/* Smartphone: Hamburger-Menü */
@media (max-width: 480px) {
    /* Mobile Top-Bar */
    .mobile-header {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 0 16px;
        background: var(--bg-card);
        border-bottom: 1px solid var(--border);
        position: fixed;
        top: 0; left: 0; right: 0;
        z-index: 20;
        height: 52px;
    }
    .hamburger {
        background: none;
        border: none;
        color: var(--text);
        font-size: 24px;
        cursor: pointer;
        padding: 4px 6px;
        line-height: 1;
    }
    .mobile-title {
        font-size: 16px;
        font-weight: 700;
        color: var(--accent);
    }

    /* Sidebar als Overlay */
    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.55);
        z-index: 14;
    }
    body.sidebar-open .sidebar-overlay { display: block; }

    .sidebar {
        width: 240px; /* 60px-Regel überschreiben */
        transform: translateX(-100%);
        transition: transform .25s ease;
        z-index: 15;
    }
    body.sidebar-open .sidebar { transform: translateX(0); }

    /* Sidebar-Inhalte wiederherstellen (von 768px-Regel ausgeblendet) */
    .sidebar-logo h2 { display: block; }
    .sidebar-logo small { display: block; }
    .sidebar-footer .user-name { display: block; }
    .sidebar-footer { padding: 16px 24px; text-align: left; }
    .nav-item span:not(.icon) { display: inline; }
    .nav-item { justify-content: flex-start; padding: 10px 12px; }

    /* Hauptinhalt: volle Breite, Platz für Top-Bar */
    .main-content {
        margin-left: 0;
        padding: 68px 14px 20px;
    }

    /* Login */
    .login-box { padding: 32px 20px; border-radius: 12px; }

    /* Modal als Bottom-Sheet */
    .modal-backdrop { align-items: flex-end; padding: 0; }
    .modal {
        width: 100%;
        max-width: 100%;
        border-radius: 20px 20px 0 0;
        max-height: 92vh;
        padding: 24px 16px;
    }
    .modal-actions { flex-wrap: wrap; }
    .modal-actions .btn { flex: 1; min-width: 120px; }

    /* Seitenkopf stapeln */
    .page-header { flex-direction: column; align-items: flex-start; }
    .page-header .btn { width: 100%; }

    /* Athlete-Grid: 2 Spalten */
    .athlete-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .athlete-card { padding: 12px 10px; }
    .athlete-card .athlete-name { font-size: 13px; }

    /* Toast */
    .toast { left: 12px; right: 12px; bottom: 12px; }
}

/* === Empty State === */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-dim);
}
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 15px; }
