/* ===== Burnt Orange Dark Theme - Colour Palette ===== */
:root {
    --bg-base: #0f1117;
    --bg-surface: #1a1d27;
    --bg-elevated: #242837;
    --accent-primary: #E8730C;
    --accent-primary-hover: #F28A2E;
    --accent-secondary: #D4650A;
    --accent-success: #00b894;
    --accent-danger: #ff6b6b;
    --text-primary: #e8e8e8;
    --text-muted: #8b8fa3;
    --border-color: #2d3148;
    --gradient-question: linear-gradient(135deg, #E8730C 0%, #F2A541 100%);
    --gradient-answer: linear-gradient(135deg, #D4650A 0%, #E8730C 100%);
    --gradient-accent: linear-gradient(135deg, #E8730C, #F2A541);
    --shadow-glow: 0 0 20px rgba(232, 115, 12, 0.15);
    --shadow-card: 0 4px 16px rgba(0, 0, 0, 0.3);
    --bs-primary: #E8730C;
    /* Sidebar */
    --sidebar-width: 260px;
    --sidebar-bg: #141620;
    --sidebar-border: #1e2235;
}

/* ===== Base ===== */
html {
    font-size: 14px;
    position: relative;
    min-height: 100%;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

body {
    margin-bottom: 0;
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

/* ===== Focus States ===== */
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem var(--bg-base), 0 0 0 0.25rem var(--accent-primary);
}

/* ===== Form Controls ===== */
.form-control,
.form-select {
    background-color: var(--bg-surface);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.form-control:focus,
.form-select:focus {
    background-color: var(--bg-elevated);
    border-color: var(--accent-primary);
    color: var(--text-primary);
    box-shadow: 0 0 0 0.2rem rgba(232, 115, 12, 0.25);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-label {
    color: var(--text-primary);
}

/* ===== Cards ===== */
.card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    border-color: var(--bg-elevated);
    box-shadow: var(--shadow-card);
}

.card-footer {
    background-color: transparent;
    border-top: 1px solid var(--border-color);
}

/* ===== Tables ===== */
.table {
    --bs-table-bg: var(--bg-surface);
    --bs-table-color: var(--text-primary);
    --bs-table-border-color: var(--border-color);
    --bs-table-striped-bg: var(--bg-elevated);
    --bs-table-hover-bg: var(--bg-elevated);
    --bs-table-hover-color: var(--text-primary);
}

.table-dark {
    --bs-table-bg: var(--bg-surface);
    --bs-table-color: var(--text-primary);
    --bs-table-border-color: var(--border-color);
}

.table thead th {
    background-color: var(--bg-elevated);
    color: var(--text-primary);
    border-bottom-color: var(--border-color);
}

/* ===== Badges ===== */
.badge.bg-secondary {
    background-color: var(--bg-elevated) !important;
    color: var(--text-muted);
}

.badge.bg-primary {
    background-color: var(--accent-primary) !important;
}

.badge-accent {
    background-color: var(--accent-secondary) !important;
    color: #fff;
}

/* ===== Alerts ===== */
.alert-danger {
    background-color: rgba(255, 107, 107, 0.1);
    border-color: rgba(255, 107, 107, 0.3);
    color: var(--accent-danger);
}

.alert-info {
    background-color: rgba(232, 115, 12, 0.1);
    border-color: rgba(232, 115, 12, 0.3);
    color: var(--accent-primary);
}

.alert .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* ===== Buttons - Primary ===== */
.btn-primary {
    background-color: var(--accent-primary);
    border-color: var(--accent-primary);
    color: #fff;
}

.btn-primary:hover, .btn-primary:active {
    background-color: var(--accent-primary-hover);
    border-color: var(--accent-primary-hover);
    color: #fff;
}

/* ===== Buttons - Success ===== */
.btn-success {
    background-color: var(--accent-success);
    border-color: var(--accent-success);
    color: var(--bg-base);
}

.btn-success:hover, .btn-success:active {
    background-color: #00d2a0;
    border-color: #00d2a0;
    color: var(--bg-base);
}

/* ===== Buttons - Danger ===== */
.btn-danger {
    background-color: var(--accent-danger);
    border-color: var(--accent-danger);
    color: #fff;
}

.btn-danger:hover, .btn-danger:active {
    background-color: #ff8787;
    border-color: #ff8787;
}

/* ===== Buttons - Outline variants ===== */
.btn-outline-primary {
    color: var(--accent-primary);
    border-color: var(--accent-primary);
}

.btn-outline-primary:hover, .btn-outline-primary:active {
    background-color: var(--accent-primary);
    border-color: var(--accent-primary);
    color: #fff;
}

.btn-outline-secondary {
    color: var(--text-muted);
    border-color: var(--border-color);
}

.btn-outline-secondary:hover, .btn-outline-secondary:active {
    background-color: var(--bg-elevated);
    border-color: var(--text-muted);
    color: var(--text-primary);
}

.btn-outline-danger {
    color: var(--accent-danger);
    border-color: var(--accent-danger);
}

.btn-outline-danger:hover, .btn-outline-danger:active {
    background-color: var(--accent-danger);
    border-color: var(--accent-danger);
    color: #fff;
}

/* ===== Neon-outlined buttons (study mode) ===== */
.btn-neon {
    color: var(--accent-primary);
    border: 2px solid var(--accent-primary);
    background: transparent;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
}

.btn-neon:hover {
    background-color: rgba(232, 115, 12, 0.1);
    box-shadow: 0 0 12px rgba(232, 115, 12, 0.3);
    color: var(--accent-primary);
}

.btn-neon:disabled {
    color: var(--text-muted);
    border-color: var(--border-color);
    box-shadow: none;
}

/* ===== Progress Bar ===== */
.progress {
    background-color: var(--bg-elevated);
    border-radius: 0.5rem;
}

.progress-bar {
    background: var(--gradient-accent);
    border-radius: 0.5rem;
}

/* ===== Utility Overrides ===== */
.text-muted {
    color: var(--text-muted) !important;
}

.bg-light {
    background-color: var(--bg-surface) !important;
}

.shadow-sm {
    box-shadow: var(--shadow-card) !important;
}

/* ===== Study Mode - Card Flip ===== */
.study-container {
    perspective: 1000px;
}

.study-card {
    width: 100%;
    max-width: 550px;
    height: 320px;
    cursor: pointer;
}

.study-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.5s ease;
    transform-style: preserve-3d;
}

.study-card-inner.flipped {
    transform: rotateY(180deg);
}

.study-card-front,
.study-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.study-card-front {
    background: var(--gradient-question);
    color: white;
}

.study-card-back {
    background: var(--gradient-answer);
    color: white;
    transform: rotateY(180deg);
}

.card-label {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.8;
    margin-bottom: 1rem;
}

.card-content {
    font-size: 1.3rem;
    text-align: center;
    line-height: 1.5;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    word-break: break-word;
    overflow-y: auto;
    width: 100%;
}

.card-hint {
    font-size: 0.8rem;
    opacity: 0.6;
    margin-top: 1rem;
}

/* ===== Feature Cards (Home) ===== */
.feature-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-top: 3px solid var(--accent-primary);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-glow);
}

.feature-card.accent-purple { border-top-color: var(--accent-primary); }
.feature-card.accent-teal { border-top-color: var(--accent-secondary); }
.feature-card.accent-mint { border-top-color: var(--accent-success); }

/* ===== Hero Section ===== */
.hero-gradient-text {
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-glow {
    position: relative;
}

.hero-glow::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(232, 115, 12, 0.15) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

/* ===== Deck Cards ===== */
.deck-card {
    border-left: 3px solid var(--accent-primary);
}

.deck-card:hover {
    border-left-color: var(--accent-primary-hover);
    box-shadow: var(--shadow-glow);
}

/* ===== Dark Surface Utility ===== */
.dark-surface {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
}

/* ===== Glow effects on interactive elements ===== */
a.btn:hover {
    transition: all 0.2s ease;
}

.btn-primary:hover {
    box-shadow: 0 0 16px rgba(232, 115, 12, 0.35);
}

.btn-success:hover {
    box-shadow: 0 0 16px rgba(0, 184, 148, 0.35);
}

.btn-danger:hover {
    box-shadow: 0 0 16px rgba(255, 107, 107, 0.35);
}

/* ===== Study Mode - Answer Buttons ===== */
.answer-buttons {
    display: none;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.answer-buttons.visible {
    display: flex;
}

.btn-correct {
    color: var(--accent-success);
    border: 2px solid var(--accent-success);
    background: transparent;
    border-radius: 0.5rem;
    padding: 0.6rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-correct:hover {
    background-color: rgba(0, 184, 148, 0.15);
    box-shadow: 0 0 16px rgba(0, 184, 148, 0.35);
    color: var(--accent-success);
}

.btn-wrong {
    color: var(--accent-danger);
    border: 2px solid var(--accent-danger);
    background: transparent;
    border-radius: 0.5rem;
    padding: 0.6rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-wrong:hover {
    background-color: rgba(255, 107, 107, 0.15);
    box-shadow: 0 0 16px rgba(255, 107, 107, 0.35);
    color: var(--accent-danger);
}

/* ===== Study Mode - Score Screen ===== */
.score-screen {
    display: none;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 3rem 2rem;
    max-width: 480px;
    margin: 0 auto;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.score-screen.visible {
    display: block;
}

.score-percentage {
    font-size: 4rem;
    font-weight: 700;
    line-height: 1;
    margin: 1rem 0 0.5rem;
}

.score-fraction {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.score-message {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.score-bar-track {
    background-color: var(--bg-elevated);
    border-radius: 0.5rem;
    height: 12px;
    max-width: 300px;
    margin: 0 auto 2rem;
    overflow: hidden;
}

.score-bar-fill {
    height: 100%;
    border-radius: 0.5rem;
    transition: width 0.6s ease;
}

/* ===== Sidebar Navigation ===== */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: transform 0.3s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1.25rem 1.5rem;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-brand:hover {
    color: var(--text-primary);
    text-decoration: none;
}

.sidebar-brand svg {
    color: var(--accent-primary);
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
}

.sidebar-nav-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-muted);
    padding: 0.75rem 1.5rem 0.5rem;
    font-weight: 600;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1.5rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
    margin: 0.1rem 0;
}

.sidebar-link:hover {
    color: var(--text-primary);
    background-color: rgba(232, 115, 12, 0.06);
    text-decoration: none;
}

.sidebar-link.active {
    color: var(--accent-primary);
    background-color: rgba(232, 115, 12, 0.1);
    border-left-color: var(--accent-primary);
}

.sidebar-link svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    opacity: 0.7;
}

.sidebar-link.active svg {
    opacity: 1;
}

.sidebar-footer {
    border-top: 1px solid var(--sidebar-border);
    padding: 1rem 1.25rem;
}

/* Sidebar user section (signed in) */
.sidebar-user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    margin-bottom: 0.5rem;
}

.sidebar-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gradient-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-weight: 700;
    font-size: 0.85rem;
    color: #fff;
}

.sidebar-user-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.sidebar-user-links {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.sidebar-user-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.5rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.825rem;
    font-weight: 500;
    border-radius: 0.375rem;
    transition: all 0.15s ease;
    background: none;
    border: none;
    width: 100%;
    cursor: pointer;
    text-align: left;
}

.sidebar-user-link:hover {
    color: var(--text-primary);
    background-color: var(--bg-elevated);
    text-decoration: none;
}

.sidebar-user-link svg {
    width: 16px;
    height: 16px;
    opacity: 0.7;
}

/* Sidebar auth buttons (not signed in) */
.sidebar-auth {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sidebar-auth .btn-auth-login {
    display: block;
    text-align: center;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    background: transparent;
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    text-decoration: none;
}

.sidebar-auth .btn-auth-login:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    background-color: rgba(232, 115, 12, 0.08);
}

.sidebar-auth .btn-auth-register {
    display: block;
    text-align: center;
    color: #fff;
    background-color: var(--accent-primary);
    border: 1px solid var(--accent-primary);
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    text-decoration: none;
}

.sidebar-auth .btn-auth-register:hover {
    background-color: var(--accent-primary-hover);
    border-color: var(--accent-primary-hover);
    color: #fff;
    box-shadow: 0 0 12px rgba(232, 115, 12, 0.35);
}

/* Main wrapper (content area right of sidebar) */
.main-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Mobile sidebar header */
.sidebar-mobile-header {
    position: sticky;
    top: 0;
    z-index: 1030;
    background-color: var(--sidebar-bg);
    border-bottom: 1px solid var(--sidebar-border);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-primary);
    padding: 0.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-toggle svg {
    width: 24px;
    height: 24px;
}

.sidebar-mobile-brand {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.sidebar-mobile-brand:hover {
    color: var(--text-primary);
    text-decoration: none;
}

.sidebar-mobile-brand svg {
    color: var(--accent-primary);
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 1035;
}

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

/* ===== Main Content Wrapper ===== */
.main-content-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem 2rem 2rem;
    animation: fadeInUp 0.35s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== Inline Footer ===== */
.footer-inline {
    background: transparent;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 1.5rem 0;
    text-align: center;
    font-size: 0.875rem;
    margin-top: auto;
}

.footer-inline a {
    color: var(--accent-primary);
}

.footer-inline a:hover {
    color: var(--accent-primary-hover);
}

/* ===== Form Card Wrapper ===== */
.form-card-wrapper {
    display: flex;
    justify-content: center;
    padding: 1rem 0;
}

.form-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    box-shadow: var(--shadow-card);
    padding: 0;
    width: 100%;
    max-width: 600px;
    overflow: hidden;
}

.form-card .form-card-body {
    padding: 2rem;
}

.form-section-header {
    background: var(--gradient-accent);
    padding: 1.5rem 2rem;
    text-align: center;
}

.form-section-header h2 {
    color: #fff;
    font-weight: 700;
    font-size: 1.4rem;
    margin: 0;
}

.form-section-header p {
    color: rgba(255, 255, 255, 0.8);
    margin: 0.25rem 0 0;
    font-size: 0.9rem;
}

.form-helper-text {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

/* ===== Page Headers ===== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.page-header h1 {
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
    margin: 0;
}

.page-header h4 {
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
    margin: 0;
}

/* ===== Enhanced Deck Cards ===== */
.deck-card-enhanced {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--accent-primary);
    border-radius: 0.75rem;
    padding: 0;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    overflow: hidden;
}

.deck-card-enhanced:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-glow);
    border-left-color: var(--accent-primary-hover);
}

.deck-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 1.25rem 0;
}

.deck-icon {
    width: 42px;
    height: 42px;
    border-radius: 0.625rem;
    background: var(--gradient-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.deck-icon svg {
    width: 20px;
    height: 20px;
    color: #fff;
}

.deck-header h5 {
    margin: 0;
    font-weight: 600;
    font-size: 1.1rem;
}

.deck-body {
    padding: 0.75rem 1.25rem 0;
}

.deck-body p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0;
}

.deck-stats {
    display: flex;
    gap: 1rem;
    padding: 0.75rem 1.25rem;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.stat-item svg {
    width: 14px;
    height: 14px;
    opacity: 0.7;
}

.deck-footer {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem 1.25rem;
    border-top: 1px solid var(--border-color);
    margin-top: 0.5rem;
}

.btn-icon-only {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
}

/* ===== Card List ===== */
.card-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.card-list-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1rem 1.25rem;
    transition: border-color 0.2s ease;
}

.card-list-item:hover {
    border-color: var(--bg-elevated);
}

.card-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--gradient-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 0.8rem;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.card-list-content {
    flex: 1;
    min-width: 0;
}

.card-list-content .card-question {
    font-weight: 600;
    margin-bottom: 0.25rem;
    word-break: break-word;
}

.card-list-content .card-answer {
    color: var(--text-muted);
    font-size: 0.9rem;
    word-break: break-word;
}

.card-list-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

/* ===== Empty States ===== */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    border: 2px dashed var(--border-color);
    border-radius: 1rem;
    background-color: rgba(26, 29, 39, 0.5);
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
    color: var(--text-muted);
    opacity: 0.5;
}

.empty-state h3 {
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

/* ===== Enhanced Feature Cards ===== */
.feature-card-enhanced {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 2rem 1.5rem;
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.feature-card-enhanced::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 50% 0%, rgba(232, 115, 12, 0.08) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}

.feature-card-enhanced:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-glow);
}

