/* ============================================================
   Общие стили сайта (современный дизайн с мягкими акцентами)
   ============================================================ */

:root {
    --accent-primary: #4f46e5;    /* индиго */
    --accent-hover: #4338ca;
    --accent-success: #10b981;    /* зелёный */
    --accent-warning: #f59e0b;    /* оранжевый */
    --accent-info: #06b6d4;       /* циан */
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --bg-soft: #f9fafb;
    --border-soft: #e5e7eb;
    --shadow-soft: 0 4px 16px rgba(79, 70, 229, 0.08);
    --radius: 14px;
}

body {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text-main);
    background: #fff;
}

a { color: var(--accent-primary); }
a:hover { color: var(--accent-hover); }

/* --- Ссылки-кнопки сайта --- */
.btn-primary {
    background-color: var(--accent-primary);
    border-color: var(--accent-primary);
    border-radius: var(--radius);
}
.btn-primary:hover {
    background-color: var(--accent-hover);
    border-color: var(--accent-hover);
}
.btn-success {
    background-color: var(--accent-success);
    border-color: var(--accent-success);
    border-radius: var(--radius);
}
.btn-info {
    background-color: var(--accent-info);
    border-color: var(--accent-info);
    color: #fff;
    border-radius: var(--radius);
}
.btn-info:hover { color: #fff; }
.btn-warning {
    background-color: var(--accent-warning);
    border-color: var(--accent-warning);
    color: #fff;
    border-radius: var(--radius);
}
.btn-warning:hover { color: #fff; }

.btn-outline-dark {
    border-radius: var(--radius);
}

/* --- Карточки --- */
.card {
    border-radius: var(--radius);
    border: 1px solid var(--border-soft);
    box-shadow: var(--shadow-soft);
}

/* --- Заголовки --- */
h1, h2, h3 {
    font-weight: 700;
}

/* --- Общие мелочи --- */
.container-fluid { padding-left: 12px; padding-right: 12px; }
.compact { margin-bottom: 4px !important; }

/* ============================================================
   Меню в левой колонке (разделы с плашками)
   ============================================================ */

.sidebar-menu {
    background: var(--bg-soft);
    border-radius: var(--radius);
    padding: 12px;
}

.sidebar-section {
    margin-bottom: 18px;
}
.sidebar-section:last-child {
    margin-bottom: 0;
}

.sidebar-section-title {
    display: inline-block;
    background: var(--accent-primary);
    color: #fff;
    padding: 4px 12px;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.sidebar-menu ul {
    list-style: none;
    padding-left: 0;
    margin: 0;
}
.sidebar-menu ul li a {
    display: block;
    padding: 5px 10px;
    border-radius: 8px;
    color: var(--text-main);
    text-decoration: none;
    transition: background .12s, color .12s;
}
.sidebar-menu ul li a:hover {
    background: rgba(79, 70, 229, 0.08);
    color: var(--accent-primary);
}
.sidebar-menu ul li a.disabled {
    color: var(--text-muted);
    pointer-events: none;
    opacity: 0.55;
}

/* ============================================================
   Карточки (курсы, классы, юниты, упражнения)
   ============================================================ */

.tile {
    display: block;
    background: #fff;
    border: 2px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 14px 16px;
    text-align: center;
    text-decoration: none;
    color: var(--text-main);
    font-weight: 600;
    transition: transform .12s, box-shadow .12s, border-color .12s;
    box-shadow: var(--shadow-soft);
}
.tile:hover {
    transform: translateY(-2px);
    border-color: var(--accent-primary);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.15);
    color: var(--text-main);
}
.tile-sm {
    padding: 10px 12px;
    font-size: 0.95rem;
}

.tile-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 4px;
}
.tile-sub {
    font-size: 0.82rem;
    color: var(--text-muted);
}


/* ============================================================
   Выпадающее меню «Уроки» (hover)
   ============================================================ */

.dropdown-menu-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.dd-item {
    position: relative;
}

.dd-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 56px;
    height: 36px;
    padding: 0 14px;
    box-sizing: border-box;
    border-radius: 10px;
    background: #fff;
    border: 2px solid var(--border-soft);
    color: var(--accent-primary);
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background .12s, border-color .12s, color .12s;
    user-select: none;
    white-space: nowrap;
}
.dd-item:hover > .dd-toggle {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: #fff;
}

