@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200');

:root {
    --primary-color: #0066cc;
    /* Blau als Primary */
    --background-color: #000000;
    --surface-color: #0a0a0c;
    --surface-color-light: #16161a;
    --border-color: rgba(255, 255, 255, 0.1);
    --text-color-primary: #ffffff;
    --text-color-secondary: #a0a0b0;
    --success-color: #30d158;
    --error-color: #ff453a;
    --shadow-color: rgba(0, 0, 0, 0.2);
    --border-radius: 8px;
    --glass-intensity: 0.15;

    /* Material Design 3 Tokens - Globaler Override */
    --md-sys-color-primary: var(--primary-color);
    --md-sys-color-on-primary: #ffffff;
    --md-sys-color-secondary: var(--primary-color);
    --md-sys-color-on-secondary: #ffffff;
    --md-sys-color-surface: var(--surface-color);
    --md-sys-color-on-surface: var(--text-color-primary);
    --md-sys-color-outline: var(--border-color);
    --md-sys-color-surface-container-highest: var(--surface-color-light);
    
    /* Button Shape Fix */
    --md-sys-shape-corner-full: 8px;
    --md-sys-shape-corner-extra-large: 12px;
    --md-sys-shape-corner-large: 8px;

    /* Typography Override für Material Components */
    --md-sys-typescale-body-large-font: 'Inter', sans-serif;
    --md-sys-typescale-body-medium-font: 'Inter', sans-serif;
    --md-sys-typescale-body-small-font: 'Inter', sans-serif;
    --md-sys-typescale-label-large-font: 'Inter', sans-serif;
    --md-sys-typescale-label-medium-font: 'Inter', sans-serif;
    --md-sys-typescale-label-small-font: 'Inter', sans-serif;
    --md-sys-typescale-title-large-font: 'Inter', sans-serif;
    --md-sys-typescale-title-medium-font: 'Inter', sans-serif;
    --md-sys-typescale-title-small-font: 'Inter', sans-serif;
    --md-sys-typescale-headline-large-font: 'Inter', sans-serif;
    --md-sys-typescale-headline-medium-font: 'Inter', sans-serif;
    --md-sys-typescale-headline-small-font: 'Inter', sans-serif;
}

.material-symbols-outlined {
    font-family: 'Material Symbols Outlined';
    font-weight: normal;
    font-style: normal;
    font-size: inherit;
    display: inline-block;
    line-height: 1;
    text-transform: none;
    letter-spacing: normal;
    word-wrap: normal;
    white-space: nowrap;
    direction: ltr;
    vertical-align: middle;
}

html {
    overflow-x: hidden;
    scroll-behavior: smooth;
}

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

body {
    font-family: 'Inter', sans-serif;
    /* Bessere Font */
    background-color: var(--background-color);
    background-image: radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 0);
    background-size: 20px 20px;
    color: var(--text-color-primary);
    display: flex;
    justify-content: flex-start;
    align-items: center;
    min-height: 100vh;
    overflow-y: auto;
    flex-direction: column;
    padding-top: 5vh;
}

/* Adjust body for admin-page to take full viewport */
body.admin-page {
    padding: 0;
    margin: 0;
    display: block;
    /* Override flex properties that might center content */
    overflow: hidden;
}

/* --- Scope Schulleitung Page --- */
.schulleitung-page,
.admin-page {
    overflow: hidden;
    padding: 0;
}

.schulleitung-page .layout-wrapper,
.admin-page .layout-wrapper {
    width: 100%;
    display: flex;
    height: 100vh;
    padding: 0;
}

.schulleitung-page .app-container,
.admin-page .app-container {
    display: flex;
    width: 100%;
    height: 100%;
    gap: 0;
}

/* --- Floating Sidebar Styles --- */
.schulleitung-page .sidebar {
    min-width: 240px;
    width: auto;
    height: calc(100vh - 30px);
    /* Fliegender Effekt */
    margin: 15px 0 15px 15px;
    /* Abstand zu den Rändern */
    background: rgba(255, 255, 255, var(--glass-intensity));
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 25px 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    color: white;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1), min-width 0.4s;
    overflow: hidden;
    position: relative;
    z-index: 100;
}

.admin-page .sidebar {
    min-width: 260px;
    width: auto;
    height: calc(100vh - 30px);
    /* Fliegender Effekt */
    margin: 15px 0 15px 15px;
    /* Abstand zu den Rändern */
    background: rgba(255, 255, 255, var(--glass-intensity));
    /* backdrop-filter entfernt */
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 25px 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    color: white;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1), min-width 0.4s;
    overflow: hidden;
    position: relative;
    z-index: 100;
}

.admin-page .sidebar-header {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-page .sidebar-title {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--primary-color);
    white-space: nowrap;
    opacity: 1;
    transition: opacity 0.3s;
}

.admin-page .sidebar.collapsed .sidebar-title {
    opacity: 0;
}

.admin-page .sidebar-add-btn-fresh {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    margin-left: auto;
}

.admin-page .sidebar-add-btn-fresh:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    transform: scale(1.1);
    box-shadow: 0 0 12px rgba(0, 122, 255, 0.4);
}

.admin-page .dashboard-header {
    /* position: static; float: none; */
    /* Removed as it's now a direct child */
    /* order: 1; */
    /* Removed as it's now a direct child */
    width: 100%;
    padding: 10px 0;
    /* Keep padding */
    margin-bottom: 20px;
    /* Space below title */
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    font-size: 1.2rem;
}

.admin-page .dashboard-header::before {
    content: 'dashboard';
    font-family: 'Material Symbols Outlined';
    font-size: 1.5rem;
    color: var(--primary-color);
    display: inline-block;
}

.schulleitung-page .sidebar.collapsed {
    width: 80px;
    padding: 25px 12px;
    justify-content: space-between;
}

.admin-page .sidebar.collapsed {
    width: 80px;
    min-width: 80px;
    padding: 20px 10px;
    justify-content: space-between;
}

.admin-page .sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 20px;
    /* Space below namecard */
    flex: 1;
    /* Allow nav to grow and push footer down */
}

.schulleitung-page .sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.schulleitung-page .nav-item,
.admin-page .nav-item {
    padding: 12px 18px; 
    border-radius: 12px; 
    cursor: pointer; 
    display: flex; 
    justify-content: flex-start; 
    align-items: center; 
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); 
    font-size: 1.05rem; 
    font-weight: 500; 
    color: rgba(255, 255, 255, 0.9); 
}

/* Sidebar Collapsed - Slim Vertical Layout */
.schulleitung-page .sidebar.collapsed,
.teacher-dashboard .sidebar.collapsed {
    width: 80px !important;
    min-width: 80px !important;
    padding: 25px 10px !important;
    align-items: center !important;
    flex-direction: column !important;
}

.schulleitung-page .sidebar.collapsed .sidebar-nav,
.teacher-dashboard .sidebar.collapsed .sidebar-nav {
    flex-direction: column !important;
    gap: 20px !important;
    margin: 0 !important;
    align-items: center !important;
}

.schulleitung-page .sidebar.collapsed .nav-item,
.teacher-dashboard .sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 12px !important;
    width: auto !important;
}

.schulleitung-page .sidebar.collapsed .sidebar-footer,
.teacher-dashboard .sidebar.collapsed .sidebar-footer {
    flex-direction: column !important;
    gap: 15px !important;
}

.schulleitung-page .nav-item-content {
    display: flex;
    align-items: center;
    gap: 15px;
    white-space: nowrap;
}

.schulleitung-page .sidebar.collapsed .nav-item-content {
    gap: 0;
}

.schulleitung-page .nav-item span:not(.material-symbols-outlined) {
    transition: opacity 0.3s, transform 0.3s;
}

.schulleitung-page .sidebar.collapsed .nav-item span:not(.material-symbols-outlined) {
    display: none !important;
}

.schulleitung-page .sidebar.collapsed .sidebar-header,
.schulleitung-page .sidebar.collapsed .sidebar-username,
.schulleitung-page .sidebar.collapsed .help-link,
.schulleitung-page .sidebar.collapsed .sidebar-title,
.schulleitung-page .sidebar.collapsed .sidebar-add-btn,
.schulleitung-page .sidebar.collapsed .action-changelog,
.teacher-dashboard .sidebar.collapsed .sidebar-header,
.teacher-dashboard .sidebar.collapsed .sidebar-username,
.teacher-dashboard .sidebar.collapsed .help-link,
.teacher-dashboard .sidebar.collapsed .action-changelog {
    display: none !important;
}

.schulleitung-page .sidebar.collapsed .sidebar-profile {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin-bottom: 10px !important;
    flex-direction: column !important;
    gap: 15px !important;
    width: auto !important;
}

.schulleitung-page .sidebar.collapsed .sidebar-actions {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
}


.schulleitung-page .nav-item:hover {
    background: rgba(255, 255, 255, var(--glass-intensity));
    transform: translateX(4px);
}

.schulleitung-page .sidebar-add-btn {
    background: rgba(255, 255, 255, var(--glass-intensity));
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    margin-left: auto;
}

/* Hide add buttons unless the user/personal tab is active */
.admin-page .sidebar-add-btn-fresh {
    display: none;
}

.admin-page:has(.nav-item[data-tab="users"].active) .sidebar-add-btn-fresh {
    display: flex;
}

.schulleitung-page .sidebar-add-btn {
    display: flex;
}

.schulleitung-page:has(.nav-item[data-tab="personal"].active) .sidebar-add-btn {
    display: flex;
}

.schulleitung-page .sidebar-add-btn span,
.admin-page .sidebar-add-btn-fresh span {
    font-size: 1.2rem;
}

.schulleitung-page .sidebar-add-btn:hover,
.admin-page .sidebar-add-btn-fresh:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
}

.admin-page .sidebar.collapsed .sidebar-add-btn-fresh {
    display: none;
}


.schulleitung-page .sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.admin-page .sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: auto;
}

.admin-page .sidebar-profile:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.schulleitung-page .help-link,
.admin-page .help-link {
    color: white;
    text-decoration: none;
    font-size: 0.8rem;
    display: block;
    margin-bottom: 5px;
    padding-left: 5px;
    opacity: 0.7;
}

/* --- Common Profile Styles (Fallback) --- */
.sidebar-profile {
    display: flex !important;
    align-items: center;
    gap: 12px;
    padding: 10px 15px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
    cursor: pointer;
}

.sidebar-profile:hover {
    background: rgba(255, 255, 255, 0.1);
}

.sidebar-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.1);
    background: #fff;
    flex-shrink: 0;
}

/* --- Lehrer Dashboard Profile (Horizontal Card) --- */
.teacher-dashboard .sidebar-profile {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 12px;
    margin: 10px 0;
    width: 100%;
    flex-direction: row !important;
    /* Forces horizontal card layout */
    justify-content: flex-start !important;
}

.teacher-dashboard .profile-info {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    text-align: left !important;
    gap: 8px !important;
}

.sidebar-avatar {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    min-height: 40px !important;
    flex-shrink: 0 !important;
    border-radius: 50%;
    object-fit: cover !important;
}

.teacher-dashboard .sidebar-actions,
.schulleitung-page .sidebar-actions,
.admin-page .sidebar-actions {
    display: flex !important;
    /* Always visible as requested */
    margin-left: auto;
    gap: 8px;
    flex-direction: row !important;
}

/* --- Schüler Dashboard Profile (Avatar-Only Trigger) --- */
.schueler-page .sidebar-profile {
    background: transparent;
    padding: 0;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
}

.schueler-page .sidebar-username,
.schueler-page .sidebar-actions {
    display: none !important;
    /* Hidden by default in header */
}

.schueler-page .sidebar-profile.active {
    background: rgba(255, 255, 255, 0.1);
}

/* ============================================================
   Student Permanent Profile Card — 1:1 Pixel Match
   Image: Avatar overlaps left edge of dark card,
          username + Stufe top row, XP bar, vertical buttons
   ============================================================ */

/* Outer wrapper */
.student-permanent-profile {
    display: flex;
    align-items: center;
    position: relative;
    flex-shrink: 0;
}

/* ---- CRITICAL: Reset the broad `.dashboard-container header div` rule ----
   That rule sets gap/flex-wrap/margin-right on ALL divs in the header,
   which breaks all the internal layout of our profile card.           ---- */
.schueler-page .student-permanent-profile,
.schueler-page .student-profile-card,
.schueler-page .dropdown-avatar-col,
.schueler-page .dropdown-content-col,
.schueler-page .dropdown-header-row,
.schueler-page .dropdown-level-col,
.schueler-page .dropdown-menu-items {
    gap: unset !important;
    flex-wrap: nowrap !important;
    margin-right: 0 !important;
}

/* The whole assembled card widget */
.student-profile-card {
    display: flex !important;
    flex-direction: row !important;
    /* Explicitly enforce row direction */
    align-items: center !important;
    position: relative !important;
    gap: 0 !important;
    flex-wrap: nowrap !important;
}

/* ---- AVATAR ---- */
.dropdown-avatar-col {
    position: relative !important;
    z-index: 5 !important;
    flex-shrink: 0 !important;
    display: flex !important;
    align-items: center !important;
}

.dropdown-large-avatar {
    width: 44px !important;
    height: 44px !important;
    border-radius: 10px !important;
    display: block !important;
    margin-right: -38px !important;
    /* Move content box much further left under the PFP */
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.4) !important;
    position: relative !important;
    z-index: 10 !important;
    background: #1B1A1F !important;
    border: 2px solid #3b3d42 !important;
}

/* ---- DARK CARD: EXACTLY 60px tall = avatar height ---- */
/* border-radius 30px on left matches the 60px height perfectly */
.dropdown-content-col {
    background: #3b3d42 !important;
    border-radius: 24px 10px 10px 24px !important;
    height: auto !important;
    min-height: 48px !important;
    box-sizing: border-box !important;
    padding: 4px 12px 4px 42px !important;
    /* Increased padding-left to 42px to account for deeper overlap */
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    gap: 2px !important;
    min-width: 140px !important;
    max-width: 250px !important;
    position: relative !important;
    z-index: 1 !important;
    overflow: hidden !important;
}

/* ---- TOP ROW: username left, Stufe+XP right ---- */
.dropdown-header-row {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    /* Changed from flex-start to center for better alignment */
    gap: 12px !important;
    /* Increased gap */
    margin-bottom: 2px !important;
    flex-wrap: nowrap !important;
    margin-right: 0 !important;
    width: 100% !important;
}

.dropdown-username {
    font-weight: 700 !important;
    font-size: 0.75rem !important;
    color: #ffffff !important;
    white-space: nowrap !important;
    line-height: 1 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 120px !important;
    display: flex !important;
    align-items: center !important;
    margin-left: 0 !important;
    position: relative !important;
    z-index: 10 !important;
}

.dropdown-badge {
    display: inline-flex !important;
    width: 6px !important;
    height: 6px !important;
    border-radius: 50% !important;
    background: #a0a0b0 !important;
    margin-left: 6px !important;
    /* Changed from margin-right to margin-left */
    flex-shrink: 0 !important;
}

