/* =========================================================
   SCHULKRAM
   Zentrales Stylesheet
   ========================================================= */


/* ---------------------------------------------------------
   Grundwerte
   --------------------------------------------------------- */

:root {
    --navy: #1f2c3d;
    --navy-light: #29394d;

    --orange: #fb8b3f;
    --orange-dark: #ed7b31;
    --orange-soft: #fff1e7;

    --background: #f5f7fa;
    --surface: #ffffff;

    --text: #17202b;
    --text-soft: #667085;
    --text-light: #98a2b3;

    --border: #e4e7ec;

    --danger: #b42318;
    --danger-background: #fef3f2;

    --success: #027a48;
    --success-background: #ecfdf3;

    --radius-small: 8px;
    --radius: 14px;
    --radius-large: 20px;

    --shadow:
        0 1px 2px rgba(16, 24, 40, 0.04),
        0 4px 12px rgba(16, 24, 40, 0.05);
}


* {
    box-sizing: border-box;
}


html,
body {
    margin: 0;
    min-height: 100%;
}


body {
    font-family:
        Inter,
        "Segoe UI",
        Arial,
        sans-serif;

    color: var(--text);
    background: var(--background);
}


a {
    color: inherit;
}


button,
input,
select,
textarea {
    font: inherit;
}


/* ---------------------------------------------------------
   Buttons
   --------------------------------------------------------- */

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 44px;

    padding: 0 20px;

    border: 0;
    border-radius: var(--radius-small);

    text-decoration: none;

    font-weight: 700;

    cursor: pointer;

    transition:
        background 0.15s ease,
        transform 0.15s ease;
}


.button:hover {
    transform: translateY(-1px);
}


.button-primary {
    width: 100%;

    color: #ffffff;
    background: var(--orange);
}


.button-primary:hover {
    background: var(--orange-dark);
}


.button-auto {
    width: auto;
    flex-shrink: 0;
}


.button-secondary {
    width: auto;

    color: var(--text);
    background: #f2f4f7;
}

.button-secondary:hover {
    background: #e4e7ec;
}

.button-danger {
    width: auto;

    color: var(--danger);
    background: var(--danger-background);
}

.button-danger:hover {
    background: #fee4e2;
}

.button-small {
    min-height: 38px;
    padding: 0 15px;

    font-size: 13px;
}


/* =========================================================
   LOGIN
   ========================================================= */

.login-page {
    min-height: 100vh;

    display: grid;
    grid-template-columns: 1fr 1fr;
}


.login-brand {
    min-height: 100vh;

    display: flex;
    flex-direction: column;
    justify-content: space-between;

    padding: 64px 54px 48px;

    color: #ffffff;
    background: var(--navy);
}


.brand-name {
    margin: 0;

    font-size: 28px;
    line-height: 1;
    font-weight: 800;
}


.brand-module {
    margin-top: 12px;

    color: var(--orange);

    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.18em;
}


.login-brand-content {
    max-width: 570px;
}


.login-brand-content h2 {
    margin: 0 0 18px;

    color: #ffffff;

    font-size: clamp(42px, 4vw, 62px);
    line-height: 0.98;
    letter-spacing: -0.045em;
}


.login-brand-content p {
    max-width: 500px;

    margin: 0;

    color: #e1e8f0;

    font-size: 17px;
    line-height: 1.6;
}


.login-brand-footer {
    color: #9fc0df;

    font-size: 13px;
}


.login-main {
    min-height: 100vh;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 50px;

    background: #f8f9fb;
}


.login-card {
    width: 100%;
    max-width: 430px;
}


.login-card h1 {
    margin: 0 0 8px;

    font-size: 30px;
    letter-spacing: -0.03em;
}


.login-subtitle {
    margin: 0 0 34px;

    color: var(--text-soft);

    font-size: 15px;
}


.form-group {
    margin-bottom: 20px;
}


.form-group label {
    display: block;

    margin-bottom: 8px;

    font-size: 14px;
    font-weight: 600;
}


.form-control {
    width: 100%;
    min-height: 48px;

    padding: 10px 14px;

    border: 1px solid var(--border);
    border-radius: var(--radius-small);

    background: #ffffff;

    outline: none;

    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease;
}


.form-control:focus {
    border-color: var(--orange);

    box-shadow:
        0 0 0 3px rgba(251, 139, 63, 0.14);
}


