/* ═══════════════════════════════════════════════════════
   DASHBOARD.CSS — Личный кабинет
   ТвойСтарт
   ═══════════════════════════════════════════════════════ */

/* ─── Layout ─── */
.dashboard-body {
    background: var(--surface);
    min-height: 100vh;
    overflow-x: hidden;
}

.dashboard {
    display: flex;
    min-height: 100vh;
}

/* ═══════════════════════════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════════════════════════ */
.sidebar {
    width: 260px;
    background: var(--surface-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform 0.3s var(--ease-out);
    overflow-y: auto;
}

.sidebar__top {
    padding: 0 8px 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}

.sidebar__logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.sidebar__logo .logo-icon {
    font-size: 1.5rem;
}

.sidebar__logo .logo-text {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 900;
    color: var(--text);
}

.sidebar__logo .logo-accent {
    color: var(--primary);
}

/* ─── Profile Card ─── */
.sidebar__profile {
    background: linear-gradient(135deg, var(--primary-light) 0%, rgba(250, 174, 65, 0.08) 100%);
    border-radius: var(--radius-lg);
    padding: 20px 16px;
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.profile-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: 0 4px 12px rgba(237, 99, 40, 0.25);
}

.profile-avatar--sm {
    width: 36px;
    height: 36px;
    box-shadow: none;
}

.profile-avatar__letter {
    color: white;
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 900;
    line-height: 1;
}

.profile-avatar--sm .profile-avatar__letter {
    font-size: 0.9rem;
}

.profile-avatar__level {
    position: absolute;
    bottom: -4px;
    right: -4px;
    width: 22px;
    height: 22px;
    background: var(--amber);
    color: white;
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--surface-card);
}

.profile-info {
    text-align: center;
}

.profile-info__name-wrapper {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    margin-bottom: 2px;
    width: 100%;
}

.profile-info__name {
    grid-column: 2;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 130px;
}

.profile-edit-btn {
    grid-column: 3;
    justify-self: start;
    margin-left: 4px;
    opacity: 0;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s;
    background: none;
    border: none;
    display: flex;
    padding: 4px;
    border-radius: 4px;
}

.profile-info__name-wrapper:hover .profile-edit-btn {
    opacity: 0.6;
}

.profile-edit-btn:hover {
    opacity: 1 !important;
    color: var(--primary);
    background: rgba(0, 0, 0, 0.05);
}

.profile-info__level {
    font-size: 0.78rem;
    color: var(--primary);
    font-weight: 600;
}

.profile-xp {
    width: 100%;
}

.profile-xp__bar {
    height: 6px;
    background: rgba(0, 0, 0, 0.06);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: 4px;
}

.profile-xp__fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
    transition: width 0.8s var(--ease-out);
}

.profile-xp__text {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-align: center;
    display: block;
}

/* ─── Sidebar Nav ─── */
.sidebar__nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--duration) var(--ease-out);
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    font-family: var(--font-body);
}

.nav-item:hover {
    background: var(--primary-light);
    color: var(--primary);
    transform: translateX(4px);
}

.nav-item--active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 700;
    box-shadow: inset 4px 0 0 var(--primary);
    /* Left border indicator */
}

.nav-item--active .nav-item__icon {
    stroke: var(--primary);
}

.nav-item--secondary {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.nav-item__icon {
    flex-shrink: 0;
}

.sidebar__bottom {
    display: flex;
    flex-direction: column;
    gap: 4px;
    border-top: 1px solid var(--border);
    padding-top: 16px;
}

/* ═══════════════════════════════════════════════════════
   MAIN CONTENT
   ═══════════════════════════════════════════════════════ */
.main {
    flex: 1;
    margin-left: 260px;
    padding: 32px 40px;
    max-width: 1100px;
}

/* ─── Mobile Header ─── */
.main__header-mobile {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    margin-bottom: 8px;
}

.burger {
    width: 36px;
    height: 36px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
}

.burger span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: all 0.3s var(--ease-out);
}

/* ─── Greeting ─── */
.main__greeting {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 32px;
    gap: 24px;
    border-radius: var(--radius-lg);
}

.greeting__title {
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 3vw, 2rem);
    font-weight: 900;
    color: var(--text);
    line-height: 1.3;
    margin-bottom: 6px;
}

