/* ========================================
   CSS Variables — Apple-inspired palette
   ======================================== */
:root {
    /* Основные цвета */
    --primary: #667eea;
    --primary-dark: #5a67d8;
    --secondary: #764ba2;

    /* Акцентные цвета */
    --accent-blue: #007aff;
    --accent-green: #34c759;
    --accent-orange: #ff9500;
    --accent-red: #ff3b30;
    --accent-purple: #af52de;
    --accent-teal: #5ac8fa;

    /* Нейтральные */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    /* Фоны */
    --bg-primary: #f5f5f5;
    --bg-card: rgba(255, 255, 255, 0.8);
    --bg-glass: rgba(255, 255, 255, 0.5);

    /* Тени */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.12);
    --shadow-glow: 0 0 40px rgba(102, 126, 234, 0.15);

    /* Размеры */
    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 17px;
    --radius-full: 9999px;

    /* Анимации */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s ease;
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display',
                 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--bg-primary);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* ========================================
   Background gradient
   ======================================== */
.bg-gradient-blur {
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background:
        radial-gradient(circle at 20% 20%, rgba(102, 126, 234, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(118, 75, 162, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 60%, rgba(90, 200, 250, 0.08) 0%, transparent 40%);
    z-index: -1;
    animation: gradientMove 20s ease infinite;
}

@keyframes gradientMove {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(2%, 2%) rotate(1deg); }
    66% { transform: translate(-1%, 1%) rotate(-1deg); }
}

/* ========================================
   Container
   ======================================== */
.container {
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ========================================
   Navbar — Glassmorphism
   ======================================== */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-glass);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    padding: 12px 0;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Navbar Brand */
.navbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--gray-900);
}

.brand-logo {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
}

@media (max-width: 480px) {
    .brand-logo {
        width: 36px;
        height: 36px;
    }

    .navbar-brand span {
        font-size: 1rem;
    }
}

.navbar-nav {
    display: flex;
    gap: 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    text-decoration: none;
    color: var(--gray-600);
    font-weight: 500;
    font-size: 0.9375rem;
    border-radius: var(--radius-full);
    transition: all var(--transition-fast);
}

.nav-link:hover {
    background: rgba(102, 126, 234, 0.1);
    color: var(--primary);
}

.nav-link i {
    font-size: 1.125rem;
}

/* Mobile nav */
@media (max-width: 480px) {
    .nav-link span {
        display: none;
    }

    .nav-link {
        padding: 10px 14px;
    }

    .nav-link i {
        font-size: 1.25rem;
    }
}

/* ========================================
   Main content
   ======================================== */
main {
    flex: 1;
    padding: 32px 0;
}

/* ========================================
   Page Header
   ======================================== */
.page-header {
    margin-bottom: 32px;
    padding-top: 27px;
}

.page-header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 8px;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: -0.02em;
    line-height: 1.3;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: nowrap;
}

.page-title i {
    color: var(--primary);
    flex-shrink: 0;
}

.page-title-text {
    word-break: keep-all;
    white-space: nowrap;
}

.page-subtitle {
    font-size: 1rem;
    color: var(--gray-500);
    margin-top: 4px;
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    background: var(--bg-card);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-full);
    color: var(--gray-600);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition-fast);
    white-space: nowrap;
    backdrop-filter: blur(10px);
    flex-shrink: 0;
}

.btn-back:hover {
    background: white;
    border-color: var(--gray-300);
    color: var(--gray-800);
    box-shadow: var(--shadow-md);
}

/* Мобильная адаптация заголовка */
@media (max-width: 480px) {
    .page-header-top {
        flex-direction: column-reverse;
        align-items: flex-start;
        gap: 12px;
    }

    .btn-back {
        align-self: flex-end;
        padding: 8px 14px;
        font-size: 0.8125rem;
    }

    .page-title {
        font-size: 1.5rem;
    }
}

/* ========================================
   Week Navigation
   ======================================== */
.week-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 32px;
    flex-wrap: wrap;
}

.week-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 12px 20px;
    background: var(--bg-card);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-full);
    color: var(--gray-700);
    font-size: 0.9375rem;
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition-fast);
    backdrop-filter: blur(10px);
}