.alert {
    margin-bottom: 22px;

    padding: 12px 14px;

    border-radius: var(--radius-small);

    font-size: 14px;
    line-height: 1.5;
}


.alert-error {
    color: var(--danger);
    background: var(--danger-background);
}


.alert-success {
    color: var(--success);
    background: var(--success-background);
}


/* =========================================================
   APP / DASHBOARD
   ========================================================= */

.app-body {
    min-height: 100vh;
    background: var(--background);
}


.app-layout {
    min-height: 100vh;

    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
}


/* ---------------------------------------------------------
   Sidebar
   --------------------------------------------------------- */

.sidebar {
    position: sticky;
    top: 0;

    height: 100vh;

    display: flex;
    flex-direction: column;
    justify-content: space-between;

    padding: 30px 20px 24px;

    color: #ffffff;
    background: var(--navy);
}


.sidebar-brand {
    padding: 4px 14px 34px;
}


.sidebar-brand-name {
    font-size: 24px;
    line-height: 1;
    font-weight: 800;
}


.sidebar-brand-module {
    margin-top: 9px;

    color: var(--orange);

    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.18em;
}


.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
}


.sidebar-link {
    min-height: 46px;

    display: flex;
    align-items: center;
    gap: 12px;

    padding: 0 14px;

    border-radius: 10px;

    color: #cbd5e1;

    text-decoration: none;

    font-size: 14px;
    font-weight: 600;

    transition:
        background 0.15s ease,
        color 0.15s ease;
}


.sidebar-link:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.07);
}


.sidebar-link.active {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.11);
}


.sidebar-link.active::before {
    content: "";

    width: 3px;
    height: 22px;

    margin-left: -14px;

    border-radius: 0 3px 3px 0;

    background: var(--orange);
}


.sidebar-icon {
    width: 20px;

    display: inline-flex;
    justify-content: center;

    font-size: 17px;
}


.sidebar-bottom {
    padding-top: 20px;

    border-top: 1px solid rgba(255, 255, 255, 0.1);
}


.sidebar-user {
    display: flex;
    align-items: center;
    gap: 11px;

    padding: 0 8px 18px;
}


.sidebar-user-avatar {
    width: 38px;
    height: 38px;

    flex-shrink: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 50%;

    color: #ffffff;
    background: var(--orange);

    font-size: 14px;
    font-weight: 800;
}


.sidebar-user-info {
    min-width: 0;

    display: flex;
    flex-direction: column;
    gap: 2px;
}


.sidebar-user-info strong {
    overflow: hidden;

    color: #ffffff;

    font-size: 13px;

    text-overflow: ellipsis;
    white-space: nowrap;
}


.sidebar-user-info span {
    color: #94a3b8;

    font-size: 11px;
}


.sidebar-logout {
    display: block;

    padding: 10px 8px;

    color: #aebdcd;

    text-decoration: none;

    font-size: 13px;
}


.sidebar-logout:hover {
    color: #ffffff;
}


/* ---------------------------------------------------------
   Hauptbereich
   --------------------------------------------------------- */

.app-main {
    min-width: 0;

    padding: 44px 48px 28px;
}


.app-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 30px;

    margin-bottom: 34px;
}


.page-eyebrow {
    margin: 0 0 7px;

    color: var(--orange-dark);

    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.16em;
}


.app-header h1 {
    margin: 0;

    font-size: 34px;
    line-height: 1.1;
    letter-spacing: -0.035em;
}


.school-year-selector {
    min-width: 210px;

    padding: 11px 14px;

    border: 1px solid var(--border);
    border-radius: 10px;

    background: var(--surface);
}


.school-year-selector span,
.school-year-selector strong {
    display: block;
}


.school-year-selector span {
    margin-bottom: 4px;

    color: var(--text-soft);

    font-size: 11px;
}


.school-year-selector strong {
    font-size: 13px;
}


/* ---------------------------------------------------------
   Welcome
   --------------------------------------------------------- */

.welcome-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 40px;

    margin-bottom: 24px;

    padding: 30px 32px;

    border-radius: var(--radius-large);

    color: #ffffff;
    background: var(--navy);

    box-shadow: var(--shadow);
}


.welcome-label {
    margin: 0 0 8px;

    color: var(--orange);

    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}


