/* ==========================================================================
   Student Task Manager — redesign
   Светлая/тёмная тема через [data-theme]
   ========================================================================== */
:root {
    --bg: #f1f5f9;
    --bg-grad: radial-gradient(1200px 600px at 10% -10%, #e0e7ff 0%, transparent 60%),
               radial-gradient(1000px 500px at 110% 10%, #cffafe 0%, transparent 55%),
               linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --text: #0f172a;
    --muted: #64748b;
    --border: #e2e8f0;
    --primary: #6366f1;
    --primary-d: #4f46e5;
    --shadow: 0 10px 30px rgba(2, 6, 23, 0.07);
    --shadow-lg: 0 24px 60px rgba(2, 6, 23, 0.14);
    --radius: 18px;
}
[data-theme="dark"] {
    --bg: #020617;
    --bg-grad: radial-gradient(1200px 600px at 10% -10%, #1e1b4b 0%, transparent 55%),
               radial-gradient(1000px 500px at 110% 10%, #082f49 0%, transparent 55%),
               radial-gradient(circle at center, #0f172a 0%, #020617 100%);
    --surface: #0f172a;
    --surface-2: #1e293b;
    --text: #e2e8f0;
    --muted: #94a3b8;
    --border: #1e293b;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; }
body {
    background: var(--bg-grad), var(--bg);
    background-attachment: fixed;
    color: var(--text);
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    min-height: 100vh;
    transition: background .4s ease, color .3s ease;
}

/* ---------- Navbar ---------- */
.app-navbar {
    background: rgba(15, 23, 42, .92);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(99, 102, 241, .35);
    box-shadow: 0 6px 24px rgba(2, 6, 23, .18);
    padding: .6rem 0;
}
.brand-logo { font-size: 1.5rem; }
.brand-text { color: #fff; font-weight: 800; letter-spacing: -.3px; font-size: 1.15rem; }
.clock {
    color: #cbd5e1; font-variant-numeric: tabular-nums; font-size: .85rem;
    background: rgba(255,255,255,.06); padding: .3rem .6rem; border-radius: 10px;
    border: 1px solid rgba(255,255,255,.08);
}
.theme-btn { border-radius: 10px; }
.lang-switch .btn { border-radius: 10px; font-weight: 700; }
.user-chip {
    background: rgba(255,255,255,.08); color: #fff; border: 1px solid rgba(255,255,255,.12);
    border-radius: 14px; padding: .3rem .6rem;
}
.user-chip:hover { background: rgba(255,255,255,.16); color: #fff; }
.role-label { color: #a5b4fc; font-size: .72rem; }
.avatar {
    width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
    font-weight: 800; color: #fff; font-size: .82rem;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
}
.avatar-admin { background: linear-gradient(135deg, #ef4444, #b91c1c); }
.avatar-teacher { background: linear-gradient(135deg, #f59e0b, #d97706); }
.avatar-student { background: linear-gradient(135deg, #10b981, #059669); }

/* ---------- Заголовки ---------- */
.page-title { font-weight: 800; letter-spacing: -.6px; color: var(--text); }

/* ---------- Цитата ---------- */
.quote-container {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    border-radius: 22px; padding: 1.6rem 2rem; position: relative;
    box-shadow: 0 20px 40px rgba(79, 70, 229, .25);
}
[data-theme="dark"] .quote-container {
    background: linear-gradient(135deg, #1e1b4b, #312e81);
    box-shadow: 0 20px 40px rgba(0,0,0,.4); border: 1px solid rgba(245,158,11,.15);
}
.quote-text {
    color: #fff; font-weight: 700; font-size: 1.05rem; letter-spacing: .5px; line-height: 1.6;
}
[data-theme="dark"] .quote-text { color: #fcd34d; text-shadow: 0 0 16px rgba(245,158,11,.4); }
.quote-icon { font-family: Georgia, serif; font-size: 2.4rem; color: rgba(255,255,255,.3); line-height: 0; }

/* ---------- Карточки/общее ---------- */
.card-soft {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem;
}
.filter-bar { padding: 1rem 1.25rem; }

/* ---------- Статистика ---------- */
.stat-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 1.1rem 1.25rem; display: flex; align-items: center; gap: 1rem;
    transition: transform .25s ease, box-shadow .25s ease; height: 100%;
}
.stat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.stat-ico {
    width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center;
    font-size: 1.5rem; color: #fff; flex-shrink: 0;
}
.stat-total .stat-ico { background: linear-gradient(135deg, #6366f1, #4f46e5); }
.stat-done  .stat-ico { background: linear-gradient(135deg, #10b981, #059669); }
.stat-pend  .stat-ico { background: linear-gradient(135deg, #f59e0b, #d97706); }
.stat-over  .stat-ico { background: linear-gradient(135deg, #ef4444, #b91c1c); }
.stat-card > div:last-child { min-width: 0; }
.stat-num { font-size: 1.7rem; font-weight: 800; line-height: 1; color: var(--text); }
.stat-lbl { color: var(--muted); font-size: .82rem; font-weight: 600; line-height: 1.2; }

/* Селекты фильтра: не вылезать за рамки при длинном тексте */
.filter-bar .form-select { text-overflow: ellipsis; }

/* ---------- Прогресс ---------- */
.progress { background: var(--border); border-radius: 30px; overflow: hidden; }
.progress-bar {
    background: linear-gradient(90deg, #10b981, #34d399); border-radius: 30px;
    font-weight: 700; transition: width .6s cubic-bezier(.34,1.56,.64,1);
}

/* ---------- Задачи ---------- */
.task-card {
    background: var(--surface); border: 1px solid var(--border);
    border-left: 5px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 1.2rem; height: 100%;
    display: flex; flex-direction: column; gap: .55rem;
    transition: transform .3s cubic-bezier(.34,1.56,.64,1), box-shadow .3s ease;
}
.task-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }
.task-card.prio-high   { border-left-color: #ef4444; }
.task-card.prio-medium { border-left-color: #f59e0b; }
.task-card.prio-low    { border-left-color: #10b981; }
.task-card.is-done { opacity: .68; }
.task-card.is-done .task-title { text-decoration: line-through; }
.task-top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.subject-pill {
    background: color-mix(in srgb, var(--pill) 16%, transparent);
    color: var(--pill); border: 1px solid color-mix(in srgb, var(--pill) 35%, transparent);
    font-weight: 700; font-size: .74rem; padding: .2rem .6rem; border-radius: 30px;
}
.prio-badge { font-size: .72rem; font-weight: 700; padding: .2rem .55rem; border-radius: 30px; color: #fff; }
.prio-badge-high { background: #ef4444; }
.prio-badge-medium { background: #f59e0b; }
.prio-badge-low { background: #10b981; }
.task-title { font-size: 1.12rem; font-weight: 800; color: var(--text); margin: 0; letter-spacing: -.3px; }
.task-desc { color: var(--muted); font-size: .9rem; margin: 0; }
.task-meta { display: flex; flex-wrap: wrap; gap: .8rem; color: var(--muted); font-size: .85rem; }
.countdown { font-weight: 700; }
.countdown.warn { color: #f59e0b; }
.countdown.danger { color: #ef4444; }
.task-owner { color: var(--muted); font-size: .83rem; }
.task-actions { display: flex; gap: .4rem; margin-top: auto; padding-top: .5rem; flex-wrap: wrap; }
/* В карточках кнопка «выполнено» — иконка с подсказкой (одинаковая ширина во всех языках) */
.btn-toggle-label { display: none; }
.task-actions .btn { flex-shrink: 0; }

/* ---------- Пустое состояние ---------- */
.empty-state {
    background: var(--surface); border: 1px dashed var(--border);
    border-radius: var(--radius); padding: 3rem 1rem;
}
.empty-ico { font-size: 3rem; }

/* ---------- Pomodoro ---------- */
.pomodoro-card {
    background: radial-gradient(circle at top right, #1e1e38, #0f0f1a);
    color: #fff; border-radius: 26px; padding: 2rem; box-shadow: var(--shadow-lg);
}
.pomodoro-title { font-weight: 800; }
.pomodoro-time { font-size: 4rem; font-weight: 800; font-variant-numeric: tabular-nums; }

/* ---------- Формы ---------- */
.form-control, .form-select {
    border-radius: 12px; border: 1px solid var(--border);
    background: var(--surface); color: var(--text);
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary); box-shadow: 0 0 0 4px rgba(99,102,241,.18);
    background: var(--surface); color: var(--text);
}
.form-label { font-weight: 600; color: var(--text); }
.input-group-text { background: var(--surface-2); border-color: var(--border); color: var(--muted); border-radius: 12px 0 0 12px; }
.form-wrap, .progress-wrap { max-width: 760px; }
.form-card { padding: 1.75rem; }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-d); border-color: var(--primary-d); }
.btn-create { border-radius: 12px; font-weight: 700; }

/* ==========================================================================
   Страница входа
   ========================================================================== */
.auth-body {
    min-height: 100vh; margin: 0; display: grid; place-items: center; padding: 1.5rem;
    background: radial-gradient(900px 500px at 20% 0%, #312e81 0%, transparent 55%),
                radial-gradient(900px 500px at 100% 100%, #0e7490 0%, transparent 55%),
                linear-gradient(135deg, #0f172a, #020617);
}
.lang-switch-fixed { position: fixed; top: 1rem; right: 1rem; }
.lang-switch-fixed .btn { border-radius: 10px; font-weight: 700; }
.auth-wrap { width: 100%; max-width: 440px; }
.auth-card {
    background: var(--surface); border-radius: 26px; padding: 2.2rem;
    box-shadow: 0 30px 80px rgba(0,0,0,.45);
}
.auth-logo {
    width: 64px; height: 64px; margin: 0 auto .8rem; border-radius: 18px;
    display: grid; place-items: center; font-size: 2rem;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    box-shadow: 0 12px 30px rgba(79,70,229,.4);
}
.auth-title { font-weight: 800; font-size: 1.6rem; margin: 0; color: var(--text); }
.auth-sub { color: var(--muted); margin-bottom: 1.5rem; }
.auth-form .form-label { font-size: .88rem; }
.btn-signin { border-radius: 12px; font-weight: 700; }

.quick-divider { display: flex; align-items: center; gap: .8rem; margin: 1.5rem 0 .4rem; color: var(--muted); font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.quick-divider::before, .quick-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.quick-hint { color: var(--muted); font-size: .82rem; margin-bottom: 1rem; }
.quick-grid { display: flex; flex-direction: column; gap: .6rem; }
.quick-btn {
    display: flex; align-items: center; gap: .9rem; text-decoration: none;
    background: var(--surface-2); border: 1px solid var(--border); border-radius: 16px;
    padding: .8rem 1rem; color: var(--text); transition: all .2s ease;
}
.quick-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--primary); }
.quick-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 1.25rem; color: #fff; flex-shrink: 0; }
.quick-admin .quick-icon { background: linear-gradient(135deg, #ef4444, #b91c1c); }
.quick-teacher .quick-icon { background: linear-gradient(135deg, #f59e0b, #d97706); }
.quick-student .quick-icon { background: linear-gradient(135deg, #10b981, #059669); }
.quick-meta { display: flex; flex-direction: column; flex: 1; }
.quick-role { font-weight: 700; }
.quick-name { color: var(--muted); }
.quick-go { font-size: 1.3rem; color: var(--muted); }
.quick-btn:hover .quick-go { color: var(--primary); }

/* ---------- Навбар: устойчивость к длине текста ---------- */
.brand { min-width: 0; flex-shrink: 1; overflow: hidden; }
.brand-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }
.nav-toolbar .user-chip { max-width: 220px; }
.user-chip .text-start { min-width: 0; overflow: hidden; }
.user-chip .fw-semibold,
.user-chip .role-label {
    display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px;
}
.lang-switch .btn { min-width: 38px; }

/* ---------- Навигация по разделам ---------- */
.nav-links { margin-left: .5rem; }
.nav-pill {
    color: #cbd5e1; text-decoration: none; padding: .4rem .7rem; border-radius: 10px;
    font-weight: 600; font-size: .9rem; display: inline-flex; align-items: center;
    transition: all .2s ease;
}
.nav-pill:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-pill.active { background: var(--primary); color: #fff; }
.avatar-lg { width: 64px; height: 64px; font-size: 1.4rem; border-radius: 18px; }

/* ---------- Бейджи / роль-чипы ---------- */
.badge-soft { background: var(--surface); border: 1px solid var(--border); color: var(--muted);
    border-radius: 30px; padding: .35rem .9rem; font-weight: 700; font-size: .85rem; }
.role-chip { font-size: .75rem; font-weight: 700; padding: .2rem .6rem; border-radius: 30px; color: #fff; display: inline-block; }
.role-chip-admin { background: #ef4444; }
.role-chip-teacher { background: #f59e0b; }
.role-chip-student { background: #10b981; }
.assigned-tag { font-size: .75rem; color: var(--muted); font-weight: 600; }

/* ---------- Таблицы ---------- */
.data-table { color: var(--text); }
.data-table thead th { color: var(--muted); font-size: .78rem; text-transform: uppercase;
    letter-spacing: .4px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.data-table td, .data-table th { border-color: var(--border); padding: .85rem 1rem; }
.data-table tbody tr:hover { background: var(--surface-2); }
.table-hover > tbody > tr:hover > * { color: var(--text); }
.color-dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; margin-right: .4rem; vertical-align: middle; border: 1px solid var(--border); }

/* ---------- Студенты ---------- */
.group-head { font-weight: 800; color: var(--text); border-left: 4px solid var(--primary);
    padding-left: .6rem; margin-bottom: 1rem; }
.student-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 1.1rem; transition: transform .25s ease, box-shadow .25s ease; }
.student-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.student-stats { display: flex; gap: 1rem; font-size: .82rem; color: var(--muted); flex-wrap: wrap; }
.student-stats b { color: var(--text); }

/* ---------- Деталь задачи ---------- */
.detail-wrap { max-width: 820px; }
.detail-card { cursor: default; }
.detail-card:hover { transform: none; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem 1.5rem; margin-top: 1rem; }
.detail-grid .dl { display: block; color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .4px; }
.detail-grid .dv { font-weight: 600; color: var(--text); }
.task-link { color: inherit; text-decoration: none; }
.task-link:hover { color: var(--primary); }

/* ---------- Комментарии ---------- */
.comment-item { display: flex; gap: .8rem; padding: .8rem 0; border-bottom: 1px solid var(--border); }
.comment-item:last-child { border-bottom: none; }
.comment-head { display: flex; align-items: center; gap: .6rem; margin-bottom: .2rem; flex-wrap: wrap; }
.comment-role { font-size: .7rem; font-weight: 700; color: var(--muted); }
.comment-date { font-size: .75rem; color: var(--muted); }
.comment-body { flex: 1; }
.comment-body p { color: var(--text); }

/* ---------- Назначение ---------- */
.assign-box { background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; padding: 1rem; }
.assign-toggle .btn { font-weight: 600; }
