/* CSS Variables - Soft Hogwarts Theme */
:root {
    /* Soft House Colors */
    --gryffindor: #c41e3a;
    --slytherin: #1a472a;
    --ravenclaw: #0e1a40;
    --hufflepuff: #ffdb00;
    
    /* UI Colors - СВЕТЛАЯ ТЕМА ПО УМОЛЧАНИЮ */
    --bg-primary: #f8f9fa;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-sidebar: #f8f9fa; /* Светлый сайдбар по умолчанию */
    --bg-modal: rgba(0, 0, 0, 0.5);
    
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --text-light: #95a5a6;
    --text-white: #ffffff;
    
    --border-color: #e0e0e0;
    --border-light: #f0f0f0;
    
    --success: #27ae60;
    --warning: #f39c12;
    --danger: #e74c3c;
    --info: #3498db;
    
    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
    
    /* Transitions */
    --transition: all 0.3s ease;
    
    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #1a1a1a;
        --bg-secondary: #2d2d2d;
        --bg-card: #2d2d2d;
        --bg-sidebar: #1e1e1e; /* Темный сайдбар в темной теме */
        
        --text-primary: #ffffff;
        --text-secondary: #b3b3b3;
        --text-light: #808080;
        
        --border-color: #404040;
        --border-light: #333333;
        
        --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
        --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
        --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
    }
}

/* ПК версия - показываем только ПК кнопку */
.desktop-search-toggle {
    display: flex !important;
}

.mobile-search-toggle {
    display: none !important;
}

/* Скрытие через класс (перебивает !important) */
.desktop-search-toggle.hidden,
.mobile-search-toggle.hidden {
    display: none !important;
}

/* Мобильная версия */
@media (max-width: 768px) {
    .desktop-search-toggle {
        display: none !important;
    }
    
    .mobile-search-toggle {
        display: flex !important;
        margin-left: 0.5rem;
    }
    
    .desktop-search-toggle.hidden,
    .mobile-search-toggle.hidden {
        display: none !important;
    }
    .header-content {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
    }
    
    .header-left {
        display: flex;
        align-items: center;
        flex-shrink: 0;
        min-width: 80px;
    }
    
    .app-title {
        display: none !important;
    }
    
    .user-actions {
        flex-shrink: 0;
        min-width: 40px;
        display: flex;
        justify-content: flex-end;
    }
    
    .header-left .menu-toggle,
    .header-left .btn-icon {
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .app-title span {
        display: none;
    }
    
    .app-title i {
        font-size: 1.2rem;
    }
    
    .header-left {
        min-width: 70px;
    }
    
    .user-actions {
        min-width: 36px;
    }
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.3s ease;
}

.loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-content {
    text-align: center;
    padding: 2rem;
}

.hogwarts-logo {
    font-size: 4rem;
    color: var(--gryffindor);
    margin-bottom: 1.5rem;
    animation: pulse 2s ease-in-out infinite;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid var(--border-color);
    border-top-color: var(--gryffindor);
    border-radius: 50%;
    margin: 0 auto 1.5rem;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(0.95); }
}

/* App Container */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: relative;
}

/* Header */
.app-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 0.75rem 1rem;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    width: 100%;
}


.menu-toggle {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.25rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.menu-toggle:hover {
    background: var(--border-light);
}

.app-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.app-title i {
    color: var(--gryffindor);
}

.user-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-primary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    font-size: 1rem;
}

.btn-icon:hover {
    background: var(--border-light);
}

/* Search Container */
.search-container {
    padding: 0.75rem 0 0;
    display: none;
}

.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-wrapper i {
    position: absolute;
    left: 1rem;
    color: var(--text-light);
    font-size: 1rem;
}

.search-wrapper input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 3rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-size: 1rem;
    transition: var(--transition);
}

.search-wrapper input:focus {
    outline: none;
    border-color: var(--info);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.search-wrapper #clearSearch {
    position: absolute;
    right: 0.75rem;
    background: var(--border-light);
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: -100%;
    width: 280px;
    height: 100%;
    background: var(--bg-sidebar);
    color: var(--text-primary); /* ← Используем text-primary для контраста */
    z-index: 1000;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}

.sidebar.open {
    left: 0;
}

@media (prefers-color-scheme: light) {
    .sidebar {
        background: var(--bg-sidebar);
    }
    
    .sidebar-header h3,
    .menu-item,
    .user-name,
    .close-sidebar {
        color: var(--text-primary); /* Темный текст */
    }
    
    .user-avatar-sm {
        background: linear-gradient(135deg, var(--gryffindor), #d62839);
        color: white; /* Иконка остается белой */
    }
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-header h3 {
    color: var(--text-primary); /* ← Для заголовка */
}

.close-sideba.close-sidebar {
    color: var(--text-primary); /* ← Цвет крестика */
}

.menu-items {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1.5rem;
    color: var(--text-primary); /* ← Основной цвет текста */
    text-decoration: none;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.menu-item:hover {
    background: rgba(0, 0, 0, 0.1); /* Полупрозрачный фон при наведении */
    color: var(--text-primary);
    border-left-color: var(--gryffindor);
}

.menu-item.active {
    background: rgba(0, 0, 0, 0.15);
    color: var(--text-primary);
    border-left-color: var(--gryffindor);
}

.menu-item i {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
}

.menu-group {
    margin-top: 1rem;
}

.menu-group-title {
    padding: 0.75rem 1.5rem;
    color: var(--text-secondary); /* ← Вторичный цвет для заголовков групп */
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color); /* ← Используем border-color */
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-avatar-sm {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gryffindor); /* Цветная иконка */
    color: white; /* Белая иконка внутри */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.user-details {
    flex: 1;
}

.user-name {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
}

.user-role {
    display: block;
    font-size: 0.875rem;
    color: var(--text-secondary); /* ← Вторичный цвет для роли */
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 1rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.content-wrapper {
    max-width: 100%;
}

/* Tab Content */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Section Header */
.section-header {
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.section-header h2 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-primary);
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: var(--transition);
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border-light);
}

.card-header h3 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-primary);
    margin: 0;
}

.card-body {
    padding: 1.25rem;
}

/* Welcome Card */
.welcome-card {
    background: linear-gradient(135deg, var(--gryffindor), var(--slytherin));
    color: white;
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
}

.welcome-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transform: translate(30%, -30%);
}

.welcome-text h2 {
    color: white;
    margin-bottom: 0.5rem;
}

.welcome-text p {
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
}

.welcome-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.stat-item {
    background: rgba(255, 255, 255, 0.1);
    padding: 1rem;
    border-radius: var(--radius-sm);
    text-align: center;
    backdrop-filter: blur(10px);
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.875rem;
    opacity: 0.9;
}

/* Cards Grid */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Quick Actions */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
}

