/**
 * NotenWeb - Stylesheet
 * Design: Warmes Weiß und Blau
 */

/* === Reset & Base === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Blaue Farbpalette mit warmem Weiß */
    --primary: #4A90E2;
    --primary-dark: #357ABD;
    --primary-light: #7DB3F5;
    --secondary: #5C7CFA;
    --secondary-light: #91A7FF;
    --accent: #228BE6;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --info: #17a2b8;
    --light: #FBF9F6;
    --light-bg: #F5F3EF;
    --warm-white: #FFFBF5;
    --dark: #2C3E50;
    --dark-text: #34495E;
    --border: rgba(74, 144, 226, 0.2);
    --border-dark: rgba(53, 122, 189, 0.3);
    --text: #2C3E50;
    --text-muted: #7F8C8D;
    --card-bg: linear-gradient(135deg, #FFFBF5 0%, #FBF9F6 100%);
    --header-bg: linear-gradient(135deg, #4A90E2 0%, #357ABD 100%);
    --page-bg: #F5F3EF;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text);
    background: var(--page-bg);
    min-height: 100vh;
}

/* === Header === */
.main-header {
    background: var(--header-bg);
    color: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 10px rgba(74, 144, 226, 0.2);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    text-decoration: none;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-name {
    font-weight: 500;
}

/* === Navigation === */
.main-nav {
    background: white;
    border-bottom: 2px solid var(--border);
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    gap: 0;
}

.nav-link {
    padding: 1rem 1.5rem;
    color: var(--text);
    text-decoration: none;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
    font-weight: 500;
}

.nav-link:hover {
    background: var(--light-bg);
    border-bottom-color: var(--primary-light);
}

.nav-link.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: var(--warm-white);
}

/* === Container & Layout === */
.container {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 2rem;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.page-header h1 {
    color: var(--dark);
    font-size: 2rem;
}

/* === Cards === */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 10px rgba(74, 144, 226, 0.1);
}

.card h2, .card h3 {
    color: var(--dark);
    margin-bottom: 1rem;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

/* === Buttons === */
.btn {
    display: inline-block;
    padding: 0.6rem 1.4rem;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1), 
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-primary {
    background: linear-gradient(135deg, 
        rgba(74, 144, 226, 0.8) 0%, 
        rgba(53, 122, 189, 0.8) 100%);
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.btn-primary:hover {
    background: linear-gradient(135deg, 
        rgba(74, 144, 226, 0.95) 0%, 
        rgba(53, 122, 189, 0.95) 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 144, 226, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(74, 144, 226, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-secondary {
    background: linear-gradient(135deg, 
        rgba(92, 124, 250, 0.8) 0%, 
        rgba(145, 167, 255, 0.8) 100%);
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, 
        rgba(92, 124, 250, 0.95) 0%, 
        rgba(145, 167, 255, 0.95) 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(92, 124, 250, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, 
        rgba(40, 167, 69, 0.8) 0%, 
        rgba(33, 136, 56, 0.8) 100%);
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.btn-success:hover {
    background: linear-gradient(135deg, 
        rgba(40, 167, 69, 0.95) 0%, 
        rgba(33, 136, 56, 0.95) 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, 
        rgba(220, 53, 69, 0.8) 0%, 
        rgba(200, 35, 51, 0.8) 100%);
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.btn-danger:hover {
    background: linear-gradient(135deg, 
        rgba(220, 53, 69, 0.95) 0%, 
        rgba(200, 35, 51, 0.95) 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(220, 53, 69, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.4);
}

.btn-outline {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(74, 144, 226, 0.5);
    color: var(--primary);
    text-shadow: none;
}

.btn-outline:hover {
    background: rgba(74, 144, 226, 0.3);
    border-color: rgba(74, 144, 226, 0.7);
    color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 144, 226, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.btn-sm {
    padding: 0.35rem 0.8rem;
    font-size: 0.9rem;
}

.btn-block {
    display: block;
    width: 100%;
}

/* === Forms === */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 500;
    color: var(--dark);
}

.form-control {
    width: 100%;
    padding: 0.6rem;
    font-size: 1rem;
    border: 2px solid var(--border);
    border-radius: 6px;
    background: white;
    transition: border-color 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

select.form-control {
    cursor: pointer;
}

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

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

/* === Tables === */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.data-table thead {
    background: var(--primary);
    color: white;
}

.data-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
}

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

.data-table tbody tr:hover {
    background: var(--light-bg);
}

.data-table .actions {
    display: flex;
    gap: 0.5rem;
}

/* === Alerts === */
.alert {
    padding: 1rem 1.2rem;
    border-radius: 6px;
    margin-bottom: 1.5rem;
    border-left: 4px solid;
}

.alert-success {
    background: #d4edda;
    border-color: var(--success);
    color: #155724;
}

.alert-error, .alert-danger {
    background: #f8d7da;
    border-color: var(--danger);
    color: #721c24;
}

.alert-warning {
    background: #fff3cd;
    border-color: var(--warning);
    color: #856404;
}

.alert-info {
    background: #d1ecf1;
    border-color: var(--info);
    color: #0c5460;
}

/* === Text Utilities === */
.text-muted {
    color: var(--text-muted);
}

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

.text-right {
    text-align: right;
}

/* === Login Page Modern Redesign === */

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

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(-45deg, #FACC15, #1E40AF, #4A90E2, #FBBF24);
    background-size: 400% 400%;
    animation: gradient-flow 15s ease infinite;
    color: white;
}

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

.login-box {
    background: rgba(0, 0, 0, 0.2);
    padding: 2.5rem;
    border-radius: 16px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.login-box h1 {
    color: white;
    margin-bottom: 0.5rem;
    text-align: center;
    font-size: 2.5rem;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.login-box .subtitle {
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 2rem;
}

.login-page .form-group label {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

.login-page .form-control {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 8px;
    padding: 0.8rem;
    transition: all 0.3s ease;
}

.login-page .form-control::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.login-page .form-control:focus {
    background: rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.1);
}

.login-page .btn-primary {
    background: linear-gradient(135deg, 
        rgba(250, 204, 21, 0.8) 0%, 
        rgba(251, 191, 36, 0.9) 100%);
    color: #1E3A8A; /* Dunkelblau für Kontrast */
    font-weight: 700;
    border: 1px solid rgba(250, 204, 21, 0.9);
    box-shadow: 0 4px 15px rgba(250, 204, 21, 0.3);
}

.login-page .btn-primary:hover {
    background: linear-gradient(135deg, 
        rgba(250, 204, 21, 1) 0%, 
        rgba(251, 191, 36, 1) 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(250, 204, 21, 0.5);
}

/* === Dashboard Cards === */
.dashboard-card {
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 1.8rem;
    text-align: center;
    transition: all 0.3s;
    cursor: pointer;
}

.dashboard-card:hover {
    border-color: var(--primary);
    box-shadow: 0 6px 20px rgba(74, 144, 226, 0.2);
    transform: translateY(-4px);
}

.dashboard-card .icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.dashboard-card h3 {
    color: var(--primary);
    margin-bottom: 0.5rem;
}

/* === Badges === */
.badge {
    display: inline-block;
    padding: 0.3rem 0.7rem;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 20px;
    background: var(--primary-light);
    color: white;
}

.badge-success {
    background: var(--success);
}

.badge-danger {
    background: var(--danger);
}

.badge-warning {
    background: var(--warning);
}

/* === Grade Display === */
.grade-display {
    font-size: 1.5rem;
    font-weight: 700;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    display: inline-block;
}

.grade-1 { background: #d4edda; color: #155724; }
.grade-2 { background: #d1ecf1; color: #0c5460; }
.grade-3 { background: #fff3cd; color: #856404; }
.grade-4 { background: #f8d7da; color: #721c24; }
.grade-5 { background: #f5c6cb; color: #721c24; }
.grade-6 { background: #dc3545; color: white; }

/* === Responsive === */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .nav-container {
        flex-direction: column;
    }

    .card-grid {
        grid-template-columns: 1fr;
    }

    .data-table {
        font-size: 0.9rem;
    }

    .data-table th,
    .data-table td {
        padding: 0.6rem;
    }
}

/* === Empty State === */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    background: var(--light-bg);
    border-radius: 8px;
    border: 2px dashed var(--border-dark);
}

.empty-state .icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    color: var(--dark);
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

/* === Noteneingabe-Maske === */
.grades-entry-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* Kopfbereich */
.grades-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    padding: 1.2rem 1.8rem;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    margin-bottom: 1.5rem;
    gap: 1rem;
    border: 1px solid rgba(74, 144, 226, 0.1);
}

.grades-selectors {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.grades-select {
    min-width: 180px;
    padding: 0.7rem 1.2rem;
    font-size: 1rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.grades-select:hover {
    border-color: var(--primary-light);
    box-shadow: 0 2px 8px rgba(74, 144, 226, 0.15);
}

.grades-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(74, 144, 226, 0.15);
    transform: translateY(-1px);
}

.grades-nav-arrows {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.grades-nav-arrows .btn-icon {
    padding: 0.4rem 0.6rem;
    font-size: 0.9rem;
    min-width: 36px;
}

.btn-icon {
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 10px;
    padding: 0.5rem 0.8rem;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    color: var(--text);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1),
                inset 0 1px 0 rgba(255, 255, 255, 0.3);
    position: relative;
    overflow: hidden;
}

.btn-icon:hover {
    background: linear-gradient(135deg, 
        rgba(74, 144, 226, 0.4) 0%, 
        rgba(53, 122, 189, 0.4) 100%);
    border-color: rgba(74, 144, 226, 0.6);
    color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 144, 226, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.btn-icon:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(74, 144, 226, 0.2),
                inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.grades-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Hauptbereich */
.grades-main {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 1.5rem;
    min-height: 600px;
}

/* Linker Bereich: Klassenarbeiten */
.grades-exams-panel {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(74, 144, 226, 0.1);
}

.exams-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

.exams-table thead {
    background: var(--primary);
    color: white;
}

.exams-table th {
    padding: 0.8rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
}

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

.exam-row {
    transition: background 0.2s;
}

.exam-row:hover:not(.active) {
    background: var(--light-bg);
    cursor: pointer;
}

.exam-row.active {
    background: linear-gradient(135deg, #FFE4B5 0%, #FFD700 100%);
    box-shadow: 0 2px 8px rgba(255, 165, 0, 0.3);
    transform: translateX(3px);
}

.exam-row.new-exam input {
    width: 100%;
    border: none;
    background: transparent;
    font-size: 0.95rem;
    padding: 0.2rem;
}

.exam-topic-input:focus,
.exam-date-input:focus {
    outline: 2px solid var(--primary);
    border-radius: 4px;
}

.new-exam-action {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

/* Rechter Bereich: Schülerliste */
.grades-students-panel {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    padding: 1.5rem;
    overflow-y: auto;
    max-height: 800px;
    border: 1px solid rgba(74, 144, 226, 0.1);
}

.grades-students-panel::-webkit-scrollbar {
    width: 8px;
}

.grades-students-panel::-webkit-scrollbar-track {
    background: var(--light-bg);
    border-radius: 4px;
}

.grades-students-panel::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: 4px;
}

.grades-students-panel::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

.students-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.students-column {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.student-grade-row {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
    background: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.student-grade-row:hover {
    background: var(--light-bg);
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    transform: translateX(2px);
}

.student-icon {
    font-size: 1.2rem;
    opacity: 0.6;
    flex-shrink: 0;
}

.student-name {
    flex: 1;
    font-weight: 500;
    color: var(--dark);
    min-width: 0;
}

.student-name.highlight {
    color: var(--danger);
    font-weight: 600;
}

.grade-input-wrapper {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    position: relative;
}

.grade-input {
    width: 80px;
    padding: 0.5rem;
    border: 2px solid var(--border);
    border-radius: 4px;
    text-align: center;
    font-size: 1rem;
    font-weight: 500;
}

.grade-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

/* Status-Icons für Auto-Save */
.grade-status-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    font-size: 0.9rem;
    position: relative;
}

.grade-status-icon span {
    display: none;
    transition: all 0.3s ease;
}

.grade-status-icon[data-status="idle"] .status-idle {
    display: inline;
    color: #ccc;
    opacity: 0.5;
}

.grade-status-icon[data-status="saving"] .status-saving {
    display: inline;
    color: var(--primary);
    animation: spin 1s linear infinite;
}

.grade-status-icon[data-status="saved"] .status-saved {
    display: inline;
    color: var(--success);
    animation: checkmark 0.5s ease;
}

.grade-status-icon[data-status="error"] .status-error {
    display: inline;
    color: var(--danger);
    animation: shake 0.5s ease;
}

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

@keyframes checkmark {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Row-Status-Highlighting */
.student-grade-row.saving {
    background: rgba(74, 144, 226, 0.1);
    border-left: 3px solid var(--primary);
}

.student-grade-row.saved {
    background: rgba(40, 167, 69, 0.1);
    border-left: 3px solid var(--success);
    animation: flashGreen 0.5s ease;
}

.student-grade-row.error {
    background: rgba(220, 53, 69, 0.1);
    border-left: 3px solid var(--danger);
}

@keyframes flashGreen {
    0% { background: rgba(40, 167, 69, 0.3); }
    100% { background: rgba(40, 167, 69, 0.1); }
}

/* Verbesserte Noteneingabefelder */
.grade-input {
    width: 85px;
    padding: 0.6rem;
    border: 2px solid var(--border);
    border-radius: 6px;
    text-align: center;
    font-size: 1.1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    background: white;
}

.grade-input:hover {
    border-color: var(--primary-light);
    box-shadow: 0 2px 8px rgba(74, 144, 226, 0.15);
}

.grade-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(74, 144, 226, 0.15);
    transform: scale(1.05);
}

.grade-input:valid {
    border-color: var(--success);
}

/* Auto-Save-Indikator */
.save-status {
    margin-bottom: 1rem;
}

.auto-save-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 20px;
    font-size: 0.9rem;
    color: var(--text-muted);
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1),
                inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.auto-save-indicator.saving {
    background: linear-gradient(135deg, 
        rgba(74, 144, 226, 0.3) 0%, 
        rgba(53, 122, 189, 0.3) 100%);
    color: var(--primary);
    border-color: rgba(74, 144, 226, 0.5);
    box-shadow: 0 4px 15px rgba(74, 144, 226, 0.2),
                inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.auto-save-indicator.saved {
    background: linear-gradient(135deg, 
        rgba(40, 167, 69, 0.3) 0%, 
        rgba(33, 136, 56, 0.3) 100%);
    color: var(--success);
    border-color: rgba(40, 167, 69, 0.5);
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.2),
                inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.auto-save-indicator.error {
    background: linear-gradient(135deg, 
        rgba(220, 53, 69, 0.3) 0%, 
        rgba(200, 35, 51, 0.3) 100%);
    color: var(--danger);
    border-color: rgba(220, 53, 69, 0.5);
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.2),
                inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.auto-save-indicator .status-icon {
    font-size: 1rem;
    animation: pulse 2s ease-in-out infinite;
}

.auto-save-indicator.saving .status-icon {
    animation: spin 1s linear infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.grades-form-actions {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 2px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Responsive */
@media (max-width: 1200px) {
    .grades-main {
        grid-template-columns: 1fr;
    }
    
    .grades-exams-panel {
        order: 2;
    }
    
    .grades-students-panel {
        order: 1;
    }
    
    .students-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .grades-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .grades-selectors {
        flex-wrap: wrap;
    }
    
    .grades-select {
        min-width: 100%;
    }
    
    .grades-actions {
        justify-content: center;
        flex-wrap: wrap;
    }
}

/* === Bewertungs-Punkte-Buttons === */
.interactive-grading-widget {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    margin-bottom: 0.75rem;
    box-shadow: 0 1px 2px 0 rgba(0,0,0,.05), 0 1px 1px -1px rgba(0,0,0,.05);
}

.criterion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.criterion-name {
    font-weight: 600;
    color: #1e293b;
    font-size: 1rem;
}

.criterion-weight {
    color: #64748b;
    font-size: 0.875rem;
}

.grading-controls {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
    justify-content: space-between; /* Distribute items and push point-buttons to left, others to right if needed */
}

.grading-controls .point-buttons {
    flex-grow: 1; /* Allow point buttons to take available space */
}

.grading-controls .override-input-wrapper {
    margin-left: auto; /* Push input and NA button to the right */
}


.grading-controls.is-na .point-buttons,
.grading-controls.is-na .override-input-wrapper {
    pointer-events: none;
    opacity: 0.5;
}

.point-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    background: #f1f5f9;
    padding: 0.75rem;
    border-radius: 0.375rem;
    max-width: 100%;
}

.point-btn {
    border: none;
    background: transparent;
    color: #475569;
    font-weight: 600;
    padding: 0; /* Remove padding to allow fixed width/height to control size */
    width: 44px; /* Fixed width */
    height: 44px; /* Fixed height */
    flex-shrink: 0; /* Prevent shrinking */
    flex-grow: 0; /* Prevent growing */
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1rem;
    display: flex; /* Use flex to center content */
    align-items: center;
    justify-content: center;
}

.point-btn:hover {
    background-color: #e2e8f0;
    transform: scale(1.05);
}

.point-btn:active {
    background-color: #cbd5e1;
    transform: scale(0.98);
}

.point-btn.selected {
    background-color: #2196f3;
    color: #fff;
    box-shadow: 0 4px 12px -2px rgba(33, 150, 243, 0.5);
    transform: scale(1.05);
    font-weight: 700;
}

.point-btn.selected:active {
    transform: scale(1.02);
}

.override-input-wrapper {
    width: 75px;
}

.override-input {
    width: 100%;
    padding: 0.5rem 0.375rem;
    border: 1px solid #cbd5e1;
    border-radius: 0.375rem;
    text-align: center;
    font-size: 0.95rem;
    font-weight: 600;
}

.override-input:focus {
    outline: none;
    border-color: #2196f3;
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

.na-btn {
    padding: 0.5rem 0.75rem;
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #64748b;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.na-btn:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

.na-btn.selected {
    background: #fef3c7;
    border-color: #fbbf24;
    color: #92400e;
}

.final-grade-display {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    padding: 1.5rem 1.5rem 1rem 1.5rem;
    border-radius: 0.75rem;
    margin-bottom: 1.5rem;
    text-align: center;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: relative;
    transition: all 0.3s ease;
}

.final-grade-display.pinned {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.5);
    margin-bottom: 0;
    animation: slideDown 0.3s ease;
    border-radius: 0;
}

@keyframes slideDown {
    from {
        transform: translateX(-50%) translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

/* Placeholder to reserve space when pinned */
.final-grade-placeholder {
    height: 0;
    transition: height 0.3s ease;
}

/* Control Buttons im blauen Feld (Ansicht + Pin) */
.grid-view-btn,
.pin-grade-btn {
    position: absolute;
    top: 0.75rem;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    border-radius: 0.5rem;
    padding: 0.5rem;
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.grid-view-btn {
    left: 0.75rem;
}

.pin-grade-btn {
    right: 0.75rem;
}

.grid-view-btn:hover,
.pin-grade-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

.grid-view-btn:active,
.pin-grade-btn:active {
    transform: scale(0.95);
}

.final-grade-display.pinned .pin-grade-btn {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

/* Verstecke den separaten Button unterhalb des blauen Feldes */
.tablet-grid-toggle-container {
    display: none !important;
}

/* === Kompakte Grid-Ansicht (für alle Geräte) === */
#criteria-container.criteria-grid-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 0.6rem;
}

#criteria-container.criteria-grid-view .interactive-grading-widget {
    padding: 0.6rem;
    margin-bottom: 0;
}

#criteria-container.criteria-grid-view .criterion-header {
    margin-bottom: 0.35rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.1rem;
}

#criteria-container.criteria-grid-view .criterion-name {
    font-size: 0.9rem;
    line-height: 1.25;
}

#criteria-container.criteria-grid-view .criterion-weight {
    font-size: 0.75rem;
}

/* Grading Controls in compact view */
#criteria-container.criteria-grid-view .grading-controls {
    display: flex; /* Use flexbox for overall layout */
    flex-wrap: wrap; /* Allow items to wrap */
    gap: 0.4rem;
    align-items: center; /* Align items vertically */
}

/* Row 1: Point Buttons */
#criteria-container.criteria-grid-view .point-buttons {
    order: 1; /* Ensure point buttons come first */
    flex-basis: 100%; /* Take full width */
    max-width: 100%; /* Ensure it doesn't overflow */
    justify-content: flex-start;
}

/* Row 2: Input field and N/A button */
#criteria-container.criteria-grid-view .override-input-wrapper {
    order: 2; /* Second in order */
    flex-grow: 1; /* Allow to grow and fill space */
    min-width: 60px; /* Minimum width */
    max-width: fit-content; /* Adjust to content size */
}

#criteria-container.criteria-grid-view .na-btn {
    order: 3; /* Third in order */
    min-width: 50px;
    min-height: 40px;
    padding: 0.45rem 0.6rem;
    font-size: 0.85rem;
}

.final-grade-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    padding: 0 3rem;
}

.final-grade-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.25rem;
}

.final-grade-nav-btn {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 0.6rem 1rem;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    min-width: 80px;
}

.final-grade-nav-btn:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: translateY(-1px);
}

.final-grade-nav-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.final-grade-student {
    text-align: center;
    flex: 0 0 auto;
}

.final-grade-student-label {
    font-size: 0.85rem;
    opacity: 0.9;
    margin-bottom: 0.15rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.final-grade-student-name {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.final-grade-counter {
    margin-top: 0.2rem;
    font-size: 0.85rem;
    opacity: 0.9;
}

.final-grade-main {
    text-align: center;
    flex: 0 0 auto;
}

.final-grade-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.9;
    margin-bottom: 0.3rem;
}

.final-grade-value {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 0.3rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.final-grade-info {
    font-size: 0.8rem;
    opacity: 0.9;
}

@media (max-width: 768px) {
    .interactive-grading-widget {
        padding: 0.625rem 0.875rem;
        margin-bottom: 0.625rem;
    }
    .criterion-header {
        margin-bottom: 0.375rem;
    }
    .point-btn {
        padding: 0.625rem 0.75rem;
        min-height: 42px;
        min-width: 45px;
        font-size: 0.9375rem;
    }
    .point-buttons {
        gap: 0.375rem;
        padding: 0.5rem;
    }
    .grading-controls {
        gap: 0.375rem;
    }
    .final-grade-value {
        font-size: 2rem;
    }
    .final-grade-row {
        flex-direction: column;
        gap: 1rem;
        padding: 0 1rem;
    }
    .final-grade-nav-btn {
        width: 100%;
        flex-direction: row;
        justify-content: center;
        gap: 0.5rem;
    }
}

/* === Einklappbare Bereiche für Bewertungen === */
.collapsible-section {
    margin-bottom: 1.5rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 0.5rem 0;
    user-select: none;
}

.section-header:hover {
    opacity: 0.8;
}

.collapsible-section .section-header {
    cursor: pointer;
}

.collapse-icon {
    font-size: 0.875rem;
    color: #64748b;
    transition: transform 0.3s ease;
}

.collapsible-section.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

.section-content {
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    max-height: 5000px;
    opacity: 1;
}

.collapsible-section.collapsed .section-content {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin-top: 0;
    margin-bottom: 0;
}

/* Tablet Grid Toggle Button - Standard: versteckt, auf Tablets sichtbar */
.tablet-grid-toggle-container {
    display: none;
    margin-bottom: 1rem;
    justify-content: center;
}

#toggle-grid-view-btn {
    min-height: 50px;
    padding: 0.9rem 1.5rem;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* === iPad-Optimierungen === */
/* iPad Portrait & Landscape */
















/* Touch-Optimierungen für alle Tablets */
@media (hover: none) and (pointer: coarse) {
    /* Entfernen von Hover-Effekten, die auf Touch-Geräten störend sind */
    .btn:hover,
    .btn-primary:hover,
    .btn-secondary:hover,
    .nav-link:hover {
        transform: none;
    }

    /* Touch-Feedback durch active state */
    .btn:active,
    .btn-primary:active {
        transform: scale(0.98);
        opacity: 0.9;
    }

    .nav-link:active {
        background: var(--primary-light);
        opacity: 0.8;
    }

    /* Größere Clickable Areas */
    .data-table tbody tr {
        cursor: pointer;
    }

    .data-table tbody tr:active {
        background: var(--primary-light);
    }

    /* Bewertungsseite Touch-Feedback */
    .point-btn:active {
        transform: scale(0.95);
        background: var(--primary);
        color: white;
    }

    .na-btn:active {
        transform: scale(0.95);
    }

    #prev-student-btn:active,
    #next-student-btn:active {
        transform: scale(0.98);
        opacity: 0.9;
    }

    #create-assessment-btn:active {
        transform: scale(0.98);
        opacity: 0.9;
    }

    .section-header:active {
        opacity: 0.7;
    }
}

/* Notenübersicht iPad-Optimierung */
@media only screen
  and (min-device-width: 768px)
  and (max-device-width: 1024px) {

    .overview-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .overview-table {
        min-width: 100%;
    }

    .overview-table th,
    .overview-table td {
        padding: 0.8rem;
        min-width: 80px;
    }

    .grade-edit-input {
        min-width: 70px;
        min-height: 44px;
        font-size: 1.1rem;
        padding: 0.6rem;
    }

    /* Sticky erste Spalte für horizontales Scrollen */
    .overview-table th:first-child,
    .overview-table td:first-child {
        position: sticky;
        left: 0;
        background: white;
        z-index: 10;
        box-shadow: 2px 0 5px rgba(0,0,0,0.1);
    }

    .overview-table thead th:first-child {
        z-index: 20;
    }
}

/* Verbesserte Filter-Selektoren für iPad */
@media only screen
  and (min-device-width: 768px)
  and (max-device-width: 1024px) {

    .filter-controls {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }

    .filter-controls select,
    .filter-controls input {
        width: 100%;
        min-height: 48px;
        font-size: 1.05rem;
    }
}

/* === Password Visibility Toggle === */
.password-wrapper {
    position: relative;
}

.password-toggle-icon {
    position: absolute;
    top: 68%;
    right: 15px;
    transform: translateY(-50%);
    cursor: pointer;
    color: rgba(255, 255, 255, 0.7);
    transition: color 0.3s ease;
}

.password-toggle-icon:hover {
    color: white;
}
/* === Question Builder UI Styles === */

/* MC Options */
.mc-option-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 3px solid var(--primary);
}

.mc-option-text {
    flex: 1;
}

.mc-option-item label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    font-weight: 500;
}

/* Keyword Items */
.keyword-item {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    align-items: center;
}

/* Match Form */
.match-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.match-column h4 {
    margin-bottom: 1rem;
    color: var(--primary);
}

.match-item {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    align-items: center;
}

/* Blank Items */
.blank-item {
    background: #f8f9fa;
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 6px;
    border-left: 3px solid var(--warning);
}

.blank-item label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.blank-item input {
    margin-bottom: 0.5rem;
}

/* Grid Editor */
#grid_pattern_editor {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 6px;
    max-width: 500px;
}

.grid-cell {
    width: 30px;
    height: 30px;
    border: 1px solid #ccc;
    cursor: pointer;
    transition: all 0.2s;
}

.grid-cell.white {
    background: white;
}

.grid-cell.black {
    background: black;
}

.grid-cell:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Table Editor */
.table-editor-grid {
    width: 100%;
    border-collapse: collapse;
}

.table-editor-grid td {
    padding: 0.5rem;
    border: 1px solid #dee2e6;
}

.table-cell-input {
    margin-bottom: 0.25rem;
}

.table-cell-input:first-child {
    background: #e3f2fd;
}

.table-cell-input:last-child {
    background: #fff3cd;
}

/* Huffman Character Items */
.huffman-char-item {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    align-items: center;
}

/* Button Icons */
.btn-icon {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    transition: all 0.2s;
    border-radius: 4px;
}

.btn-icon:hover {
    background: rgba(220, 53, 69, 0.1);
    transform: scale(1.1);
}

/* Help Text */
.help-text {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 1rem;
}

/* Form Row */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Image Preview */
.image-preview-box {
    margin-top: 1rem;
    position: relative;
    display: inline-block;
}

.image-preview-box img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 8px;
    border: 2px solid var(--border);
}

.image-preview-box .btn-icon {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(255, 255, 255, 0.9);
}


/* False Statements */
.false-statement-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
    padding: 0.75rem;
    background: #fff5f5;
    border-radius: 6px;
    border-left: 3px solid #dc3545;
}

.false-statement-text {
    flex: 1;
}

.false-statement-item label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    font-weight: 500;
    color: #dc3545;
}