/* Все подменю — absolute, не влияют на layout родителя */
.dd-submenu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: auto;
    z-index: 1000;
    min-width: 140px;
    background: #fff;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(79, 70, 229, 0.15);
    padding: 6px;
    margin-top: 4px;
    list-style: none;
}
.dd-item:hover > .dd-submenu {
    display: block;
}

/* Уровень 3 (юниты) — раскрываем вправо */
.dd-submenu-right {
    top: 0;
    left: 100%;
    right: auto;
    margin-top: 0;
    margin-left: 4px;
    min-width: 200px;
    max-height: 60vh;
    overflow-y: auto;
}

/* ПРАВЫЕ курсы: flip влево */
.dd-item.dd-right > .dd-submenu {
    left: auto;
    right: 0;
}
.dd-item.dd-right .dd-submenu-right {
    left: auto;
    right: 100%;
    margin-left: 0;
    margin-right: 4px;
}

/* Мобильный: колонка, но submenu остаётся absolute */
@media (max-width: 768px) {
    .dropdown-menu-list {
        flex-direction: column;
        gap: 4px;
        width: 100%;
    }
    .dd-item {
        width: 100%;
    }
    .dd-toggle {
        display: flex;
        width: 100%;
        justify-content: space-between;
        padding: 8px 14px;
    }
    .dd-submenu {
        top: 100%;
        left: 0;
        right: 0;
        min-width: auto;
        margin-top: 2px;
        margin-left: 0;
        box-shadow: 0 4px 16px rgba(79, 70, 229, 0.12);
    }
    .dd-item.dd-right > .dd-submenu {
        left: 0;
        right: 0;
    }
    /* Level 3 на мобильном — тоже absolute, но чуть сдвинут */
    .dd-submenu-right {
        top: 100%;
        left: 12px;
        right: 12px;
        margin-left: 0;
        margin-top: 2px;
        max-height: 50vh;
    }
    .dd-item.dd-right .dd-submenu-right {
        left: 12px;
        right: 12px;
    }
}

/* ============================================================
   Dropdown «Профиль»
   ============================================================ */

.profile-dropdown {
    position: relative;
    display: inline-block;
}

.profile-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    border-radius: 10px;
    background: var(--accent-primary);
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.profile-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 1000;
    min-width: 220px;
    background: #fff;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(79, 70, 229, 0.15);
    padding: 6px;
    margin-top: 4px;
    list-style: none;
}

.profile-dropdown:hover > .profile-menu {
    display: block;
}

.profile-menu li a {
    display: block;
    padding: 8px 12px;
    border-radius: 8px;
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.92rem;
    white-space: nowrap;
}
.profile-menu li a:hover {
    background: rgba(79, 70, 229, 0.1);
    color: var(--accent-primary);
}
.profile-menu .divider {
    height: 1px;
    background: var(--border-soft);
    margin: 4px 0;
}

.stats-table .score {
    color: #0d6efd;
    font-weight: 600;
}

/* Bootstrap accordion — немного осовременим */
.accordion-button {
    font-size: 1rem;
    font-weight: 500;
    border-radius: 8px !important;
}
.accordion-button:not(.collapsed) {
    background: #eef2ff;
    color: var(--accent-primary);
    box-shadow: none;
}
.accordion-button:focus {
    box-shadow: none;
    border-color: var(--border-soft);
}

.dd-submenu.flip-right {
    left: auto;
    right: 0;
}
.dd-submenu-right.flip-right {
    left: auto;
    right: 100%;
    margin-left: 0;
    margin-right: 4px;
}