.dropdown-badge.admin {
    background: #ff453a !important;
}

.dropdown-badge.dev {
    background: transparent !important;
    width: 16px !important;
    height: 16px !important;
    border-radius: 0 !important;
    color: #30d158 !important;
    align-items: center !important;
    justify-content: center !important;
}

.dropdown-badge.dev .material-symbols-outlined {
    font-size: 16px !important;
    line-height: 1 !important;
    font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 20;
}

.dropdown-badge.mod {
    background: #ff9f0a !important;
}


/* Stufe label + XP bar stacked right-aligned */
.dropdown-level-col {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    /* Centered instead of flex-end */
    gap: 2px !important;
    flex-shrink: 0 !important;
    margin-right: 0 !important;
    flex-wrap: nowrap !important;
}

.dropdown-stufe-text {
    font-weight: 700 !important;
    font-size: 0.7rem !important;
    /* Back to original size */
    color: #ffffff !important;
    line-height: 1.1 !important;
}

/* XP bar directly below Stufe */
.dropdown-xp-container {
    width: 50px !important;
    /* Middle ground 40 -> 60 -> 50 */
    height: 3px !important;
    background: rgba(255, 255, 255, 0.15) !important;
    border-radius: 100px !important;
    overflow: hidden !important;
    margin-right: 0 !important;
}

.dropdown-xp-fill {
    height: 100% !important;
    background: linear-gradient(90deg, #1db954, #30d158) !important;
    box-shadow: 0 0 5px rgba(30, 215, 96, 0.8) !important;
    border-radius: 100px !important;
}

/* ---- MENU BUTTONS: compact to fit in remaining ~70px ---- */
.dropdown-menu-items {
    display: flex !important;
    flex-direction: column !important;
    gap: 0px !important;
    flex-wrap: nowrap !important;
    margin-right: 0 !important;
}

.dropdown-menu-items button {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 2px 0 !important;
    /* Added slight vertical padding */
    background: transparent !important;
    border: none !important;
    color: rgba(255, 255, 255, 0.85) !important;
    cursor: pointer !important;
    font-size: 0.75rem !important;
    /* Increased from 0.65rem */
    font-weight: 500 !important;
    line-height: 1.2 !important;
    text-align: left !important;
    transition: all 0.2s ease !important;
    white-space: nowrap !important;
    width: 100% !important;
}

.dropdown-menu-items button:hover {
    opacity: 1 !important;
    transform: translateX(1px) !important;
    color: #ffffff !important;
}

.dropdown-menu-items button .material-symbols-outlined {
    font-size: 14px !important;
    flex-shrink: 0 !important;
}

.schulleitung-page .sidebar.collapsed .sidebar-username,
.schulleitung-page .sidebar.collapsed .help-link {
    display: none;
}

.admin-page .sidebar.collapsed .sidebar-username {
    display: block;
    opacity: 1;
    transform: none;
    overflow: hidden;
    text-overflow: ellipsis;
    /* Add ellipsis for long names */
}

.admin-page .sidebar.collapsed .help-link {
    display: none;
}

/* Keep help link hidden */

.schulleitung-page .sidebar-username,
.admin-page .sidebar-username {
    font-size: 0.95rem;
    font-weight: 600;
    white-space: nowrap;
    transition: opacity 0.3s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.sidebar-profile-badge {
    font-size: 1.4rem !important;
    color: var(--success-color);
    /* Green for admin/dev badge */
    margin-left: 5px;
    /* Spacing from username */
    vertical-align: middle;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sidebar-profile-badge:hover {
    transform: none !important;
    text-shadow: none !important;
    color: var(--success-color) !important;
}

.admin-page .sidebar.collapsed .sidebar-actions {
    display: flex;
    justify-content: center;
    /* Center toggle button */
    margin-top: auto;
}

.schulleitung-page .sidebar.collapsed .sidebar-actions {
    display: flex;
    justify-content: center;
    width: 100%;
}

.admin-page .sidebar.collapsed .sidebar-username,
.admin-page .sidebar.collapsed .help-link,
.admin-page .sidebar.collapsed .sidebar-action-btn span:not(.material-symbols-outlined) {
    display: none;
}

.admin-page .sidebar.collapsed .sidebar-profile {
    background: transparent;
    border: none;
    flex-direction: column;
    /* Stack avatar and actions vertically */
    align-items: center;
    /* Center items */
    padding: 5px 0;
}

.admin-page .sidebar.collapsed .sidebar-profile .profile-info {
    flex-direction: column;
    /* Stack avatar and badge vertically */
    align-items: center;
    gap: 5px;
    /* Smaller gap for stacked items */
}

.admin-page .sidebar.collapsed .sidebar-profile .sidebar-avatar {
    margin-bottom: 0;
    /* No extra margin */
}

.admin-page .sidebar.collapsed .sidebar-actions {
    flex-direction: column;
    /* Stack buttons vertically */
    gap: 10px;
    /* Space between stacked buttons */
}

.schulleitung-page .sidebar.collapsed .sidebar-profile,
.schulleitung-page .sidebar.collapsed .sidebar-profile {
    background: transparent;
    border: none;
    flex-direction: column;
    gap: 15px;
    padding: 5px;
    align-items: center;
}

.schulleitung-page .sidebar.collapsed .sidebar-footer,
.admin-page .sidebar.collapsed .sidebar-footer {
    align-items: center;
}

.schulleitung-page .sidebar-actions,
.admin-page .sidebar-actions,
.schueler-page .sidebar-actions {
    display: none;
    gap: 15px;
    margin-top: 5px;
    animation: fadeInSlide 0.3s ease forwards;
}

.sidebar-profile.active .sidebar-actions {
    display: flex !important;
}

@keyframes fadeInSlide {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.schulleitung-page .sidebar-action-btn,
.admin-page .sidebar-action-btn,
.schueler-page .sidebar-action-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.schulleitung-page .sidebar-action-btn:hover,
.admin-page .sidebar-action-btn:hover {
    opacity: 1;
}

/* --- Main Content --- */
.admin-page .main-content {
    flex: 1;
    padding: 25px 30px 30px 10px;
    overflow-y: auto;
}

.schulleitung-page .main-content {
    flex: 1;
    padding: 25px 30px 30px 10px;
    overflow-y: auto;
}

/* Remove any floating global headers in the admin main view */
.admin-page .main-content section {
    background: rgba(255, 255, 255, var(--glass-intensity));
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 35px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.schulleitung-page .main-content section {
    background: rgba(255, 255, 255, var(--glass-intensity));
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 35px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.schulleitung-page .main-content section h3,
.admin-page .main-content section h3 {
    margin-bottom: 20px;
    font-size: 1.4rem;
    color: white;
    font-weight: 600;
}

/* --- Tabs Logic --- */
.schulleitung-page .tab-pane,
.admin-page .tab-pane {
    display: none;
    width: 100%;
}

.schulleitung-page .tab-pane.active {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 40px;
    align-items: stretch;
}

.admin-page .tab-pane.active {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
}

.schulleitung-page .forms-container,
.admin-page .forms-container {
    display: contents;
    /* Allows nested sections to utilize the parent grid */
}

@media (max-width: 1024px) {

    .schulleitung-page .tab-pane.active,
    .admin-page .tab-pane.active {
        grid-template-columns: 1fr;
    }
}

#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000000;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease-out, visibility 0.5s;
}

.loading-active #loading-overlay {
    opacity: 1;
    visibility: visible;
}

.loading-text-container {
    position: relative;
    width: 200px;
    height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.loading-text {
    position: absolute;
    font-family: 'Brush Script MT', cursive;
    font-size: 3.5em;
    font-weight: 500;
    letter-spacing: -0.02em;
    color: rgba(255, 255, 255, 0.75);
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.5s ease-in-out, transform 0.5s ease-in-out;
}

.loading-text.visible {
    opacity: 1;
    transform: scale(1);
}

.loading-active .glass-container,
.loading-active .docs-container {
    opacity: 0;
}

.loading-active .shape {
    filter: blur(150px) !important;
}

.loading-active .background-shapes {
    z-index: 10000;
}

.loading-active .shape1 {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: orbit 2s infinite ease-in-out !important;
}

.loading-active .shape2 {
    top: 50%;
    left: 50%;
    animation: orbit 2s infinite ease-in-out !important;
    animation-delay: -1s !important;
}

@keyframes orbit {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
    }

    50% {
        transform: translate(-50%, -50%) scale(1);
    }

    100% {
        transform: translate(-50%, -50%) scale(0.5);
    }
}

.goals-view-active .dashboard-container {
    opacity: 0;
    transform: scale(0.9);
    pointer-events: none;
}

.background-shapes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}

.shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(150px);
    will-change: transform;
}

.shape1 {
    width: 400px;
    height: 400px;
    background: linear-gradient(45deg, #ff9a9e 0%, #fad0c4 99%, #fad0c4 100%);
    top: -50px;
    left: -50px;
    animation: moveShape1 15s infinite alternate ease-in-out;
}

.shape2 {
    width: 500px;
    height: 500px;
    background: linear-gradient(45deg, #a1c4fd 0%, #c2e9fb 100%);
    bottom: -100px;
    right: -100px;
    animation: moveShape2 20s infinite alternate-reverse ease-in-out;
}

@keyframes moveShape1 {
    0% {
        transform: translate(0, 0) scale(1);
    }

    50% {
        transform: translate(100px, 150px) scale(1.1);
    }

    100% {
        transform: translate(0, 0) scale(1);
    }
}

@keyframes moveShape2 {
    0% {
        transform: translate(0, 0) scale(1);
    }

    40% {
        transform: translate(-120px, 80px) scale(0.9);
    }

    80% {
        transform: translate(50px, -100px) scale(1.2);
    }

    100% {
        transform: translate(0, 0) scale(1);
    }
}

.glass-container {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 30px 40px;
    box-shadow: 0 8px 32px 0 var(--shadow-color);
    color: white;
    width: 90%;
    max-width: 450px;
    transition: all 0.3s ease;
    color: var(--text-color-primary);
}

.login-container {
    text-align: center;
}

h2 {
    margin-bottom: 20px;
    color: var(--text-color-primary);
    font-weight: 600;
}

.input-group {
    margin-bottom: 20px;
    text-align: left;
}

.input-group label {
    display: block;
    margin-bottom: 5px;
    color: var(--text-color-secondary);
    font-weight: 400;
    font-size: 0.9em;
}

input[type="text"],
input[type="password"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--surface-color-light);
    color: var(--text-color-primary);
    font-family: 'Inter', sans-serif;
    font-size: 1em;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
}

input:focus {
    border: 1px solid var(--primary-color);
}

.btn {
    width: 100%;
    padding: 12px;
    border: 1px solid transparent;
    border-radius: 10px;
    color: white;
    background-color: var(--primary-color);
    color: white;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s;
}

.btn:hover {
    filter: brightness(1.1);
}

.error-message {
    color: var(--error-color);
    margin-top: 10px;
    height: 1em;
}

/* Password Visibility Toggle */
.password-input-wrapper {
    position: relative;
    width: 100%;
}

.password-input-wrapper input {
    padding-right: 40px;
    /* Make space for the icon */
}

.toggle-password {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--text-color-secondary);
    font-size: 1.1em;
}

.toggle-password .material-symbols-outlined {
    font-size: 20px;
}

.toggle-password:hover {
    color: var(--text-color-primary);
}

.dashboard-container {
    width: 100%;
    max-width: 1200px;
    background: none;
    border: none;
    box-shadow: none;
    padding: 0 20px;
}

.dashboard-container main {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.schulleitung-dashboard main,
.admin-dashboard main {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 15px;
}

.teacher-dashboard {
    width: 100%;
    max-width: none;
}

/* Lehrer Dashboard Detail View Optimierung */
#class-detail-view {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    align-items: start;
}

#class-detail-view.hidden {
    display: none;
}

#profile-container {
    position: relative;
    cursor: pointer;
    z-index: 1001;
}

#profile-image {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    object-fit: cover;
    transition: border-color 0.2s;
}

#profile-container:hover #profile-image {
    border-color: var(--primary-color);
}

.dashboard-container header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    width: 100%;
    overflow: visible;
    /* Allow avatar to overflow without clipping */
}

/* Student page: give header enough height for the big avatar card */
.schueler-page .dashboard-container header {
    align-items: center;
    padding-top: 10px;
    padding-bottom: 10px;
    overflow: visible;
}

.dashboard-container header h1 {
    flex-grow: 1;
}

.dashboard-container header div {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
    margin-right: 20px;
}

.btn-secondary {
    background-color: var(--surface-color-light);
    width: auto;
    padding: 8px 15px;
}

.btn-secondary:hover {
    background-color: var(--border-color);
}

.reason-box {
    background: rgba(30, 30, 35, 0.8);
    /* backdrop-filter entfernt */
    border: none;
    padding: 25px;
    border-radius: 24px;
    margin-top: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    position: relative;
    overflow: hidden;
}

.reason-box h3 {
    color: var(--primary-color);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin-bottom: 10px;
    opacity: 0.9;
}

.reason-box p {
    font-size: 1.1rem;
    font-weight: 500;
    color: #ffffff;
    line-height: 1.5;
}

.teacher-dashboard section {
    margin-bottom: 15px;
}

.add-user-section,
.student-list-section,
.add-student-section {
    background: var(--surface-color);
    padding: 15px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.add-user-section form,
.schulleitung-dashboard .add-user-section form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.add-user-section md-filled-button {
    margin-top: 10px;
    --md-filled-button-container-height: 48px;
}

#add-student-form {
    display: flex;
    gap: 10px;
}

#student-list .student-item,
.user-list-section .user-item,
#class-student-list .student-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    border-radius: 8px;
    margin-bottom: 4px;
    color: var(--text-color-primary);
    background: var(--surface-color-light);
    border: 1px solid var(--border-color);
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), border-color 0.2s;
}

.student-item:hover {
    transform: scale(1.01) translateX(5px);
    border-color: var(--primary-color);
}

.user-item small {
    color: var(--text-color-secondary);
    font-size: 0.85em;
}

.user-item .btn-delete {
    background-color: var(--error-color);
}

.user-item .user-actions {
    display: flex;
    gap: 5px;
}

.user-item .btn-reset-pw {
    background-color: var(--surface-color-light);
    padding: 5px 10px;
    font-size: 0.8em;
    line-height: 1;
}

.modal-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal-content {
    position: relative;
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    color: var(--text-color-secondary);
    font-size: 2em;
    cursor: pointer;
    transition: color 0.2s;
    z-index: 20;
}

.close-btn:hover {
    color: var(--text-color-primary);
}

.modal-background {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
}

.modal-background.active {
    opacity: 1; /* Korrektur: 100% ist keine gültige Opacity-Angabe */
    visibility: visible;
}

.modal-background .modal-content {
    background: var(--surface-color);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

#privileges-modal .modal-content {
    width: 800px;
    max-width: 90vw;
    height: 550px;
    padding: 40px;
    /* The general .modal-content styles will apply for the liquid look */
}

