:root {
    --bg-main: #0f172a;
    --bg-card: #1e293b;
    --primary: #3b82f6;
    --primary-glow: rgba(59, 130, 246, 0.4);
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --nav-bg: rgba(30, 41, 59, 0.8); /* Glass */
    
    /* Colors */
    --g1: #22c55e; --g2: #84cc16; --g3: #eab308; --g4: #f97316; --g5: #ef4444;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Inter', sans-serif; }
body { background: var(--bg-main); color: var(--text-main); height: 100vh; overflow: hidden; }

/* --- VIEWS LOGIC --- */
.view { display: none; height: 100%; width: 100%; }
.view.active { display: flex; }

/* --- LOGIN SCREEN --- */
#loginView { justify-content: center; align-items: center; padding: 20px; }
.login-container {
    width: 100%; max-width: 400px;
    background: var(--bg-card);
    padding: 40px 30px;
    border-radius: 24px;
    border: 1px solid rgba(255,255,255,0.05);
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}
.login-header { text-align: center; margin-bottom: 30px; }
.login-header h1 { font-size: 2rem; font-weight: 700; margin-bottom: 5px; }
.input-group { position: relative; margin-bottom: 15px; }
.input-group i { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 1.2rem; }
.input-group input {
    width: 100%; padding: 14px 14px 14px 45px;
    background: #0f172a; border: 1px solid #334155;
    border-radius: 12px; color: white; outline: none; transition: 0.3s;
}
.input-group input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }
button {
    width: 100%; padding: 14px; background: var(--primary); color: white;
    border: none; border-radius: 12px; font-weight: 600; cursor: pointer;
    transition: 0.3s; display: flex; justify-content: center; align-items: center;
}
button:hover { background: #2563eb; transform: translateY(-2px); }

/* --- MAIN APP LAYOUT --- */
#appView { flex-direction: column; } /* Mobile first: column */

/* NAVIGATION (Responsive) */
.navbar {
    background: var(--nav-bg);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255,255,255,0.05);
    z-index: 100;
}
.nav-brand { display: none; } /* Скрыто на мобилках */

/* Mobile Bottom Bar */
@media (max-width: 768px) {
    #appView { flex-direction: column-reverse; } /* Nav снизу */
    .navbar { height: 70px; display: flex; justify-content: space-around; align-items: center; width: 100%; flex-shrink: 0; }
    .nav-links { display: flex; width: 100%; justify-content: space-around; list-style: none; }
    .nav-links li {
        display: flex; flex-direction: column; align-items: center; gap: 4px;
        color: var(--text-muted); font-size: 0.75rem; cursor: pointer; transition: 0.3s;
    }
    .nav-links li i { font-size: 1.5rem; margin-bottom: 2px; }
    .nav-links li.active { color: var(--primary); transform: translateY(-2px); }
}

/* Desktop Sidebar */
@media (min-width: 769px) {
    #appView { flex-direction: row; }
    .navbar {
        width: 250px; height: 100%; display: flex; flex-direction: column; padding: 30px;
        border-right: 1px solid rgba(255,255,255,0.05); border-top: none;
    }
    .nav-brand {
        display: flex; align-items: center; gap: 10px; font-size: 1.5rem; font-weight: 800;
        margin-bottom: 50px; color: white;
    }
    .nav-links { list-style: none; display: flex; flex-direction: column; gap: 10px; }
    .nav-links li {
        display: flex; align-items: center; gap: 15px; padding: 14px 20px;
        color: var(--text-muted); border-radius: 12px; cursor: pointer; transition: 0.3s; font-weight: 500;
    }
    .nav-links li:hover { background: rgba(255,255,255,0.05); color: white; }
    .nav-links li.active { background: var(--primary); color: white; box-shadow: 0 10px 20px var(--primary-glow); }
    .nav-links li i { font-size: 1.3rem; }
}

/* --- CONTENT AREA --- */
.content {
    flex: 1; height: 100%; overflow-y: auto; overflow-x: hidden;
    padding: 20px; position: relative; scroll-behavior: smooth;
}
@media (min-width: 769px) { .content { padding: 40px; } }

/* HEADER */
.top-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; }
.top-header h2 { font-size: 1.8rem; font-weight: 700; }
.refresh-btn-icon {
    width: 40px; height: 40px; border-radius: 50%; background: var(--bg-card);
    border: 1px solid rgba(255,255,255,0.1); color: var(--text-muted);
    font-size: 1.2rem; cursor: pointer;
}
.refresh-btn-icon:hover { color: white; background: var(--primary); border-color: var(--primary); }

