/* ============================================================
   Mediencurriculum – Stylesheet
   Professionelles, modernes Design für Schulumgebung
   ============================================================ */

/* ── CSS Variables ────────────────────────────────────────── */
:root {
    /* Hauptfarben – ruhiges, institutionelles Blau */
    --primary: #1a5276;
    --primary-light: #2980b9;
    --primary-dark: #0e3a53;
    --primary-50: #eaf2f8;
    --primary-100: #d4e6f1;

    /* Akzent */
    --accent: #e67e22;
    --accent-light: #f39c12;
    --accent-dark: #d35400;

    /* Kompetenzbereich-Farben */
    --comp-1: #2c3e50; /* Basiskompetenzen */
    --comp-2: #27ae60; /* Suchen und Verarbeiten */
    --comp-3: #2980b9; /* Kommunizieren */
    --comp-4: #8e44ad; /* Produzieren */
    --comp-5: #c0392b; /* Analysieren */

    /* Neutrale Töne */
    --bg: #f8f9fa;
    --bg-card: #ffffff;
    --bg-dark: #1a1a2e;
    --text: #2c3e50;
    --text-light: #7f8c8d;
    --text-muted: #95a5a6;
    --border: #dfe6e9;
    --border-light: #ecf0f1;

    /* Schatten */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
    --shadow-hover: 0 6px 20px rgba(0,0,0,0.15);

    /* Typografie */
    --font-display: 'Source Serif 4', 'Georgia', serif;
    --font-body: 'Source Sans 3', 'Segoe UI', sans-serif;
    --font-sans: 'Source Sans 3', 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    /* Abstände */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;

    /* Radien */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    /* Transitions */
    --transition: 0.2s ease;
}

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

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

body {
    font-family: var(--font-body);
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.3;
}

a { color: var(--primary-light); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-dark); }

/* ── Layout ───────────────────────────────────────────────── */
.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

.page-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-content {
    flex: 1;
    padding: var(--space-xl) 0;
}

/* ── Header ───────────────────────────────────────────────── */
.site-header {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
    color: white;
    padding: var(--space-md) 0 var(--space-sm);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-md);
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-sm);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-lg);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.header-brand img {
    height: 42px;
    width: auto;
    border-radius: var(--radius-sm);
}

.header-brand h1 {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: white;
}

.header-brand .subtitle {
    font-size: 0.8rem;
    opacity: 0.8;
    font-weight: 400;
    font-family: var(--font-body);
}

/* ── Navigation ───────────────────────────────────────────── */
.main-nav {
    display: flex;
    gap: var(--space-xs);
    background: rgba(255,255,255,0.1);
    border-radius: var(--radius-lg);
    padding: 4px;
    justify-content: center;
}

.nav-btn {
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    color: rgba(255,255,255,0.8);
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: all var(--transition);
    white-space: nowrap;
}

.nav-btn:hover { background: rgba(255,255,255,0.15); color: white; }
.nav-btn.active { background: white; color: var(--primary); font-weight: 600; }

.nav-links {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.nav-links a {
    color: rgba(255,255,255,0.7);
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

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

/* ── Cards ────────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    overflow: hidden;
    transition: all var(--transition);
}

.card:hover { box-shadow: var(--shadow-hover); transform: translateY(-1px); }

.card-header {
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-body { padding: var(--space-lg); }
.card-footer { padding: var(--space-md) var(--space-lg); border-top: 1px solid var(--border-light); background: var(--bg); }

/* ── Tabellen ─────────────────────────────────────────────── */
.curriculum-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.9rem;
}

.curriculum-table thead th {
    background: var(--primary);
    color: white;
    padding: 0.8rem 1rem;
    font-weight: 600;
    text-align: left;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    position: sticky;
    top: 0;
    z-index: 10;
}

.curriculum-table thead th:first-child { border-radius: var(--radius-md) 0 0 0; }
.curriculum-table thead th:last-child { border-radius: 0 var(--radius-md) 0 0; }

.curriculum-table tbody td {
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--border-light);
    vertical-align: top;
}

.curriculum-table tbody tr:hover { background: var(--primary-50); }