.modal-content {
    transform: translateY(-30px);
    transition: transform 0.3s ease-out;
    opacity: 0; /* Sicherstellen, dass es standardmäßig unsichtbar ist */
}

.modal-background.active .modal-content {
    transform: translateY(0);
    opacity: 1;
}

/* Ensure sub-modals are above the settings modal */
#change-password-modal,
#change-picture-modal {
    z-index: 2050;
}

#goals-page {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transform: scale(1.05);
    transition: opacity 0.4s ease-out, visibility 0.4s, transform 0.4s ease-out;
    z-index: 500;
}

.goals-view-active #goals-page {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

.goals-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    z-index: 501;
}

.goals-header h3 {
    font-weight: 600;
    color: white;
}

#add-goal-form {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    width: 100%;
    max-width: 500px;
    z-index: 501;
}

#goals-graph-container {
    width: 100%;
    flex-grow: 1;
    position: relative;
}

.goal-text-editor {
    display: none;
    position: absolute;
    z-index: 502;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid var(--primary-color);
    color: white;
    text-align: center;
    padding: 5px;
    border-radius: 5px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
}

.docs-container {
    max-width: 550px;
    width: 90%;
    padding: 20px 30px;
}

.docs-container h3 {
    font-weight: 700;
    margin-bottom: 10px;
    text-align: center;
    font-size: 1.5rem;
}

.tutorial-header {
    text-align: center;
    margin-bottom: 25px;
}

.tutorial-icon-large {
    width: 60px;
    height: 60px;
    background: rgba(0, 122, 255, 0.15);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 15px;
    color: var(--primary-color);
}

.tutorial-icon-large span {
    font-size: 32px;
}

.tutorial-steps {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.step-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.step-icon {
    color: var(--primary-color);
    font-size: 24px;
}

.step-text {
    font-size: 0.95rem;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.9);
}

.step-text strong {
    color: white;
}

.docs-container ul {
    list-style: none;
    padding-left: 5px;
}

.change-picture-options {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin: 20px 0;
}

.change-picture-options p {
    color: var(--text-color-secondary);
}

#upload-picture-form label {
    display: inline-block;
}

.hidden {
    display: none !important;
}

#picture-preview-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.cropper-container {
    width: 100%;
    max-width: 300px;
    height: 300px;
    margin-bottom: 20px;
}

#picture-preview {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color);
    margin-bottom: 10px;
}

.docs-container li {
    margin-bottom: 8px;
    font-size: 0.9em;
}

.student-goals-section h4 {
    margin-bottom: 10px;
    color: var(--text-color-secondary);
    font-weight: 400;
    font-size: 1em;
}

.student-goal-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--surface-color-light);
    border-radius: 6px;
    margin-bottom: 8px;
    font-size: 0.9em;
}

.student-goal-item.completed {
    text-decoration: line-through;
    opacity: 0.6;
}

.goal-actions .btn-approve-goal {
    background-color: var(--success-color);
    padding: 4px 8px;
    font-size: 0.8em;
    border: none;
}

@media (max-width: 1024px) {
    .goals-content {
        max-width: 90%;
    }

    .dashboard-container header {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }

    .dashboard-container header>div {
        justify-content: flex-start;
    }

    .settings-layout {
        flex-direction: column;
    }

    .settings-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        border-radius: 16px 16px 0 0;
    }

    .settings-modal-content {
        max-height: 80vh;
        display: flex;
        flex-direction: column;
    }

    .settings-content {
        overflow-y: auto;
        padding: 20px;
    }
}

@media (max-width: 820px) {
    .glass-container {
        padding: 25px;
    }

    .dashboard-container {
        padding: 0 20px;
    }
}

@media (max-width: 1024px) {

    /* Erlaubt auf iPads noch 2 Spalten, wenn Platz ist, sonst 1 */
    #class-detail-view {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .dashboard-container {
        padding: 0 25px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 20px 15px;
        justify-content: flex-start;
        font-size: 14px;
    }

    #add-student-form,
    #add-goal-form {
        flex-direction: column;
    }

    .dashboard-container {
        padding: 0;
    }

    .filter-controls {
        flex-direction: column;
    }

    .filter-controls>* {
        width: 100%;
    }
}

/* --- Login Page Redesign --- */

body.login-page {
    padding-top: 0;
    overflow: hidden;
    background: var(--background-color);
}

.login-wrapper {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

.login-left {
    position: absolute;
    right: 10%;
    top: 50%;
    transform: translateY(-50%);
    width: 450px;
    max-width: 90%;
    background-color: rgba(28, 28, 34, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 50px;
    z-index: 10;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.login-content-wrapper {
    width: 100%;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    gap: 60px;
}

.brand-header {
    margin-bottom: 0;
    text-align: left;
}

.brand-header h1 {
    font-size: 5rem;
    font-weight: 700;
    letter-spacing: -1px;
    margin-bottom: 5px;
    background: linear-gradient(90deg, #fff, #a0a0b0);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-header p {
    font-size: 1.1rem;
    color: var(--text-color-secondary);
    font-weight: 300;
    letter-spacing: 0.5px;
}

.login-page #login-form {
    width: 100%;
    max-width: 100%;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.login-page md-outlined-text-field,
.login-page md-filled-button {
    width: 100%;
}

.login-page #login-btn {
    --md-filled-button-container-height: 56px;
    margin-top: 8px;
}

.login-options {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-color-secondary);
    font-size: 0.9rem;
    padding: 4px 0;
}

.login-options label {
    cursor: pointer;
    user-select: none;
}

.login-footer {
    position: relative;
    bottom: auto;
    margin-top: 30px;
    display: flex;
    gap: 30px;
    justify-content: center;
}

.login-footer a {
    color: var(--text-color-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s;
}

.login-footer a:hover {
    color: var(--text-color-primary);
}

.login-right {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, #2a2a33 0%, #1c1c22 100%);
    z-index: 0;
}

#login-visuals {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

@media (max-width: 1024px) {
    .login-left {
        position: relative;
        right: auto;
        top: auto;
        transform: none;
        width: 100%;
        padding: 30px;
        border: none;
        box-shadow: none;
        background-color: transparent;
    }

    .login-wrapper {
        align-items: center;
        justify-content: center;
        display: flex;
        padding: 20px;
    }

    .brand-header h1 {
        text-align: center;
    }

    .brand-header p {
        text-align: center;
    }
}

/* iPad / Tablet Optimierungen */
@media (min-width: 481px) and (max-width: 1024px) {

    .btn,
    input,
    select,
    textarea {
        padding: 14px;
        /* Größere Touch-Targets */
        font-size: 16px;
        /* Verhindert Auto-Zoom auf iOS */
    }

    .user-item,
    .student-item,
    .checklist-item {
        padding: 15px 20px;
        /* Mehr Platz in Listen */
        margin-bottom: 12px;
    }

    .btn-icon-circle {
        width: 44px;
        height: 44px;
    }

    .dashboard-container header {
        margin-bottom: 40px;
    }

    .forms-container {
        gap: 30px;
    }
}

.gauge-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 20px 0;
}

.gauge-arc {
    width: 280px;
    height: 140px;
    border-radius: 280px 280px 0 0;
    background: rgba(255, 255, 255, 0.03);
    position: relative;
    overflow: hidden;
    -webkit-mask-image: radial-gradient(circle at 50% 100%, transparent 105px, black 106px);
    mask-image: radial-gradient(circle at 50% 100%, transparent 105px, black 106px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-bottom: none;
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.gauge-fill {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform-origin: center bottom;
    transform: rotate(calc(-180deg + (1.8deg * var(--fill-percentage, 0))));
    background-color: var(--gauge-color, #007bff);
    transition: transform 1.2s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.5s ease;
    filter: drop-shadow(0 0 10px var(--gauge-color));
    box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.3);
}

.gauge-level-text {
    font-size: 2.2rem;
    font-weight: 600;
    background: linear-gradient(180deg, #ffffff, #a0a0b0);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    cursor: help;
    margin-top: 15px;
    text-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.level-1 {
    --gauge-color: #8e8e93;
}

.level-2 {
    --gauge-color: #0a84ff;
}

.level-3 {
    --gauge-color: #30d158;
}

.level-4 {
    --gauge-color: #ff9f0a;
}

/* Level 4 Liquid & Gold Flex */
.gauge-container.level-4 .gauge-fill {
    background: linear-gradient(90deg, #ff9f0a, #ffcc00, #ff9f0a);
    background-size: 200% 100%;
    animation: liquid-flow 2s linear infinite;
    box-shadow: 0 0 30px rgba(255, 159, 10, 0.6), inset 0 0 15px rgba(255, 255, 255, 0.4);
}

@keyframes liquid-flow {
    0% {
        background-position: 100% 0;
    }

    100% {
        background-position: -100% 0;
    }
}

.gauge-container.level-4 .gauge-level-text {
    background: linear-gradient(180deg, #ffd700, #fdb931, #b8860b);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 30px rgba(255, 215, 0, 0.4);
    font-weight: 800;
    letter-spacing: 1px;
    transform: scale(1.1);
}

.gauge-arc.level-change-animation {
    animation: level-change-pulse 0.7s ease-in-out;
}

@keyframes level-change-pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 0 25px rgba(255, 255, 255, 0.7);
    }

    100% {
        transform: scale(1);
    }
}

.btn-icon-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    border: none;
    color: white;
    cursor: pointer;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
    font-size: 1.1em;
}

.btn-icon-circle .material-symbols-outlined {
    font-size: 20px;
}

.btn-reset-pw-icon {
    background-color: var(--surface-color-light);
    color: var(--text-color-primary);
}

.btn-reset-pw-icon:hover {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 15px rgba(10, 132, 255, 0.4);
}

.btn-delete-icon {
    background-color: var(--error-color);
    box-shadow: 0 4px 10px rgba(255, 68, 68, 0.3);
}

.btn-delete-icon:hover {
    filter: brightness(1.1);
}

.class-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.class-tile {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    height: 110px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.class-tile:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--primary-color);
    background-color: var(--surface-color-light);
}

.class-tile-header {
    display: flex;
    align-items: center;
    gap: 15px;
}

.class-icon-wrapper {
    width: 32px;
    height: 32px;
    background: rgba(0, 122, 255, 0.15);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
}

.class-icon-wrapper .material-symbols-outlined {
    font-size: 18px;
}

.class-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-color-primary);
    letter-spacing: -0.5px;
}

.class-tile-footer {
    display: flex;
    flex-direction: column;
    gap: 2px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 20px;
}

.tutor-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-color-secondary);
    font-weight: 600;
}

.tutor-list {
    font-size: 0.95rem;
    color: #e0e0e0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.filter-controls {
    display: flex;
    gap: 15px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.filter-controls input[type="text"] {
    flex: 1;
    min-width: 180px;
}

.filter-controls select {
    flex-basis: 180px;
    flex-grow: 1;
}

.class-controls {
    display: flex;
    gap: 15px;
    margin-bottom: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.class-controls input[type="text"] {
    flex: 1;
    min-width: 200px;
}

.filter-toggle-container {
    display: flex;
    align-items: center;
}

.forms-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#user-list {
    max-height: 600px;
    overflow-y: auto;
    padding-right: 5px;
}

#class-list {
    max-height: 30vh;
    min-height: 150px;
    overflow-y: auto;
    padding-right: 5px;
}

/* Better Scrollbar for Beta */
#user-list::-webkit-scrollbar,
#class-list::-webkit-scrollbar,
.settings-content::-webkit-scrollbar {
    width: 6px;
}
#user-list::-webkit-scrollbar-thumb,
#class-list::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
}

/* Custom Scrollbar für die Liste */
#user-list::-webkit-scrollbar,
#class-list::-webkit-scrollbar {
    width: 8px;
}

#user-list::-webkit-scrollbar-track,
#class-list::-webkit-scrollbar-track {
    background: var(--surface-color-light);
    border-radius: 4px;
}

#user-list::-webkit-scrollbar-thumb,
#class-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

/* Custom Searchable Dropdown */
.custom-dropdown {
    position: relative;
    width: 100%;
}

.custom-dropdown input {
    width: 100%;
    cursor: text;
}

.custom-dropdown-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface-color-light);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.custom-dropdown-options.active {
    display: block;
}

.custom-option {
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.custom-option:hover {
    background-color: var(--primary-color);
    color: white;
}

/* View Toggle Switch */
.view-toggle-container {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    z-index: 501;
    width: 100%;
}

.view-toggle {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 4px;
    display: flex;
    gap: 5px;
}

.toggle-btn {
    background: transparent;
    border: none;
    color: var(--text-color-secondary);
    padding: 6px 15px;
    border-radius: 16px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.toggle-btn .material-symbols-outlined {
    font-size: 18px;
}

.toggle-btn.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 2px 8px rgba(10, 132, 255, 0.3);
}

/* Checklist View */
.checklist-container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    padding: 10px;
}

