/* Все CSS стили из предыдущей версии */
* {margin: 0; padding: 0; box-sizing: border-box;}
/* Полный и исправленный стиль модального окна */
.modal {
    display: none; /* Скрыто по умолчанию */
    position: fixed;
    z-index: 9999; /* Поверх всего */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.7); /* Затемнение фона */
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px); /* Размытие заднего фона */
}
@media (max-width: 768px) {
    .dashboard-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 15px;
    }

    .card {
        width: 100%;
        margin-bottom: 10px;
    }
}
/* Это заставит окно появиться */
.modal.active {
    display: flex !important;
}

/* Стили для белого/темного блока внутри модалки */
.modal-content {
    background-color: var(--bg-card);
    margin: auto;
    padding: 2rem;
    border: 1px solid var(--border);
    width: 90%;
    max-width: 500px;
    border-radius: 24px;
    position: relative;
    box-shadow: 0 20px 60px var(--shadow);
}

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

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s;
}

.close-btn:hover {
    color: var(--danger);
}
:root {
    --bg-primary: #0f0f1e; --bg-secondary: #1a1a2e; --bg-card: #16213e;
    --text-primary: #e4e4e7; --text-secondary: #a1a1aa;
    --accent-1: #6366f1; --success: #10b981; --warning: #f59e0b; --danger: #ef4444;
    --border: #27272a; --shadow: rgba(0, 0, 0, 0.3);
    --gradient-1: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
}

[data-theme="light"] {
    --bg-primary: #f8fafc; --bg-secondary: #ffffff; --bg-card: #ffffff;
    --text-primary: #0f172a; --text-secondary: #64748b;
    --border: #e2e8f0; --shadow: rgba(0, 0, 0, 0.08);
}

[data-theme="colorful"] {
    --bg-primary: #fff5f7; --bg-secondary: #ffe8ec; --bg-card: #ffffff;
    --text-primary: #1a0a14; --text-secondary: #8b5a7d;
    --accent-1: #ff6b9d; --success: #00d9ff; --warning: #ff6b9d;
    --border: #ffd6e0; --shadow: rgba(255, 107, 157, 0.15);
    --gradient-1: linear-gradient(135deg, #ff6b9d 0%, #c44569 100%);
}

body {font-family: 'Manrope', sans-serif; background: var(--bg-primary); color: var(--text-primary); line-height: 1.6; transition: all 0.3s ease;}

.login-screen {min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 2rem;}
.login-card {background: var(--bg-card); border-radius: 24px; padding: 3rem; max-width: 450px; width: 100%; box-shadow: 0 20px 60px var(--shadow); border: 1px solid var(--border);}
.login-logo {width: 80px; height: 80px; background: var(--gradient-1); border-radius: 20px; display: flex; align-items: center; justify-content: center; font-size: 3rem; margin: 0 auto 1.5rem; animation: float 3s ease-in-out infinite;}
.login-title {font-size: 2rem; font-weight: 800; background: var(--gradient-1); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; margin-bottom: 0.5rem; text-align: center;}
.login-subtitle {color: var(--text-secondary); margin-bottom: 2rem; text-align: center;}

.btn-primary, .btn-secondary {width: 100%; padding: 1rem; border-radius: 12px; font-size: 1rem; font-weight: 600; cursor: pointer; transition: all 0.3s; border: none; display: flex; align-items: center; justify-content: center; gap: 0.5rem; margin-top: 1rem;}
.btn-primary {background: var(--gradient-1); color: white; box-shadow: 0 10px 30px rgba(99, 102, 241, 0.3);}
.btn-primary:hover {transform: translateY(-2px); box-shadow: 0 15px 40px rgba(99, 102, 241, 0.4);}
.btn-secondary {background: var(--bg-primary); color: var(--text-primary); border: 1px solid var(--border);}
.btn-secondary:hover {background: var(--bg-secondary);}

.input-group {margin-bottom: 1rem;}
.input-group label {display: block; margin-bottom: 0.5rem; font-weight: 600; font-size: 0.9rem; color: var(--text-secondary);}
.input-group input {width: 100%; padding: 0.75rem; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-primary); color: var(--text-primary); font-family: inherit; font-size: 0.95rem;}
.input-group input:focus {outline: none; border-color: var(--accent-1); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);}

