/* ============================================
   SCHUL-ASSISTENT – Stylesheet
   ============================================ */

:root {
    --primary:     #2563eb;
    --primary-dark:#1d4ed8;
    --secondary:   #7c3aed;
    --success:     #16a34a;
    --warning:     #d97706;
    --danger:      #dc2626;
    --info:        #0891b2;
    
    --bg:          #f1f5f9;
    --bg-card:     #ffffff;
    --border:      #e2e8f0;
    --text:        #1e293b;
    --text-muted:  #64748b;
    
    --nav-bg:      #1e293b;
    --nav-text:    #f8fafc;
    
    --radius:      12px;
    --radius-sm:   8px;
    --shadow:      0 2px 8px rgba(0,0,0,0.08);
    --shadow-md:   0 4px 16px rgba(0,0,0,0.12);
    
    --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

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

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

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

/* ── Login ── */
body.login-page {
    background: linear-gradient(135deg, #1e293b 0%, #2563eb 100%);
    justify-content: center;
    align-items: center;
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 1rem;
}

.login-box {
    background: white;
    border-radius: var(--radius);
    padding: 2.5rem;
    box-shadow: var(--shadow-md);
    text-align: center;
}

.login-icon { font-size: 3rem; margin-bottom: 0.5rem; }
.login-box h1 { font-size: 1.6rem; margin-bottom: 0.25rem; color: var(--text); }
.login-sub { color: var(--text-muted); margin-bottom: 1.5rem; }

/* ── Navbar ── */
.navbar {
    background: var(--nav-bg);
    color: var(--nav-text);
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0 1.5rem;
    flex-wrap: wrap;
    min-height: 60px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.nav-brand a {
    color: white;
    font-size: 1.1rem;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.kind-switcher {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
    margin-left: auto;
}

.kind-btn {
    background: rgba(255,255,255,0.1);
    color: white;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 20px;
    padding: 0.3rem 0.75rem;
    font-size: 0.85rem;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}

.kind-btn:hover { background: rgba(255,255,255,0.2); text-decoration: none; }
.kind-btn.aktiv { background: var(--primary); border-color: var(--primary); }
.kind-btn.neu { background: transparent; border-style: dashed; color: #94a3b8; }
.kind-btn.neu:hover { color: white; border-color: white; }

.nav-menu {
    display: flex;
    list-style: none;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.nav-menu a {
    color: #94a3b8;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    white-space: nowrap;
    display: block;
    text-decoration: none;
    transition: all 0.2s;
}

.nav-menu a:hover,
.nav-menu a.aktiv {
    background: rgba(255,255,255,0.1);
    color: white;
}

/* ── Banner ── */
.erinnerungs-banner {
    background: linear-gradient(90deg, #fef3c7, #fde68a);
    border-bottom: 2px solid #f59e0b;
    padding: 0.6rem 1.5rem;
    font-size: 0.9rem;
    color: #92400e;
}

.ferien-banner {
    background: linear-gradient(90deg, #d1fae5, #a7f3d0);
    border-bottom: 2px solid #10b981;
    padding: 0.6rem 1.5rem;
    font-size: 0.9rem;
    color: #064e3b;
    font-weight: 600;
}

.erinnerungs-banner .datum { color: #b45309; margin-left: 0.5rem; }

/* ── Main Content ── */
.main-content {
    flex: 1;
    padding: 1.5rem;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

/* ── Cards ── */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text);
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--bg);
}

.card-link {
    display: block;
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--primary);
    text-align: right;
}

.card-wide { grid-column: 1 / -1; }

/* ── Dashboard Grid ── */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.25rem;
}

/* ── Begrüßung ── */
.begruessung {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    background: linear-gradient(135deg, #1e293b, #2563eb);
    color: white;
    flex-wrap: wrap;
}

.begruessung h3 { border-color: rgba(255,255,255,0.2); color: white; }
.begruessung h1 { font-size: 1.5rem; margin-bottom: 0.35rem; }
.begruessung p { opacity: 0.85; margin-top: 0.25rem; }
.datum-anzeige { font-size: 0.9rem; opacity: 0.7; }

.begruessung-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* ── Stats ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.stat-item {
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    text-align: center;
}

.stat-item.highlight {
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    border: 1px solid #93c5fd;
}

.stat-zahl {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    display: block;
}

/* ── Stundenplan (Dashboard) ── */
.stunden-liste { display: flex; flex-direction: column; gap: 0.4rem; }

.stunde-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--primary);
}

.stunde-nr {
    font-weight: 700;
    color: var(--primary);
    font-size: 0.85rem;
    min-width: 20px;
}

.stunde-info { flex: 1; }
.stunde-info strong { display: block; font-size: 0.9rem; }
.stunde-info small { color: var(--text-muted); font-size: 0.8rem; }
.stunde-zeit { font-size: 0.8rem; color: var(--text-muted); }

/* ── Termine (Dashboard) ── */
.termine-liste { display: flex; flex-direction: column; gap: 0.4rem; }

.termin-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg);
    border-radius: var(--radius-sm);
}

.termin-icon { font-size: 1.1rem; }
.termin-info { flex: 1; }
.termin-info strong { display: block; font-size: 0.875rem; }
.termin-info small { color: var(--text-muted); font-size: 0.8rem; }

.termin-badge {
    background: #e2e8f0;
    color: var(--text-muted);
    border-radius: 12px;
    padding: 0.2rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.termin-badge.dringend { background: #fee2e2; color: var(--danger); }

/* ── Ferien Card ── */
.ferien-card { 
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    border-color: #6ee7b7; 
}
.ferien-card h3 { border-color: #a7f3d0; }

.ferien-name { font-size: 1.1rem; font-weight: 700; color: #064e3b; }
.ferien-datum { color: #065f46; margin: 0.25rem 0; }
.ferien-dauer { font-size: 0.85rem; color: #047857; }

/* ── Dokument-Buttons ── */
.dokument-links {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.dok-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    padding: 0.75rem 0.5rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    color: var(--text);
    text-align: center;
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
}

.dok-btn span:first-child { font-size: 1.5rem; }
.dok-btn:hover { 
    background: #dbeafe; 
    border-color: var(--primary); 
    color: var(--primary);
    text-decoration: none;
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn:hover { text-decoration: none; opacity: 0.9; }

.btn-primary   { background: var(--primary); color: white; }
.btn-secondary { background: rgba(255,255,255,0.15); color: white; border-color: rgba(255,255,255,0.3); }
.btn-success   { background: var(--success); color: white; }
.btn-danger    { background: var(--danger); color: white; }
.btn-outline   { background: transparent; border-color: var(--border); color: var(--text); }
.btn-block     { width: 100%; justify-content: center; }
.btn-sm        { padding: 0.35rem 0.75rem; font-size: 0.8rem; }

/* ── Formulare ── */
.form-group { margin-bottom: 1rem; }

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.35rem;
    color: var(--text);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.6rem 0.875rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: var(--font);
    color: var(--text);
    background: white;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

/* ── Alerts ── */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.alert-success { background: #dcfce7; border: 1px solid #86efac; color: #166534; }
.alert-error   { background: #fee2e2; border: 1px solid #fca5a5; color: #991b1b; }
.alert-info    { background: #dbeafe; border: 1px solid #93c5fd; color: #1e40af; }
.alert-warning { background: #fef3c7; border: 1px solid #fcd34d; color: #92400e; }

/* ── Tabellen ── */
.table-wrapper { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

table th {
    background: var(--bg);
    padding: 0.6rem 0.875rem;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

table td {
    padding: 0.6rem 0.875rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

table tr:hover td { background: #f8fafc; }

/* ── Empty States ── */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.empty-icon { font-size: 4rem; margin-bottom: 1rem; }
.empty-state h2 { margin-bottom: 0.5rem; color: var(--text); }
.empty-state p { margin-bottom: 1.5rem; }
.empty-small { color: var(--text-muted); font-size: 0.875rem; padding: 0.75rem 0; }

/* ── Page Header ── */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.page-header h2 { font-size: 1.4rem; }

/* ── Stundenplan Grid (stundenplan.php) ── */
.stundenplan-grid {
    display: grid;
    grid-template-columns: 60px repeat(5, 1fr);
    gap: 3px;
    background: var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    font-size: 0.85rem;
}

.sp-header {
    background: var(--nav-bg);
    color: white;
    padding: 0.6rem 0.4rem;
    text-align: center;
    font-weight: 600;
    font-size: 0.8rem;
}

.sp-cell {
    background: var(--bg-card);
    padding: 0.5rem 0.4rem;
    min-height: 60px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0.2rem;
    position: relative;
    transition: background 0.2s;
}

.sp-cell:hover { background: #f0f9ff; cursor: pointer; }
.sp-cell.frei { background: #fafafa; }
.sp-cell .fach { font-weight: 600; font-size: 0.85rem; }
.sp-cell .lehrer { font-size: 0.7rem; color: var(--text-muted); }
.sp-cell.stundennr { background: var(--bg); font-weight: 700; color: var(--text-muted); }

/* Fach-Farben */
.fach-farbe-0  { border-top: 3px solid #3b82f6; }
.fach-farbe-1  { border-top: 3px solid #10b981; }
.fach-farbe-2  { border-top: 3px solid #f59e0b; }
.fach-farbe-3  { border-top: 3px solid #ef4444; }
.fach-farbe-4  { border-top: 3px solid #8b5cf6; }
.fach-farbe-5  { border-top: 3px solid #06b6d4; }
.fach-farbe-6  { border-top: 3px solid #f97316; }
.fach-farbe-7  { border-top: 3px solid #ec4899; }

/* ── Kalender ── */
.kalender-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    background: var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.kal-header {
    background: var(--nav-bg);
    color: white;
    text-align: center;
    padding: 0.5rem;
    font-weight: 600;
    font-size: 0.8rem;
}

.kal-tag {
    background: white;
    min-height: 80px;
    padding: 0.4rem;
    position: relative;
    cursor: pointer;
    transition: background 0.15s;
}

.kal-tag:hover { background: #f0f9ff; }
.kal-tag.anderer-monat { background: #f8fafc; opacity: 0.5; }
.kal-tag.heute { background: #dbeafe; }
.kal-tag.ferien { background: #d1fae5; }
.kal-tag.wochenende { background: #fafafa; }

.kal-nummer {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.kal-tag.heute .kal-nummer {
    background: var(--primary);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

.kal-event {
    font-size: 0.7rem;
    background: var(--primary);
    color: white;
    border-radius: 3px;
    padding: 0.1rem 0.3rem;
    margin-top: 0.2rem;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.kal-event.typ-elternabend   { background: #7c3aed; }
.kal-event.typ-zeugnis        { background: #d97706; }
.kal-event.typ-ausflug        { background: #2563eb; }
.kal-event.typ-ferien         { background: #059669; }
.kal-event.typ-schulveranstaltung { background: #0891b2; }
.kal-event.typ-arzt           { background: #dc2626; }

/* ── Footer ── */
.site-footer {
    background: var(--nav-bg);
    color: #64748b;
    text-align: center;
    padding: 0.75rem;
    font-size: 0.8rem;
    margin-top: auto;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .navbar { padding: 0.5rem 1rem; gap: 0.5rem; }
    .nav-menu { gap: 0; }
    .nav-menu a { padding: 0.4rem 0.5rem; font-size: 0.8rem; }
    .main-content { padding: 1rem; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .card-wide { grid-column: 1; }
    .begruessung { flex-direction: column; align-items: flex-start; }
    .dokument-links { grid-template-columns: repeat(2, 1fr); }
    .stundenplan-grid { font-size: 0.75rem; }
    .kalender-grid { font-size: 0.75rem; }
    .kal-tag { min-height: 55px; }
}

@media (max-width: 480px) {
    .kind-switcher { order: 3; width: 100%; }
    .nav-menu { order: 4; width: 100%; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Print ── */
@media print {
    .navbar, .site-footer, .btn, .nav-menu, .kind-switcher { display: none !important; }
    .main-content { padding: 0; }
    .card { box-shadow: none; border: 1px solid #ccc; }
}