.checklist-item {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.checklist-left {
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    flex-grow: 1;
}

.checklist-icon {
    font-size: 1.4em;
    color: var(--text-color-secondary);
    display: flex;
    align-items: center;
}

.checklist-item.completed .checklist-icon {
    color: var(--success-color);
}

.checklist-item.pending .checklist-icon {
    color: #ff9f0a;
}

.checklist-item.completed .checklist-text {
    text-decoration: line-through;
    opacity: 0.6;
}

.checklist-item.pending {
    border-left: 4px solid #ff9f0a;
    animation: pulse-border 2s infinite;
}

@keyframes pulse-border {
    0% { border-left-color: rgba(255, 159, 10, 1); }
    50% { border-left-color: rgba(255, 159, 10, 0.3); }
    100% { border-left-color: rgba(255, 159, 10, 1); }
}

.teacher-badge {
    background: #30d158;
    color: white;
    font-size: 0.7em;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
    vertical-align: middle;
}

.settings-modal-content {
    max-width: 800px;
    width: 90%;
    padding: 0;
}

.settings-layout {
    display: flex;
    min-height: 500px;
}

.settings-sidebar {
    width: 200px;
    background-color: rgba(0, 0, 0, 0.2);
    padding: 25px;
    border-right: 1px solid var(--border-color);
    border-radius: 16px 0 0 16px;
}

.settings-sidebar h2 {
    font-size: 1.2em;
    margin-bottom: 20px;
}

.settings-sidebar ul {
    list-style: none;
}

.settings-sidebar li {
    padding: 10px 15px;
    margin-bottom: 5px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.settings-sidebar li:hover {
    background-color: var(--surface-color-light);
}

.settings-sidebar li.active {
    background-color: var(--primary-color);
    color: white;
    font-weight: 600;
}

.settings-content {
    flex: 1;
    padding: 25px;
    position: relative;
}

.settings-pane {
    display: none;
}

.settings-pane.active {
    display: block;
}

.setting-item {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.setting-item:last-child {
    border-bottom: none;
}

.setting-item h4 {
    color: var(--text-color-secondary);
    font-weight: 400;
    margin-bottom: 10px;
}

.profile-picture-editable {
    position: relative;
    width: 100px;
    height: 100px;
    cursor: pointer;
}

.profile-picture-editable img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.profile-picture-editable .edit-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
align-items: center;
    color: white;
    font-size: 1.5em;
    opacity: 0;
    transition: opacity 0.2s;
}

.profile-picture-editable:hover .edit-overlay {
    opacity: 1;
}

/* --- Landing Page (Startseite) --- */

body.landing-page {
    padding-top: 0;
    overflow-y: auto;
    background: var(--background-color);
}

.landing-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 20px 50px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
    backdrop-filter: blur(10px);
    background: rgba(28, 28, 34, 0.5);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.landing-logo {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(90deg, #fff, #a0a0b0);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-decoration: none;
}

.landing-links a {
    color: var(--text-color-secondary);
    text-decoration: none;
    margin-left: 30px;
    font-weight: 500;
    transition: color 0.3s;
}

.landing-links a:hover {
    color: var(--primary-color);
}

.hero-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 100px 50px;
    gap: 50px;
}

.hero-content {
    flex: 1;
    max-width: 600px;
    z-index: 10;
}

.hero-title {
    font-size: 4rem;
    line-height: 1.1;
    margin-bottom: 20px;
    font-weight: 700;
}

.hero-title span {
    color: var(--primary-color);
}

.hero-subtitle {
    font-size: 1.2rem;
    color: var(--text-color-secondary);
    margin-bottom: 40px;
    line-height: 1.6;
}

.hero-login-wrapper {
    flex: 1;
    max-width: 450px;
    background: rgba(42, 42, 51, 0.5);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 40px;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    z-index: 10;
    transform: translateY(0);
    transition: transform 0.3s;
}

.hero-login-wrapper:hover {
    transform: translateY(-5px);
}

.features-section {
    padding: 100px 50px;
    background: var(--surface-color);
    position: relative;
    z-index: 10;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 40px;
    max-width: 1200px;
    margin: 0 auto;
}

.feature-card {
    background: var(--surface-color-light);
    padding: 30px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    transition: transform 0.3s, border-color 0.3s;
}

.feature-card:hover {
    transform: translateY(-10px);
    border-color: var(--primary-color);
}

.feature-icon {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 20px;
}

.feature-title {
    font-size: 1.5rem;
    margin-bottom: 15px;
    font-weight: 600;
}

.feature-desc {
    color: var(--text-color-secondary);
    line-height: 1.6;
}

footer {
    padding: 50px;
    text-align: center;
    color: var(--text-color-secondary);
    background: var(--background-color);
    border-top: 1px solid var(--border-color);
    position: relative;
    z-index: 10;
}

@media (max-width: 1024px) {
    .hero-section {
        flex-direction: column;
        text-align: center;
        padding-top: 150px;
    }

    .hero-content {
        margin-bottom: 40px;
    }

    .landing-nav {
        padding: 20px;
    }

    .landing-links {
        display: none;
    }
}

/* Custom Dialog Styling (Material 3 Override) */
md-dialog {
    z-index: 10000;
}

@keyframes dialog-slide-up {
    0% {
        opacity: 0;
        transform: translateY(100%) scale(0.95);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

md-dialog.custom-dialog {
    --md-dialog-container-color: rgba(20, 20, 25, 0.7); /* Erhöhte Transparenz, da kein Blur */
    --md-dialog-headline-color: #ffffff;
    --md-dialog-supporting-text-color: #e0e0e0;
    --md-dialog-container-shape: 24px;

    position: fixed !important;
    margin-left: auto !important;
    margin-right: auto !important;
    margin-top: auto !important;
    /* Drückt das Modal nach unten */
    margin-bottom: 40px !important;
    top: auto !important;
    bottom: 40px !important;
    left: 0 !important;
    right: 0 !important;

    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4);

    backdrop-filter: blur(12px) saturate(150%);
    -webkit-backdrop-filter: blur(12px) saturate(150%);

    min-width: 320px;
    max-width: 90vw;
    width: fit-content;

    animation: dialog-slide-up 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    will-change: transform, opacity;
}

md-dialog.custom-dialog [slot="headline"] {
    text-align: center;
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 1.3rem;
    margin-top: 24px;
    margin-bottom: 10px;
    letter-spacing: -0.02em;
    padding: 0 24px;
}

md-dialog.custom-dialog [slot="content"] {
    text-align: center;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    line-height: 1.5;
    color: #c0c0c0;
    padding: 0 25px;
}

md-dialog.custom-dialog div[slot="actions"] {
    display: flex;
    justify-content: center;
    gap: 12px;
    padding: 10px 25px 25px 25px;
    width: 100%;
}

md-dialog.custom-dialog md-filled-button,
md-dialog.custom-dialog md-text-button {
    --md-sys-typescale-label-large-font: 'Inter', sans-serif;
    font-family: 'Inter', sans-serif;
    flex: 1;
}

md-dialog.custom-dialog md-filled-button {
    --md-filled-button-container-color: var(--primary-color);
    --md-filled-button-label-text-color: #ffffff;
    font-weight: 600;
}

/* Privilegien Modal - Liquid Tabs Layout */
.privileges-layout {
    display: flex;
    gap: 30px;
    height: 100%;
}

.privileges-tabs {
    display: flex;
    flex-direction: column;
    width: 180px;
    gap: 15px;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    padding-right: 15px;
}

.privilege-tab {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid transparent;
    color: rgba(255, 255, 255, 0.6);
    padding: 20px;
    border-radius: 16px;
    cursor: pointer;
    text-align: center;
    font-size: 1.1rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.privilege-tab:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.privilege-tab.active {
    background: rgba(255, 255, 255, var(--glass-intensity));
    border-color: rgba(255, 255, 255, 0.2);
    color: white;
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.privileges-content-area {
    flex: 1; /* Erhöhte Transparenz, da kein Blur */
    background: rgba(255, 255, 255, 0.1); /* Erhöhte Transparenz, da kein Blur */
    /* backdrop-filter entfernt */
    border-radius: 24px;
    padding: 40px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.privilege-item {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 15px;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 1.1rem;
    line-height: 1.6;
}

/* --- Profile Dropdown (Glass Liquid Design) --- */
#profile-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    left: 50%;
    width: max-content;
    min-width: 200px; /* Leicht erhöhte Deckkraft */
    background: rgba(27, 26, 31, 0.98); /* Leicht erhöhte Deckkraft */
    /* backdrop-filter entfernt */
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 8px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateX(-50%) translateY(-15px) scale(0.95);
    transform-origin: top center;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    /* Bouncy Spring Animation */
    z-index: 10000;
    overflow: hidden;
}

#profile-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0) scale(1);
}

/* Keep full width sidebar style for Admin and Schulleitung */
.admin-page #profile-dropdown,
.schulleitung-page #profile-dropdown {
    left: 0;
    width: 100%;
    min-width: 0;
    transform: translateY(-15px) scale(0.95);
}

.admin-page #profile-dropdown.active,
.schulleitung-page #profile-dropdown.active {
    transform: translateY(0) scale(1);
}

.profile-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 5px;
}

#dropdown-username {
    font-weight: 700;
    font-size: 1.1em;
    color: #fff;
    letter-spacing: 0.5px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-dropdown-actions {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.profile-dropdown-actions button {
    width: 100%;
    background: transparent;
    border: 1px solid transparent;
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--text-color-secondary);
    font-size: 0.9em;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.profile-dropdown-actions button:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.1);
    transform: translateX(5px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.profile-dropdown-actions button .material-symbols-outlined {
    font-size: 18px;
    transition: transform 0.2s ease, text-shadow 0.2s ease;
}

.profile-dropdown-actions button:hover .material-symbols-outlined {
    transform: scale(1.1);
    color: var(--primary-color);
    text-shadow: 0 0 12px var(--primary-color);
    /* Neon Glow Effekt */
}

/* --- Guided Tour Styles --- */
#tour-overlay {
    position: fixed;
    top: 0;
    left: 0; /* Noch höheres Alpha, da kein Blur */
    width: 100%;
    height: 100%;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.85); /* Noch höheres Alpha, da kein Blur */
    transition: opacity 0.3s;
}

#tour-overlay.fade-out {
    opacity: 0;
}

#tour-spotlight {
    position: absolute;
    border-radius: 12px;
    z-index: 10001;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    border: 2px solid var(--primary-color);
    box-shadow: 0 0 10px rgba(0, 122, 255, 0.5);
}

#tour-box {
    position: absolute;
    width: 300px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 10002;
    pointer-events: all;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#tour-box h4 {
    margin: 0 0 10px 0;
    color: var(--primary-color);
    font-size: 1.1rem;
}

#tour-box p {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.4;
    margin-bottom: 20px;
}

#tour-actions {
    display: flex;
    justify-content: space-between;
align-items: center;
}

#tour-skip-btn {
    background: none;
    border: none;
    color: var(--text-color-secondary);
    cursor: pointer;
    font-size: 0.9rem;
}

#tour-skip-btn:hover {
    color: white;
}

/* Bugfix: Contrast for inputs in Schulleitung Dashboard */
.schulleitung-page .personal-tab-content input,
.schulleitung-page .forms-container input,
.schulleitung-page select {
    background-color: rgba(255, 255, 255, 0.9) !important;
    color: #1a1a1a !important;
    border: 1px solid #ccc !important;
}

/* Tour Box Mobile UI fix */
@media (max-width: 768px) {
    #tour-box {
        width: 90% !important;
        left: 5% !important;
        bottom: 80px !important;
        top: auto !important;
        transform: none !important;
        padding: 15px !important;
    }

    #tour-actions {
        margin-top: 15px !important;
        display: flex !important;
        justify-content: space-between !important;
        gap: 10px;
    }
}

/* ============================================
   MOBILE UI — Schüler Dashboard
   ============================================ */
@media (max-width: 600px) {

    /* --- Header: relative so profile can be absolute top-right --- */
    .schueler-page .dashboard-container header {
        position: relative !important;
        flex-direction: column !important;
        gap: 0 !important;
        padding: 12px 12px 8px 12px !important;
        align-items: flex-start !important;
        min-height: 64px !important;
    }

    /* --- Title: leave room on the right for the profile card --- */
    .schueler-page .dashboard-container header h1 {
        font-size: 1.05rem !important;
        width: 100% !important;
        padding-right: 200px !important;
        /* Space for profile card */
        margin-bottom: 8px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    /* --- Profile card: pinned to top-right on mobile UI --- */
    .schueler-page #profile-container {
        position: fixed !important;
        top: 10px !important;
        right: 12px !important;
        z-index: 1000 !important;
    }

    /* Scale down profile card slightly to fit top-right */
    .schueler-page .student-profile-card {
        transform: scale(0.85) !important;
        transform-origin: top right !important;
    }

    .schueler-page .dropdown-content-col {
        min-width: 110px !important;
        max-width: 160px !important;
        padding: 3px 8px 3px 26px !important;
    }

    .schueler-page .dropdown-large-avatar {
        width: 38px !important;
        height: 38px !important;
        margin-right: -26px !important;
    }

    /* --- Button row: horizontal scroll, no wrapping --- */
    .schueler-page .dashboard-container header>div {
        display: flex !important;
        flex-wrap: nowrap !important;
        gap: 6px !important;
        width: 100% !important;
        overflow-x: auto !important;
        padding-bottom: 4px !important;
        margin-right: 0 !important;
        align-items: center !important;
        /* Hide scrollbar but keep scrollable */
        scrollbar-width: none !important;
    }

    .schueler-page .dashboard-container header>div::-webkit-scrollbar {
        display: none !important;
    }

    /* Compact buttons — hide text labels on mobile */
    .schueler-page .large-elevated-button {
        min-width: 44px !important;
        flex-shrink: 0 !important;
        --md-elevated-button-leading-space: 12px !important;
        --md-elevated-button-trailing-space: 12px !important;
    }

    .schueler-page .large-elevated-button::part(label) {
        display: none !important;
    }

    /* Profile container should NOT be in the scrollable button row */
    .schueler-page .student-permanent-profile {
        flex-shrink: 0 !important;
    }

    /* --- Gauge / XP-Arc --- */
    .schueler-page .gauge-container {
        width: min(200px, 75vw) !important;
        height: auto !important;
        margin: 10px auto !important;
    }

    /* --- Main content padding --- */
    .schueler-page #main-dashboard {
        padding: 10px !important;
    }

    .schueler-page .reason-box {
        margin: 10px 0 !important;
        padding: 12px !important;
    }
}

/* ============================================
   MOBILE UI - Teacher / Lehrer Dashboard
   ============================================ */
@media (max-width: 600px) {

    .teacher-page .class-controls,
    .teacher-page .filter-bar {
        flex-direction: column !important;
        gap: 8px !important;
    }

    .teacher-page .class-controls input,
    .teacher-page .class-controls select {
        width: 100% !important;
    }

    .teacher-page #class-gallery {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    .teacher-page .dashboard-container header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 10px !important;
        padding: 12px !important;
    }
}

/* ============================================
   MOBILE UI - Schulleitung Dashboard
   ============================================ */
@media (max-width: 768px) {
    .schulleitung-page .app-container {
        flex-direction: column !important;
    }

    .schulleitung-page .sidebar {
        width: 100% !important;
        height: auto !important;
        position: relative !important;
        padding: 8px !important;
        border-radius: 0 !important;
        overflow-x: auto !important;
    }

    .schulleitung-page .sidebar-nav {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        gap: 4px !important;
    }

    .schulleitung-page .main-content {
        padding: 10px !important;
    }

    .schulleitung-page #class-list,
    .schulleitung-page #my-class-list {
        grid-template-columns: 1fr !important;
    }

    .schulleitung-page .forms-container {
        flex-direction: column !important;
    }

    .schulleitung-page .forms-container>* {
        width: 100% !important;
    }
}

/* ============================================
   MOBILE UI - Admin Dashboard
   ============================================ */
@media (max-width: 768px) {
    .admin-page .app-container {
        flex-direction: column !important;
    }

    .admin-page .sidebar {
        width: 100% !important;
        height: auto !important;
        min-height: unset !important;
        position: relative !important;
        flex-direction: row !important;
        padding: 8px !important;
        border-radius: 0 !important;
        overflow-x: auto !important;
        gap: 4px !important;
    }

    .admin-page .sidebar-action-btn span:not(.material-symbols-outlined) {
        display: none !important;
    }

    .admin-page .main-content {
        padding: 10px !important;
    }

    .admin-page #user-list {
        grid-template-columns: 1fr !important;
    }

    .admin-page .user-controls {
        flex-direction: column !important;
        gap: 8px !important;
    }

    .admin-page #search-user-dev {
        width: 100% !important;
    }
}

/* --- Bug Reporting Tool --- */
.bug-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary-color, #007aff);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    cursor: pointer;
    z-index: 9999;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.3s;
}

.bug-fab:hover {
    transform: scale(1.1) rotate(5deg);
    background: var(--primary-color-hover, #0062cc);
}

.bug-fab span {
    font-size: 28px;
}

.bug-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.bug-modal.active {
    opacity: 1;
    visibility: visible;
}

.bug-modal-content {
    background: #1c1c1e;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
    transform: translateY(20px);
    transition: transform 0.3s;
}

.bug-modal.active .bug-modal-content {
    transform: translateY(0);
}

.bug-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.bug-modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: #fff;
}

