/* ===============================================
   STUDY HUB - DASHBOARD WORKSPACE
   A dedicated, self-contained layout system
   =============================================== */

/* ─── Layout Shell ─── */
.study-workspace {
    display: flex;
    min-height: 100vh;
    background: var(--bg-dark);
}

html[data-study-booting="true"] body,
html[data-study-booting="true"] .study-sidebar,
html[data-study-booting="true"] .study-main,
html[data-study-booting="true"] .study-theme-switcher__toggle,
html[data-study-booting="true"] .study-theme-switcher__btn {
    transition: none !important;
}

/* ─── SIDEBAR ─── */
.study-sidebar {
    width: 272px;
    min-width: 272px;
    max-width: 272px;
    height: 100vh;
    height: 100dvh; /* dynamic viewport – accounts for iPad/iPhone browser chrome */
    position: fixed;
    top: 0;
    left: 0;
    z-index: 900;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, var(--bg-surface) 0%, rgba(16, 185, 129, 0.03) 100%);
    border-right: 1px solid rgba(16, 185, 129, 0.12);
    transition: width 0.25s ease, min-width 0.25s ease, max-width 0.25s ease, transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: visible;
}

.study-overlay {
    position: fixed;
    inset: 0;
    z-index: 90;
    background: rgba(2, 6, 23, 0.62);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.study-overlay.study-overlay--active,
.study-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

[data-theme="dark"] .study-sidebar {
    background: linear-gradient(180deg, var(--bg-surface) 0%, rgba(16, 185, 129, 0.05) 100%);
    border-right: 1px solid rgba(16, 185, 129, 0.15);
}

/* ─── SIDEBAR TOGGLE BUTTON ─── */
.study-sidebar__toggle {
    position: absolute;
    top: 26px;
    right: -14px;
    width: 28px;
    height: 28px;
    background: var(--bg-surface);
    border: 1px solid rgba(16, 185, 129, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 5;
    color: var(--text-secondary);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: auto;
}

[data-theme="dark"] .study-sidebar__toggle {
    background: #1e293b;
    border-color: rgba(16, 185, 129, 0.3);
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.study-sidebar__toggle:hover {
    background: var(--accent-purple);
    color: white;
    border-color: var(--accent-purple);
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
}

.study-sidebar__toggle i {
    font-size: 0.9rem;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

:is(body.study-sidebar-collapsed, html[data-study-sidebar-collapsed="true"] body) .study-sidebar__toggle i {
    transform: rotate(180deg);
}

/* ─── BRAND ─── */
.study-sidebar__brand {
    padding: 24px 22px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    border-bottom: 1px solid rgba(16, 185, 129, 0.08);
    flex-shrink: 0;
}

.study-sidebar__brand img {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    object-fit: cover;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.study-sidebar__brand-name {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.study-sidebar__brand-tag {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ─── NAVIGATION ─── */
.study-sidebar__nav {
    flex: 1;
    min-height: 0; /* lets it shrink so the footer stays visible */
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px 12px 24px;
    scrollbar-width: thin;
    scrollbar-color: rgba(16, 185, 129, 0.2) transparent;
}

.study-sidebar__nav::-webkit-scrollbar {
    width: 4px;
}
.study-sidebar__nav::-webkit-scrollbar-thumb {
    background: var(--border-glass);
    border-radius: 4px;
}

.study-sidebar__section-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: rgba(16, 185, 129, 0.6);
    font-weight: 700;
    padding: 16px 14px 8px;
    font-family: var(--font-heading);
}

.study-sidebar__link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    margin-bottom: 3px;
    border-radius: 10px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.92rem;
    transition: all 0.2s ease;
    position: relative;
}

.study-sidebar__link i {
    font-size: 1.45rem;
    color: var(--text-muted);
    transition: color 0.2s;
    width: 28px;
    height: 28px;
    border-radius: 9px;
    background: rgba(148, 163, 184, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.study-sidebar__nav .study-sidebar__link > img {
    width: 28px !important;
    height: 28px !important;
    padding: 4px;
    border-radius: 9px !important;
    object-fit: cover;
    background: rgba(148, 163, 184, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-right: 0 !important;
    box-sizing: border-box;
    transition: background 0.2s ease, transform 0.2s ease;
}

.study-sidebar__link:hover {
    background: rgba(16, 185, 129, 0.07);
    color: var(--text-primary);
}
.study-sidebar__link:hover i {
    color: var(--accent-purple);
    background: rgba(16, 185, 129, 0.12);
}

.study-sidebar__link:hover > img {
    background: rgba(16, 185, 129, 0.12);
}

.study-sidebar__link--active {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-purple);
    font-weight: 600;
    border-radius: 12px;
    box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.2);
}
.study-sidebar__link--active i {
    color: var(--accent-purple);
    background: rgba(16, 185, 129, 0.16);
}

.study-sidebar__link--active > img {
    background: rgba(16, 185, 129, 0.16);
}


.study-sidebar__badge {
    margin-left: auto;
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-purple);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    line-height: 1.4;
}

/* ─── FOOTER ─── */
.study-sidebar__footer {
    padding: 16px;
    /* Add bottom safe-area padding for iPhone/iPad home indicator */
    padding-bottom: max(16px, env(safe-area-inset-bottom, 16px));
    border-top: 1px solid rgba(16, 185, 129, 0.1);
    flex-shrink: 0;
    background: rgba(16, 185, 129, 0.02);
}

.study-sidebar__user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--bg-surface);
    border: 1px solid rgba(16, 185, 129, 0.1);
    text-decoration: none;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}
.study-sidebar__user:hover {
    border-color: var(--accent-purple);
}

.study-sidebar__avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
    flex-shrink: 0;
}

.study-sidebar__user-name {
    display: block;
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.study-sidebar__user-role {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* Theme Switcher */
.study-theme-switcher {
    margin-top: 16px;
    background: var(--bg-dark);
    border: 1px solid var(--border-glass);
    border-radius: 14px;
    padding: 5px;
    display: flex;
    position: relative;
    gap: 4px;
}

.study-theme-switcher__btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    background: none;
    padding: 8px 10px;
    border-radius: 10px;
    cursor: pointer;
    z-index: 2;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-muted);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.82rem;
}
.study-theme-switcher__btn.active { color: #fff; }
.study-theme-switcher__btn i { font-size: 1.15rem; transition: transform 0.3s; }
.study-theme-switcher__btn:hover { color: var(--text-primary); }
.study-theme-switcher__btn.active i { transform: rotate(360deg); }

.study-theme-switcher__toggle {
    position: absolute;
    top: 5px;
    bottom: 5px;
    left: 5px;
    width: calc(50% - 7px);
    background: var(--gradient-primary);
    border-radius: 10px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.study-theme-switcher[data-active-theme="dark"] .study-theme-switcher__toggle {
    transform: translateX(calc(100% + 4px));
}

/* Language Switcher */
.study-lang-switcher {
    margin-top: 12px;
    display: flex;
    gap: 8px;
}

.study-lang-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 12px;
    background: var(--bg-surface);
    border: 1px solid rgba(16, 185, 129, 0.1);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] .study-lang-btn {
    background: #1e293b;
    border-color: rgba(16, 185, 129, 0.15);
}

.study-lang-btn img {
    width: 18px;
    height: 12px;
    object-fit: cover;
    border-radius: 2px;
}

.study-lang-btn:hover {
    border-color: var(--accent-purple);
    background: rgba(16, 185, 129, 0.05);
}

.study-lang-btn.active {
    background: rgba(16, 185, 129, 0.1);
    border-color: #10B981;
    color: var(--accent-purple);
}

/* ─── MAIN CONTENT AREA ─── */
.study-main {
    flex: 1;
    margin-left: 272px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.25s ease;
}

/* Top bar */
.study-topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 32px;
    background: var(--bg-dark);
    border-bottom: 1px solid var(--border-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    flex-shrink: 0;
}

[data-theme="dark"] .study-topbar {
    background: rgba(15, 23, 42, 0.85);
}

.study-topbar__left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.study-topbar__hamburger {
    display: none;
    background: none;
    border: none;
    font-size: 1.4rem;
    color: var(--text-primary);
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    transition: background 0.2s;
}
.study-topbar__hamburger:hover { background: var(--border-glass); }

.study-topbar__title {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.study-topbar__right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.study-topbar__icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid var(--border-glass);
    background: var(--bg-surface);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    cursor: pointer;
    transition: all 0.2s;
}
.study-topbar__icon-btn:hover {
    border-color: var(--accent-purple);
    color: var(--accent-purple);
}

/* ─── DASHBOARD BODY ─── */
.study-dashboard {
    flex: 1;
    padding: 28px 32px 60px;
    overflow-y: auto;
}

/* ─── Welcome Banner ─── */
.dash-welcome {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 36px 40px;
    border-radius: 24px;
    background: linear-gradient(135deg, #065F46 0%, #10B981 60%, #34D399 100%);
    color: white;
    margin-bottom: 32px;
    overflow: hidden;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2), 0 12px 40px rgba(5, 150, 105, 0.3);
}

.dash-welcome__text h1 { font-size: 1.85rem; font-weight: 800; margin-bottom: 6px; }
.dash-welcome__text p { font-size: 1rem; color: rgba(255, 255, 255, 0.85); margin: 0; max-width: 400px; }

.dash-welcome__streak {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 24px;
    background: rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 16px;
}

.dash-welcome__streak-num { font-size: 1.6rem; font-weight: 800; line-height: 1.1; }
.dash-welcome__streak-label { font-size: 0.8rem; color: rgba(255, 255, 255, 0.8); }

/* ─── Grids ─── */
.dash-quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 32px; }
.dash-smart-grid { display: grid; grid-template-columns: 1.2fr 1fr 1fr 1fr; gap: 18px; margin-bottom: 32px; }
.dash-stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 32px; }
.dash-continue-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 32px; }
.dash-rec-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 32px; }