.quick-action-btn {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    color: var(--text-primary);
}

.quick-action-btn:hover {
    background: var(--border-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.quick-action-btn i {
    font-size: 1.5rem;
    color: var(--info);
}

.quick-action-btn span {
    font-size: 0.875rem;
    font-weight: 500;
    text-align: center;
}

/* Activity List */
.activity-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.75rem;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--info);
}

.activity-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--info);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.activity-content {
    flex: 1;
}

.activity-text {
    font-size: 0.9375rem;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.activity-time {
    font-size: 0.8125rem;
    color: var(--text-light);
}

/* Houses Stats */
.houses-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
}

.house-stat {
    padding: 1rem;
    border-radius: var(--radius-sm);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.house-stat.gryffindor {
    background: rgba(196, 30, 58, 0.1); /* Только один цвет */
    border: 1px solid rgba(196, 30, 58, 0.3);
}

.house-stat.slytherin {
    background: rgba(26, 71, 42, 0.1);
    border: 1px solid rgba(26, 71, 42, 0.3);
}

.house-stat.ravenclaw {
    background: rgba(14, 26, 64, 0.1);
    border: 1px solid rgba(14, 26, 64, 0.3);
}

.house-stat.hufflepuff {
    background: rgba(255, 219, 0, 0.1);
    border: 1px solid rgba(255, 219, 0, 0.3);
}

.house-name {
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.house-count {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.house-percent {
    font-size: 0.875rem;
    color: var(--text-light);
}

/* Course Filters */
.course-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    margin-bottom: 2rem; /* Увеличиваем отступ снизу */
}


.course-filter {
    padding: 6px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);  /* Вместо 20px */
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.course-filter.active {
    background: var(--info);
    border-color: var(--info);
    color: white;
}

.course-filter:hover {
    background: var(--border-light);
}

/* Sort Controls */
.sort-controls {
    display: flex;
    justify-content: flex-end;
}

.form-select {
    padding: 0.5rem 2rem 0.5rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9375rem;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
}

.form-select:focus {
    outline: none;
    border-color: var(--info);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* Students List */
.students-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

@media (max-width: 768px) {
    .students-list {
        grid-template-columns: 1fr;
    }
}

/* Student Card */
.student-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    padding: 1.25rem;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.student-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--info);
}

.student-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--info);
    opacity: 0;
    transition: var(--transition);
}

.student-card:hover::before {
    opacity: 1;
}

.student-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.student-name {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.student-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.house-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.house-badge.gryffindor {
    background: var(--gryffindor); /* Только основной цвет */
    color: white;
}

.house-badge.slytherin {
    background: var(--slytherin);
    color: white;
}

.house-badge.ravenclaw {
    background: var(--ravenclaw); /* Чистый синий */
    color: white; /* Белый текст */
}

.house-badge.hufflepuff {
    background: var(--hufflepuff); /* Чистый желтый */
    color: #000000; /* Черный текст */
}

.course-badge {
    padding: 0.25rem 0.75rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
}

.gpa-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    padding: 0.5rem 0.75rem;
    background: var(--bg-primary);
    border-radius: 20px;
    border: 1px solid var(--border-color);
}

.gpa-excellent { color: var(--success); }
.gpa-good { color: var(--warning); }
.gpa-poor { color: var(--danger); }

.student-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.detail-label {
    font-size: 0.8125rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-value {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-primary);
}