.bug-modal-close {
    background: none;
    border: none;
    color: #aaa;
    cursor: pointer;
    padding: 5px;
    display: flex;
    transition: color 0.2s;
}

.bug-modal-close:hover {
    color: #fff;
}

.bug-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.bug-form md-outlined-text-field, 
.bug-form select {
    width: 100%;
}

.bug-form select {
    background: #2c2c2e;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    padding: 12px;
    color: #fff;
    font-size: 1rem;
    outline: none;
    cursor: pointer;
}

.bug-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 10px;
}

/* Developer Dashboard Styles */
.bug-dashboard {
    padding: 30px;
    max-width: 1200px;
    margin: 0 auto;
}

.bug-table-container {
    background: rgba(255,255,255,0.05);
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.1);
}

.bug-table {
    width: 100%;
    border-collapse: collapse;
}

.bug-table th, 
.bug-table td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.bug-table th {
    background: rgba(255,255,255,0.02);
    font-weight: 600;
    color: #aaa;
}

.bug-status-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-open { background: rgba(255, 69, 58, 0.2); color: #ff453a; }
.status-in_progress { background: rgba(255, 159, 10, 0.2); color: #ff9f0a; }
.status-resolved { background: rgba(48, 209, 88, 0.2); color: #30d158; }

/* --- Expanded Settings Modal Styles --- */
.settings-modal-content {
    max-width: 850px;
    padding: 0;
    overflow: hidden;
    height: 600px;
}

.settings-layout {
    display: flex;
    height: calc(100% - 70px); /* Adjust for footer */
}

.settings-sidebar {
    width: 200px;
    background: rgba(255, 255, 255, 0.05);
    padding: 20px 0;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.settings-sidebar h2 {
    font-size: 1.1rem;
    padding: 0 20px 15px 20px;
    color: #fff;
}

.settings-sidebar ul {
    list-style: none;
}

.settings-sidebar li {
    padding: 12px 20px;
    cursor: pointer;
    color: var(--text-color-secondary);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
}

.settings-sidebar li span {
    font-size: 1.2rem;
}

.settings-sidebar li:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.settings-sidebar li.active {
    background: rgba(255, 255, 255, 0.12);
    color: var(--primary-color);
    border-right: 3px solid var(--primary-color);
}

.settings-content {
    flex: 1;
    padding: 25px 35px;
    overflow-y: auto;
}

.settings-pane {
    display: none;
}

.settings-pane.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.settings-content h3 {
    margin-bottom: 25px;
    font-size: 1.3rem;
}

.setting-item {
    margin-bottom: 30px;
    background: rgba(255, 255, 255, var(--glass-intensity));
    padding: 15px;
    border-radius: 12px;
}

.setting-item h4 {
    margin-bottom: 10px;
    font-size: 1rem;
    color: #eee;
}

.settings-footer {
    padding: 15px 35px;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: flex-end;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Color Picker */
.color-picker-grid {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.color-option {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.2s, border-color 0.2s;
}

.color-option:hover {
    transform: scale(1.15);
}

.color-option.active {
    border-color: #fff;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Fixes for new settings controls */
md-slider {
    width: 100%;
    margin-top: 10px;
}

select#setting-notification-filter,
select#setting-profile-visibility {
    width: 100%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 10px;
    border-radius: 8px;
    margin-top: 5px;
}

/* New styles for class detail view */
#class-detail-view {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: stretch;
    animation: fadeIn 0.4s ease;
}

.class-hero-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 30px;
    background: linear-gradient(135deg, rgba(0, 102, 204, 0.2) 0%, rgba(27, 26, 31, 0.8) 100%);
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.hero-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.hero-titles h2 {
    font-size: 2.2rem;
    margin: 0;
    color: #fff;
    letter-spacing: -1px;
}

.hero-titles p {
    margin: 0;
    color: var(--text-color-secondary);
    font-size: 0.95rem;
}

.class-content-grid {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 25px;
    align-items: start;
}

.class-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.noticeboard-card, .add-student-section-compact {
    background: #1B1A1F;
    padding: 20px;
    border-radius: 20px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.noticeboard-card h4, .add-student-section-compact h4 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    font-size: 1rem;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.noticeboard-card textarea {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.1);
    color: #eee;
    width: 100%;
    height: 150px;
    resize: none;
    padding: 12px;
    font-size: 0.9rem;
    border-radius: 12px;
}

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

.student-card {
    background: #1B1A1F;
    border-radius: 18px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255,255,255,0.05);
}

.student-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-color);
    box-shadow: 0 10px 25px rgba(0,0,0,0.4);
}

.student-card-top {
    display: flex;
    align-items: center;
    gap: 12px;
}

.student-card-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--surface-color-light);
}

.student-card-info {
    flex: 1;
    overflow: hidden;
}

.student-card-name {
    font-weight: 700;
    font-size: 1.05rem;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.student-card-level {
    font-size: 0.8rem;
    color: var(--text-color-secondary);
    font-weight: 600;
    text-transform: uppercase;
}

.student-card-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 5px;
    padding-top: 10px;
    border-top: 1px solid rgba(255,255,255,0.05);
}

.stat-content {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: white;
    line-height: 1;
}

.stat-label {
    font-size: 0.7rem;
    color: var(--text-color-secondary);
    text-transform: uppercase;
    font-weight: 600;
    margin-top: 2px;
}

.level-distribution-container {
    background: rgba(0, 0, 0, 0.15);
    padding: 15px;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 5px;
}

.level-distribution-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
}

.level-progress-stack {
    height: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    display: flex;
    overflow: hidden;
}

.level-bar-segment {
    height: 100%;
    transition: width 1s cubic-bezier(0.2, 1, 0.3, 1);
}

.level-legend {
    display: flex;
    justify-content: space-between;
    font-size: 0.65rem;
    color: var(--text-color-secondary);
}

.level-legend span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.level-legend i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

.overview-card p {
    font-size: 1.1rem;
    color: white;
    margin: 0;
}

.overview-card span {
    font-weight: 700;
}

.class-management-section {
    gap: 25px;
}

.add-student-section,
.student-list-section {
    background: var(--surface-color-light);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 20px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.add-student-section h4,
.student-list-section h4 {
    font-size: 1.1rem;
    color: white;
    margin-bottom: 15px;
    font-weight: 600;
}

#add-student-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

#add-student-form input {
    flex-grow: 1;
    min-width: 150px;
}

#add-student-form .btn {
    flex-shrink: 0;
    width: auto;
    padding: 10px 20px;
}

#student-list {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 8px;
}

/* Requests Dropdown Styling */
#requests-dropdown-container {
    position: relative;
}

#btn-show-requests {
    background: var(--surface-color-light);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: white;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 15px;
    cursor: pointer;
    transition: all 0.2s ease;
}

#btn-show-requests:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    box-shadow: 0 4px 10px rgba(0, 122, 255, 0.3);
}

#requests-badge {
    background: var(--error-color);
    color: white;
    border-radius: 10px;
    padding: 2px 7px;
    font-size: 0.75em;
    font-weight: 700;
    display: none;
    min-width: 20px;
    text-align: center;
}

#requests-dropdown-list {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    left: auto;
    width: 350px;
    max-height: 300px;
    overflow-y: auto;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    display: none;
    flex-direction: column;
    gap: 10px;
    z-index: 1000;
}

#requests-dropdown-list.active {
    display: flex;
}

#requests-dropdown-list .request-item {
    background: var(--surface-color-light);
    padding: 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

#requests-dropdown-list .request-item strong {
    color: white;
}

#requests-dropdown-list .request-item small {
    color: var(--text-color-secondary);
    font-size: 0.8em;
}

#requests-dropdown-list .btn-approve-req {
    background: var(--success-color);
    color: white;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.9em;
    font-weight: 600;
    white-space: nowrap;
}

/* Media Queries for responsiveness */
@media (max-width: 1024px) {
    .class-content-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .class-detail-header {
        flex-wrap: wrap;
        justify-content: center;
        text-align: center;
    }

    .class-detail-title {
        width: 100%;
        text-align: center;
        font-size: 1.5rem;
    }

    #back-to-gallery-btn {
        order: -1;
    }

    #requests-dropdown-container {
        width: 100%;
        display: flex;
        justify-content: center;
    }

    #requests-dropdown-list {
        right: auto;
        left: 50%;
        transform: translateX(-50%);
        width: 90%;
    }

    .class-overview-section,
    .class-management-section {
        padding: 15px;
    }

    .overview-card {
        flex-direction: column;
        text-align: center;
        gap: 8px;
    }

    .overview-icon {
        margin-bottom: 5px;
    }

    #add-student-form {
        flex-direction: column;
    }

    #add-student-form input,
    #add-student-form .btn {
        width: 100%;
    }
}
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.class-tile:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--primary-color);
    background-color: var(--surface-color-light);
}

.class-tile-header {
    display: flex;
    align-items: center;
    gap: 15px;
}

.class-icon-wrapper {
    width: 32px;
    height: 32px;
    background: rgba(0, 122, 255, 0.15);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
}

.class-icon-wrapper .material-symbols-outlined {
    font-size: 18px;
}

.class-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-color-primary);
    letter-spacing: -0.5px;
}

.class-tile-footer {
    display: flex;
    flex-direction: column;
    gap: 2px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 15px;
}

.tutor-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-color-secondary);
    font-weight: 600;
}

.tutor-list {
    font-size: 0.95rem;
    color: #e0e0e0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.filter-controls {
    display: flex;
    gap: 15px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.filter-controls input[type="text"] {
    flex: 1;
    min-width: 180px;
}

.filter-controls select {
    flex-basis: 180px;
    flex-grow: 1;
}

.class-controls {
    display: flex;
    gap: 15px;
    margin-bottom: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.class-controls input[type="text"] {
    flex: 1;
    min-width: 200px;
}

.filter-toggle-container {
    display: flex;
    align-items: center;
}

.forms-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#user-list {
    max-height: 600px;
    overflow-y: auto;
    padding-right: 5px;
}

#class-list {
    max-height: 30vh;
    min-height: 150px;
    overflow-y: auto;
    padding-right: 5px;
}

/* Better Scrollbar for Beta */
#user-list::-webkit-scrollbar,
#class-list::-webkit-scrollbar,
.settings-content::-webkit-scrollbar {
    width: 6px;
}
#user-list::-webkit-scrollbar-thumb,
#class-list::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
}

/* Custom Scrollbar für die Liste */
#user-list::-webkit-scrollbar,
#class-list::-webkit-scrollbar {
    width: 8px;
}

#user-list::-webkit-scrollbar-track,
#class-list::-webkit-scrollbar-track {
    background: var(--surface-color-light);
    border-radius: 4px;
}

#user-list::-webkit-scrollbar-thumb,
#class-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

/* Custom Searchable Dropdown */
.custom-dropdown {
    position: relative;
    width: 100%;
}

.custom-dropdown input {
    width: 100%;
    cursor: text;
}

.custom-dropdown-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface-color-light);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.custom-dropdown-options.active {
    display: block;
}

.custom-option {
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.custom-option:hover {
    background-color: var(--primary-color);
    color: white;
}

/* View Toggle Switch */
.view-toggle-container {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    z-index: 501;
    width: 100%;
}

.view-toggle {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 4px;
    display: flex;
    gap: 5px;
}

.toggle-btn {
    background: transparent;
    border: none;
    color: var(--text-color-secondary);
    padding: 6px 15px;
    border-radius: 16px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.toggle-btn .material-symbols-outlined {
    font-size: 18px;
}

.toggle-btn.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 2px 8px rgba(10, 132, 255, 0.3);
}

/* Checklist View */
.checklist-container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    padding: 10px;
}