.week-btn:hover {
    background: white;
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: var(--shadow-md);
}

.week-btn.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border-color: transparent;
    color: white;
    box-shadow: var(--shadow-glow);
}

.week-dates {
    padding: 12px 24px;
    background: white;
    border-radius: var(--radius-full);
    font-weight: 600;
    color: var(--gray-800);
    font-size: 1rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-100);
}

@media (max-width: 480px) {
    .week-nav {
        gap: 8px;
    }

    .week-dates {
        order: -1;
        width: 100%;
        text-align: center;
        border-radius: var(--radius-md);
    }

    .week-btn {
        padding: 12px 16px;
    }
}

/* ========================================
   Cards — Glass effect
   ======================================== */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: all var(--transition-normal);
}

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

/* ========================================
   Schedule Cards
   ======================================== */
.schedule-day {
    background: white;
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-100);
}

.schedule-day.is-today {
    border: 2px solid var(--accent-orange);
    box-shadow: 0 0 0 4px rgba(255, 149, 0, 0.1), var(--shadow-md);
}

.schedule-day-header {
    padding: 16px 20px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
}

.schedule-day.is-today .schedule-day-header {
    background: linear-gradient(135deg, var(--accent-orange) 0%, #f5730a 100%);
}

.schedule-day-header i {
    font-size: 1.125rem;
    opacity: 0.9;
}

.schedule-day-title {
    font-weight: 600;
    font-size: 1.0625rem;
    flex: 1;
}

.today-badge {
    background: rgba(255, 255, 255, 0.25);
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 0.8125rem;
    font-weight: 600;
}

/* Teacher schedule header */
.schedule-day.teacher-card .schedule-day-header {
    background: linear-gradient(135deg, var(--accent-green) 0%, #2da44e 100%);
}

/* ========================================
   Lesson Items
   ======================================== */
.lesson {
    padding: 20px;
    border-bottom: 1px solid #d0d0d0;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 16px;
    align-items: start;
    transition: background var(--transition-fast);
}

.lesson:last-child {
    border-bottom: none;
}

.lesson:hover {
    background: var(--gray-50);
}

.lesson.is-current {
    background: linear-gradient(135deg, rgba(52, 199, 89, 0.08) 0%, rgba(52, 199, 89, 0.04) 100%);
    border-left: 4px solid var(--accent-green);
    margin-left: -1px;
}

.lesson-time {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 80px;
}

.lesson-time-text {
    font-weight: 600;
    color: var(--primary);
    font-size: 1rem;
}

.current-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--accent-green);
    color: white;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
}

.current-badge .dot {
    width: 6px;
    height: 6px;
    background: white;
    border-radius: 50%;
    animation: pulse 1.5s ease infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.3); }
}

.lesson-content {
    min-width: 0;
}

.lesson-subject {
    font-weight: 600;
    font-size: 1.0625rem;
    color: var(--gray-800);
    margin-bottom: 8px;
    line-height: 1.4;
}

.lesson-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 20px;
    color: var(--gray-500);
    font-size: 0.9375rem;
}

.lesson-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.lesson-meta-item i {
    color: var(--gray-400);
    font-size: 1rem;
}

.lesson-meta-item.online {
    color: var(--accent-green);
}

.lesson-meta-item.online i {
    color: var(--accent-green);
}

/* Lesson type badge */
.lesson-type {
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
}

.lesson-type.lecture {
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
    color: #0369a1;
}

.lesson-type.seminar {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    color: #15803d;
}

.lesson-type.exam {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #dc2626;
}

.lesson-type.consultation {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #b45309;
}

.lesson-type.other {
    background: linear-gradient(135deg, var(--gray-100) 0%, var(--gray-200) 100%);
    color: var(--gray-600);
}

/* Mobile lesson layout */
@media (max-width: 600px) {
    .lesson {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .lesson-time {
        flex-direction: row;
        justify-content: space-between;
        width: 100%;
    }

    .lesson-type {
        align-self: flex-start;
    }
}

/* ========================================
   Empty State
   ======================================== */
.empty-state {
    text-align: center;
    padding: 60px 24px;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    background: var(--gray-100);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 2rem;
    color: var(--gray-400);
}

.empty-state h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--gray-500);
    font-size: 1rem;
}