.badges-container {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.badge {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    position: relative;
    cursor: help;
    transition: var(--transition);
}

.badge:hover {
    transform: scale(1.1);
}

.badge:hover::after {
    opacity: 1;
}

.badge-star {
    background: linear-gradient(135deg, gold, #ffd700);
    color: black;
}

.badge-arrow {
    background: linear-gradient(135deg, var(--danger), #c0392b);
    color: white;
}

.badge-clock {
    background: linear-gradient(135deg, var(--info), #2980b9);
    color: white;
}

.badge-whip {
    background: linear-gradient(135deg, #8b4513, #a0522d);
    color: white;
}

.badge-train {
    background: linear-gradient(135deg, var(--success), #229954);
    color: white;
}


/* Stats Container */
.stats-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    text-align: center;
    border: 1px solid var(--border-color);
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.stat-card .stat-label {
    font-size: 0.9375rem;
    color: var(--text-light);
}

.charts-container {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    border: 1px solid var(--border-color);
}

/* Profile Container */
.profile-container {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    border: 1px solid var(--border-color);
}

/* Admin Container */
.admin-container {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    border: 1px solid var(--border-color);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-modal);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1100;
    padding: 1rem;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
}

.modal.active {
    display: flex;
}

.modal-dialog {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    margin: 0;
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    padding: 1rem 1.5rem;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 1rem;
    z-index: 1200;
    transform: translateY(100px);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    max-width: 400px;
    border-left: 4px solid var(--info);
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast-success {
    border-left-color: var(--success);
}

.toast-error {
    border-left-color: var(--danger);
}

.toast-warning {
    border-left-color: var(--warning);
}

.toast i {
    font-size: 1.25rem;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.toast-message {
    font-size: 0.9375rem;
    color: var(--text-secondary);
}

/* Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 900;
    display: none;
    backdrop-filter: blur(2px);
}

.overlay.active {
    display: block;
}

/* Utility Classes */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
}

.loading i {
    animation: spin 1s linear infinite;
    margin-right: 0.5rem;
}

.admin-only {
    display: none; /* Убрали !important */
}

.admin-only.show {
    display: flex !important;
}

.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-info { color: var(--info); }

/* Responsive */
@media (max-width: 576px) {
    .app-header {
        padding: 0.5rem;
    }
    
    .main-content {
        padding: 0.75rem;
    }
    
    .cards-grid {
        grid-template-columns: 1fr;
    }
    
    .welcome-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .quick-actions {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .houses-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .student-details {
        grid-template-columns: 1fr;
    }
    
    .stats-cards {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .toast {
        left: 1rem;
        right: 1rem;
        max-width: none;
    }
}

@media (min-width: 768px) {
    .app-title span {
        display: inline;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

/* Print Styles */
@media print {
    .app-header,
    .sidebar,
    .menu-toggle,
    .user-actions,
    .search-container,
    .modal,
    .toast {
        display: none !important;
    }
    
    .main-content {
        padding: 0;
    }
    
    .tab-content.active {
        display: block !important;
    }
}

/* Text link */
.text-link {
    color: var(--info);
    text-decoration: none;
    transition: var(--transition);
}

.text-link:hover {
    text-decoration: underline;
    color: #2980b9;
}

/* Avatar large */
.avatar-large {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
}

.avatar-large.gryffindor {
    background: var(--gryffindor);
    color: white;
}

.avatar-large.slytherin {
    background: var(--slytherin);
    color: white;
}

.avatar-large.ravenclaw {
    background: var(--ravenclaw); /* Чистый синий */
    color: white; /* Белый текст как у гриффа и слизерина */
}

.avatar-large.hufflepuff {
    background: var(--hufflepuff); /* Чистый желтый */
    color: #000000; /* Черный текст */
}

/* Profile header */
.profile-header {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
}

.profile-info h2 {
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.profile-meta {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}

.profile-meta .house-badge,
.profile-meta .course-badge,
.profile-meta .role-badge,
.profile-meta .gpa-display,
.profile-meta .badge-graduate {
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.profile-details .detail-item {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-light);
}

.profile-details .detail-item:last-child {
    border-bottom: none;
}

.profile-details .detail-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
    min-width: 120px;
}

.profile-details .detail-value {
    color: var(--text-primary);
    font-weight: 500;
    text-align: right;
}

.specialization-badge {
    padding: 0.25rem 0.75rem;
    background: var(--info);
    color: white;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
}

/* Detail section */
.detail-section {
    margin-bottom: 2rem;
}

.detail-section h3 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

/* Achievements list */
.achievements-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.achievement-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--warning);
}

/* Profile actions */
.profile-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

/* Student modal specific */
.student-modal-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.student-modal-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.student-modal-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
}

.student-modal-info h4 {
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.student-modal-info p {
    color: var(--text-light);
    margin: 0;
}

.student-modal-details {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-light);
}

.detail-row:last-child {
    border-bottom: none;
}

.student-modal-badges h5,
.student-modal-achievements h5 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.student-modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Responsive adjustments for admin */
@media (max-width: 768px) {
    .profile-header {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    
    .profile-meta {
        justify-content: center;
    }
    
    .detail-grid {
        grid-template-columns: 1fr;
    }
    
    .student-modal-header {
        flex-direction: column;
        text-align: center;
    }
    
    .student-modal-actions {
        flex-direction: column;
    }
    
    .btn-sm {
        width: 100%;
    }
}
/* Вместо старых стилей для badge */
.badge {
    position: relative;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    cursor: help;
    transition: var(--transition);
}

/* Убираем все ::after и ::before для тултипов */
.badge::after,
.badge::before {
    display: none;
}

/* Используем стандартный title для тултипов */

/* Мобильная адаптация */
@media (max-width: 768px) {
    .badge::after {
        left: 50%;
        transform: translateX(-50%);
        white-space: normal;
        width: 160px;
        font-size: 0.7rem;
        padding: 4px 8px;
    }
    
    .badge:hover::after,
    .badge:hover::before {
        opacity: 1;
    }
}

.badge:hover .badge-tooltip {
    opacity: 1;
}

/* Гарантируем, что тултип не вылезет за экран */
@media (max-width: 768px) {
    .badge-tooltip {
        left: 50%;
        transform: translateX(-50%);
        white-space: normal;
        width: 150px;
    }
}

/* Стили для создания профиля */
.profile-creation {
    max-width: 800px;
    margin: 0 auto;
}

.profile-creation-header {
    text-align: center;
    margin-bottom: 2rem;
    padding: 2rem;
    background: linear-gradient(135deg, var(--gryffindor), var(--slytherin));
    color: white;
    border-radius: var(--radius-lg);
}

.profile-creation-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.profile-creation-header h3 {
    color: white;
    margin-bottom: 0.5rem;
}

.profile-creation-header p {
    opacity: 0.9;
    margin: 0;
}

.role-selection {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.role-option {
    padding: 1.5rem;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.role-option:hover {
    border-color: var(--info);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.role-option.selected {
    border-color: var(--success);
    background: rgba(39, 174, 96, 0.05);
}

.role-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--info);
}

.role-option.selected .role-icon {
    background: var(--success);
    color: white;
}

.role-info {
    flex: 1;
}

.role-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.role-desc {
    font-size: 0.875rem;
    color: var(--text-light);
}

.profile-form-section {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.profile-form-section h4 {
    margin-bottom: 1rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Стили для редактирования профиля */
.edit-profile-form {
    max-width: 800px;
    margin: 0 auto;
}

.edit-profile-avatar {
    text-align: center;
    margin-bottom: 2rem;
}

.avatar-edit {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    margin: 0 auto 1rem;
    cursor: pointer;
    transition: var(--transition);
}

.avatar-edit:hover {
    transform: scale(1.05);
}

.avatar-change-text {
    color: var(--info);
    font-size: 0.875rem;
    cursor: pointer;
}

.avatar-change-text:hover {
    text-decoration: underline;
}

/* Кнопки действий профиля */
.profile-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

@media (max-width: 768px) {
    .role-selection {
        grid-template-columns: 1fr;
    }
    
    .role-option {
        flex-direction: column;
        text-align: center;
    }
    
    .profile-actions {
        flex-direction: column;
    }
}

/* Стили для формы создания профиля */
.profile-creation-form {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 2rem;
    border: 1px solid var(--border-color);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 0.875rem 1rem;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 1rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--info);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.form-text {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-top: 0.25rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.btn {
    padding: 0.875rem 1.75rem;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 24px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: var(--border-light);
    transform: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Стили для выбора роли */
.role-selection {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.role-option {
    padding: 1.5rem;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.role-option:hover {
    border-color: var(--info);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.role-option.selected {
    border-color: var(--success);
    background: rgba(39, 174, 96, 0.05);
}

.role-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--info);
}

.role-option.selected .role-icon {
    background: var(--success);
    color: white;
}

.role-info {
    flex: 1;
}

.role-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.role-desc {
    font-size: 0.875rem;
    color: var(--text-light);
}

/* Информационные блоки */
.alert {
    padding: 1rem 1.5rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    border-left: 4px solid var(--info);
    background: var(--bg-secondary);
}

.alert-info {
    border-left-color: var(--info);
    background: rgba(52, 152, 219, 0.1);
}

.alert-success {
    border-left-color: var(--success);
    background: rgba(39, 174, 96, 0.1);
}

.alert-warning {
    border-left-color: var(--warning);
    background: rgba(243, 156, 18, 0.1);
}

.alert-danger {
    border-left-color: var(--danger);
    background: rgba(231, 76, 60, 0.1);
}

.alert-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.alert-message {
    color: var(--text-secondary);
}

/* Сообщение когда профиль не создан */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-light);
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.empty-state p {
    margin-bottom: 1.5rem;
}

/* ФИКС ДЛЯ ВЫРАВНИВАНИЯ СООБЩЕНИЙ "Нет..." НА ПК */
@media (min-width: 768px) {
    /* Центрируем все empty-state сообщения */
    .students-grid .empty-state,
    .tab-content > .empty-state,
    #coursesList > .empty-state,
    #allList > .empty-state,
    #repeatersList > .empty-state,
    #externalsList > .empty-state,
    #academicList > .empty-state,
    #graduatesList > .empty-state,
    #distanceList > .empty-state,
    #inactiveList > .empty-state,
    #othersList > .empty-state {
        grid-column: 1 / -1;
        text-align: center;
        margin: 0 auto;
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 4rem 2rem;
    }
    
    /* Переопределяем grid для пустых состояний */
    .students-grid:has(.empty-state) {
        display: grid !important;
        grid-template-columns: 1fr;
        justify-items: center;
    }
    
    /* Для списков студентов без grid */
    #coursesList:has(.empty-state),
    #allList:has(.empty-state),
    #repeatersList:has(.empty-state),
    #externalsList:has(.empty-state),
    #academicList:has(.empty-state),
    #graduatesList:has(.empty-state),
    #distanceList:has(.empty-state),
    #inactiveList:has(.empty-state),
    #othersList:has(.empty-state) {
        display: flex;
        justify-content: center;
        align-items: center;
        min-height: 200px;
    }
}

/* Адаптивность */
@media (max-width: 768px) {
    .role-selection {
        grid-template-columns: 1fr;
    }
    
    .role-option {
        flex-direction: column;
        text-align: center;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
}

/* Стили для выбора года */
.year-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.year-label {
    font-weight: 600;
    color: var(--text-primary);
}

.year-value {
    font-weight: 700;
    color: var(--gryffindor);
    font-size: 1.25rem;
}

/* Стили для главного экрана админки */
.admin-sections {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.admin-section {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    border: 1px solid var(--border-color);
}

.admin-section h3 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.admin-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
}

.admin-stats {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    border: 1px solid var(--border-color);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

/* Добавьте эти стили в конец файла styles.css */

/* Мобильная адаптация */
@media (max-width: 480px) {
    .app-title span {
        display: none;
    }
    
    .app-title i {
        font-size: 1.5rem;
    }
    
    .welcome-card {
        padding: 1rem;
    }
    
    .welcome-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    
    .stat-item {
        padding: 0.75rem;
    }
    
    .stat-value {
        font-size: 1.25rem;
    }
    
    .cards-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .quick-actions {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .quick-action-btn {
        padding: 0.75rem;
    }
    
    .student-card {
        padding: 1rem;
    }
    
    .profile-header {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
        padding: 1.5rem;
    }
    
    .profile-meta {
        justify-content: center;
    }
    
    .profile-actions {
        flex-direction: column;
    }
    
    .admin-sections {
        grid-template-columns: 1fr;
    }
    
    .admin-actions {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .data-table {
        font-size: 0.875rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.5rem;
    }
    
    .action-buttons {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
    
    /* Формы */
    .form-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .role-selection {
        grid-template-columns: 1fr;
    }
    
    .role-option {
        flex-direction: column;
        text-align: center;
        padding: 1rem;
    }
    
    .role-icon {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }
    
    /* Модальные окна */
    .modal-dialog {
        margin: 0.5rem;
        max-height: 90vh;
    }
    
    .modal-header {
        padding: 1rem;
    }
    
    .modal-body {
        padding: 1rem;
        max-height: 60vh;
        overflow-y: auto;
    }
    
    /* Табы */
    .admin-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .admin-tab {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
        white-space: nowrap;
    }
    
    /* Туалтипы */
    .badge-tooltip {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
        max-width: 150px;
        white-space: normal;
    }
    
    /* Заголовки */
    .section-header h2 {
        font-size: 1.25rem;
    }
    
    .section-header h2 i {
        font-size: 1rem;
    }
    
    /* Карточки профиля */
    .avatar-large {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }
    
    .detail-grid {
        grid-template-columns: 1fr;
        padding: 1rem;
    }
    
    /* Бейджи ролей */
    .role-badge {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }
    
    /* Поля ввода */
    .form-control {
        padding: 0.75rem;
        font-size: 16px; /* Убирает масштабирование в iOS */
    }
    
    /* Кнопки */
    .btn {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
    
    /* Сайдбар */
    .sidebar {
        width: 85%;
    }
    
    .menu-item {
        padding: 0.75rem 1rem;
    }
    
    /* Ширина для поиска */
    .search-wrapper input {
        font-size: 16px;
        padding: 0.75rem 1rem 0.75rem 2.5rem;
    }
    
    /* Быстрое меню */
    .quick-actions {
        gap: 0.5rem;
    }
}

/* Для очень маленьких экранов */
@media (max-width: 360px) {
    .welcome-stats {
        grid-template-columns: 1fr;
    }
    
    .quick-actions {
        grid-template-columns: 1fr;
    }
    
    .houses-stats {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .admin-actions {
        grid-template-columns: 1fr;
    }
}

/* Улучшение для iOS */
@supports (-webkit-touch-callout: none) {
    .form-control,
    .search-wrapper input {
        font-size: 16px;
    }
    
    button,
    .btn {
        cursor: pointer;
        -webkit-appearance: none;
    }
    
    /* Убирает подсветку при тапе */
    * {
        -webkit-tap-highlight-color: transparent;
    }
}

/* Для Android */
@supports not (-webkit-touch-callout: none) {
    button,
    .btn {
        min-height: 44px;
    }
}

/* Улучшение скролла на мобильных */
@media (hover: none) and (pointer: coarse) {
    .students-list,
    .activity-list,
    .achievements-list {
        -webkit-overflow-scrolling: touch;
    }
}

/* Более компактные карточки студентов на мобильных */
@media (max-width: 768px) {
    .student-details {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    
    .detail-label {
        font-size: 0.75rem;
    }
    
    .detail-value {
        font-size: 0.875rem;
    }
}

/* Ховер эффекты только для десктопа */
@media (hover: hover) and (pointer: fine) {
    .student-card:hover {
        transform: translateY(-3px);
        box-shadow: var(--shadow-md);
    }
    
    .role-option:hover {
        border-color: var(--info);
        transform: translateY(-2px);
    }
}

/* Для мобильных убираем ховеры */
@media (hover: none) and (pointer: coarse) {
    .student-card:active {
        background: var(--border-light);
    }
    
    .role-option:active {
        background: var(--border-light);
    }
}

/* Стили для бейджей ролей */
.role-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    display: inline-block;
}

.role-badge.student {
    background: rgba(52, 152, 219, 0.1);
    color: #3498db;
    border: 1px solid rgba(52, 152, 219, 0.2);
}

.role-badge.professor {
    background: rgba(155, 89, 182, 0.1);
    color: #9b59b6;
    border: 1px solid rgba(155, 89, 182, 0.2);
}

.role-badge.keeper {
    background: rgba(39, 174, 96, 0.1);
    color: #27ae60;
    border: 1px solid rgba(39, 174, 96, 0.2);
}

.role-badge.moderator {
    background: rgba(243, 156, 18, 0.1);
    color: #f39c12;
    border: 1px solid rgba(243, 156, 18, 0.2);
}

.role-badge.admin {
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
    border: 1px solid rgba(231, 76, 60, 0.2);
}

/* Стили для статусов */
.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
}

.status-badge.active {
    background: rgba(39, 174, 96, 0.1);
    color: #27ae60;
}

.status-badge.inactive {
    background: rgba(149, 165, 166, 0.1);
    color: #95a5a6;
}

/* Улучшение таблиц для админа */
.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1.5rem;
}

.data-table {
    width: 100%;
    min-width: 600px;
    border-collapse: collapse;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.data-table th {
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-weight: 600;
    text-align: left;
    padding: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.data-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.data-table tr:hover {
    background: var(--border-light);
}

/* Улучшение виджета года */
.year-widget {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.year-label {
    font-weight: 600;
    color: var(--text-primary);
}

.year-value {
    font-weight: 700;
    color: var(--gryffindor);
    font-size: 1.25rem;
}

/* Добавьте в конец styles.css */
.student-decision-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 1rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: start;
}

.student-info .student-name {
    font-weight: 600;
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.student-info .student-details {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.decision-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.decision-controls .form-group {
    margin-bottom: 0;
}

.additional-fields {
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    padding: 1rem;
    border: 1px solid var(--border-color);
}

@media (max-width: 768px) {
    .student-decision-item {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

/* Кнопка завершения года */
.btn-year-advance {
    background: linear-gradient(135deg, #27ae60, #229954);
    color: white;
}

.btn-year-advance:hover {
    background: linear-gradient(135deg, #229954, #1e8449);
}

/* История в карточке */
.academic-history {
    margin-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
}

.academic-history h4 {
    margin-bottom: 1rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.history-item {
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    padding: 1rem;
    margin-bottom: 0.75rem;
    border-left: 3px solid var(--info);
}

.history-item.repeat {
    border-left-color: var(--warning);
}

.history-item.external {
    border-left-color: var(--success);
}

.history-item.academic {
    border-left-color: var(--danger);
}

.history-item.graduate {
    border-left-color: #9b59b6;
}

.history-year {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.history-details {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Стили для редактора профиля */
.modal-lg {
    max-width: 800px;
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 0.5rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Сетка формы */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

/* Адаптивность */
@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .checkbox-group {
        flex-direction: column;
        gap: 0.5rem;
    }
}

/* Исправление отображения карточек персонажей */
.student-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    padding: 0;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.student-card-header {
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--gryffindor), #d62839);
    color: white;
    position: relative;
}

.student-card-header.slytherin {
    background: linear-gradient(135deg, var(--slytherin), #2a623d);
}

.student-card-header.ravenclaw {
    background: var(--ravenclaw); /* Чистый синий */
    color: white; /* Белый текст */
}

.student-card-header.hufflepuff {
    background: var(--hufflepuff); /* Чистый желтый */
    color: #000000; /* Черный текст */
}

.student-card-header.default {
    background: linear-gradient(135deg, #3498db, #2980b9);
}

.student-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    margin-bottom: 1rem;
}

.student-badges {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.5rem;
}

.student-card-body {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.student-name {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.student-info {
    flex: 1;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-light);
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.info-value {
    color: var(--text-primary);
    font-weight: 500;
    text-align: right;
}

.student-uid {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.student-uid span {
    font-family: monospace;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.btn-copy {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
}

.btn-copy:hover {
    background: var(--border-light);
    color: var(--text-primary);
}

/* Стили для неактивных кнопок редактирования */
.btn-primary:disabled,
.btn-primary.disabled {
    background: var(--text-light);
    cursor: not-allowed;
    opacity: 0.7;
}

.btn-primary:disabled:hover,
.btn-primary.disabled:hover {
    transform: none;
    box-shadow: none;
}

/* Стили для сообщений о доступе */
.access-message {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin: 1.5rem 0;
    border-left: 4px solid var(--warning);
}

.access-message h4 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.access-message p {
    color: var(--text-secondary);
    margin: 0;
}

.badge-distance {
    background: linear-gradient(135deg, #8e44ad, #9b59b6);
    color: white;
}

.course-section {
    margin-bottom: 2.5rem;
}

/* Для первой секции курса */
.course-section:first-of-type {
    margin-top: 0.5rem;
}

.course-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border-light);
    font-size: 1.5rem;
    margin-top: 1rem; /* Добавляем отступ сверху */
}

.course-count {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: normal;
    background: var(--bg-secondary);
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
}

/* Увеличиваем расстояние между карточками студентов */
.students-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.25rem;
}

/* Для мобильных */
@media (max-width: 768px) {
    .course-title {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .students-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

/* Отображение текущего года */
.current-year-display {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
}

.current-year-display i {
    font-size: 1.1rem;
}

#currentYearDisplay {
    font-weight: 700;
    font-size: 1.2rem;
    color: white;
}

.btn-edit-year {
    margin-left: auto;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    width: 32px;
    height: 32px;
    font-size: 0.875rem;
}

.btn-edit-year:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Форма редактирования года */
.year-edit-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.year-edit-input {
    width: 80px;
    padding: 0.5rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    text-align: center;
    background: var(--bg-card);
    color: var(--text-primary);
}

.year-edit-buttons {
    display: flex;
    gap: 0.25rem;
}

/* Для текущего учебного года в welcome-card */
.welcome-card .current-year-display {
    color: rgba(255, 255, 255, 0.9); /* Белый текст на темном фоне */
}

.welcome-card .current-year-display #currentYearDisplay {
    color: white;
    font-weight: 700;
}

/* Для светлой темы - если welcome-card темный */
@media (prefers-color-scheme: light) {
    .welcome-card .current-year-display {
        color: rgba(255, 255, 255, 0.9); /* Оставляем белым, так как welcome-card темный */
    }
    
    .welcome-card .current-year-display #currentYearDisplay {
        color: white;
    }
}

/* Плашка выбора вида */
.view-controls-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 0.5rem 1rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
    height: 48px;
}

.view-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.view-info i {
    color: var(--info);
    font-size: 1rem;
}

.view-toggle {
    display: flex;
    gap: 0.25rem;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    padding: 0.25rem;
}

.compact-controls-bar {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    align-items: center;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 0.5rem 1rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
    gap: 1rem;
    height: 48px;
}

@media (max-width: 768px) {
    .compact-controls-bar {
        grid-template-columns: 1fr;
        height: auto;
        padding: 0.75rem;
        gap: 0.75rem;
    }
}

.controls-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.controls-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.controls-count {
    background: var(--info);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 28px;
    text-align: center;
}

.controls-center {
    display: flex;
    justify-content: center;
}

.controls-right {
    display: flex;
    justify-content: flex-end;
}

/* Компактные поля фильтра */
.compact-filter-inputs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-input-small {
    width: 60px;
    padding: 0.375rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.875rem;
    text-align: center;
}

.btn-icon-small {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: var(--transition);
}

.btn-icon-small:hover {
    background: var(--border-light);
}

/* Компактный селект сортировки */
.sort-controls-compact {
    min-width: 140px;
}

.form-select-sm {
    padding: 0.375rem 2rem 0.375rem 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 0.875rem;
    width: 100%;
}

.view-toggle-small {
    display: flex;
    gap: 0.25rem;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    padding: 0.25rem;
}

.view-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: var(--radius-xs);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.875rem;
}

.view-btn:hover {
    background: var(--border-light);
    color: var(--text-primary);
}

.view-btn.active {
    background: var(--info);
    color: white;
}

/* Компактный список */
.compact-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.compact-card-center {
    min-width: 0; /* Для корректного обрезания текста */
}

/* Компактные карточки - исправленная версия */
/* Компактные карточки - исправленная версия */
.compact-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.6rem 0.75rem;
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
    box-sizing: border-box;
}

.compact-card:hover {
    background: var(--bg-secondary);
    transform: translateX(2px);
}

.compact-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.compact-info {
    flex: 1;
    min-width: 0; /* Критически важно для обрезания текста */
    overflow: hidden;
}

.compact-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.1rem;
    width: 100%; /* Занимает всю доступную ширину */
}

.compact-details {
    display: flex;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.compact-details span {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    white-space: nowrap;
}

.compact-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.compact-badges-row {
    display: flex;
    gap: 0.2rem;
    align-items: center;
    flex-shrink: 0;
}

.compact-badges-row .badge {
    width: 20px;
    height: 20px;
    font-size: 0.7rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.compact-uid {
    font-family: monospace;
    font-size: 0.75rem;
    color: var(--text-light);
    padding: 0.2rem 0.5rem;
    background: var(--bg-secondary);
    border-radius: 14px;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    border: 1px solid var(--border-color);
    font-weight: 500;
    flex-shrink: 0;
    min-width: 45px;
    text-align: center;
}

.compact-uid:hover {
    background: var(--info);
    color: white;
    border-color: var(--info);
}

/* Мобильная версия */
@media (max-width: 768px) {
    .compact-card {
        padding: 0.5rem 0.6rem;
        gap: 0.5rem;
    }
    
    .compact-avatar {
        width: 30px;
        height: 30px;
        font-size: 0.95rem;
        flex-shrink: 0;
    }
    
    .compact-info {
        flex: 1;
        min-width: 0; /* Важно для обрезания */
        overflow: hidden;
    }
    
    .compact-name {
        font-size: 0.8rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        width: 100%;
    }
    
    .compact-details {
        font-size: 0.65rem;
        gap: 0.35rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        width: 100%;
    }
    
    .compact-right {
        gap: 0.35rem;
        flex-shrink: 0;
        max-width: 40%; /* Ограничиваем ширину правой части */
    }
    
    .compact-badges-row {
        flex-shrink: 0;
    }
    
    .compact-badges-row .badge {
        width: 18px;
        height: 18px;
        font-size: 0.6rem;
    }
    
    .compact-uid {
        font-size: 0.65rem;
        padding: 0.15rem 0.4rem;
        min-width: 40px;
        flex-shrink: 0;
    }
}

/* Для очень маленьких экранов */
@media (max-width: 480px) {
    .compact-card {
        padding: 0.4rem 0.5rem;
        gap: 0.4rem;
    }
    
    .compact-avatar {
        width: 26px;
        height: 26px;
        font-size: 0.85rem;
    }
    
    .compact-name {
        font-size: 0.75rem;
    }
    
    .compact-details {
        font-size: 0.6rem;
        gap: 0.25rem;
    }
    
    .compact-right {
        max-width: 45%;
    }
    
    .compact-badges-row .badge {
        width: 16px;
        height: 16px;
        font-size: 0.55rem;
    }
    
    .compact-uid {
        font-size: 0.6rem;
        padding: 0.1rem 0.3rem;
        min-width: 35px;
    }
}

@media (max-width: 360px) {
    /* Прячем факультет, но показываем GPA */
    .compact-details span:nth-child(2) {
        display: none;
    }
    /* GPA показываем всегда */
    .compact-details span:last-child {
        display: inline-flex !important;
    }
}

/* Бейджи в компактном виде */
.compact-card .badge {
    width: 20px;
    height: 20px;
    font-size: 0.625rem;
    flex-shrink: 0;
}

/* Компактный фильтр для выпускников */
.compact-filter-bar {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
}

.filter-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filter-input-group {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.filter-input-group label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.filter-input {
    width: 70px;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.875rem;
    text-align: center;
}

.btn-filter-apply,
.btn-filter-reset {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.btn-filter-apply {
    background: var(--success);
    color: white;
}

.btn-filter-reset {
    background: var(--text-light);
    color: var(--text-primary);
}

.btn-filter-apply:hover {
    background: #229954;
}

.btn-filter-reset:hover {
    background: var(--text-secondary);
}

.filter-result {
    margin-left: auto;
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Компактный фильтр выпускников */
.graduate-controls {
    margin-bottom: 1rem;
}

.graduate-filter-compact {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    padding: 0.75rem;
}

.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.filter-count {
    background: var(--info);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.timeline-filter {
    margin-bottom: 0.75rem;
}

.timeline-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.year-inputs {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.year-input {
    width: 60px;
    padding: 0.375rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.875rem;
    text-align: center;
}

.btn-filter-small {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: var(--success);
    color: white;
    font-size: 0.75rem;
}

.btn-filter-small.reset {
    background: var(--text-light);
    color: var(--text-primary);
}

.quick-years {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.year-buttons {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
    margin-top: 0.25rem;
}

.year-btn {
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 0.75rem;
    cursor: pointer;
    transition: var(--transition);
}

.year-btn:hover {
    background: var(--border-light);
}

.year-btn.active {
    background: var(--info);
    color: white;
    border-color: var(--info);
}

.year-btn.more {
    opacity: 0.7;
}

.view-controls {
    display: flex;
    justify-content: flex-end;
}

.view-toggle-small {
    display: flex;
    gap: 0.25rem;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    padding: 0.25rem;
}

.graduate .graduate-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

/* Стили для экстернов */
.external-badge {
    background: linear-gradient(135deg, var(--success), #229954);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.5rem;
}

.external-additional-badge {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: var(--success);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    z-index: 10;
}

.student-card {
    position: relative;
}

/* Делаем область пользователя кликабельной */
.user-info.clickable {
    cursor: pointer;
    transition: var(--transition);
    border-radius: var(--radius-sm);
    padding: 0.5rem;
}

.user-info.clickable:hover {
    background: rgba(0, 0, 0, 0.1);
}

/* Для темной темы */
@media (prefers-color-scheme: dark) {
    .user-info.clickable:hover {
        background: rgba(255, 255, 255, 0.1);
    }
}

/* Убираем отдельную кнопку профиля из меню */
#myProfileTab {
    display: none !important;
}

/* Стили для заголовка "Все студенты" */
.all-students-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 1rem;
}

.header-left {
    display: flex;
    align-items: center;
}

.section-title-with-count {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.students-count {
    background: var(--info);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Стили для компактных контролов */
.sort-controls-compact {
    min-width: 160px;
}

.form-select-sm {
    padding: 0.5rem 2rem 0.5rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 0.875rem;
    width: 100%;
}

.view-toggle-small {
    display: flex;
    gap: 0.25rem;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    padding: 0.25rem;
}

.view-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: var(--radius-xs);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.875rem;
}

.view-btn:hover {
    background: var(--border-light);
    color: var(--text-primary);
}

.view-btn.active {
    background: var(--info);
    color: white;
}

/* Адаптивность для мобильных */
@media (max-width: 768px) {
    .all-students-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .header-right {
        width: 100%;
        justify-content: space-between;
    }
    
    .sort-controls-compact {
        flex: 1;
    }
}

/* Стили для счетчика студентов в заголовке */
.students-count-badge {
    background: var(--info);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    margin-left: 0.75rem;
}

/* Стили для контейнера с переключателем вида и сортировкой */
.view-toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.view-toggle-mini {
    display: flex;
    gap: 0.25rem;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    padding: 0.25rem;
}

.view-btn-mini {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: var(--radius-xs);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.875rem;
}

.view-btn-mini:hover {
    background: var(--border-light);
    color: var(--text-primary);
}

.view-btn-mini.active {
    background: var(--info);
    color: white;
}

/* Обновляем стили для sort-controls */
.sort-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.form-select {
    width: auto;
    min-width: 160px;
}

/* Адаптивность для мобильных */
@media (max-width: 768px) {
    .view-toggle-wrapper {
        flex-wrap: wrap;
        justify-content: flex-end;
    }
    
    .form-select {
        min-width: 140px;
    }
}

/* В вашем CSS-файле */
.btn-primary {
    background: var(--success);
    border: none;
    border-radius: var(--radius-sm);
    padding: 10px 24px;
    font-weight: 600;
    font-size: 14px;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: none;
}


.btn-primary:active {
    transform: translateY(0px);
}

/* Кнопка "Мои табели" с иконкой */
.btn-tabels {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border: none;
    border-radius: 50px;
    padding: 14px 35px;
    font-weight: 600;
    font-size: 16px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(245, 87, 108, 0.4);
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.btn-tabels:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(245, 87, 108, 0.6);
}

.btn-tabels::before {
    content: "📋";
    font-size: 18px;
}

/* Заголовки секций */
.section-title {
    font-weight: 700;
    font-size: 24px;
    color: #2d3748;
    border-bottom: 3px solid #667eea;
    padding-bottom: 12px;
    margin-bottom: 25px;
    position: relative;
}

.section-title::after {
    content: "";
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 3px;
}

/* Надпись "Год заблокирован" — стильная */
.badge-locked {
    display: inline-block;
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    color: white;
    padding: 4px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 10px rgba(238, 90, 36, 0.3);
}



/* ========== АДАПТАЦИЯ ДЛЯ МОБИЛЬНЫХ ========== */

@media (max-width: 768px) {
    /* Таблица с прокруткой */
    .table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -10px;
        padding: 0 10px;
    }
    
    .table-wrap table {
        min-width: 600px;
        font-size: 13px;
    }
    
    .table-wrap table th,
    .table-wrap table td {
        padding: 8px 10px;
        white-space: nowrap;
    }
    
    /* Сокращаем "Оценка" до "Оц." только на мобильных */
    .grade-label .full {
        display: none;
    }
    .grade-label .short {
        display: inline;
    }
    
    /* Сама ячейка оценки — компактнее */
    td .grade-badge {
        font-size: 12px;
        padding: 2px 10px;
    }
}

@media (min-width: 769px) {
    .grade-label .full {
        display: inline;
    }
    .grade-label .short {
        display: none;
    }
}

/* ========== КНОПКА РЕДАКТИРОВАНИЯ ========== */

.btn-edit {
    background: #667eea;
    border: none;
    border-radius: 8px;
    padding: 5px 12px;
    color: white;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-edit:hover {
    background: #5a67d8;
    transform: scale(1.05);
}

.btn-edit:active {
    transform: scale(0.95);
}

/* Иконка внутри кнопки */
.btn-edit svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

/* Текст кнопки на десктопе */
.btn-edit .text {
    display: inline;
}

/* На мобильных — только иконка */
@media (max-width: 768px) {
    .btn-edit .text {
        display: none;
    }
    
    .btn-edit {
        padding: 5px 8px;
        border-radius: 6px;
    }
    
    .btn-edit svg {
        width: 16px;
        height: 16px;
    }
}

.btn-primary:hover {
    opacity: 0.85;
    transform: none;
    box-shadow: none;
}

/* Для надписей */
.section-title {
    font-weight: 700;
    color: #2d3748;
    border-bottom: 3px solid #667eea;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

/* Для мобильных устройств */
@media (max-width: 768px) {
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table-container table {
        min-width: 600px;
        font-size: 14px;
    }
    
    /* Или сокращаем текст */
    .grade-label {
        font-size: 12px;
    }
    
    /* Или используем иконки вместо текста */
    .grade-label .full-text {
        display: none;
    }
    .grade-label .short-text {
        display: inline;
    }
}

/* ========== МОДАЛЬНОЕ ОКНО ========== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1001;
}

.modal-content {
    position: relative;
    z-index: 1002;
    background: white;
    border-radius: 20px;
    max-width: 700px;
    width: 95%;
    max-height: 85vh;
    overflow-y: auto;
    padding: 30px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.4);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(30px) scale(0.95);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

/* Для мобильных */
@media (max-width: 768px) {
    .modal-header {
        padding-bottom: 12px;
        margin-bottom: 16px;
        flex-direction: column;
        align-items: flex-start;
    }
}

.modal-header h3 {
    margin: 0;
    font-size: 20px;
    color: #2d3748;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #a0aec0;
    transition: all 0.2s;
    line-height: 1;
}

.modal-close:hover {
    color: #e53e3e;
    transform: rotate(90deg);
}

/* ===== ГРУППЫ В МОДАЛКЕ ===== */
.current-grade-block {
    background: #f7fafc;
    padding: 15px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.current-grade-block p {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.grade-select-block {
    margin-bottom: 25px;
}

.grade-select-block p {
    margin: 0 0 10px 0;
    font-weight: 600;
}

.grade-buttons-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.grade-btn {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);  /* Вместо 50% или 12px */
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.grade-btn:hover {
    background: var(--border-light);
    border-color: var(--info);
    transform: none;
}

.grade-btn[data-grade="П"]:hover { background: #48bb78; color: white; border-color: #48bb78; }
.grade-btn[data-grade="В"]:hover { background: #68d391; color: white; border-color: #68d391; }
.grade-btn[data-grade="У"]:hover { background: #f6ad55; color: white; border-color: #f6ad55; }
.grade-btn[data-grade="С"]:hover { background: #fc8181; color: white; border-color: #fc8181; }
.grade-btn[data-grade="О"]:hover { background: #e53e3e; color: white; border-color: #e53e3e; }


.grade-message {
    margin-top: 10px;
    padding: 8px 15px;
    border-radius: 8px;
    font-weight: 500;
}

.grade-message.success {
    background: #c6f6d5;
    color: #22543d;
}

.grade-message.error {
    background: #fed7d7;
    color: #742a2a;
}

/* ===== ИСТОРИЯ И ПРЕДМЕТЫ ===== */
.history-block, .subjects-block {
    margin-top: 20px;
}

.history-block h4, .subjects-block h4 {
    margin: 0 0 12px 0;
    color: #2d3748;
    font-size: 16px;
}

/* Бейджи оценок */
.grade-badge {
    display: inline-block;
    padding: 2px 14px;
    border-radius: 16px;
    font-weight: 700;
    font-size: 14px;
    min-width: 30px;
    text-align: center;
}

.grade-badge[data-grade="П"] { background: #48bb78; color: white; }
.grade-badge[data-grade="В"] { background: #68d391; color: white; }
.grade-badge[data-grade="У"] { background: #f6ad55; color: #2d3748; }
.grade-badge[data-grade="С"] { background: #fc8181; color: white; }
.grade-badge[data-grade="О"] { background: #e53e3e; color: white; }

/* Список предметов */
.subject-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: 8px;
    background: #f7fafc;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.subject-item.active {
    background: #ebf4ff;
    border-left: 4px solid #667eea;
}

.subject-name {
    font-weight: 500;
    flex: 1;
    min-width: 100px;
}

.subject-year {
    color: #718096;
    font-size: 13px;
    margin-left: auto;
}

/* ===== ТАБЛИЦЫ ===== */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-wrap table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.table-wrap th {
    background: #f7fafc;
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    color: #2d3748;
    border-bottom: 2px solid #e2e8f0;
}

.table-wrap td {
    padding: 10px 14px;
    border-bottom: 1px solid #e2e8f0;
}

/* ===== УВЕДОМЛЕНИЯ ===== */
#notificationContainer {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.notification {
    padding: 12px 24px;
    border-radius: 12px;
    color: white;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    max-width: 400px;
}

.notification.success {
    background: linear-gradient(135deg, #48bb78, #38a169);
}

.notification.error {
    background: linear-gradient(135deg, #fc8181, #e53e3e);
}

.notification.info {
    background: linear-gradient(135deg, #667eea, #5a67d8);
}

/* ===== МОБИЛЬНЫЕ АДАПТАЦИИ ===== */
@media (max-width: 768px) {
    .modal-content {
        padding: 20px 15px;
        width: 98%;
        max-height: 90vh;
    }
    
    .modal-header h3 {
        font-size: 16px;
    }
    
    .grade-buttons-group {
        gap: 6px;
    }
    
    .table-wrap table {
        font-size: 12px;
    }
    
    .table-wrap th,
    .table-wrap td {
        padding: 6px 8px;
    }
    
    .subject-item {
        font-size: 13px;
        padding: 6px 10px;
    }
    
    .current-grade-block p {
        font-size: 14px;
    }
    
    .grade-label .full {
        display: none;
    }
    .grade-label .short {
        display: inline;
    }
}

@media (min-width: 769px) {
    .grade-label .full {
        display: inline;
    }
    .grade-label .short {
        display: none;
    }
}

.modal-header h3,
#modalStudentName,
.modal-title {
    color: var(--text-primary) !important;
}

.course-tab {
    padding: 6px 16px;
    border-radius: var(--radius-sm);  /* Вместо 20px */
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.course-tab:hover {
    border-color: var(--info);
    color: var(--text-primary);
}

.course-tab.active {
    background: var(--info);
    border-color: var(--info);
    color: white;
}

/* ===== КРАСИВЫЕ КОМПАКТНЫЕ БЕЙДЖИ ===== */

/* Бейдж "обяз" - маленький, аккуратный */
.badge-required {
    display: inline-block;
    padding: 0px 6px;
    border-radius: 3px;
    font-size: 8px;
    font-weight: 700;
    background: #f6ad55;
    color: #2d3748;
    text-transform: lowercase;
    letter-spacing: 0.2px;
    line-height: 1.6;
    border: none;
}

/* Бейдж "по выбору" - если нужно */
.badge-elective {
    display: inline-block;
    padding: 0px 6px;
    border-radius: 3px;
    font-size: 8px;
    font-weight: 700;
    background: #bee3f8;
    color: #2a4365;
    text-transform: lowercase;
    letter-spacing: 0.2px;
    line-height: 1.6;
    border: none;
}

/* Бейдж "год заблокирован" - маленький, красный */
.badge-locked {
    display: inline-block;
    padding: 0px 6px;
    border-radius: 3px;
    font-size: 8px;
    font-weight: 700;
    background: #fc8181;
    color: white;
    text-transform: lowercase;
    letter-spacing: 0.2px;
    line-height: 1.6;
    border: none;
}

/* Бейдж "текущий" для курса */
.badge-current {
    display: inline-block;
    padding: 0px 6px;
    border-radius: 3px;
    font-size: 8px;
    font-weight: 700;
    background: #48bb78;
    color: white;
    text-transform: lowercase;
    letter-spacing: 0.2px;
    line-height: 1.6;
    border: none;
}

/* Для темной темы */
@media (prefers-color-scheme: dark) {
    .badge-required {
        background: #d69e2e;
        color: #1a202c;
    }
    .badge-elective {
        background: #2b6cb0;
        color: #e2e8f0;
    }
    .badge-locked {
        background: #e53e3e;
        color: white;
    }
    .badge-current {
        background: #38a169;
        color: white;
    }
}

.btn-edit-profile {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 20px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: none;
}

.btn-edit-profile:hover {
    background: var(--border-light);
    transform: none;
    box-shadow: none;
}