.greeting__subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
}

.greeting__stats {
    display: flex;
    gap: 12px;
    flex-shrink: 0;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    background: var(--surface-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: all var(--duration) var(--ease-out);
}

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

.stat-card__icon {
    font-size: 1.4rem;
}

.stat-card__value {
    display: block;
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 900;
    color: var(--text);
    line-height: 1;
}

.stat-card__label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* ─── Section Header ─── */
.main__section {
    margin-bottom: 32px;
    border-radius: var(--radius-lg);
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.section-header__title {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 900;
    color: var(--text);
}

.section-header__badge {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary);
    background: var(--primary-light);
    padding: 6px 14px;
    border-radius: var(--radius-full);
}

/* ═══════════════════════════════════════════════════════
   COURSE PROGRESS CARDS
   ═══════════════════════════════════════════════════════ */
.courses-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.course-progress-card {
    background: var(--surface-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    text-decoration: none;
    transition: all var(--duration) var(--ease-out);
    position: relative;
    overflow: hidden;
}

.course-progress-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--card-accent);
    opacity: 0.6;
    transition: opacity var(--duration);
}

.course-progress-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
    border-color: var(--card-accent);
}

.course-progress-card:hover::before {
    opacity: 1;
}

.course-progress-card__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.course-progress-card__icon {
    font-size: 2rem;
}

.course-progress-card__number {
    font-family: var(--font-display);
    font-size: 0.75rem;
    font-weight: 900;
    color: var(--card-accent);
    opacity: 0.4;
}

.course-progress-card__title {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 4px;
}

.course-progress-card__desc {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.course-progress-card__bar {
    height: 6px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: 10px;
}

.course-progress-card__fill {
    height: 100%;
    background: var(--card-accent);
    border-radius: var(--radius-full);
    transition: width 0.8s var(--ease-out);
}

.course-progress-card__meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.course-progress-card__lessons {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
}

.course-progress-card__status {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    padding: 3px 10px;
    background: rgba(0, 0, 0, 0.04);
    border-radius: var(--radius-full);
}

.course-progress-card__status--active {
    color: var(--primary);
    background: var(--primary-light);
}

.course-progress-card__status--done {
    color: var(--mint);
    background: rgba(154, 195, 187, 0.15);
}

/* ═══════════════════════════════════════════════════════
   WIDGETS
   ═══════════════════════════════════════════════════════ */
.main__widgets {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}

.widget {
    background: var(--surface-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: all var(--duration) var(--ease-out);
}

.widget:hover {
    box-shadow: var(--shadow-md);
}

.widget__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.widget__badge {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text);
}

.widget__counter {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
}

.widget__title {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 8px;
    line-height: 1.3;
}

.widget__desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 16px;
}

.widget__link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
    transition: gap var(--duration) var(--ease-out);
}

.widget__link:hover {
    gap: 10px;
}

/* ─── Topic Widget ─── */
.widget--topic {
    background: linear-gradient(135deg, rgba(237, 99, 40, 0.04) 0%, rgba(250, 174, 65, 0.04) 100%);
    border-color: rgba(237, 99, 40, 0.12);
}

/* ─── Achievements Widget ─── */
.achievements-preview {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.achievement-mini {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 6px;
    border-radius: var(--radius-md);
    background: rgba(0, 0, 0, 0.03);
    opacity: 0.4;
    filter: grayscale(1);
    transition: all 0.3s var(--ease-out);
}

.achievement-mini--earned {
    opacity: 1;
    filter: none;
    background: rgba(250, 174, 65, 0.08);
}

.achievement-mini__icon {
    font-size: 1.4rem;
}

.achievement-mini__name {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.2;
}

/* ─── Quick Chat Widget ─── */
.quick-chat {
    display: flex;
    gap: 8px;
}

.quick-chat__input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: var(--text);
    background: var(--surface);
    outline: none;
    transition: border-color var(--duration);
}

.quick-chat__input:focus {
    border-color: var(--primary);
}

.quick-chat__input::placeholder {
    color: var(--text-muted);
}

.quick-chat__send {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-primary);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform var(--duration) var(--ease-out), box-shadow var(--duration);
}

.quick-chat__send:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(237, 99, 40, 0.3);
}