/* ========================================
   Groups & Teachers Lists
   ======================================== */
.level-section {
    background: white;
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-100);
}

.level-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 16px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--gray-100);
}

.level-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: white;
}

.level-icon.bachelor {
    background: linear-gradient(135deg, var(--accent-blue) 0%, #0055d4 100%);
}

.level-icon.master {
    background: linear-gradient(135deg, var(--accent-green) 0%, #2da44e 100%);
}

.level-icon.specialist {
    background: linear-gradient(135deg, var(--accent-orange) 0%, #e6650a 100%);
}

.level-icon.other {
    background: linear-gradient(135deg, var(--gray-400) 0%, var(--gray-500) 100%);
}

.level-title {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--gray-800);
}

.year-section {
    margin-bottom: 20px;
}

.year-section:last-child {
    margin-bottom: 0;
}

.year-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--gray-500);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.year-title i {
    font-size: 1rem;
}

.groups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
}

.group-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px 12px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    color: var(--gray-700);
    font-size: 0.9375rem;
    font-weight: 600;
    text-decoration: none;
    transition: all var(--transition-fast);
}

.group-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Teachers list */
.letter-section {
    margin-bottom: 24px;
}

.letter-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 16px;
    padding-left: 4px;
}

.teachers-grid {
    display: grid;
    gap: 10px;
}

.teacher-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    color: var(--gray-700);
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition-fast);
}

.teacher-btn:hover {
    background: var(--gray-50);
    border-color: var(--accent-green);
    color: var(--gray-800);
    transform: translateX(4px);
}

.teacher-btn i {
    color: var(--accent-green);
    font-size: 1.25rem;
}

/* ========================================
   Home Page
   ======================================== */
.hero {
    text-align: center;
    padding: 48px 0 32px;
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 12px;
    letter-spacing: -0.03em;
    line-height: 1.1;
}

.hero-subtitle {
    font-size: 1.125rem;
    color: var(--gray-500);
    margin-bottom: 48px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.home-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    max-width: 500px;
    margin: 0 auto;
}

.home-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 32px 20px;
    text-align: center;
    text-decoration: none;
    color: var(--gray-700);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-100);
    transition: all var(--transition-normal);
}

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

.home-card:hover .home-card-icon {
    transform: scale(1.1);
}

.home-card-icon {
    width: 72px;
    height: 72px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
    margin: 0 auto 16px;
    transition: transform var(--transition-normal);
}

.home-card-icon.groups {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.3);
}

.home-card-icon.teachers {
    background: linear-gradient(135deg, var(--accent-green) 0%, #2da44e 100%);
    box-shadow: 0 8px 24px rgba(52, 199, 89, 0.3);
}

.home-card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 6px;
}

.home-card-desc {
    font-size: 0.9375rem;
    color: var(--gray-500);
}

@media (max-width: 500px) {
    .home-cards {
        grid-template-columns: 1fr;
    }

    .hero-title {
        font-size: 2rem;
    }
}

/* ========================================
   Info Banner
   ======================================== */
.info-banner {
    margin-top: 40px;
    padding: 20px 24px;
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-md);
    border: 1px solid rgba(102, 126, 234, 0.2);
    text-align: center;
    color: var(--gray-600);
    font-size: 0.9375rem;
}

.info-banner i {
    color: var(--primary);
    margin-right: 8px;
}

/* ========================================
   Footer
   ======================================== */
.footer {
    margin-top: auto;
    padding: 24px 0;
    text-align: center;
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--gray-200);
}

.footer p {
    margin: 0;
    color: var(--gray-500);
    font-size: 0.875rem;
}

.footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--transition-fast);
}

.footer a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.footer-copyright {
    margin-top: 8px !important;
    color: var(--gray-400) !important;
}

/* ========================================
   Utility classes
   ======================================== */
.text-gradient {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ========================================
   Scrollbar
   ======================================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}