.checklist-item {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.checklist-left {
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    flex-grow: 1;
}

.checklist-icon {
    font-size: 1.4em;
    color: var(--text-color-secondary);
    display: flex;
    align-items: center;
}

.checklist-item.completed .checklist-icon {
    color: var(--success-color);
}

.checklist-item.pending .checklist-icon {
    color: #ff9f0a;
}

.checklist-item.completed .checklist-text {
    text-decoration: line-through;
    opacity: 0.6;
}

.checklist-item.pending {
    border-left: 4px solid #ff9f0a;
    animation: pulse-border 2s infinite;
}

@keyframes pulse-border {
    0% { border-left-color: rgba(255, 159, 10, 1); }
    50% { border-left-color: rgba(255, 159, 10, 0.3); }
    100% { border-left-color: rgba(255, 159, 10, 1); }
}

.teacher-badge {
    background: #30d158;
    color: white;
    font-size: 0.7em;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
    vertical-align: middle;
}

.settings-modal-content {
    max-width: 800px;
    width: 90%;
    padding: 0;
}

.settings-layout {
    display: flex;
    min-height: 500px;
}

.settings-sidebar {
    width: 200px;
    background-color: rgba(0, 0, 0, 0.2);
    padding: 25px;
    border-right: 1px solid var(--border-color);
    border-radius: 16px 0 0 16px;
}

.settings-sidebar h2 {
    font-size: 1.2em;
    margin-bottom: 20px;
}

.settings-sidebar ul {
    list-style: none;
}

.settings-sidebar li {
    padding: 10px 15px;
    margin-bottom: 5px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.settings-sidebar li:hover {
    background-color: var(--surface-color-light);
}

.settings-sidebar li.active {
    background-color: var(--primary-color);
    color: white;
    font-weight: 600;
}

.settings-content {
    flex: 1;
    padding: 25px;
    position: relative;
}

.settings-pane {
    display: none;
}

.settings-pane.active {
    display: block;
}

.setting-item {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.setting-item:last-child {
    border-bottom: none;
}

.setting-item h4 {
    color: var(--text-color-secondary);
    font-weight: 400;
    margin-bottom: 10px;
}

.profile-picture-editable {
    position: relative;
    width: 100px;
    height: 100px;
    cursor: pointer;
}

.profile-picture-editable img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.profile-picture-editable .edit-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 1.5em;
    opacity: 0;
    transition: opacity 0.2s;
}

.profile-picture-editable:hover .edit-overlay {
    opacity: 1;
}

/* --- Landing Page (Startseite) --- */

body.landing-page {
    padding-top: 0;
    overflow-y: auto;
    background: var(--background-color);
}

.landing-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 20px 50px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
    backdrop-filter: blur(10px);
    background: rgba(28, 28, 34, 0.5);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.landing-logo {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(90deg, #fff, #a0a0b0);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-decoration: none;
}

.landing-links a {
    color: var(--text-color-secondary);
    text-decoration: none;
    margin-left: 30px;
    font-weight: 500;
    transition: color 0.3s;
}

.landing-links a:hover {
    color: var(--primary-color);
}

.hero-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 100px 50px;
    gap: 50px;
}

.hero-content {
    flex: 1;
    max-width: 600px;
    z-index: 10;
}

.hero-title {
    font-size: 4rem;
    line-height: 1.1;
    margin-bottom: 20px;
    font-weight: 700;
}

.hero-title span {
    color: var(--primary-color);
}

.hero-subtitle {
    font-size: 1.2rem;
    color: var(--text-color-secondary);
    margin-bottom: 40px;
    line-height: 1.6;
}

.hero-login-wrapper {
    flex: 1;
    max-width: 450px;
    background: rgba(42, 42, 51, 0.5);
    /* backdrop-filter entfernt */
    padding: 40px;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    z-index: 10;
    transform: translateY(0);
    transition: transform 0.3s;
}

.hero-login-wrapper:hover {
    transform: translateY(-5px);
}

.features-section {
    padding: 100px 50px;
    background: var(--surface-color);
    position: relative;
    z-index: 10;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 40px;
    max-width: 1200px;
    margin: 0 auto;
}

.feature-card {
    background: var(--surface-color-light);
    padding: 30px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    transition: transform 0.3s, border-color 0.3s;
}

.feature-card:hover {
    transform: translateY(-10px);
    border-color: var(--primary-color);
}

.feature-icon {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 20px;
}

.feature-title {
    font-size: 1.5rem;
    margin-bottom: 15px;
    font-weight: 600;
}

.feature-desc {
    color: var(--text-color-secondary);
    line-height: 1.6;
}

footer {
    padding: 50px;
    text-align: center;
    color: var(--text-color-secondary);
    background: var(--background-color);
    border-top: 1px solid var(--border-color);
    position: relative;
    z-index: 10;
}

@media (max-width: 1024px) {
    .hero-section {
        flex-direction: column;
        text-align: center;
        padding-top: 150px;
    }

    .hero-content {
        margin-bottom: 40px;
    }

    .landing-nav {
        padding: 20px;
    }

    .landing-links {
        display: none;
    }
}

/* Custom Dialog Styling (Material 3 Override) */
md-dialog {
    z-index: 10000;
}

@keyframes dialog-slide-up {
    0% {
        opacity: 0;
        transform: translateY(100%) scale(0.95);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

md-dialog.custom-dialog {
    --md-dialog-container-color: rgba(20, 20, 25, 0.7); /* Erhöhte Transparenz, da kein Blur */
    --md-dialog-headline-color: #ffffff;
    --md-dialog-supporting-text-color: #e0e0e0;
    --md-dialog-container-shape: 24px;

    position: fixed !important;
    margin-left: auto !important;
    margin-right: auto !important;
    margin-top: auto !important;
    /* Drückt das Modal nach unten */
    margin-bottom: 40px !important;
    top: auto !important;
    bottom: 40px !important;
    left: 0 !important;
    right: 0 !important;

    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4);

    backdrop-filter: blur(12px) saturate(150%);
    -webkit-backdrop-filter: blur(12px) saturate(150%);

    min-width: 320px;
    max-width: 90vw;
    width: fit-content;

    animation: dialog-slide-up 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    will-change: transform, opacity;
}

md-dialog.custom-dialog [slot="headline"] {
    text-align: center;
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 1.3rem;
    margin-top: 24px;
    margin-bottom: 10px;
    letter-spacing: -0.02em;
    padding: 0 24px;
}

md-dialog.custom-dialog [slot="content"] {
    text-align: center;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    line-height: 1.5;
    color: #c0c0c0;
    padding: 0 25px;
}

md-dialog.custom-dialog div[slot="actions"] {
    display: flex;
    justify-content: center;
    gap: 12px;
    padding: 10px 25px 25px 25px;
    width: 100%;
}

md-dialog.custom-dialog md-filled-button,
md-dialog.custom-dialog md-text-button {
    --md-sys-typescale-label-large-font: 'Inter', sans-serif;
    font-family: 'Inter', sans-serif;
    flex: 1;
}

md-dialog.custom-dialog md-filled-button {
    --md-filled-button-container-color: var(--primary-color);
    --md-filled-button-label-text-color: #ffffff;
    font-weight: 600;
}

/* Privilegien Modal - Liquid Tabs Layout */
.privileges-layout {
    display: flex;
    gap: 30px;
    height: 100%;
}

.privileges-tabs {
    display: flex;
    flex-direction: column;
    width: 180px;
    gap: 15px;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    padding-right: 15px;
}

.privilege-tab {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid transparent;
    color: rgba(255, 255, 255, 0.6);
    padding: 20px;
    border-radius: 16px;
    cursor: pointer;
    text-align: center;
    font-size: 1.1rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.privilege-tab:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.privilege-tab.active {
    background: rgba(255, 255, 255, var(--glass-intensity));
    border-color: rgba(255, 255, 255, 0.2);
    color: white;
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.privileges-content-area {
    flex: 1; /* Erhöhte Transparenz, da kein Blur */
    background: rgba(255, 255, 255, 0.1); /* Erhöhte Transparenz, da kein Blur */
    /* backdrop-filter entfernt */
    border-radius: 24px;
    padding: 40px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.privilege-item {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 15px;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 1.1rem;
    line-height: 1.6;
}

/* --- Profile Dropdown (Glass Liquid Design) --- */
#profile-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    left: 50%;
    width: max-content;
    min-width: 200px; /* Leicht erhöhte Deckkraft */
    background: rgba(27, 26, 31, 0.98); /* Leicht erhöhte Deckkraft */
    /* backdrop-filter entfernt */
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 8px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateX(-50%) translateY(-15px) scale(0.95);
    transform-origin: top center;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    /* Bouncy Spring Animation */
    z-index: 10000;
    overflow: hidden;
}

#profile-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0) scale(1);
}

/* Keep full width sidebar style for Admin and Schulleitung */
.admin-page #profile-dropdown,
.schulleitung-page #profile-dropdown {
    left: 0;
    width: 100%;
    min-width: 0;
    transform: translateY(-15px) scale(0.95);
}

.admin-page #profile-dropdown.active,
.schulleitung-page #profile-dropdown.active {
    transform: translateY(0) scale(1);
}

.profile-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 5px;
}

#dropdown-username {
    font-weight: 700;
    font-size: 1.1em;
    color: #fff;
    letter-spacing: 0.5px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-dropdown-actions {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.profile-dropdown-actions button {
    width: 100%;
    background: transparent;
    border: 1px solid transparent;
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--text-color-secondary);
    font-size: 0.9em;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.profile-dropdown-actions button:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.1);
    transform: translateX(5px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.profile-dropdown-actions button .material-symbols-outlined {
    font-size: 18px;
    transition: transform 0.2s ease, text-shadow 0.2s ease;
}

.profile-dropdown-actions button:hover .material-symbols-outlined {
    transform: scale(1.1);
    color: var(--primary-color);
    text-shadow: 0 0 12px var(--primary-color);
    /* Neon Glow Effekt */
}

/* --- Guided Tour Styles --- */
#tour-overlay {
    position: fixed;
    top: 0;
    left: 0; /* Noch höheres Alpha, da kein Blur */
    width: 100%;
    height: 100%;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.85); /* Noch höheres Alpha, da kein Blur */
    transition: opacity 0.3s;
}

#tour-overlay.fade-out {
    opacity: 0;
}

#tour-spotlight {
    position: absolute;
    border-radius: 12px;
    z-index: 10001;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    border: 2px solid var(--primary-color);
    box-shadow: 0 0 10px rgba(0, 122, 255, 0.5);
}

#tour-box {
    position: absolute;
    width: 300px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 10002;
    pointer-events: all;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#tour-box h4 {
    margin: 0 0 10px 0;
    color: var(--primary-color);
    font-size: 1.1rem;
}

#tour-box p {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.4;
    margin-bottom: 20px;
}

#tour-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#tour-skip-btn {
    background: none;
    border: none;
    color: var(--text-color-secondary);
    cursor: pointer;
    font-size: 0.9rem;
}

#tour-skip-btn:hover {
    color: white;
}

/* Bugfix: Contrast for inputs in Schulleitung Dashboard */
.schulleitung-page .personal-tab-content input,
.schulleitung-page .forms-container input,
.schulleitung-page select {
    background-color: rgba(255, 255, 255, 0.9) !important;
    color: #1a1a1a !important;
    border: 1px solid #ccc !important;
}

/* Tour Box Mobile UI fix */
@media (max-width: 768px) {
    #tour-box {
        width: 90% !important;
        left: 5% !important;
        bottom: 80px !important;
        top: auto !important;
        transform: none !important;
        padding: 15px !important;
    }

    #tour-actions {
        margin-top: 15px !important;
        display: flex !important;
        justify-content: space-between !important;
        gap: 10px;
    }
}

/* --- Login Page Redesign --- */

body.login-page {
    padding-top: 0;
    overflow: hidden;
    background: var(--background-color);
}

.login-wrapper {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

.login-left {
    position: absolute; /* Erhöhte Deckkraft */
    right: 10%;
    top: 50%;
    transform: translateY(-50%);
    width: 450px;
    max-width: 90%;
    background-color: rgba(28, 28, 34, 0.95); /* Erhöhte Deckkraft */
    /* backdrop-filter entfernt */
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 50px;
    z-index: 10;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.login-content-wrapper {
    width: 100%;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    gap: 60px;
}

.brand-header {
    margin-bottom: 0;
    text-align: left;
}

.brand-header h1 {
    font-size: 5rem;
    font-weight: 700;
    letter-spacing: -1px;
    margin-bottom: 5px;
    background: linear-gradient(90deg, #fff, #a0a0b0);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-header p {
    font-size: 1.1rem;
    color: var(--text-color-secondary);
    font-weight: 300;
letter-spacing: 0.5px;
}

.login-page #login-form {
    width: 100%;
    max-width: 100%;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.login-page md-outlined-text-field,
.login-page md-filled-button {
    width: 100%;
}

.login-page #login-btn {
    --md-filled-button-container-height: 56px;
    margin-top: 8px;
}

.login-options {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-color-secondary);
    font-size: 0.9rem;
    padding: 4px 0;
}

.login-options label {
    cursor: pointer;
    user-select: none;
}

.login-footer {
    position: relative;
    bottom: auto;
    margin-top: 30px;
    display: flex;
    gap: 30px;
    justify-content: center;
}

.login-footer a {
    color: var(--text-color-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s;
}

.login-footer a:hover {
    color: var(--text-color-primary);
}

.login-right {
    position: absolute;
    top: 0;
left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, #2a2a33 0%, #1c1c22 100%);
    z-index: 0;
}

#login-visuals {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

@media (max-width: 1024px) {
    .login-left {
        position: relative;
        right: auto;
        top: auto;
        transform: none;
        width: 100%;
        padding: 30px;
        border: none;
        box-shadow: none;
        background-color: transparent;
    }

    .login-wrapper {
        align-items: center;
        justify-content: center;
        display: flex;
        padding: 20px;
    }

    .brand-header h1 {
        text-align: center;
    }

    .brand-header p {
        text-align: center;
    }
}

/* iPad / Tablet Optimierungen */
@media (min-width: 481px) and (max-width: 1024px) {

    .btn,
    input,
    select,
    textarea {
        padding: 14px;
        /* Größere Touch-Targets */
        font-size: 16px;
        /* Verhindert Auto-Zoom auf iOS */
    }

    .user-item,
    .student-item,
    .checklist-item {
        padding: 15px 20px;
        /* Mehr Platz in Listen */
        margin-bottom: 12px;
    }

    .btn-icon-circle {
        width: 44px;
        height: 44px;
    }

    .dashboard-container header {
        margin-bottom: 40px;
    }

    .forms-container {
        gap: 30px;
    }
}

.gauge-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 20px 0;
}

.gauge-arc {
    width: 280px;
    height: 140px;
    border-radius: 280px 280px 0 0;
    background: rgba(255, 255, 255, 0.03);
    position: relative;
    overflow: hidden;
    -webkit-mask-image: radial-gradient(circle at 50% 100%, transparent 105px, black 106px);
    mask-image: radial-gradient(circle at 50% 100%, transparent 105px, black 106px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-bottom: none;
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.gauge-fill {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform-origin: center bottom;
    transform: rotate(calc(-180deg + (1.8deg * var(--fill-percentage, 0))));
    background-color: var(--gauge-color, #007bff);
    transition: transform 1.2s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.5s ease;
    filter: drop-shadow(0 0 10px var(--gauge-color));
    box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.3);
}

.gauge-level-text {
    font-size: 2.2rem;
    font-weight: 600;
    background: linear-gradient(180deg, #ffffff, #a0a0b0);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    cursor: help;
    margin-top: 15px;
    text-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.level-1 {
    --gauge-color: #8e8e93;
}

.level-2 {
    --gauge-color: #0a84ff;
}

.level-3 {
    --gauge-color: #30d158;
}

.level-4 {
    --gauge-color: #ff9f0a;
}

/* Level 4 Liquid & Gold Flex */
.gauge-container.level-4 .gauge-fill {
    background: linear-gradient(90deg, #ff9f0a, #ffcc00, #ff9f0a);
    background-size: 200% 100%;
    animation: liquid-flow 2s linear infinite;
    box-shadow: 0 0 30px rgba(255, 159, 10, 0.6), inset 0 0 15px rgba(255, 255, 255, 0.4);
}

@keyframes liquid-flow {
    0% {
        background-position: 100% 0;
    }

    100% {
        background-position: -100% 0;
    }
}

.gauge-arc.level-change-animation {
    animation: level-change-pulse 0.7s ease-in-out;
}

@keyframes level-change-pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 0 25px rgba(255, 255, 255, 0.7);
    }

    100% {
        transform: scale(1);
    }
}

.btn-icon-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    border: none;
    color: white;
    cursor: pointer;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
    font-size: 1.1em;
}

.btn-icon-circle .material-symbols-outlined {
    font-size: 20px;
}

.btn-reset-pw-icon {
    background-color: var(--surface-color-light);
    color: var(--text-color-primary);
}

.btn-reset-pw-icon:hover {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 15px rgba(10, 132, 255, 0.4);
}

.btn-delete-icon {
    background-color: var(--error-color);
    box-shadow: 0 4px 10px rgba(255, 68, 68, 0.3);
}

.btn-delete-icon:hover {
    filter: brightness(1.1);
}

.class-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.class-tile {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    height: 150px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.class-tile:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--primary-color);
    background-color: var(--surface-color-light);
}

.class-tile-header {
    display: flex;
    align-items: center;
    gap: 15px;
}

.class-icon-wrapper {
    width: 32px;
    height: 32px;
    background: rgba(0, 122, 255, 0.15);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
}

.class-icon-wrapper .material-symbols-outlined {
    font-size: 18px;
}

.class-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-color-primary);
    letter-spacing: -0.5px;
}

/* Beta Badge Styles */
.beta-badge {
    position: absolute;
    top: 5px;
    right: -25px;
    background: var(--primary-color);
    color: white;
    font-size: 0.6rem;
    font-weight: 800;
    padding: 2px 30px;
    transform: rotate(45deg);
    z-index: 5;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.class-tile-footer {
    display: flex;
    flex-direction: column;
    gap: 2px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 20px;
}

.tutor-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-color-secondary);
    font-weight: 600;
}