/* Kompetenzbereich-Header in Tabelle */
.grade-header {
    background: var(--primary-dark);
    color: white;
    font-size: 1rem;
    font-weight: 700;
    padding: 0.8rem 1rem;
    font-family: var(--font-display);
}

.grade-header td { padding: 0.8rem 1rem !important; }

/* ── Eintrags-Kacheln (in Tabellenzellen) ─────────────────── */
.entry-chip {
    display: inline-block;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.5rem 0.75rem;
    margin: 0.2rem;
    cursor: pointer;
    transition: all var(--transition);
    font-size: 0.82rem;
    line-height: 1.4;
    max-width: 100%;
}

.entry-chip:hover {
    background: var(--primary-50);
    border-color: var(--primary-light);
    box-shadow: var(--shadow-sm);
}

.entry-chip strong {
    color: var(--primary);
    display: block;
    font-size: 0.78rem;
}

.entry-chip .entry-title { color: var(--text); }

/* ── Kompetenzbereich-Badges ──────────────────────────────── */
.comp-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    color: white;
    margin: 0.1rem;
}

.comp-badge-1 { background: var(--comp-1); }
.comp-badge-2 { background: var(--comp-2); }
.comp-badge-3 { background: var(--comp-3); }
.comp-badge-4 { background: var(--comp-4); }
.comp-badge-5 { background: var(--comp-5); }

/* ── Kompetenz-Checkboxen (Editor) ────────────────────────── */
.competence-grid {
    display: grid;
    gap: var(--space-lg);
}

.competence-area {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.competence-area-header {
    padding: 0.75rem 1rem;
    font-weight: 700;
    font-size: 0.9rem;
    color: white;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.competence-area[data-area="1"] .competence-area-header,
.competence-area[data-area="2"] .competence-area-header,
.competence-area[data-area="3"] .competence-area-header,
.competence-area[data-area="4"] .competence-area-header,
.competence-area[data-area="5"] .competence-area-header { /* Farben werden per inline-style gesetzt */ }

.competence-sub {
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    cursor: pointer;
    transition: background var(--transition);
}

.competence-sub:hover { background: var(--primary-50); }
.competence-sub:last-child { border-bottom: none; }

.competence-sub input[type="checkbox"] {
    margin-top: 0.2rem;
    accent-color: var(--primary);
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.competence-sub .sub-number {
    font-weight: 700;
    color: var(--primary);
    min-width: 2.5rem;
    font-size: 0.85rem;
}

.competence-sub .sub-desc {
    font-size: 0.82rem;
    color: var(--text-light);
    line-height: 1.5;
    transition: color var(--transition);
}

.competence-sub.selected { background: var(--primary-50); }
.competence-sub.selected .sub-desc { color: var(--text); }

/* ── Modal ────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active { opacity: 1; pointer-events: all; }

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 700px;
    max-height: 85vh;
    overflow-y: auto;
    transform: translateY(20px) scale(0.95);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal { transform: translateY(0) scale(1); }

.modal-header {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 1;
}

.modal-header h2 {
    font-size: 1.15rem;
    color: var(--primary);
}

.modal-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--bg);
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    color: var(--text-light);
}

.modal-close:hover { background: var(--primary-50); color: var(--primary); }

.modal-body { padding: var(--space-lg); }
.modal-footer { padding: var(--space-md) var(--space-lg); border-top: 1px solid var(--border-light); display: flex; justify-content: flex-end; gap: var(--space-sm); }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); color: white; box-shadow: var(--shadow-sm); }

.btn-accent { background: var(--accent); color: white; }
.btn-accent:hover { background: var(--accent-dark); color: white; }

.btn-outline { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover { background: var(--primary-50); }

.btn-ghost { background: transparent; color: var(--text-light); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }

.btn-danger { background: #e74c3c; color: white; }
.btn-danger:hover { background: #c0392b; }

.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.78rem; }
.btn-lg { padding: 0.8rem 1.5rem; font-size: 0.95rem; }

/* ── Forms ────────────────────────────────────────────────── */
.form-group {
    margin-bottom: var(--space-md);
}

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

.form-control {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 0.9rem;
    transition: border-color var(--transition), box-shadow var(--transition);
    background: white;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(41,128,185,0.15);
}

select.form-control { cursor: pointer; }
textarea.form-control { min-height: 100px; resize: vertical; }

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

/* ── Hilfe-Tooltip ────────────────────────────────────────── */
.help-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--primary-100);
    color: var(--primary);
    font-size: 0.72rem;
    font-weight: 700;
    cursor: help;
    position: relative;
    transition: all var(--transition);
}

.help-trigger:hover { background: var(--primary-light); color: white; }

.help-popup {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-dark);
    color: white;
    padding: 0.8rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.8rem;
    line-height: 1.5;
    width: 280px;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 50;
    font-weight: 400;
}