.welcome-panel h2 {
    margin: 0 0 9px;

    color: #ffffff;

    font-size: 25px;
    letter-spacing: -0.025em;
}


.welcome-panel p:last-child {
    max-width: 650px;

    margin: 0;

    color: #cbd5e1;

    font-size: 14px;
    line-height: 1.55;
}


/* ---------------------------------------------------------
   Kennzahlen
   --------------------------------------------------------- */

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;

    margin-bottom: 24px;
}


.stat-card {
    min-width: 0;

    padding: 22px;

    border: 1px solid var(--border);
    border-radius: var(--radius);

    background: var(--surface);

    box-shadow: var(--shadow);
}


.stat-label {
    display: block;

    margin-bottom: 16px;

    color: var(--text-soft);

    font-size: 12px;
    font-weight: 700;
}


.stat-value {
    display: block;

    margin-bottom: 5px;

    font-size: 30px;
    line-height: 1;
    letter-spacing: -0.04em;
}


.stat-description {
    color: var(--text-light);

    font-size: 11px;
}


/* ---------------------------------------------------------
   Dashboard-Inhalte
   --------------------------------------------------------- */

.dashboard-grid {
    display: grid;
    grid-template-columns:
        minmax(0, 1.2fr)
        minmax(300px, 0.8fr);

    gap: 20px;
}


.content-card {
    min-width: 0;

    border: 1px solid var(--border);
    border-radius: var(--radius);

    background: var(--surface);

    box-shadow: var(--shadow);
}


.content-card-header {
    padding: 22px 24px 18px;

    border-bottom: 1px solid var(--border);
}


.card-kicker {
    display: block;

    margin-bottom: 5px;

    color: var(--orange-dark);

    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.13em;
}


.content-card-header h3 {
    margin: 0;

    font-size: 18px;
    letter-spacing: -0.02em;
}


/* ---------------------------------------------------------
   Schnellstart
   --------------------------------------------------------- */

.setup-list {
    padding: 8px;
}


.setup-item {
    min-height: 70px;

    display: flex;
    align-items: center;
    gap: 14px;

    padding: 12px 14px;

    border-radius: 10px;

    color: var(--text);

    text-decoration: none;
}


a.setup-item:hover {
    background: var(--background);
}


.setup-number {
    width: 34px;
    height: 34px;

    flex-shrink: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 9px;

    color: var(--orange-dark);
    background: var(--orange-soft);

    font-size: 13px;
    font-weight: 800;
}


.setup-text {
    min-width: 0;

    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 4px;
}


.setup-text strong {
    font-size: 13px;
}


.setup-text small {
    color: var(--text-soft);

    font-size: 11px;
}


.setup-arrow {
    color: var(--orange-dark);

    font-size: 20px;
}


.setup-item.disabled {
    opacity: 0.48;
}


/* ---------------------------------------------------------
   Empty State
   --------------------------------------------------------- */

.empty-state {
    min-height: 245px;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    padding: 35px;

    text-align: center;
}


.empty-state-symbol {
    width: 42px;
    height: 42px;

    display: flex;
    align-items: center;
    justify-content: center;

    margin-bottom: 14px;

    border-radius: 50%;

    color: var(--orange-dark);
    background: var(--orange-soft);

    font-weight: 800;
}


.empty-state strong {
    margin-bottom: 7px;

    font-size: 14px;
}


.empty-state p {
    max-width: 330px;

    margin: 0;

    color: var(--text-soft);

    font-size: 12px;
    line-height: 1.55;
}


/* =========================================================
   SCHULJAHRESVERWALTUNG
   ========================================================= */

.management-stack {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.card-body {
    padding: 24px;
}

.school-year-create-form {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto;
    align-items: end;
    gap: 14px;
}

.school-year-create-form .form-group {
    margin-bottom: 0;
}

.school-year-create-form .button {
    min-width: 190px;
}

.school-year-list {
    display: flex;
    flex-direction: column;
}

.school-year-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;

    padding: 18px 0;

    border-bottom: 1px solid var(--border);
}

.school-year-row:first-child {
    padding-top: 0;
}