/* ─── Cards ─── */
.dash-qcard {
    display: flex;
    flex-direction: column;
    padding: 24px 22px;
    border-radius: 24px;
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-glass);
}
.dash-qcard:hover { transform: translateY(-6px); box-shadow: 0 18px 42px rgba(16, 185, 129, 0.16); border-color: var(--card-accent, var(--accent-purple)); }

.dash-section__header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 0 0 24px;
}

.dash-section__header > i {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #059669;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.16), rgba(52, 211, 153, 0.08));
    box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.18);
    font-size: 1.25rem;
}

.dash-section__header h2 {
    margin: 0;
}

.dash-smart-section {
    margin-bottom: 2px;
}

.dash-smart-card {
    min-height: 178px;
    display: flex;
    flex-direction: column;
    padding: 24px;
    border-radius: 24px;
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--smart-accent, #10b981) 12%, transparent), transparent 54%),
        var(--bg-glass);
    border: 1px solid color-mix(in srgb, var(--smart-accent, #10b981) 22%, var(--border-glass));
    box-shadow: var(--shadow-glass);
    text-decoration: none;
    position: relative;
    overflow: hidden;
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.dash-smart-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 5px;
    background: var(--smart-accent, #10b981);
    opacity: 0.95;
}

.dash-smart-card:hover {
    transform: translateY(-5px);
    border-color: var(--smart-accent, #10b981);
    box-shadow: 0 16px 38px rgba(15, 23, 42, 0.12);
}

.dash-smart-card--primary {
    min-height: 196px;
}

.dash-smart-card__eyebrow {
    width: fit-content;
    margin-bottom: 12px;
    padding: 5px 10px;
    border-radius: 999px;
    color: var(--smart-accent, #10b981);
    background: color-mix(in srgb, var(--smart-accent, #10b981) 12%, transparent);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.dash-smart-card__title {
    color: var(--text-primary);
    font-size: 1.16rem;
    font-weight: 800;
    line-height: 1.25;
    margin-bottom: 8px;
}

.dash-smart-card__desc {
    color: var(--text-secondary);
    font-size: 0.92rem;
    line-height: 1.45;
    margin: 0 0 18px;
}

.dash-smart-card__meta {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--text-secondary);
    font-size: 0.84rem;
    font-weight: 700;
}

.dash-smart-card__meta i {
    width: 34px;
    height: 34px;
    border-radius: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: var(--smart-accent, #10b981);
    flex-shrink: 0;
}

.dash-qcard--blue { --card-accent: #3b82f6; --card-soft: rgba(59, 130, 246, 0.13); --card-soft-2: rgba(59, 130, 246, 0.05); }
.dash-qcard--green { --card-accent: #10b981; --card-soft: rgba(16, 185, 129, 0.15); --card-soft-2: rgba(52, 211, 153, 0.06); }
.dash-qcard--purple { --card-accent: #8b5cf6; --card-soft: rgba(139, 92, 246, 0.14); --card-soft-2: rgba(139, 92, 246, 0.05); }
.dash-qcard--amber { --card-accent: #f59e0b; --card-soft: rgba(245, 158, 11, 0.16); --card-soft-2: rgba(245, 158, 11, 0.06); }
.dash-qcard--cyan { --card-accent: #06b6d4; --card-soft: rgba(6, 182, 212, 0.15); --card-soft-2: rgba(103, 232, 249, 0.06); }

.dash-qcard__icon,
.dash-continue-card__icon,
.dash-stat__icon {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--card-accent, currentColor);
    background:
        radial-gradient(circle at 30% 18%, rgba(255, 255, 255, 0.9), transparent 32%),
        linear-gradient(135deg, var(--card-soft, rgba(16, 185, 129, 0.14)), var(--card-soft-2, rgba(16, 185, 129, 0.04))) !important;
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--card-accent, #10b981) 20%, transparent), 0 12px 28px rgba(15, 23, 42, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.dash-qcard__icon {
    margin-bottom: 18px;
}

.dash-qcard__icon i,
.dash-continue-card__icon i,
.dash-stat__icon i {
    font-size: 1.75rem;
    line-height: 1;
}

.dash-qcard__title {
    color: var(--text-primary);
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 8px;
}

.dash-qcard__desc {
    color: var(--text-secondary);
    font-size: 0.92rem;
    line-height: 1.45;
    margin: 0 0 22px;
}

.dash-qcard__arrow,
.dash-continue-card__go {
    margin-top: auto;
    width: 34px;
    height: 34px;
    border-radius: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    background: rgba(148, 163, 184, 0.08);
    transition: all 0.2s ease;
}

.dash-qcard:hover .dash-qcard__icon,
.dash-continue-card:hover .dash-continue-card__icon,
.dash-stat:hover .dash-stat__icon {
    transform: scale(1.04);
}

.dash-qcard:hover .dash-qcard__arrow,
.dash-continue-card:hover .dash-continue-card__go {
    color: white;
    background: var(--card-accent, var(--accent-purple));
    transform: translateX(3px);
}

.dash-continue-card:nth-child(1) { --card-accent: #8b5cf6; --card-soft: rgba(139, 92, 246, 0.14); --card-soft-2: rgba(139, 92, 246, 0.05); }
.dash-continue-card:nth-child(2), .dash-stat:nth-child(1) { --card-accent: #3b82f6; --card-soft: rgba(59, 130, 246, 0.13); --card-soft-2: rgba(59, 130, 246, 0.05); }
.dash-continue-card:nth-child(3), .dash-stat:nth-child(2) { --card-accent: #10b981; --card-soft: rgba(16, 185, 129, 0.15); --card-soft-2: rgba(52, 211, 153, 0.06); }
.dash-stat:nth-child(3) { --card-accent: #f59e0b; --card-soft: rgba(245, 158, 11, 0.16); --card-soft-2: rgba(245, 158, 11, 0.06); }
.dash-stat:nth-child(4) { --card-accent: #f43f5e; --card-soft: rgba(244, 63, 94, 0.14); --card-soft-2: rgba(244, 63, 94, 0.05); }

.dash-continue-card__title,
.dash-stat__value {
    color: var(--text-primary);
    font-weight: 700;
}

.dash-continue-card__meta,
.dash-stat__label {
    color: var(--text-secondary);
    line-height: 1.4;
}

.dash-stat__top {
    margin-bottom: 14px;
}

.dash-stat__value {
    font-size: 1.45rem;
    margin-top: 6px;
}

.dash-stat {
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    border-radius: 24px;
    padding: 24px;
    box-shadow: var(--shadow-glass);
    transition: all 0.3s ease;
}
.dash-stat:hover { transform: translateY(-4px); border-color: var(--accent-purple); box-shadow: 0 10px 30px rgba(16, 185, 129, 0.1); }

.dash-continue-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 22px;
    border-radius: 24px;
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-glass);
}
.dash-continue-card:hover { transform: translateY(-6px); box-shadow: 0 15px 40px rgba(16, 185, 129, 0.15); border-color: var(--accent-purple); }

.dash-rec-card {
    display: flex;
    flex-direction: column;
    padding: 24px 22px;
    border-radius: 24px;
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-glass);
    position: relative;
}
.dash-rec-card:hover { transform: translateY(-6px); box-shadow: 0 15px 40px rgba(16, 185, 129, 0.15); border-color: var(--accent-purple); }

.dash-rec-card__emoji {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    margin-bottom: 18px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.13), rgba(59, 130, 246, 0.07));
    box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.12), 0 12px 28px rgba(15, 23, 42, 0.08);
}
.dash-rec-card__title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}
.dash-rec-card__desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
}
.dash-rec-card__tag {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-purple);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
}

/* ─── Responsive ─── */
:is(body.study-sidebar-collapsed, html[data-study-sidebar-collapsed="true"] body) .study-sidebar { width: 76px; min-width: 76px; }
:is(body.study-sidebar-collapsed, html[data-study-sidebar-collapsed="true"] body) .study-main {
    margin-left: 76px;
    width: calc(100% - 76px);
    max-width: calc(100vw - 76px);
}
:is(body.study-sidebar-collapsed, html[data-study-sidebar-collapsed="true"] body) .study-sidebar__brand > div,
:is(body.study-sidebar-collapsed, html[data-study-sidebar-collapsed="true"] body) .study-sidebar__link span,
:is(body.study-sidebar-collapsed, html[data-study-sidebar-collapsed="true"] body) .study-sidebar__section-title,
:is(body.study-sidebar-collapsed, html[data-study-sidebar-collapsed="true"] body) .study-sidebar__badge,
:is(body.study-sidebar-collapsed, html[data-study-sidebar-collapsed="true"] body) .study-sidebar__user-info,
:is(body.study-sidebar-collapsed, html[data-study-sidebar-collapsed="true"] body) .study-sidebar__user > i { display: none !important; }
:is(body.study-sidebar-collapsed, html[data-study-sidebar-collapsed="true"] body) .study-sidebar__brand {
    justify-content: center;
    padding: 24px 12px 20px;
}
:is(body.study-sidebar-collapsed, html[data-study-sidebar-collapsed="true"] body) .study-sidebar__nav {
    padding: 16px 10px 24px;
}
:is(body.study-sidebar-collapsed, html[data-study-sidebar-collapsed="true"] body) .study-sidebar__link {
    width: 44px;
    height: 44px;
    margin: 0 auto 6px;
    padding: 0;
    justify-content: center;
    border-radius: 14px;
}
:is(body.study-sidebar-collapsed, html[data-study-sidebar-collapsed="true"] body) .study-sidebar__link i,
:is(body.study-sidebar-collapsed, html[data-study-sidebar-collapsed="true"] body) .study-sidebar__nav .study-sidebar__link > img {
    width: 32px !important;
    height: 32px !important;
    margin: 0 !important;
}

/* Minimized Sidebar Theme Switcher Fix */
:is(body.study-sidebar-collapsed, html[data-study-sidebar-collapsed="true"] body) .study-theme-switcher {
    background: transparent;
    border-color: transparent;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
:is(body.study-sidebar-collapsed, html[data-study-sidebar-collapsed="true"] body) .study-theme-switcher__toggle,
:is(body.study-sidebar-collapsed, html[data-study-sidebar-collapsed="true"] body) .study-theme-switcher__btn span {
    display: none !important;
}
:is(body.study-sidebar-collapsed, html[data-study-sidebar-collapsed="true"] body) .study-theme-switcher__btn {
    display: none;
    flex: none;
    width: 38px;
    height: 38px;
    margin: 0 auto;
    padding: 0;
    border-radius: 10px;
    border: 1px solid var(--border-glass);
    background: var(--bg-surface);
    color: var(--text-primary);
    justify-content: center;
    font-size: 1.15rem;
}
:is(body.study-sidebar-collapsed, html[data-study-sidebar-collapsed="true"] body) .study-theme-switcher__btn.active {
    display: flex !important;
    background: var(--gradient-primary);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 8px 18px rgba(16, 185, 129, 0.22);
}
:is(body.study-sidebar-collapsed, html[data-study-sidebar-collapsed="true"] body) .study-theme-switcher__btn.active:hover {
    border-color: transparent;
    color: #fff;
}

/* Minimized Sidebar User/Profile Fix */
:is(body.study-sidebar-collapsed, html[data-study-sidebar-collapsed="true"] body) .study-sidebar__user {
    width: 38px;
    height: 38px;
    padding: 0;
    margin: 0 auto;
    justify-content: center;
    border-radius: 10px;
    box-sizing: border-box;
}
:is(body.study-sidebar-collapsed, html[data-study-sidebar-collapsed="true"] body) .study-sidebar__avatar {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    font-size: 0.85rem;
}

/* Minimized Sidebar Language Switcher Fix */
:is(body.study-sidebar-collapsed, html[data-study-sidebar-collapsed="true"] body) .study-lang-switcher {
    background: transparent;
    border-color: transparent;
    padding: 0;
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
:is(body.study-sidebar-collapsed, html[data-study-sidebar-collapsed="true"] body) .study-lang-btn span {
    display: none !important;
}
:is(body.study-sidebar-collapsed, html[data-study-sidebar-collapsed="true"] body) .study-lang-btn {
    display: none;
    flex: none;
    width: 38px;
    height: 38px;
    margin: 0 auto;
    padding: 0;
    border-radius: 10px;
    border: 1px solid var(--border-glass);
    background: var(--bg-surface);
    justify-content: center;
}
:is(body.study-sidebar-collapsed, html[data-study-sidebar-collapsed="true"] body) .study-lang-btn.active {
    display: flex !important;
    background: rgba(16, 185, 129, 0.12);
    border-color: #10B981;
    color: var(--accent-purple);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.14);
}
:is(body.study-sidebar-collapsed, html[data-study-sidebar-collapsed="true"] body) .study-lang-btn.active:hover {
    border-color: var(--accent-purple);
}

@media (max-width: 1024px) {
    .study-sidebar { transform: translateX(-100%); }
    .study-sidebar--open { transform: translateX(0); box-shadow: 8px 0 30px rgba(0, 0, 0, 0.12); }
    .study-main { margin-left: 0; }
    .study-topbar__hamburger { display: flex; }
    .study-sidebar__toggle { display: none; }
    :is(body.study-sidebar-collapsed, html[data-study-sidebar-collapsed="true"] body) .study-sidebar { width: 272px; min-width: 272px; transform: translateX(-100%); }
    :is(body.study-sidebar-collapsed, html[data-study-sidebar-collapsed="true"] body) .study-sidebar--open { transform: translateX(0); }
    :is(body.study-sidebar-collapsed, html[data-study-sidebar-collapsed="true"] body) .study-main { margin-left: 0; }
    .dash-smart-grid { grid-template-columns: 1fr; }
    .dash-smart-card,
    .dash-smart-card--primary { min-height: 0; }
}

@media (max-width: 640px) {
    .dash-quick-grid, .dash-stats-grid, .dash-rec-grid { grid-template-columns: repeat(2, 1fr); }
    .dash-continue-grid { grid-template-columns: 1fr; }
    .dash-smart-grid { grid-template-columns: 1fr; }
    .dash-smart-card { padding: 20px; }
}

/* ─── Cover Cards (Past Papers) ─── */
.dash-cover-card {
    display: flex;
    flex-direction: column;
    border-radius: 24px;
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-glass);
    overflow: hidden;
    position: relative;
    height: 100%;
}
.dash-cover-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 15px 40px rgba(16, 185, 129, 0.15);
    border-color: var(--accent-purple);
}
.dash-cover-card__img-wrapper {
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--bg-dark);
}
.dash-cover-card__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}
.dash-cover-card:hover .dash-cover-card__img {
    transform: scale(1.05);
}
.dash-cover-card__body {
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    flex: 1;
}
.dash-cover-card__badge {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent-purple);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}
.dash-cover-card__title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}
.dash-cover-card__desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Mobile workspace hardening */
.study-main,
.study-dashboard,
.study-topbar,
.study-topbar__left,
.study-topbar__right {
    min-width: 0;
}

.study-main {
    width: calc(100% - 272px);
    max-width: calc(100vw - 272px);
}

.study-dashboard {
    max-width: 100%;
}

@media (max-width: 1024px) {
    .study-workspace {
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
    }

    .study-main,
    :is(body.study-sidebar-collapsed, html[data-study-sidebar-collapsed="true"] body) .study-main {
        width: 100%;
        max-width: 100vw;
        margin-left: 0 !important;
        overflow-x: hidden;
    }

    .study-sidebar {
        width: min(320px, calc(100vw - 56px));
        min-width: min(320px, calc(100vw - 56px));
        max-width: min(320px, calc(100vw - 56px));
        z-index: 1000;
        background: #ffffff;
        border-right: 1px solid rgba(15, 23, 42, 0.08);
        box-shadow: none;
        transform: translateX(-105%);
        transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.28s ease;
    }

    [data-theme="dark"] .study-sidebar {
        background: #0f172a;
        border-right-color: rgba(16, 185, 129, 0.2);
    }

    .study-sidebar.study-sidebar--open,
    :is(body.study-sidebar-collapsed, html[data-study-sidebar-collapsed="true"] body) .study-sidebar.study-sidebar--open {
        transform: translateX(0) !important;
        box-shadow: 18px 0 42px rgba(2, 6, 23, 0.28);
    }

    :is(body.study-sidebar-collapsed, html[data-study-sidebar-collapsed="true"] body) .study-sidebar {
        width: min(320px, calc(100vw - 56px));
        min-width: min(320px, calc(100vw - 56px));
        max-width: min(320px, calc(100vw - 56px));
        transform: translateX(-105%);
    }

    :is(body.study-sidebar-collapsed, html[data-study-sidebar-collapsed="true"] body) .study-sidebar__brand {
        justify-content: flex-start;
        padding: 24px 22px 20px;
    }

    :is(body.study-sidebar-collapsed, html[data-study-sidebar-collapsed="true"] body) .study-sidebar__brand > div,
    :is(body.study-sidebar-collapsed, html[data-study-sidebar-collapsed="true"] body) .study-sidebar__link span,
    :is(body.study-sidebar-collapsed, html[data-study-sidebar-collapsed="true"] body) .study-sidebar__section-title,
    :is(body.study-sidebar-collapsed, html[data-study-sidebar-collapsed="true"] body) .study-sidebar__badge,
    :is(body.study-sidebar-collapsed, html[data-study-sidebar-collapsed="true"] body) .study-sidebar__user-info,
    :is(body.study-sidebar-collapsed, html[data-study-sidebar-collapsed="true"] body) .study-sidebar__user > i {
        display: revert !important;
    }

    :is(body.study-sidebar-collapsed, html[data-study-sidebar-collapsed="true"] body) .study-sidebar__nav {
        padding: 16px 12px 24px;
    }

    :is(body.study-sidebar-collapsed, html[data-study-sidebar-collapsed="true"] body) .study-sidebar__link {
        width: auto;
        height: auto;
        margin: 0 0 3px;
        padding: 11px 14px;
        justify-content: flex-start;
        border-radius: 10px;
    }

    :is(body.study-sidebar-collapsed, html[data-study-sidebar-collapsed="true"] body) .study-sidebar__link i,
    :is(body.study-sidebar-collapsed, html[data-study-sidebar-collapsed="true"] body) .study-sidebar__nav .study-sidebar__link > img {
        width: 28px !important;
        height: 28px !important;
        margin-right: 0 !important;
    }

    :is(body.study-sidebar-collapsed, html[data-study-sidebar-collapsed="true"] body) .study-sidebar__user {
        width: auto;
        height: auto;
        padding: 10px 12px;
        margin: 0;
        justify-content: flex-start;
        border-radius: 12px;
    }

    :is(body.study-sidebar-collapsed, html[data-study-sidebar-collapsed="true"] body) .study-sidebar__avatar {
        width: 34px;
        height: 34px;
        border-radius: 10px;
        font-size: 1rem;
    }

    :is(body.study-sidebar-collapsed, html[data-study-sidebar-collapsed="true"] body) .study-theme-switcher,
    :is(body.study-sidebar-collapsed, html[data-study-sidebar-collapsed="true"] body) .study-lang-switcher {
        background: var(--bg-surface);
        border-color: rgba(16, 185, 129, 0.1);
        padding: 4px;
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 0;
    }

    :is(body.study-sidebar-collapsed, html[data-study-sidebar-collapsed="true"] body) .study-theme-switcher__toggle {
        display: block !important;
    }

    :is(body.study-sidebar-collapsed, html[data-study-sidebar-collapsed="true"] body) .study-theme-switcher__btn,
    :is(body.study-sidebar-collapsed, html[data-study-sidebar-collapsed="true"] body) .study-lang-btn {
        display: flex !important;
        flex: 1;
        width: auto;
        height: auto;
        margin: 0;
        padding: 8px 10px;
        border: none;
        background: transparent;
        box-shadow: none;
    }

    :is(body.study-sidebar-collapsed, html[data-study-sidebar-collapsed="true"] body) .study-theme-switcher__btn span,
    :is(body.study-sidebar-collapsed, html[data-study-sidebar-collapsed="true"] body) .study-lang-btn span {
        display: inline !important;
    }

    #studySidebar.study-sidebar--open {
        transform: translateX(0) !important;
        box-shadow: 18px 0 42px rgba(2, 6, 23, 0.28);
    }

    #sidebarOverlay.study-overlay--active,
    #sidebarOverlay.active {
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
    }

    .study-topbar {
        width: 100%;
        max-width: 100vw;
        padding: 14px 18px;
        gap: 12px;
    }

    .study-topbar__left {
        flex: 1;
        overflow: hidden;
    }

    .study-topbar__title {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .study-topbar__hamburger,
    .study-topbar__icon-btn {
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
        padding: 0;
        align-items: center;
        justify-content: center;
    }

    .study-topbar__right {
        gap: 8px;
        flex-shrink: 0;
    }
}

@media (max-width: 640px) {
    .study-dashboard {
        padding: 20px 16px 48px;
    }

    .dash-welcome {
        flex-direction: column;
        align-items: flex-start;
        gap: 18px;
        padding: 24px 20px;
        border-radius: 18px;
    }

    .dash-welcome__text h1 {
        font-size: 1.45rem;
    }

    .dash-welcome__streak {
        width: 100%;
        justify-content: center;
    }

    .dash-quick-grid,
    .dash-stats-grid,
    .dash-rec-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .dash-continue-card {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .dash-continue-card__info,
    .dash-continue-card__title,
    .dash-continue-card__meta {
        min-width: 0;
        overflow-wrap: anywhere;
    }
}