.tutor-list {
    font-size: 0.95rem;
    color: #e0e0e0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.filter-controls {
    display: flex;
    gap: 15px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.filter-controls input[type="text"] {
    flex: 1;
    min-width: 180px;
}

.filter-controls select {
    flex-basis: 180px;
    flex-grow: 1;
}

.class-controls {
    display: flex;
    gap: 15px;
    margin-bottom: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.class-controls input[type="text"] {
    flex: 1;
    min-width: 200px;
}

.filter-toggle-container {
    display: flex;
    align-items: center;
}

.forms-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#user-list {
    max-height: 600px;
    overflow-y: auto;
    padding-right: 5px;
}

#class-list {
    max-height: 30vh;
    min-height: 150px;
    overflow-y: auto;
    padding-right: 5px;
}

/* Sanfterer Übergang für Modals */
.modal-content {
    transform: translateY(-30px);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s;
}

/* Better Scrollbar for Beta */
#user-list::-webkit-scrollbar,
#class-list::-webkit-scrollbar,
.settings-content::-webkit-scrollbar {
    width: 6px;
}
#user-list::-webkit-scrollbar-thumb,
#class-list::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
}

/* Custom Scrollbar für die Liste */
#user-list::-webkit-scrollbar,
#class-list::-webkit-scrollbar {
    width: 8px;
}

#user-list::-webkit-scrollbar-track,
#class-list::-webkit-scrollbar-track {
    background: var(--surface-color-light);
    border-radius: 4px;
}

#user-list::-webkit-scrollbar-thumb,
#class-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

/* Custom Searchable Dropdown */
.custom-dropdown {
    position: relative;
    width: 100%;
}

.custom-dropdown input {
    width: 100%;
    cursor: text;
}

.custom-dropdown-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface-color-light);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.custom-dropdown-options.active {
    display: block;
}

.custom-option {
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.custom-option:hover {
    background-color: var(--primary-color);
    color: white;
}

/* View Toggle Switch */
.view-toggle-container {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    z-index: 501;
    width: 100%;
}

.view-toggle {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 4px;
    display: flex;
    gap: 5px;
}

.toggle-btn {
    background: transparent;
    border: none;
    color: var(--text-color-secondary);
    padding: 6px 15px;
    border-radius: 16px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.toggle-btn .material-symbols-outlined {
    font-size: 18px;
}

.toggle-btn.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 2px 8px rgba(10, 132, 255, 0.3);
}

/* Checklist View */
.checklist-container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    padding: 10px;
}

.checklist-item {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.checklist-left {
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    flex-grow: 1;
}

.checklist-icon {
    font-size: 1.4em;
    color: var(--text-color-secondary);
    display: flex;
    align-items: center;
}

.checklist-item.completed .checklist-icon {
    color: var(--success-color);
}

.checklist-item.pending .checklist-icon {
    color: #ff9f0a;
}

.checklist-item.completed .checklist-text {
    text-decoration: line-through;
    opacity: 0.6;
}

.checklist-item.pending {
    border-left: 4px solid #ff9f0a;
    animation: pulse-border 2s infinite;
}

@keyframes pulse-border {
    0% { border-left-color: rgba(255, 159, 10, 1); }
    50% { border-left-color: rgba(255, 159, 10, 0.3); }
    100% { border-left-color: rgba(255, 159, 10, 1); }
}

.teacher-badge {
    background: #30d158;
    color: white;
    font-size: 0.7em;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
    vertical-align: middle;
}

.settings-modal-content {
    max-width: 800px;
    width: 90%;
    padding: 0;
}

.settings-layout {
    display: flex;
    min-height: 500px;
}

.settings-sidebar {
    width: 200px;
    background-color: rgba(0, 0, 0, 0.2);
    padding: 25px;
    border-right: 1px solid var(--border-color);
    border-radius: 16px 0 0 16px;
}

.settings-sidebar h2 {
    font-size: 1.2em;
    margin-bottom: 20px;
}

.settings-sidebar ul {
    list-style: none;
}

.settings-sidebar li {
    padding: 10px 15px;
    margin-bottom: 5px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.settings-sidebar li:hover {
    background-color: var(--surface-color-light);
}

.settings-sidebar li.active {
    background-color: var(--primary-color);
    color: white;
    font-weight: 600;
}

.settings-content {
    flex: 1;
    padding: 25px;
    position: relative;
}

.settings-pane {
    display: none;
}

.settings-pane.active {
    display: block;
}

.setting-item {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.setting-item:last-child {
    border-bottom: none;
}

.setting-item h4 {
    color: var(--text-color-secondary);
    font-weight: 400;
    margin-bottom: 10px;
}

.profile-picture-editable {
    position: relative;
    width: 100px;
    height: 100px;
    cursor: pointer;
}

.profile-picture-editable img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.profile-picture-editable .edit-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 1.5em;
    opacity: 0;
    transition: opacity 0.2s;
}

.profile-picture-editable:hover .edit-overlay {
    opacity: 1;
}

/* --- Landing Page (Startseite) --- */

body.landing-page {
    padding-top: 0;
    overflow-y: auto;
    background: var(--background-color);
}

.landing-nav {
    position: fixed; /* Erhöhte Deckkraft */
    top: 0;
    left: 0;
    width: 100%;
    padding: 20px 50px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
    background: rgba(28, 28, 34, 0.8); /* Erhöhte Deckkraft */
    /* backdrop-filter entfernt */
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.landing-logo {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(90deg, #fff, #a0a0b0);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-decoration: none;
}

.landing-links a {
    color: var(--text-color-secondary);
    text-decoration: none;
    margin-left: 30px;
    font-weight: 500;
    transition: color 0.3s;
}

.landing-links a:hover {
    color: var(--primary-color);
}

.hero-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 100px 50px;
    gap: 50px;
}

.hero-content {
    flex: 1;
    max-width: 600px;
    z-index: 10;
}

.hero-title {
    font-size: 4rem;
    line-height: 1.1;
    margin-bottom: 20px;
    font-weight: 700;
}

.hero-title span {
    color: var(--primary-color);
}

.hero-subtitle {
    font-size: 1.2rem;
    color: var(--text-color-secondary);
    margin-bottom: 40px;
    line-height: 1.6;
}

.hero-login-wrapper {
    flex: 1; /* Erhöhte Deckkraft */
    max-width: 450px;
    background: rgba(42, 42, 51, 0.8); /* Erhöhte Deckkraft */
    /* backdrop-filter entfernt */
    padding: 40px;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    z-index: 10;
    transform: translateY(0);
    transition: transform 0.3s;
}

.hero-login-wrapper:hover {
    transform: translateY(-5px);
}

.features-section {
    padding: 100px 50px;
    background: var(--surface-color);
    position: relative;
    z-index: 10;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 40px;
    max-width: 1200px;
    margin: 0 auto;
}

.feature-card {
    background: var(--surface-color-light);
    padding: 30px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    transition: transform 0.3s, border-color 0.3s;
}

.feature-card:hover {
    transform: translateY(-10px);
    border-color: var(--primary-color);
}

.feature-icon {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 20px;
}

.feature-title {
    font-size: 1.5rem;
    margin-bottom: 15px;
    font-weight: 600;
}

.feature-desc {
    color: var(--text-color-secondary);
    line-height: 1.6;
}

footer {
    padding: 50px;
    text-align: center;
    color: var(--text-color-secondary);
    background: var(--background-color);
    border-top: 1px solid var(--border-color);
    position: relative;
    z-index: 10;
}

@media (max-width: 1024px) {
    .hero-section {
        flex-direction: column;
        text-align: center;
        padding-top: 150px;
    }

    .hero-content {
        margin-bottom: 40px;
    }

    .landing-nav {
        padding: 20px;
    }

    .landing-links {
        display: none;
    }
}

/* Custom Dialog Styling (Material 3 Override) */
md-dialog {
    z-index: 10000;
}

@keyframes dialog-slide-up {
    0% {
        opacity: 0;
        transform: translateY(100%) scale(0.95);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

md-dialog.custom-dialog {
    --md-dialog-container-color: rgba(20, 20, 25, 0.7); /* Erhöhte Transparenz, da kein Blur */
    --md-dialog-headline-color: #ffffff;
    --md-dialog-supporting-text-color: #e0e0e0;
    --md-dialog-container-shape: 24px;

    position: fixed !important;
    margin-left: auto !important;
    margin-right: auto !important;
    margin-top: auto !important;
    /* Drückt das Modal nach unten */
    margin-bottom: 40px !important;
    top: auto !important;
    bottom: 40px !important;
    left: 0 !important;
    right: 0 !important;

    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4);

    /* backdrop-filter entfernt */

    min-width: 320px;
    max-width: 90vw;
    width: fit-content;

    animation: dialog-slide-up 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    will-change: transform, opacity;
}

md-dialog.custom-dialog [slot="headline"] {
    text-align: center;
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 1.3rem;
    margin-top: 24px;
    margin-bottom: 10px;
    letter-spacing: -0.02em;
    padding: 0 24px;
}

md-dialog.custom-dialog [slot="content"] {
    text-align: center;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    line-height: 1.5;
    color: #c0c0c0;
    padding: 0 25px;
}

md-dialog.custom-dialog div[slot="actions"] {
    display: flex;
    justify-content: center;
    gap: 12px;
    padding: 10px 25px 25px 25px;
    width: 100%;
}

md-dialog.custom-dialog md-filled-button,
md-dialog.custom-dialog md-text-button {
    --md-sys-typescale-label-large-font: 'Inter', sans-serif;
    font-family: 'Inter', sans-serif;
    flex: 1;
}

md-dialog.custom-dialog md-filled-button {
    --md-filled-button-container-color: var(--primary-color);
    --md-filled-button-label-text-color: #ffffff;
    font-weight: 600;
}

/* Privilegien Modal - Liquid Tabs Layout */
.privileges-layout {
    display: flex;
    gap: 30px;
    height: 100%;
}

.privileges-tabs {
    display: flex;
    flex-direction: column;
    width: 180px;
    gap: 15px;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    padding-right: 15px;
}

.privilege-tab {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid transparent;
    color: rgba(255, 255, 255, 0.6);
    padding: 20px;
    border-radius: 16px;
    cursor: pointer;
    text-align: center;
    font-size: 1.1rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.privilege-tab:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.privilege-tab.active {
    background: rgba(255, 255, 255, var(--glass-intensity));
    border-color: rgba(255, 255, 255, 0.2);
    color: white;
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.1);
    /* backdrop-filter entfernt */
}

.privileges-content-area {
    flex: 1; /* Erhöhte Transparenz, da kein Blur */
    background: rgba(255, 255, 255, 0.1); /* Erhöhte Transparenz, da kein Blur */
    /* backdrop-filter entfernt */
    border-radius: 24px;
    padding: 40px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.privilege-item {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 15px;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 1.1rem;
    line-height: 1.6;
}

/* --- Profile Dropdown (Glass Liquid Design) --- */
#profile-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    left: 50%;
    width: max-content;
    min-width: 200px; /* Leicht erhöhte Deckkraft */
    background: rgba(27, 26, 31, 0.98); /* Leicht erhöhte Deckkraft */
    /* backdrop-filter entfernt */
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 8px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateX(-50%) translateY(-15px) scale(0.95);
    transform-origin: top center;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    /* Bouncy Spring Animation */
    z-index: 10000;
    overflow: hidden;
}

#profile-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0) scale(1);
}

/* Keep full width sidebar style for Admin and Schulleitung */
.admin-page #profile-dropdown,
.schulleitung-page #profile-dropdown {
    left: 0;
    width: 100%;
    min-width: 0;
    transform: translateY(-15px) scale(0.95);
}

.admin-page #profile-dropdown.active,
.schulleitung-page #profile-dropdown.active {
    transform: translateY(0) scale(1);
}

.profile-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 5px;
}

#dropdown-username {
    font-weight: 700;
    font-size: 1.1em;
    color: #fff;
    letter-spacing: 0.5px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-dropdown-actions {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.profile-dropdown-actions button {
    width: 100%;
    background: transparent;
    border: 1px solid transparent;
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--text-color-secondary);
    font-size: 0.9em;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.profile-dropdown-actions button:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.1);
    transform: translateX(5px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.profile-dropdown-actions button .material-symbols-outlined {
    font-size: 18px;
    transition: transform 0.2s ease, text-shadow 0.2s ease;
}

.profile-dropdown-actions button:hover .material-symbols-outlined {
    transform: scale(1.1);
    color: var(--primary-color);
    text-shadow: 0 0 12px var(--primary-color);
    /* Neon Glow Effekt */
}

/* --- Guided Tour Styles --- */
#tour-overlay {
    position: fixed;
    top: 0;
    left: 0; /* Noch höheres Alpha, da kein Blur */
    width: 100%;
    height: 100%;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.85); /* Noch höheres Alpha, da kein Blur */
    transition: opacity 0.3s;
}

#tour-overlay.fade-out {
    opacity: 0;
}

#tour-spotlight {
    position: absolute;
    border-radius: 12px;
    z-index: 10001;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    border: 2px solid var(--primary-color);
    box-shadow: 0 0 10px rgba(0, 122, 255, 0.5);
}

#tour-box {
    position: absolute;
    width: 300px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 10002;
    pointer-events: all;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#tour-box h4 {
    margin: 0 0 10px 0;
    color: var(--primary-color);
    font-size: 1.1rem;
}

#tour-box p {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.4;
    margin-bottom: 20px;
}

#tour-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#tour-skip-btn {
    background: none;
    border: none;
    color: var(--text-color-secondary);
    cursor: pointer;
    font-size: 0.9rem;
}

#tour-skip-btn:hover {
    color: white;
}

/* Bugfix: Contrast for inputs in Schulleitung Dashboard */
.schulleitung-page .personal-tab-content input,
.schulleitung-page .forms-container input,
.schulleitung-page select {
    background-color: rgba(255, 255, 255, 0.9) !important;
    color: #1a1a1a !important;
    border: 1px solid #ccc !important;
}

/* Tour Box Mobile UI fix */
@media (max-width: 768px) {
    #tour-box {
        width: 90% !important;
        left: 5% !important;
        bottom: 80px !important;
        top: auto !important;
        transform: none !important;
        padding: 15px !important;
    }

    #tour-actions {
        margin-top: 15px !important;
        display: flex !important;
        justify-content: space-between !important;
        gap: 10px;
    }
}

/* ============================================
   MOBILE UI — Schüler Dashboard
   ============================================ */