/* ─── Sidebar Overlay ─── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 90;
    backdrop-filter: blur(4px);
}

.sidebar-overlay--visible {
    display: block;
}

/* ─── Gradient text reuse ─── */
.gradient-text {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ═══════════════════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════════════════ */
@keyframes fade-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.main__greeting {
    animation: fade-up 0.5s var(--ease-out);
}

.main__section {
    animation: fade-up 0.5s var(--ease-out) 0.1s both;
}

.main__widgets {
    animation: fade-up 0.5s var(--ease-out) 0.2s both;
}

.course-progress-card:nth-child(1) {
    animation: fade-up 0.4s var(--ease-out) 0.15s both;
}

.course-progress-card:nth-child(2) {
    animation: fade-up 0.4s var(--ease-out) 0.2s both;
}

.course-progress-card:nth-child(3) {
    animation: fade-up 0.4s var(--ease-out) 0.25s both;
}

.course-progress-card:nth-child(4) {
    animation: fade-up 0.4s var(--ease-out) 0.3s both;
}

/* ═══════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar--open {
        transform: translateX(0);
    }

    .main {
        margin-left: 0;
        padding: 24px 24px;
    }

    .main__header-mobile {
        display: flex;
    }

    .main__widgets {
        grid-template-columns: 1fr 1fr;
    }

    .widget--chat {
        grid-column: 1 / -1;
    }
}

@media (max-width: 768px) {
    .main {
        padding: 16px 20px;
    }

    .main__greeting {
        flex-direction: column;
        gap: 16px;
    }

    .greeting__stats {
        width: 100%;
    }

    .stat-card {
        flex: 1;
        padding: 12px 14px;
    }

    .courses-grid {
        grid-template-columns: 1fr;
    }

    .main__widgets {
        grid-template-columns: 1fr;
    }

    .widget--chat {
        grid-column: auto;
    }
}

@media (max-width: 480px) {
    .greeting__stats {
        flex-direction: column;
    }

    .stat-card {
        flex: auto;
    }

    .stat-card__icon {
        font-size: 1.2rem;
    }
}

/* Section Highlight Effect */
.section-highlight {
    position: relative;
}

.section-highlight::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    z-index: 10;
    animation: pulse-highlight 1.2s ease-in-out;
}

@keyframes pulse-highlight {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 107, 0, 0);
    }

    40% {
        box-shadow: 0 0 0 20px rgba(255, 107, 0, 0.2);
    }

    100% {
        box-shadow: 0 0 0 40px rgba(255, 107, 0, 0);
    }
}

/* ═══════════════════════════════════════════════════════
   CERTIFICATES
   ═══════════════════════════════════════════════════════ */
.certificates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.certificate-card {
    background: var(--surface-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: all 0.3s var(--ease-out);
    position: relative;
    overflow: hidden;
    text-decoration: none;
    color: var(--text);
}

.certificate-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--amber);
}

.certificate-card__top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.certificate-card__icon {
    font-size: 2.5rem;
    line-height: 1;
}

.certificate-card__badge {
    background: var(--amber);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 4px;
    text-transform: uppercase;
}

.certificate-card__title {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1.3;
}

.certificate-card__date {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.certificate-card__id {
    font-family: monospace;
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.03);
    padding: 6px 10px;
    border-radius: 6px;
    align-self: flex-start;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 32px;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

/* ─── Certificate Empty State ─── */
.cert-empty-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 40px 24px;
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    text-align: center;
    background: linear-gradient(135deg, rgba(237, 99, 40, 0.02) 0%, rgba(250, 174, 65, 0.02) 100%);
    transition: border-color var(--duration);
}

.cert-empty-state:hover {
    border-color: rgba(237, 99, 40, 0.3);
}

.cert-empty-state__icon {
    font-size: 2.5rem;
    opacity: 0.35;
}

.cert-empty-state__text {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-secondary);
}

.cert-empty-state__hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    max-width: 340px;
    line-height: 1.5;
}

/* ─── Leaderboard separator ─── */
.lb-separator {
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: stretch;
    padding: 4px 0;
    color: var(--text-muted);
    font-weight: 900;
    letter-spacing: 4px;
    opacity: 0.45;
    font-size: 0.75rem;
}