.help-popup::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--bg-dark);
}

.help-trigger:hover .help-popup { opacity: 1; pointer-events: all; }

/* ── Listenansicht ────────────────────────────────────────── */
.list-view { max-width: 900px; margin: 0 auto; }

.grade-section {
    margin-bottom: var(--space-lg);
}

.grade-section-header {
    background: var(--primary);
    color: white;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-md);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: var(--space-sm);
}

.list-entry {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    margin-bottom: 0.3rem;
    overflow: hidden;
}

.list-entry-header {
    padding: 0.6rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: background var(--transition);
}

.list-entry-header:hover { background: var(--primary-50); }

.list-entry-header .entry-label { font-weight: 600; font-size: 0.88rem; }
.list-entry-header .entry-subject { color: var(--primary); font-weight: 700; margin-right: 0.5rem; }

.list-entry-toggle {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1.5px solid var(--border);
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    font-size: 1.1rem;
    color: var(--text-light);
}

.list-entry-toggle:hover { border-color: var(--primary); color: var(--primary); }
.list-entry.open .list-entry-toggle { transform: rotate(45deg); color: var(--primary); }

.list-entry-details {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    border-top: 1px solid transparent;
}

.list-entry.open .list-entry-details {
    max-height: 500px;
    border-top-color: var(--border-light);
}

.list-entry-details-inner {
    padding: var(--space-md) var(--space-lg);
}

/* ── Detail-Ansicht im Modal ──────────────────────────────── */
.detail-section {
    margin-bottom: var(--space-md);
}

.detail-section h4 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

.detail-section p { font-size: 0.9rem; }

.material-item {
    background: var(--bg);
    border-radius: var(--radius-md);
    padding: 0.6rem 0.8rem;
    margin-bottom: 0.3rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.material-item .material-title { font-weight: 600; font-size: 0.85rem; }
.material-item .material-link { font-size: 0.8rem; color: var(--primary-light); }

/* ── Admin-Sidebar ────────────────────────────────────────── */
.admin-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

.admin-sidebar {
    background: var(--bg-dark);
    color: white;
    padding: var(--space-lg);
}

.admin-sidebar .brand {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: var(--space-2xl);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.admin-sidebar .brand small {
    display: block;
    font-family: var(--font-body);
    font-size: 0.72rem;
    opacity: 0.5;
    font-weight: 400;
    margin-top: 0.2rem;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 0.6rem 0.8rem;
    color: rgba(255,255,255,0.65);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    margin-bottom: 0.2rem;
    transition: all var(--transition);
}

.sidebar-nav a:hover { color: white; background: rgba(255,255,255,0.08); }
.sidebar-nav a.active { color: white; background: var(--primary); font-weight: 600; }
.sidebar-nav a .icon { width: 20px; text-align: center; opacity: 0.7; }

.admin-main {
    padding: var(--space-xl);
    background: var(--bg);
    overflow-y: auto;
}

.admin-main h2 {
    font-size: 1.3rem;
    color: var(--primary);
    margin-bottom: var(--space-lg);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

/* ── Login ────────────────────────────────────────────────── */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary), var(--primary-light));
}

.login-card {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: var(--space-2xl);
    width: 100%;
    max-width: 420px;
}

.login-card h1 {
    text-align: center;
    color: var(--primary);
    margin-bottom: var(--space-xl);
    font-size: 1.5rem;
}

.login-card .subtitle {
    text-align: center;
    color: var(--text-light);
    font-size: 0.85rem;
    margin-top: -var(--space-md);
    margin-bottom: var(--space-xl);
}