@media (max-width: 600px) {

    /* --- Header: relative so profile can be absolute top-right --- */
    .schueler-page .dashboard-container header {
        position: relative !important;
        flex-direction: column !important;
        gap: 0 !important;
        padding: 12px 12px 8px 12px !important;
        align-items: flex-start !important;
        min-height: 64px !important;
    }

    /* --- Title: leave room on the right for the profile card --- */
    .schueler-page .dashboard-container header h1 {
        font-size: 1.05rem !important;
        width: 100% !important;
        padding-right: 200px !important;
        /* Space for profile card */
        margin-bottom: 8px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    /* --- Profile card: pinned to top-right on mobile UI --- */
    .schueler-page #profile-container {
        position: fixed !important;
        top: 10px !important;
        right: 12px !important;
        z-index: 1000 !important;
    }

    /* Scale down profile card slightly to fit top-right */
    .schueler-page .student-profile-card {
        transform: scale(0.85) !important;
        transform-origin: top right !important;
    }

    .schueler-page .dropdown-content-col {
        min-width: 110px !important;
        max-width: 160px !important;
        padding: 3px 8px 3px 26px !important;
    }

    .schueler-page .dropdown-large-avatar {
        width: 38px !important;
        height: 38px !important;
        margin-right: -26px !important;
    }

    /* --- Button row: horizontal scroll, no wrapping --- */
    .schueler-page .dashboard-container header>div {
        display: flex !important;
        flex-wrap: nowrap !important;
        gap: 6px !important;
        width: 100% !important;
        overflow-x: auto !important;
        padding-bottom: 4px !important;
        margin-right: 0 !important;
        align-items: center !important;
        /* Hide scrollbar but keep scrollable */
        scrollbar-width: none !important;
    }

    .schueler-page .dashboard-container header>div::-webkit-scrollbar {
        display: none !important;
    }

    /* Compact buttons — hide text labels on mobile */
    .schueler-page .large-elevated-button {
        min-width: 44px !important;
        flex-shrink: 0 !important;
        --md-elevated-button-leading-space: 12px !important;
        --md-elevated-button-trailing-space: 12px !important;
    }

    .schueler-page .large-elevated-button::part(label) {
        display: none !important;
    }

    /* Profile container should NOT be in the scrollable button row */
    .schueler-page .student-permanent-profile {
        flex-shrink: 0 !important;
    }

    /* --- Gauge / XP-Arc --- */
    .schueler-page .gauge-container {
        width: min(200px, 75vw) !important;
        height: auto !important;
        margin: 10px auto !important;
    }

    /* --- Main content padding --- */
    .schueler-page #main-dashboard {
        padding: 10px !important;
    }

    .schueler-page .reason-box {
        margin: 10px 0 !important;
        padding: 12px !important;
    }
}

/* ============================================
   MOBILE UI - Teacher / Lehrer Dashboard
   ============================================ */
@media (max-width: 600px) {

    .teacher-page .class-controls,
    .teacher-page .filter-bar {
        flex-direction: column !important;
        gap: 8px !important;
    }

    .teacher-page .class-controls input,
    .teacher-page .class-controls select {
        width: 100% !important;
    }

    .teacher-page #class-gallery {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    .teacher-page .dashboard-container header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 10px !important;
        padding: 12px !important;
    }
}

/* ============================================
   MOBILE UI - Schulleitung Dashboard
   ============================================ */
@media (max-width: 768px) {
    .schulleitung-page .app-container {
        flex-direction: column !important;
    }

    .schulleitung-page .sidebar {
        width: 100% !important;
        height: auto !important;
        position: relative !important;
        padding: 8px !important;
        border-radius: 0 !important;
        overflow-x: auto !important;
    }

    .schulleitung-page .sidebar-nav {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        gap: 4px !important;
    }

    .schulleitung-page .main-content {
        padding: 10px !important;
    }

    .schulleitung-page #class-list,
    .schulleitung-page #my-class-list {
        grid-template-columns: 1fr !important;
    }

    .schulleitung-page .forms-container {
        flex-direction: column !important;
    }

    .schulleitung-page .forms-container>* {
        width: 100% !important;
    }
}

/* ============================================
   MOBILE UI - Admin Dashboard
   ============================================ */
@media (max-width: 768px) {
    .admin-page .app-container {
        flex-direction: column !important;
    }

    .admin-page .sidebar {
        width: 100% !important;
        height: auto !important;
        min-height: unset !important;
        position: relative !important;
        flex-direction: row !important;
        padding: 8px !important;
        border-radius: 0 !important;
        overflow-x: auto !important;
        gap: 4px !important;
    }

    .admin-page .sidebar-action-btn span:not(.material-symbols-outlined) {
        display: none !important;
    }

    .admin-page .main-content {
        padding: 10px !important;
    }

    .admin-page #user-list {
        grid-template-columns: 1fr !important;
    }

    .admin-page .user-controls {
        flex-direction: column !important;
        gap: 8px !important;
    }

    .admin-page #search-user-dev {
        width: 100% !important;
    }
}

/* --- Bug Reporting Tool --- */
.bug-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary-color, #007aff);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    cursor: pointer;
    z-index: 9999;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.3s;
}

.bug-fab:hover {
    transform: scale(1.1) rotate(5deg);
    background: var(--primary-color-hover, #0062cc);
}

.bug-fab span {
    font-size: 28px;
}

.bug-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.bug-modal.active {
    opacity: 1;
    visibility: visible;
}

.bug-modal-content {
    background: #1c1c1e;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
    transform: translateY(20px);
    transition: transform 0.3s;
}

.bug-modal.active .bug-modal-content {
    transform: translateY(0);
}

.bug-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.bug-modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: #fff;
}

.bug-modal-close {
    background: none;
    border: none;
    color: #aaa;
    cursor: pointer;
    padding: 5px;
    display: flex;
    transition: color 0.2s;
}

.bug-modal-close:hover {
    color: #fff;
}

.bug-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.bug-form md-outlined-text-field, 
.bug-form select {
    width: 100%;
}

.bug-form select {
    background: #2c2c2e;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    padding: 12px;
    color: #fff;
    font-size: 1rem;
    outline: none;
    cursor: pointer;
}

.bug-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 10px;
}

/* Developer Dashboard Styles */
.bug-dashboard {
    padding: 30px;
    max-width: 1200px;
    margin: 0 auto;
}

.bug-table-container {
    background: rgba(255,255,255,0.05);
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.1);
}

.bug-table {
    width: 100%;
    border-collapse: collapse;
}

.bug-table th, 
.bug-table td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.bug-table th {
    background: rgba(255,255,255,0.02);
    font-weight: 600;
    color: #aaa;
}

.bug-status-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-open { background: rgba(255, 69, 58, 0.2); color: #ff453a; }
.status-in_progress { background: rgba(255, 159, 10, 0.2); color: #ff9f0a; }
.status-resolved { background: rgba(48, 209, 88, 0.2); color: #30d158; }

/* --- Expanded Settings Modal Styles --- */
.settings-modal-content {
    max-width: 850px;
    padding: 0;
    overflow: hidden;
    height: 600px;
}

.settings-layout {
    display: flex;
    height: calc(100% - 70px); /* Adjust for footer */
}

.settings-sidebar {
    width: 200px;
    background: rgba(255, 255, 255, 0.05);
    padding: 20px 0;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.settings-sidebar h2 {
    font-size: 1.1rem;
    padding: 0 20px 15px 20px;
    color: #fff;
}

.settings-sidebar ul {
    list-style: none;
}

.settings-sidebar li {
    padding: 12px 20px;
    cursor: pointer;
    color: var(--text-color-secondary);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
}

.settings-sidebar li span {
    font-size: 1.2rem;
}

.settings-sidebar li:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.settings-sidebar li.active {
    background: rgba(255, 255, 255, 0.12);
    color: var(--primary-color);
    border-right: 3px solid var(--primary-color);
}

.settings-content {
    flex: 1;
    padding: 25px 35px;
    overflow-y: auto;
}

.settings-pane {
    display: none;
}

.settings-pane.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.settings-content h3 {
    margin-bottom: 25px;
    font-size: 1.3rem;
}

.setting-item {
    margin-bottom: 30px;
    background: rgba(255, 255, 255, var(--glass-intensity));
    padding: 15px;
    border-radius: 12px;
}

.setting-item h4 {
    margin-bottom: 10px;
    font-size: 1rem;
    color: #eee;
}

.settings-footer {
    padding: 15px 35px;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: flex-end;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Color Picker */
.color-picker-grid {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.color-option {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.2s, border-color 0.2s;
}

.color-option:hover {
    transform: scale(1.15);
}

.color-option.active {
    border-color: #fff;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

/* Backup Item Styling */
.backup-item {
    display: flex;
    align-items: center;
    background: var(--surface-color-light);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 10px 15px;
    margin-bottom: 8px;
    transition: all 0.2s ease;
}

.backup-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    border-color: var(--primary-color);
}

.backup-actions-left {
    display: flex;
    gap: 5px;
    margin-right: 15px;
    flex-shrink: 0; /* Prevent buttons from shrinking */
}

.backup-details-wrapper {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Ensure text truncation */
}

.backup-filename {
    font-weight: 500;
    color: var(--text-color-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.backup-meta {
    font-size: 0.8em;
    color: var(--text-color-secondary);
    display: flex;
    gap: 10px;
}

/* High Contrast Mode classes */
body.high-contrast {
    --background-color: #000000;
    --surface-color: #000000;
    --text-color-primary: #ffffff;
    --text-color-secondary: #ffff00;
    --border-color: #ffffff;
}

body.high-contrast .glass-container {
    background: #000 !important;
    border: 2px solid #fff !important;
}

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

/* Fixes for new settings controls */
md-slider {
    width: 100%;
    margin-top: 10px;
}

select#setting-notification-filter,
select#setting-profile-visibility {
    width: 100%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 10px;
    border-radius: 8px;
    margin-top: 5px;
/* --- Refined Modal Styling --- */
.modal-refined-large { max-width: 700px; width: 95%; }
.modal-refined-medium { max-width: 600px; width: 95%; }

.modal-header-with-icon {
    display: flex; align-items: center; gap: 15px; margin-bottom: 20px; padding-bottom: 15px; border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.modal-header-with-icon .header-icon { font-size: 2.2rem; }
.modal-header-with-icon h3 { margin: 0; font-size: 1.3rem; font-weight: 600; }

.modal-form-layout { display: flex; flex-direction: column; gap: 15px; }
.form-row-group { display: flex; gap: 15px; align-items: flex-start; }
.modal-actions-end { display: flex; justify-content: flex-end; margin-top: 5px; }

.student-goals-section-refined { margin-top: 25px; padding-top: 20px; border-top: 1px solid rgba(255, 255, 255, 0.1); }
.section-title-row { display: flex; align-items: center; gap: 10px; margin-bottom: 15px; color: var(--primary-color); }
.section-title-row h4 { margin: 0; text-transform: uppercase; font-size: 0.9rem; letter-spacing: 1px; }
.refined-goals-list { max-height: 180px; overflow-y: auto; margin-bottom: 15px; display: flex; flex-direction: column; gap: 8px; padding-right: 8px; }

.modal-goal-item {
    background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.06); padding: 12px 15px; border-radius: 12px; display: flex; justify-content: space-between; align-items: center; transition: all 0.2s ease;
}
.modal-goal-item:hover { background: rgba(255, 255, 255, 0.08); transform: translateX(4px); }
.modal-goal-item.is-done { opacity: 0.5; background: rgba(0, 0, 0, 0.2); }

.modal-mini-add-form { display: flex; background: rgba(255, 255, 255, 0.05); border-radius: 12px; padding: 4px; border: 1px solid rgba(255, 255, 255, 0.1); }
.modal-mini-add-form input { flex: 1; background: transparent !important; border: none !important; color: white !important; padding: 8px 12px !important; font-size: 0.95rem; }
/* Changelog Modal Styles */
.changelog-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
    text-align: left;
}
.changelog-item {
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.changelog-item h4 {
    color: var(--primary-color);
    margin-bottom: 5px;
    font-size: 0.95rem;
}
.changelog-item p {
    font-size: 0.85rem;
    color: var(--text-color-secondary);
    line-height: 1.4;
}

/* Changelog Tags */
.changelog-tag {
    font-size: 0.65rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    margin-right: 6px;
    text-transform: uppercase;
}
.tag-added { background: #30d158; color: #fff; }
.tag-removed { background: #ff453a; color: #fff; }
.tag-fixed { background: #0a84ff; color: #fff; }
.tag-changed { background: #ff9f0a; color: #fff; }
.tag-security { background: #af52de; color: #fff; }
.tag-deprecated { background: #8e8e93; color: #fff; }

/* --- Timeline Visual Hierarchy --- */
.changelog-list {
    position: relative;
    padding-left: 30px;
    border-left: 2px solid rgba(255, 255, 255, 0.05);
    margin-left: 10px;
    margin-top: 30px;
}

.changelog-item {
    position: relative;
    margin-bottom: 40px;
    cursor: pointer;
}

.timeline-dot {
    position: absolute;
    left: -37px;
    top: 5px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--surface-color-light);
    border: 2px solid var(--primary-color);
    z-index: 2;
}

.changelog-item.latest .timeline-dot {
    background: #000; /* Black node for latest */
    box-shadow: 0 0 10px var(--primary-color);
}

.changelog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.changelog-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.neu-badge {
    background: var(--error-color);
    color: white;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.changelog-body {
    max-height: 1000px;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s;
    padding-top: 15px;
}

.changelog-item.collapsed .changelog-body {
    max-height: 0;
    opacity: 0;
}
.btn-add-mini { width: 36px; height: 36px; background: var(--primary-color); color: white; border: none; border-radius: 10px; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: transform 0.2s; }
.btn-add-mini:hover { transform: scale(1.1); }

.refined-notes-list { max-height: 320px; overflow-y: auto; margin-bottom: 25px; display: flex; flex-direction: column; gap: 12px; padding-right: 8px; }
.note-entry { padding: 12px 15px; border-radius: 12px; border: 1px solid transparent; }
.note-entry-header { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 0.85rem; }
.note-entry-header strong { color: white; }
.note-entry-header span { opacity: 0.6; }
.note-entry-text { line-height: 1.5; font-size: 0.95rem; color: #eee; }

.note-entry.warning { background: rgba(255, 69, 58, 0.1); border-left: 4px solid #ff453a; border-color: rgba(255, 69, 58, 0.15); }
.note-entry.general { background: rgba(255, 255, 255, 0.04); border-left: 4px solid rgba(255, 255, 255, 0.2); border-color: rgba(255, 255, 255, 0.05); }
.note-entry.tutor { background: rgba(48, 209, 88, 0.1); border-left: 4px solid #30d158; border-color: rgba(48, 209, 88, 0.15); }

.add-note-box { background: rgba(0, 0, 0, 0.25); padding: 20px; border-radius: 20px; border: 1px solid rgba(255, 255, 255, 0.05); }
.add-note-box .box-title { font-size: 0.85rem; color: var(--text-color-secondary); text-transform: uppercase; letter-spacing: 1.2px; margin-bottom: 15px; }
.note-controls-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 15px; }
.refined-select { flex: 1; background: rgba(255, 255, 255, 0.08) !important; border: 1px solid rgba(255, 255, 255, 0.1) !important; color: white !important; height: 40px; }
.add-note-box textarea { background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1); color: white; width: 100%; border-radius: 12px; padding: 12px; resize: none; font-family: inherit; }
.add-note-box textarea:focus { border-color: var(--primary-color); }
}