.alert {padding: 1rem; border-radius: 10px; margin-bottom: 1rem; display: flex; align-items: center; gap: 0.75rem;}
.alert-info {background: rgba(99, 102, 241, 0.15); border: 1px solid var(--accent-1); color: var(--accent-1);}
.alert-success {background: rgba(16, 185, 129, 0.15); border: 1px solid var(--success); color: var(--success);}
.alert i {font-size: 1.5rem;}

.app-container {min-height: 100vh; display: flex; flex-direction: column;}
.header {background: var(--bg-secondary); border-bottom: 1px solid var(--border); padding: 1.5rem 2rem; display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; z-index: 100; box-shadow: 0 4px 6px var(--shadow);}
.logo {display: flex; align-items: center; gap: 1rem;}
.logo-icon {width: 40px; height: 40px; background: var(--gradient-1); border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; animation: float 3s ease-in-out infinite;}
@keyframes float {0%, 100% {transform: translateY(0px);} 50% {transform: translateY(-5px);}}
.logo h1 {font-size: 1.5rem; font-weight: 800; background: var(--gradient-1); -webkit-background-clip: text; -webkit-text-fill-color: transparent;}

.header-actions {display: flex; align-items: center; gap: 1rem;}
.user-info {display: flex; align-items: center; gap: 0.75rem; background: var(--bg-card); padding: 0.5rem 1rem; border-radius: 12px; border: 1px solid var(--border);}
.user-avatar {width: 32px; height: 32px; border-radius: 50%; background: var(--gradient-1); display: flex; align-items: center; justify-content: center; font-weight: 600;}
.theme-switcher {display: flex; gap: 0.5rem; background: var(--bg-card); padding: 0.5rem; border-radius: 12px; border: 1px solid var(--border);}
.theme-btn {width: 40px; height: 40px; border: none; border-radius: 8px; cursor: pointer; font-size: 1.2rem; transition: all 0.2s; display: flex; align-items: center; justify-content: center; background: transparent; color: var(--text-primary);}
.theme-btn:hover {transform: translateY(-2px);}
.theme-btn.active {background: var(--accent-1); color: white;}
.btn-icon {background: var(--bg-card); border: 1px solid var(--border); color: var(--text-primary); width: 40px; height: 40px; border-radius: 10px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s;}
.btn-icon:hover {background: var(--accent-1); color: white; transform: translateY(-2px);}