.error-message {
    background: #fef2f2;
    color: #dc2626;
    padding: 0.6rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    margin-bottom: var(--space-md);
    border: 1px solid #fecaca;
}

.success-message {
    background: #f0fdf4;
    color: #16a34a;
    padding: 0.6rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    margin-bottom: var(--space-md);
    border: 1px solid #bbf7d0;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 1024px) {
    .admin-layout { grid-template-columns: 1fr; }
    .admin-sidebar { display: none; }
}

@media (max-width: 768px) {
    .header-top { margin-bottom: var(--space-xs); }
    .main-nav { flex-wrap: wrap; justify-content: center; }
    .nav-btn { padding: 0.4rem 0.7rem; font-size: 0.78rem; }
    .container { padding: 0 var(--space-md); }
    .form-row { grid-template-columns: 1fr; }
    .curriculum-table { font-size: 0.8rem; }
    .curriculum-table thead th,
    .curriculum-table tbody td { padding: 0.5rem 0.6rem; }
    .modal { max-width: 100%; border-radius: var(--radius-lg); }
}

/* ── Animations ───────────────────────────────────────────── */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeIn 0.4s ease forwards; }

@keyframes slideDown { from { opacity: 0; max-height: 0; } to { opacity: 1; max-height: 1000px; } }

/* ── Print ────────────────────────────────────────────────── */
@media print {
    .site-header, .main-nav, .nav-links, .modal-overlay { display: none !important; }
    .card { box-shadow: none; border: 1px solid #ddd; }
    body { font-size: 10pt; }
}

/* ── Loading Spinner ──────────────────────────────────────── */
.spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-2xl);
    gap: var(--space-sm);
    color: var(--text-light);
    font-size: 0.9rem;
}

/* ── Admin Data Table ─────────────────────────────────────── */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.data-table th {
    text-align: left;
    padding: 0.6rem 0.8rem;
    background: var(--bg);
    font-weight: 600;
    color: var(--text-light);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 2px solid var(--border);
}

.data-table td {
    padding: 0.6rem 0.8rem;
    border-bottom: 1px solid var(--border-light);
}

.data-table tr:hover td { background: var(--primary-50); }

/* Toggle switches */
.toggle {
    position: relative;
    width: 40px;
    height: 22px;
    appearance: none;
    background: var(--border);
    border-radius: 999px;
    cursor: pointer;
    transition: background var(--transition);
    border: none;
}

.toggle::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: white;
    transition: transform var(--transition);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle:checked { background: var(--primary); }
.toggle:checked::after { transform: translateX(18px); }