.school-year-row:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.school-year-info {
    min-width: 0;

    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.school-year-name {
    font-size: 16px;
    font-weight: 800;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 25px;
    padding: 0 9px;

    border-radius: 999px;

    color: var(--orange-dark);
    background: var(--orange-soft);

    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.school-year-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
}

.school-year-actions form {
    margin: 0;
}

.text-button {
    padding: 7px 4px;

    border: 0;

    color: var(--orange-dark);
    background: transparent;

    font-size: 13px;
    font-weight: 700;

    cursor: pointer;
}

.text-button:hover {
    text-decoration: underline;
}

.edit-panel {
    display: none;

    width: 100%;
    margin-top: 14px;
    padding: 14px;

    border: 1px solid var(--border);
    border-radius: 10px;

    background: var(--background);
}

.edit-panel.is-open {
    display: block;
}

.school-year-edit-form {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) auto auto;
    align-items: center;
    gap: 10px;
}

.school-year-edit-form .form-control {
    min-height: 40px;
}

.school-year-delete-form {
    display: inline;
}

.empty-state.compact {
    min-height: 190px;
}

.empty-state.compact strong {
    display: block;
}

.empty-state.compact p {
    margin-top: 7px;
}



/* ---------------------------------------------------------
   Footer
   --------------------------------------------------------- */

.app-footer {
    padding-top: 28px;

    color: var(--text-light);

    font-size: 11px;
}


/* =========================================================
   Responsive
   ========================================================= */

@media (max-width: 1100px) {

    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr);
    }

}


@media (max-width: 900px) {

    .login-page {
        grid-template-columns: 1fr;
    }


    .login-brand {
        min-height: auto;

        padding: 35px;
    }


    .login-brand-content,
    .login-brand-footer {
        display: none;
    }


    .login-main {
        min-height: calc(100vh - 120px);

        padding: 35px 24px;
    }


    .app-layout {
        grid-template-columns: 1fr;
    }


    .sidebar {
        position: static;

        width: 100%;
        height: auto;
    }


    .sidebar-bottom {
        display: none;
    }


    .sidebar-brand {
        padding-bottom: 20px;
    }


    .sidebar-nav {
        flex-direction: row;
        overflow-x: auto;
    }


    .sidebar-link {
        flex-shrink: 0;
    }


    .app-main {
        padding: 30px 24px;
    }


    .dashboard-grid {
        grid-template-columns: 1fr;
    }

}


@media (max-width: 650px) {

    .app-header {
        flex-direction: column;
    }


    .school-year-selector {
        width: 100%;
    }


    .welcome-panel {
        align-items: flex-start;
        flex-direction: column;
    }


    .dashboard-stats {
        grid-template-columns: 1fr;
    }


    .school-year-create-form {
        grid-template-columns: 1fr;
    }


    .school-year-create-form .button {
        width: 100%;
    }


    .school-year-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 14px;
    }


    .school-year-actions {
        width: 100%;
        justify-content: flex-start;
    }


    .school-year-edit-form {
        grid-template-columns: 1fr;
    }


    .school-year-edit-form .button {
        width: 100%;
    }

}

/* =========================================================
   KLASSEN – FEINSCHLIFF
   ========================================================= */


/* ---------------------------------------------------------
   Aktuelles Schuljahr
   --------------------------------------------------------- */

.context-bar {
    display: flex;
    align-items: center;

    margin-bottom: 20px;
    padding: 14px 18px;

    border: 1px solid var(--border);
    border-radius: 12px;

    background: var(--surface);

    box-shadow: var(--shadow);
}


.context-bar > div {
    display: flex;
    align-items: baseline;
    gap: 7px;
}


.context-bar-label {
    color: var(--text-soft);

    font-size: 12px;
    font-weight: 600;
}


.context-bar strong {
    color: var(--text);

    font-size: 14px;
    font-weight: 800;
}


/* ---------------------------------------------------------
   Formular: Klasse anlegen
   --------------------------------------------------------- */

.class-create-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 14px;
}


.class-create-form .form-group {
    margin-bottom: 0;
}


.class-create-form .button {
    width: auto;
    min-width: 150px;
}


/* ---------------------------------------------------------
   Klassenübersicht
   --------------------------------------------------------- */

.class-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}


.class-card {
    min-width: 0;

    padding: 20px;

    border: 1px solid var(--border);
    border-radius: 12px;

    background: var(--surface);

    box-shadow:
        0 1px 2px rgba(16, 24, 40, 0.03),
        0 3px 8px rgba(16, 24, 40, 0.04);

    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease,
        transform 0.15s ease;
}