.main-content {flex: 1; padding: 2rem; max-width: 1400px; margin: 0 auto; width: 100%;}
.dashboard-grid {display: grid; grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); gap: 1.5rem; margin-top: 2rem;}
.card {background: var(--bg-card); border-radius: 20px; padding: 1.5rem; border: 1px solid var(--border); box-shadow: 0 10px 30px var(--shadow); transition: all 0.3s; position: relative; overflow: hidden;}
.card:hover {transform: translateY(-5px); box-shadow: 0 20px 40px var(--shadow);}
.card-header {display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem;}
.card-title {display: flex; align-items: center; gap: 0.75rem; font-size: 1.25rem; font-weight: 700;}
.card-icon {width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.25rem;}
.schedule-icon {background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%); color: white;}
.homework-icon {background: linear-gradient(135deg, #ec4899 0%, #f59e0b 100%); color: white;}
.deadline-icon {background: linear-gradient(135deg, #ef4444 0%, #f97316 100%); color: white;}
.grades-icon {background: linear-gradient(135deg, #10b981 0%, #3b82f6 100%); color: white;}
.birthday-icon {background: linear-gradient(135deg, #f59e0b 0%, #ec4899 100%); color: white;}
.holidays-icon {background: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%); color: white;}

.btn {border: none; background: var(--accent-1); color: white; padding: 0.5rem 1rem; border-radius: 10px; cursor: pointer; font-size: 0.9rem; font-weight: 600; transition: all 0.2s; display: flex; align-items: center; gap: 0.5rem;}
.btn:hover {transform: translateY(-2px); box-shadow: 0 5px 15px var(--shadow);}
.btn-sm {padding: 0.4rem 0.8rem; font-size: 0.85rem;}

.day-navigation {display: flex; justify-content: space-between; align-items: center; background: var(--bg-primary); padding: 1rem; border-radius: 12px; margin-bottom: 1rem;}
.day-nav-btn {background: var(--bg-card); border: 1px solid var(--border); color: var(--text-primary); width: 36px; height: 36px; border-radius: 8px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s;}
.day-nav-btn:hover:not(:disabled) {background: var(--accent-1); color: white;}
.day-nav-btn:disabled {opacity: 0.3; cursor: not-allowed;}
.current-day {font-weight: 700; font-size: 1.1rem; text-align: center; flex: 1;}

.lesson-list {display: flex; flex-direction: column; gap: 0.75rem;}
.lesson-item {background: var(--bg-primary); padding: 1rem; border-radius: 12px; border: 1px solid var(--border); display: flex; gap: 1rem; align-items: center; transition: all 0.2s;}
.lesson-item:hover {border-color: var(--accent-1); transform: translateX(5px);}
.lesson-time {font-weight: 700; color: var(--accent-1); font-family: 'JetBrains Mono', monospace; min-width: 80px;}
.lesson-name {flex: 1; font-weight: 600;}

.empty-state {text-align: center; padding: 2rem; color: var(--text-secondary);}
.empty-state i {font-size: 3rem; margin-bottom: 1rem; opacity: 0.3;}

.loader {position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.8); display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 9999;}
.spinner {border: 4px solid var(--border); border-top: 4px solid var(--accent-1); border-radius: 50%; width: 50px; height: 50px; animation: spin 1s linear infinite;}
@keyframes spin {0% {transform: rotate(0deg);} 100% {transform: rotate(360deg);}}
.loader p {color: white; margin-top: 1rem; font-weight: 600;}

.homework-item, .deadline-item, .birthday-item {background: var(--bg-primary); padding: 1rem; border-radius: 12px; margin-bottom: 0.75rem; display: flex; justify-content: space-between; align-items: center; transition: all 0.2s; border: 1px solid var(--border);}
.homework-item:hover, .deadline-item:hover, .birthday-item:hover {transform: translateX(5px); border-color: var(--accent-1);}
.homework-item.completed {opacity: 0.6; text-decoration: line-through;}

.checkbox {width: 24px; height: 24px; border: 2px solid var(--border); border-radius: 6px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s; flex-shrink: 0;}
.checkbox.checked {background: var(--success); border-color: var(--success);}
.checkbox.checked::after {content: '✓'; color: white; font-weight: bold;}

.grade-calculator {background: var(--bg-primary); padding: 1.5rem; border-radius: 12px; margin-bottom: 1rem;}
.grade-buttons {display: flex; gap: 0.5rem; margin-bottom: 1rem;}
.grade-btn {flex: 1; padding: 1rem; font-size: 1.5rem; font-weight: 700; border: 2px solid var(--border); background: var(--bg-card); color: var(--text-primary); border-radius: 12px; cursor: pointer; transition: all 0.2s;}
.grade-btn:hover {transform: scale(1.05); border-color: var(--accent-1);}
.grade-display {padding: 1rem; background: var(--bg-card); border-radius: 10px; text-align: center; font-family: 'JetBrains Mono', monospace; font-size: 1.2rem; margin-bottom: 1rem; min-height: 60px;}
.average-display {font-size: 2rem; font-weight: 800; background: var(--gradient-1); -webkit-background-clip: text; -webkit-text-fill-color: transparent;}

.date-badge {display: inline-block; background: var(--accent-1); color: white; padding: 0.25rem 0.75rem; border-radius: 20px; font-size: 0.85rem; font-weight: 600;}
.delete-btn {background: var(--danger); border: none; color: white; padding: 0.5rem; border-radius: 8px; cursor: pointer; transition: all 0.2s; flex-shrink: 0;}
.delete-btn:hover {transform: scale(1.1);}

.stats-grid {display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; margin-top: 1rem;}
.stat-card {background: var(--bg-primary); padding: 1rem; border-radius: 10px; text-align: center;}
.stat-value {font-size: 2rem; font-weight: 800; background: var(--gradient-1); -webkit-background-clip: text; -webkit-text-fill-color: transparent;}
.stat-label {font-size: 0.85rem; color: var(--text-secondary); margin-top: 0.25rem;}

.holiday-item {background: var(--bg-primary); padding: 1rem; border-radius: 10px; margin-bottom: 0.75rem; border-left: 4px solid var(--accent-1);}
.holiday-name {font-weight: 600; margin-bottom: 0.25rem;}
.holiday-dates {color: var(--text-secondary); font-size: 0.9rem;}

@media (max-width: 768px) {
    .dashboard-grid {grid-template-columns: 1fr;}
    .header {flex-direction: column; gap: 1rem; align-items: stretch;}
    .header-actions {justify-content: space-between;}
}