/* ── Compact Table for Grade View ─────────────────────────── */
.grade-table-wrapper {
    margin-bottom: var(--space-xl);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.grade-table-wrapper .grade-title {
    background: var(--primary-dark);
    color: white;
    padding: 0.7rem 1.2rem;
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 700;
}

.grade-table-wrapper table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.grade-table-wrapper th {
    background: var(--primary);
    color: white;
    padding: 0.6rem 0.8rem;
    font-size: 0.78rem;
    font-weight: 600;
    text-align: center;
    width: 20%;
    border-right: 1px solid rgba(255,255,255,0.15);
}

.grade-table-wrapper th:last-child { border-right: none; }

.grade-table-wrapper td {
    padding: 0.5rem;
    border-right: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
    vertical-align: top;
}

.grade-table-wrapper td:last-child { border-right: none; }

/* ── Footer ───────────────────────────────────────────────── */
.site-footer {
    background: var(--bg-dark);
    color: rgba(255,255,255,0.5);
    padding: var(--space-lg) 0;
    text-align: center;
    font-size: 0.78rem;
}

/* ═══════════════════════════════════════════════════════════
   Admin Dashboard Styles
   ═══════════════════════════════════════════════════════════ */

.admin-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-bottom: 1.5rem;
    padding: 0.5rem;
    background: var(--bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.admin-tab {
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    color: var(--text-light);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: all 0.15s ease;
    font-family: inherit;
    white-space: nowrap;
}

.admin-tab:hover {
    background: var(--primary-50);
    color: var(--primary);
}

.admin-tab.active {
    background: var(--primary);
    color: #fff;
}

.admin-section {
    display: none;
}

.admin-section.active {
    display: block;
    animation: fadeIn 0.2s ease;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: #ccc;
    border-radius: 24px;
    transition: 0.3s;
}

.toggle-slider::before {
    content: "";
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--accent, #27ae60);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

/* Responsive admin tabs */
@media (max-width: 768px) {
    .admin-tabs {
        gap: 0.15rem;
        padding: 0.35rem;
    }
    .admin-tab {
        padding: 0.4rem 0.6rem;
        font-size: 0.75rem;
    }
}

/* ═══ Password Toggle Eye ═══ */
.password-wrapper {
    position: relative;
}
.password-wrapper input {
    padding-right: 2.5rem;
}
.password-toggle {
    position: absolute;
    right: 0.6rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1.1rem;
    padding: 0.2rem;
    line-height: 1;
}
.password-toggle:hover { color: var(--primary); }

/* ═══ Kompetenz-Badge Tooltip ═══ */
.comp-badge {
    position: relative;
    cursor: help;
}
.comp-badge .comp-tooltip {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #2c3e50;
    color: #fff;
    padding: 0.5rem 0.7rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 400;
    line-height: 1.4;
    white-space: normal;
    width: 260px;
    max-width: 90vw;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    pointer-events: none;
    margin-bottom: 4px;
}
.comp-badge .comp-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #2c3e50;
}
.comp-badge:hover .comp-tooltip {
    display: block;
}

/* ── Competence Tooltip ──────────────────────────── */
.comp-tooltip-trigger { cursor: help; position: relative; }
.comp-tooltip-popup {
    position: absolute;
    z-index: 10000;
    background: #1a1a2e;
    color: #fff;
    padding: 0.6rem 0.8rem;
    border-radius: 8px;
    font-size: 0.78rem;
    line-height: 1.4;
    max-width: 320px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    pointer-events: none;
    animation: tooltipIn 0.15s ease-out;
}
@keyframes tooltipIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }

/* ── Grade Collapsible ───────────────────────────── */
.grade-toggle {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}
.grade-toggle-icon {
    font-size: 0.7rem;
    transition: transform 0.3s;
}
.grade-collapsible .grade-collapse-content {
    max-height: 2000px;
    overflow: hidden;
    transition: max-height 0.4s ease;
}
.grade-collapsible.collapsed .grade-collapse-content {
    max-height: 100px;
    position: relative;
}
.grade-collapsible.collapsed .grade-collapse-content::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: linear-gradient(transparent, white);
    pointer-events: none;
}
.grade-collapsible.collapsed .grade-toggle-icon {
    transform: rotate(-90deg);
}

/* ── Password Eye Toggle ─────────────────────────── */
.password-wrapper {
    position: relative;
}
.password-wrapper input {
    padding-right: 2.8rem;
}
.password-toggle {
    position: absolute;
    right: 0.6rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    color: var(--text-muted);
    padding: 0.2rem;
    line-height: 1;
}
.password-toggle:hover { color: var(--primary); }

/* ── Import Log ──────────────────────────────────── */
.import-log-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.8rem;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}
.import-log-card .log-meta {
    color: var(--text-muted);
    font-size: 0.78rem;
}

/* ── Collapsible Public Competence Subs ──────────── */
.comp-sub-item {
    border-bottom: 1px solid var(--border-light);
}
.comp-sub-item:last-child { border-bottom: none; }
.comp-sub-header {
    display: flex;
    align-items: center;
    padding: 0.7rem 1rem;
    gap: 0.5rem;
    transition: background 0.15s ease;
}
.comp-sub-header:hover { background: var(--primary-50); }
.comp-sub-toggle-icon {
    font-size: 0.7rem;
    color: var(--text-muted);
    transition: transform 0.25s ease;
    flex-shrink: 0;
}
.comp-sub-item:not(.collapsed) .comp-sub-toggle-icon { transform: rotate(90deg); }
.comp-sub-entries {
    max-height: 500px;
    overflow: hidden;
    opacity: 1;
    transition: max-height 0.35s ease, opacity 0.25s ease;
}
.comp-sub-item.collapsed .comp-sub-entries {
    max-height: 0;
    opacity: 0;
}