/* --- TABS SYSTEM --- */
.tab-content { display: none; animation: fadeIn 0.3s ease; }
.tab-content.active { display: block; }

/* --- COMPONENTS --- */

/* CHART */
.chart-container {
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    border-radius: 24px; padding: 20px; height: 350px;
    border: 1px solid rgba(255,255,255,0.05);
    box-shadow: 0 20px 40px -10px rgba(0,0,0,0.3);
    margin-bottom: 30px;
}

/* SUBJECT CARD */
.subject-card {
    background: var(--bg-card); border-radius: 16px; padding: 20px;
    margin-bottom: 15px; border: 1px solid rgba(255,255,255,0.05);
    transition: transform 0.2s;
}
.subject-card:hover { transform: translateY(-2px); border-color: rgba(255,255,255,0.1); }

.subject-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.subject-name { font-weight: 700; font-size: 1.1rem; }
.subject-header-left { display: flex; align-items: center; }

/* BADGES */
.final-badge {
    padding: 4px 10px; border-radius: 8px; font-weight: 700; font-size: 0.9rem; margin-left: 10px;
}
.final-official { background: #22c55e; color: #022c22; }
.final-predicted { border: 1px dashed #64748b; color: #94a3b8; }

.subject-avg { 
    background: #0f172a; padding: 6px 12px; border-radius: 8px; font-weight: 700; cursor: pointer;
}

/* CHIPS */
.grades-row { display: flex; flex-wrap: wrap; gap: 8px; }
.grade-chip {
    width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
    border-radius: 8px; font-weight: 700; background: #0f172a; position: relative;
}
.weight-high { border: 2px solid currentColor; }
.weight-mid { border: 1px solid currentColor; opacity: 0.9; }
.weight-low { border: 1px dashed currentColor; opacity: 0.7; font-size: 0.8rem; }
.g-1 { color: var(--g1); } .g-2 { color: var(--g2); } .g-3 { color: var(--g3); } .g-4 { color: var(--g4); } .g-5 { color: var(--g5); }

/* SETTINGS & EMPTY STATE */
.settings-card { background: var(--bg-card); padding: 30px; border-radius: 20px; text-align: center; }
.avatar-placeholder { 
    width: 80px; height: 80px; background: var(--primary); color: white; 
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 2rem; font-weight: 800; margin: 0 auto 15px;
}
.logout-btn { background: #ef4444; margin-top: 20px; }

.empty-state { text-align: center; margin-top: 50px; color: var(--text-muted); }
.empty-state i { font-size: 4rem; margin-bottom: 20px; opacity: 0.5; }

/* MODAL */
.modal { position: fixed; top:0; left:0; width:100%; height:100%; background: rgba(0,0,0,0.8); backdrop-filter: blur(5px); z-index: 200; display: flex; justify-content: center; align-items: center; }
.hidden { display: none; }
.modal-content { background: var(--bg-card); padding: 30px; border-radius: 20px; width: 90%; max-width: 350px; text-align: center; position: relative; border: 1px solid rgba(255,255,255,0.1); }
.close-modal { position: absolute; right: 20px; top: 20px; font-size: 1.5rem; cursor: pointer; }
.goal-controls { display: flex; justify-content: center; gap: 20px; align-items: center; margin: 20px 0; }
.goal-controls span { font-size: 2.5rem; font-weight: 800; }
.goal-controls button { width: 40px; height: 40px; border-radius: 50%; font-size: 1.5rem; padding: 0; background: #334155; }
.gold-text { margin-top: 15px; background: #0f172a; padding: 15px; border-radius: 12px; }
.gold-badge { display: inline-block; padding: 5px 10px; border: 2px solid; border-radius: 8px; margin: 5px 0; font-weight: 700; }
/* Добавь в style.css */

/* Специальный стиль для body логина */
.login-body {
    display: flex; justify-content: center; align-items: center;
    height: 100vh; background: var(--bg-main);
}

/* Обертка для внутренних страниц */
#app-layout {
    display: flex;
    height: 100vh;
    width: 100%;
    overflow: hidden;
}

/* Адаптив (как мы делали раньше) */
@media (max-width: 768px) {
    #app-layout { flex-direction: column-reverse; }
}
/* ANIMATIONS */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.loader { width: 20px; height: 20px; border: 3px solid #fff3; border-top-color: #fff; border-radius: 50%; animation: spin 1s infinite linear; display: none; }
@keyframes spin { to { transform: rotate(360deg); } }