.feature-card-enhanced:hover::before {
    opacity: 1;
}

.feature-card-enhanced.accent-teal::before {
    background: radial-gradient(circle at 50% 0%, rgba(232, 115, 12, 0.08) 0%, transparent 60%);
}

.feature-card-enhanced.accent-mint::before {
    background: radial-gradient(circle at 50% 0%, rgba(0, 184, 148, 0.08) 0%, transparent 60%);
}

.feature-card-icon {
    width: 56px;
    height: 56px;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.25rem;
}

.feature-card-icon svg {
    width: 28px;
    height: 28px;
    color: #fff;
}

.feature-card-icon.bg-purple {
    background: var(--gradient-question);
}

.feature-card-icon.bg-teal {
    background: var(--gradient-answer);
}

.feature-card-icon.bg-mint {
    background: linear-gradient(135deg, #00b894, #00d2a0);
}

.feature-card-enhanced h4 {
    font-weight: 600;
    margin-bottom: 0.5rem;
    position: relative;
}

.feature-card-enhanced p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0;
    position: relative;
}

/* ===== Deck Detail Header ===== */
.deck-detail-header {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--accent-primary);
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.deck-detail-header h1 {
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.deck-detail-header .deck-description {
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.deck-detail-meta {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.deck-detail-meta .meta-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.deck-detail-meta .meta-item svg {
    width: 16px;
    height: 16px;
    opacity: 0.7;
}

/* ===== Utility Classes ===== */
.btn-icon {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.btn-icon svg {
    width: 16px;
    height: 16px;
}

.gradient-text {
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.icon-sm { width: 16px; height: 16px; }
.icon-md { width: 20px; height: 20px; }
.icon-lg { width: 24px; height: 24px; }

kbd {
    background-color: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    padding: 0.15rem 0.4rem;
    font-size: 0.8rem;
    color: var(--text-primary);
    font-family: inherit;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.kbd-hints {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

details summary {
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 0.5rem 0;
    transition: color 0.2s ease;
}

details summary:hover {
    color: var(--text-primary);
}

/* ===== Back Link ===== */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    margin-bottom: 1rem;
    transition: color 0.2s ease;
}

.back-link:hover {
    color: var(--accent-primary);
}

.back-link svg {
    width: 16px;
    height: 16px;
}

/* ===== Study Mode Header ===== */
.study-header {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--accent-primary);
    border-radius: 0.75rem;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.study-header h1 {
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
    font-size: 1.5rem;
    margin: 0;
}

.study-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0.15rem 0 0;
}

/* ===== Progress Pill ===== */
.progress-pill {
    background: var(--gradient-accent);
    color: #fff;
    padding: 0.3rem 1rem;
    border-radius: 50rem;
    font-weight: 600;
    font-size: 0.9rem;
}

/* ===== Warning Card (Delete confirmations) ===== */
.warning-alert {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    background-color: rgba(255, 107, 107, 0.1);
    border: 1px solid rgba(255, 107, 107, 0.3);
    border-radius: 0.75rem;
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
}

.warning-alert svg {
    width: 24px;
    height: 24px;
    color: var(--accent-danger);
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.warning-alert h5 {
    color: var(--accent-danger);
    font-weight: 600;
    margin: 0 0 0.25rem;
    font-size: 1rem;
}

.warning-alert p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0;
}

/* ===== Delete Preview Card ===== */
.delete-preview {
    background-color: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
}

/* ===== Error Page ===== */
.error-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    color: var(--accent-danger);
    opacity: 0.8;
}

/* ===== Responsive ===== */
@media (max-width: 767.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

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

    .main-wrapper {
        margin-left: 0;
    }

    .main-content-wrapper {
        padding: 1rem;
    }

    .page-header {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }

    .deck-detail-header {
        padding: 1.25rem;
    }

    .deck-detail-meta {
        flex-direction: column;
        gap: 0.5rem;
    }

    .study-header {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }

    .card-list-item {
        flex-direction: column;
        gap: 0.5rem;
    }

    .card-list-actions {
        align-self: flex-end;
    }

    .kbd-hints {
        flex-wrap: wrap;
        gap: 0.75rem;
    }
}

@media (min-width: 768px) {
    .sidebar-mobile-header {
        display: none !important;
    }

    .sidebar-overlay {
        display: none !important;
    }
}

/* ===== Markdown Content Rendering ===== */
.md-content {
    text-align: left;
    width: 100%;
}

.md-content > p:only-child {
    margin: 0;
}

.md-content p {
    margin-bottom: 0.5rem;
}

.md-content p:last-child {
    margin-bottom: 0;
}

.md-content pre {
    background-color: var(--bg-base);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    overflow-x: auto;
    font-size: 0.8rem;
    margin: 0.35rem 0;
    text-align: left;
}

.md-content code:not(pre code) {
    background-color: rgba(232, 115, 12, 0.15);
    color: var(--accent-primary-hover);
    padding: 0.1em 0.4em;
    border-radius: 0.25rem;
    font-size: 0.875em;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}

.md-content pre code {
    background: none !important;
    padding: 0 !important;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}

/* Study card code blocks — dark overlay on orange gradient background */
.study-card-front .md-content pre,
.study-card-back .md-content pre {
    background-color: rgba(0, 0, 0, 0.45);
    border-color: rgba(255, 255, 255, 0.2);
}

.study-card-front .md-content code:not(pre code),
.study-card-back .md-content code:not(pre code) {
    background-color: rgba(0, 0, 0, 0.3);
    color: #ffd699;
}

/* When the card has code, align content to top and left */
.card-content.has-code {
    justify-content: flex-start;
    align-items: flex-start;
    font-size: 1rem;
    padding-top: 0.25rem;
}

.card-content.has-code p {
    text-align: left;
}

/* Simple (no-code) single-paragraph answers stay centred */
.card-content:not(.has-code) .md-content > p:only-child {
    text-align: center;
}

/* ===== Markdown Editor ===== */
.md-editor {
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    overflow: hidden;
}

.md-editor-header {
    display: flex;
    align-items: center;
    background-color: var(--bg-elevated);
    border-bottom: 1px solid var(--border-color);
    padding: 0.25rem 0.5rem;
    gap: 0.5rem;
}

.md-editor-tabs {
    display: flex;
    gap: 0.15rem;
}

.md-tab-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 0.3rem 0.75rem;
    border-radius: 0.35rem;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.md-tab-btn:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.05);
}

.md-tab-btn.active {
    background-color: rgba(232, 115, 12, 0.15);
    color: var(--accent-primary);
}

.md-toolbar {
    display: flex;
    gap: 0.2rem;
    margin-left: auto;
}

.md-tool {
    background: none;
    border: 1px solid transparent;
    color: var(--text-muted);
    padding: 0.2rem 0.6rem;
    border-radius: 0.3rem;
    font-size: 0.75rem;
    font-family: 'Consolas', 'Monaco', monospace;
    cursor: pointer;
    transition: all 0.15s ease;
    line-height: 1.5;
}

.md-tool:hover {
    background-color: var(--bg-surface);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.md-editor .form-control {
    border: none;
    border-radius: 0;
    resize: vertical;
}

.md-editor .form-control:focus {
    border: none;
    box-shadow: none;
}

.md-preview-pane {
    min-height: 90px;
    padding: 0.75rem 1rem;
    background-color: var(--bg-surface);
    font-size: 0.9rem;
    line-height: 1.6;
    overflow-x: auto;
}

.md-preview-pane.hidden {
    display: none;
}