.class-card:hover {
    border-color: #d0d5dd;

    box-shadow:
        0 2px 4px rgba(16, 24, 40, 0.04),
        0 8px 20px rgba(16, 24, 40, 0.06);

    transform: translateY(-1px);
}


/* ---------------------------------------------------------
   Kopf der Klassenkarte
   --------------------------------------------------------- */

.class-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}


.class-card-title {
    min-width: 0;
}


.class-card-title h4 {
    margin: 0 0 5px;

    color: var(--text);

    font-size: 18px;
    line-height: 1.25;
    font-weight: 800;

    letter-spacing: -0.02em;
}


.class-card-meta {
    margin: 0;

    color: var(--text-soft);

    font-size: 11px;
    line-height: 1.4;
}


/* ---------------------------------------------------------
   Bearbeiten / Löschen
   --------------------------------------------------------- */

.class-card-actions {
    display: flex;
    align-items: center;
    gap: 6px;

    flex-shrink: 0;
}


.class-card-actions form {
    margin: 0;
}


.class-card-actions .action-button {
    height: 32px;
    min-height: 32px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 0 11px;

    border: 1px solid var(--border);
    border-radius: 7px;

    background: #f9fafb;
    color: var(--text);

    font: inherit;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;

    text-decoration: none;

    cursor: pointer;

    appearance: none;
    -webkit-appearance: none;
}


.class-card-actions .action-button:hover {
    border-color: #d0d5dd;
    background: #f2f4f7;
}


.class-card-actions .action-button-danger {
    border-color: #fecdca;

    color: var(--danger);
    background: var(--danger-background);
}


.class-card-actions .action-button-danger:hover {
    border-color: #fda29b;
    background: #fee4e2;
}


/* ---------------------------------------------------------
   Unterer Bereich der Klassenkarte
   --------------------------------------------------------- */

.class-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;

    margin-top: 20px;
    padding-top: 15px;

    border-top: 1px solid var(--border);
}


.class-card-counts {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}


.count-chip {
    min-height: 27px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 0 10px;

    border-radius: 999px;

    color: var(--text-soft);
    background: var(--background);

    font-size: 10px;
    font-weight: 700;
    white-space: nowrap;
}


/*
 * Noch keine Schaltfläche:
 * "Details folgen" bleibt bewusst zurückhaltend,
 * bis wir die Klassendetailseite gebaut haben.
 */

.class-open-link {
    color: var(--text-light);

    font-size: 11px;
    font-weight: 600;

    white-space: nowrap;
}


/* ---------------------------------------------------------
   Bearbeitungsmodus
   --------------------------------------------------------- */

.class-edit {
    margin-top: 16px;
    padding: 13px;

    border: 1px solid var(--border);
    border-radius: 10px;

    background: var(--background);
}


.class-edit-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 8px;
}


.class-edit-form .form-control {
    min-height: 38px;
    padding: 7px 11px;

    font-size: 13px;
}


.class-edit-form .action-button {
    height: 38px;
    min-height: 38px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 0 12px;

    border: 1px solid var(--border);
    border-radius: 7px;

    background: #f2f4f7;
    color: var(--text);

    font-size: 12px;
    font-weight: 700;

    text-decoration: none;
}


.class-edit-form .action-button-primary {
    border-color: var(--orange);

    color: #ffffff;
    background: var(--orange);
}


.class-edit-form .action-button-primary:hover {
    border-color: var(--orange-dark);
    background: var(--orange-dark);
}


/* ---------------------------------------------------------
   Responsive
   --------------------------------------------------------- */

@media (max-width: 1000px) {

    .class-list {
        grid-template-columns: 1fr;
    }

}


@media (max-width: 650px) {

    .context-bar > div {
        align-items: flex-start;
        flex-direction: column;
        gap: 3px;
    }


    .class-create-form {
        grid-template-columns: 1fr;
    }


    .class-create-form .button {
        width: 100%;
    }


    .class-card-header {
        flex-direction: column;
    }


    .class-card-actions {
        width: 100%;
        justify-content: flex-start;
    }


    .class-card-footer {
        align-items: flex-start;
        flex-direction: column;
    }


    .class-edit-form {
        grid-template-columns: 1fr;
    }


    .class-edit-form .action-button {
        width: 100%;
    }

}