/* ============================================
   AI Interview Assistant — LeetCode-Inspired Theme
   Complete CSS — Dark-First Design
   ============================================ */

/* --- COLOR SYSTEM --- */
:root, [data-theme="dark"] {
    --bg-primary: #1a1a2e;
    --bg-surface: #282828;
    --bg-elevated: #303030;
    --bg-hover: #3a3a3a;
    --border-color: #3e3e3e;
    --text-primary: #eff1f6;
    --text-secondary: #9b9b9b;
    --text-muted: #6b6b6b;
    --accent: #ffa116;
    --accent-hover: #ffb84d;
    --accent-light: rgba(255, 161, 22, 0.1);
    --success: #00b8a3;
    --warning: #ffc01e;
    --danger: #ef4743;
    --link: #5cb3ff;
    --shadow: rgba(0, 0, 0, 0.3);
    --shadow-lg: rgba(0, 0, 0, 0.5);
    --navbar-bg: rgba(26, 26, 46, 0.85);
    --sidebar-bg: #1e1e30;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

[data-theme="light"] {
    --bg-primary: #f7f8fa;
    --bg-surface: #ffffff;
    --bg-elevated: #ffffff;
    --bg-hover: #f0f0f0;
    --border-color: #e5e7eb;
    --text-primary: #262626;
    --text-secondary: #555555;
    --text-muted: #888888;
    --accent: #f5a623;
    --accent-hover: #e09000;
    --accent-light: rgba(245, 166, 35, 0.1);
    --success: #00b8a3;
    --warning: #ffc01e;
    --danger: #ef4743;
    --link: #2563eb;
    --shadow: rgba(0, 0, 0, 0.08);
    --shadow-lg: rgba(0, 0, 0, 0.15);
    --navbar-bg: rgba(255, 255, 255, 0.9);
    --sidebar-bg: #ffffff;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

/* --- RESET & BASE --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: clamp(0.875rem, 2vw, 1rem);
    font-weight: 400;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    line-height: 1.3;
    color: var(--text-primary);
}

h1 {
    font-size: clamp(1.2rem, 2.5vw, 1.6rem);
    font-weight: 700;
    margin-bottom: 16px;
}

h2 {
    font-size: clamp(1rem, 2vw, 1.25rem);
    font-weight: 600;
    margin-bottom: 12px;
}

h3 {
    font-size: clamp(0.9rem, 1.8vw, 1.05rem);
    font-weight: 600;
    margin-bottom: 8px;
}

a {
    color: var(--link);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--accent-hover);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

ul, ol {
    list-style: none;
}

/* --- LAYOUT --- */
.app-layout {
    display: grid;
    grid-template-columns: auto 1fr;
    min-height: 100vh;
}

.main-content {
    padding: 32px;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

.page-container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 0 16px;
}

/* --- SIDEBAR --- */
.sidebar {
    width: 240px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
    transition: width 0.2s ease;
    overflow: hidden;
    z-index: 100;
}

.sidebar.collapsed {
    width: 60px;
}

.sidebar-logo {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent);
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-logo img,
.sidebar-logo svg {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

.sidebar.collapsed .sidebar-logo span {
    display: none;
}

.sidebar-nav {
    flex: 1;
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 44px;
    padding: 0 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.15s ease;
    white-space: nowrap;
    overflow: hidden;
    text-decoration: none;
    cursor: pointer;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    border-left: 3px solid var(--accent);
    color: var(--accent);
    background: var(--accent-light);
}

.nav-item .nav-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
    width: 24px;
    text-align: center;
}

.nav-item .nav-label {
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar.collapsed .nav-label {
    display: none;
}

.sidebar-user {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
    overflow: hidden;
}

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

.user-info {
    overflow: hidden;
    white-space: nowrap;
}

.user-info .user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

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

.sidebar.collapsed .user-info {
    display: none;
}

.sidebar-collapse-btn {
    padding: 12px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.15s ease;
}

.sidebar-collapse-btn:hover {
    color: var(--text-primary);
}

/* --- NAVBAR (Top Bar) --- */
.navbar {
    height: 56px;
    background: var(--navbar-bg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 1px 8px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 90;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.navbar-title {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
}

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

.navbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.hamburger-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px;
}

.theme-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* --- BUTTONS --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    white-space: nowrap;
    line-height: 1.4;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: linear-gradient(135deg, #ffa116, #ff8c00);
    color: #000;
    font-weight: 600;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #ffb84d, #ffa116);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 161, 22, 0.3);
}

.btn-primary:active {
    transform: scale(0.97) translateY(0);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--text-muted);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-success:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 1rem;
}

.btn-full {
    width: 100%;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* --- CARDS --- */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    transition: all 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px var(--shadow);
}

.topic-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.topic-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px var(--shadow);
    border-color: var(--accent);
}

.topic-card .card-icon {
    font-size: 1.5rem;
    margin-bottom: 4px;
}

.topic-card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.topic-card p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.topic-card.selected {
    border-color: var(--accent);
    background: var(--accent-light);
}

.mode-card .badge {
    position: absolute;
    top: 12px;
    right: 12px;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 12px;
    background: var(--accent-light);
    color: var(--accent);
    font-weight: 600;
}

.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    border-left: 4px solid var(--accent);
}

.stat-card.success {
    border-left-color: var(--success);
}

.stat-card.warning {
    border-left-color: var(--warning);
}

.stat-card.danger {
    border-left-color: var(--danger);
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-card .stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* --- FORMS --- */
.form-group {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-label,
label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
input[type="search"],
input[type="tel"],
textarea,
select {
    width: 100%;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    font-size: 0.9rem;
    font-family: inherit;
    transition: all 0.15s ease;
    outline: none;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="url"]:focus,
input[type="search"]:focus,
input[type="tel"]:focus,
textarea:focus,
select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239b9b9b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

select option {
    background: #1a1a2e;
    color: #e0e0e0;
}

.char-counter {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: right;
    margin-top: 4px;
}

.char-counter.warning {
    color: var(--warning);
}

.char-counter.danger {
    color: var(--danger);
}

/* --- AUTH PAGES --- */
.auth-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    padding: 24px 16px;
    position: relative;
    overflow: hidden;
}

.auth-page::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(ellipse at 30% 20%, rgba(255, 161, 22, 0.04) 0%, transparent 50%),
                radial-gradient(ellipse at 70% 80%, rgba(92, 179, 255, 0.03) 0%, transparent 50%);
    pointer-events: none;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px 36px;
    box-shadow: 0 20px 60px var(--shadow-lg), 0 0 0 1px rgba(255, 161, 22, 0.05);
    position: relative;
    z-index: 1;
    backdrop-filter: blur(10px);
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo-icon {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.auth-logo-icon svg {
    width: 48px;
    height: 48px;
    filter: drop-shadow(0 4px 12px rgba(255, 161, 22, 0.3));
}

.auth-card h1 {
    text-align: center;
    margin-bottom: 8px;
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.auth-card .auth-subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 0;
    font-size: 0.9rem;
    line-height: 1.5;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.auth-card .form-group {
    margin-bottom: 18px;
}

.auth-card .form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.auth-card .input-icon-wrapper {
    position: relative;
}

.auth-card .input-icon-wrapper .input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.95rem;
    opacity: 0.7;
    pointer-events: none;
}

.auth-card .input-icon-wrapper input {
    padding-left: 16px;
    padding-right: 16px;
    width: 100%;
    height: 46px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.92rem;
    font-family: 'Inter', sans-serif;
    transition: border-color 0.2s, box-shadow 0.2s;
}

/* Password field with eye toggle needs right padding */
.auth-card .input-icon-wrapper.has-toggle input {
    padding-right: 44px;
}

/* Hide browser's native password reveal button (Edge/Chrome on Windows) */
input[type="password"]::-ms-reveal,
input[type="password"]::-ms-clear,
input[type="password"]::-webkit-credentials-auto-fill-button {
    display: none !important;
}

/* Password visibility toggle */
.password-toggle-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: color 0.15s ease;
    border-radius: 4px;
}

.password-toggle-btn:hover {
    color: var(--accent);
}

.password-toggle-btn svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.auth-card .input-icon-wrapper input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(255, 161, 22, 0.1);
}

.auth-card .input-icon-wrapper input::placeholder {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.auth-card .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.auth-submit-btn {
    width: 100%;
    margin-top: 8px;
    padding: 14px 24px;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    border-radius: var(--radius-sm);
    transition: transform 0.15s, box-shadow 0.15s;
}

.auth-submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(255, 161, 22, 0.25);
}

.auth-submit-btn:active {
    transform: translateY(0);
}

.auth-divider {
    display: flex;
    align-items: center;
    margin: 20px 0;
    gap: 12px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.auth-divider span {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.auth-card .auth-link {
    text-align: center;
    margin-top: 0;
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.auth-card .auth-link a {
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s;
}

.auth-card .auth-link a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

.auth-footer {
    margin-top: 24px;
    text-align: center;
    position: relative;
    z-index: 1;
}

.auth-footer p {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
}

.auth-trust {
    margin-top: 16px;
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.auth-card .flash-message {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 0.85rem;
    line-height: 1.4;
}

.flash-message.error,
.flash-message.danger {
    background: rgba(239, 71, 67, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 71, 67, 0.3);
}

.flash-message.success {
    background: rgba(0, 184, 163, 0.1);
    color: var(--success);
    border: 1px solid rgba(0, 184, 163, 0.3);
}

.flash-message.warning {
    background: rgba(255, 192, 30, 0.1);
    color: var(--warning);
    border: 1px solid rgba(255, 192, 30, 0.3);
}

/* --- TOPIC GRID --- */
.topic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.mode-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-top: 16px;
}

.mode-card {
    background: transparent;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
}

.mode-card:hover {
    border-color: var(--accent);
    background: var(--accent-light);
}

.mode-card.selected {
    border-color: var(--accent);
    background: var(--accent-light);
    box-shadow: 0 0 0 1px var(--accent);
}

.mode-card-icon {
    font-size: 1.3rem;
    line-height: 1;
}

.mode-card-body {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.mode-card-body h3 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.mode-badge {
    font-size: 0.65rem;
    padding: 2px 7px;
    border-radius: 10px;
    background: var(--bg-elevated);
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
}

.mode-card.selected .mode-badge {
    background: var(--accent);
    color: #000;
}

.mode-card-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.4;
    margin: 0;
}

/* --- COLLAPSIBLE CATEGORIES --- */
details.topic-category {
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 16px;
    padding-bottom: 16px;
}

details.topic-category:last-child {
    border-bottom: none;
}

summary.category-title {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    color: var(--accent);
    padding: 8px 0;
    list-style: none;
    user-select: none;
}

summary.category-title::-webkit-details-marker {
    display: none;
}

summary.category-title::before {
    content: '\25B6';
    font-size: 0.7rem;
    transition: transform 0.2s ease;
    display: inline-block;
}

details[open] > summary.category-title::before {
    transform: rotate(90deg);
}

.category-count {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 12px;
    background: var(--bg-hover);
    color: var(--text-secondary);
    margin-left: auto;
}

/* --- SECTION HEADER --- */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.section-header h1,
.section-header h2,
.section-header h3 {
    margin: 0;
}

/* --- QUIZ --- */
.quiz-container {
    max-width: 720px;
    margin: 0 auto;
}

.quiz-question {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
    line-height: 1.5;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.quiz-option {
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 14px 18px;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.quiz-option:hover {
    border-color: var(--accent);
    background: var(--accent-light);
}

.quiz-option input[type="radio"] {
    display: none;
}

.quiz-option.selected,
.quiz-option:has(input:checked) {
    border-color: var(--accent);
    background: var(--accent-light);
}

.quiz-option.correct {
    border-color: var(--success);
    background: rgba(0, 184, 163, 0.1);
}

.quiz-option.wrong {
    border-color: var(--danger);
    background: rgba(239, 71, 67, 0.1);
}

.quiz-option .option-marker {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    flex-shrink: 0;
}

.quiz-option.selected .option-marker,
.quiz-option:has(input:checked) .option-marker {
    border-color: var(--accent);
    background: var(--accent);
    color: #000;
}

.quiz-progress {
    margin-bottom: 24px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.quiz-progress-bar {
    height: 4px;
    background: var(--bg-hover);
    border-radius: 2px;
    margin-top: 8px;
    overflow: hidden;
}

.quiz-progress-bar .fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* --- FEEDBACK CARD --- */
.feedback-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius-md);
    padding: 24px;
    margin-top: 20px;
}

.feedback-card .score-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 12px;
}

.feedback-card h3 {
    margin-bottom: 12px;
}

.feedback-card p {
    color: var(--text-secondary);
    line-height: 1.6;
}

.feedback-card .feedback-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

/* --- DIFFICULTY BADGES --- */
.difficulty-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
}

.difficulty-easy {
    background: rgba(0, 184, 163, 0.15);
    color: var(--success);
}

.difficulty-medium {
    background: rgba(255, 192, 30, 0.15);
    color: var(--warning);
}

.difficulty-hard {
    background: rgba(239, 71, 67, 0.15);
    color: var(--danger);
}

/* --- TIMER --- */
.timer-bar {
    height: 6px;
    background: var(--bg-hover);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 16px;
}

.timer-progress {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 1s linear;
}

.timer-bar.warning .timer-progress {
    background: var(--warning);
}

.timer-bar.critical .timer-progress {
    background: var(--danger);
    animation: timer-pulse 0.5s infinite alternate;
}

@keyframes timer-pulse {
    from { opacity: 1; }
    to { opacity: 0.6; }
}

.timer-display {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: right;
    margin-bottom: 8px;
}

.timer-display.warning {
    color: var(--warning);
}

.timer-display.critical {
    color: var(--danger);
}

/* --- VOICE CONTROLS --- */
.voice-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.voice-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.voice-btn .voice-icon {
    font-size: 0.85rem;
}

.voice-btn:hover {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent);
}

.voice-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #000;
}

.voice-btn.recording,
.voice-btn.active.recording {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
    animation: recording-pulse 1.5s infinite;
}

.voice-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

@keyframes recording-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 71, 67, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(239, 71, 67, 0); }
}

.voice-status {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-style: italic;
}

/* --- FLASHCARDS --- */
.flashcard-container {
    perspective: 1000px;
    margin: 24px auto;
    max-width: 600px;
}

.flashcard {
    width: 100%;
    min-height: 300px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.flashcard.flipped {
    transform: rotateY(180deg);
}

.flashcard-front,
.flashcard-back {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.flashcard-back {
    transform: rotateY(180deg);
    background: var(--bg-elevated);
}

.flashcard-front h3 {
    font-size: 1.1rem;
    margin-bottom: 12px;
}

.flashcard-front p,
.flashcard-back p {
    color: var(--text-secondary);
    line-height: 1.6;
}

.flashcard-controls {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 16px;
}

.flashcard-counter {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 12px;
}

/* --- CHAT --- */
.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 200px);
    min-height: 400px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-bubble {
    max-width: 80%;
    padding: 14px 18px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    line-height: 1.6;
    word-wrap: break-word;
}

.chat-bubble.assistant {
    background: var(--bg-elevated);
    color: var(--text-primary);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.chat-bubble.user {
    background: var(--accent);
    color: #000;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.chat-form {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.chat-form textarea,
.chat-form input {
    flex: 1;
    min-height: 44px;
    max-height: 120px;
    resize: none;
}

.chat-form .btn {
    flex-shrink: 0;
}

/* --- STUDY PLAN --- */
.study-plan-form-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    max-width: 600px;
    margin: 0 auto;
}

.study-plan-form-card h2 {
    margin-bottom: 16px;
}

.study-plan-result {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    margin-top: 24px;
}

.study-plan-result h3 {
    margin-bottom: 12px;
    color: var(--accent);
}

.study-plan-result .plan-day {
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.study-plan-result .plan-day:last-child {
    border-bottom: none;
}

.study-plan-result .plan-day h4 {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.study-plan-result .plan-day p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* --- MARKDOWN BODY --- */
.markdown-body {
    color: var(--text-primary);
    line-height: 1.7;
    font-size: 0.9rem;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
    margin-top: 24px;
    margin-bottom: 12px;
}

.markdown-body p {
    margin-bottom: 12px;
}

.markdown-body ul,
.markdown-body ol {
    padding-left: 24px;
    margin-bottom: 12px;
    list-style: disc;
}

.markdown-body ol {
    list-style: decimal;
}

.markdown-body li {
    margin-bottom: 6px;
}

.markdown-body code {
    background: var(--bg-elevated);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85em;
    font-family: 'Fira Code', 'Consolas', monospace;
}

.markdown-body pre {
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 16px;
    overflow-x: auto;
    margin-bottom: 12px;
}

.markdown-body pre code {
    background: none;
    padding: 0;
    font-size: 0.85rem;
}

.markdown-body blockquote {
    border-left: 3px solid var(--accent);
    padding-left: 16px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.markdown-body strong {
    font-weight: 600;
    color: var(--text-primary);
}

.markdown-body a {
    color: var(--link);
}

.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 16px;
}

.markdown-body th,
.markdown-body td {
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    text-align: left;
}

.markdown-body th {
    background: var(--bg-elevated);
    font-weight: 600;
}

/* --- DAILY CHALLENGE --- */
.daily-challenge {
    background: linear-gradient(135deg, var(--accent-light), rgba(255, 140, 0, 0.05));
    border: 1px solid var(--accent);
    border-radius: var(--radius-md);
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.daily-challenge .challenge-info h3 {
    color: var(--accent);
    margin-bottom: 4px;
}

.daily-challenge .challenge-info p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* --- WEAK AREAS --- */
.weak-areas {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
}

.weak-areas h3 {
    margin-bottom: 12px;
    color: var(--text-primary);
}

.weak-areas .weak-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.weak-areas .weak-item:last-child {
    border-bottom: none;
}

.weak-areas .weak-item .topic-name {
    font-size: 0.9rem;
    color: var(--text-primary);
}

.weak-areas .weak-item .score {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--danger);
}

/* --- XP SYSTEM --- */
.xp-banner {
    background: linear-gradient(135deg, var(--accent-light), rgba(255, 161, 22, 0.05));
    border: 1px solid var(--accent);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.xp-banner .xp-info {
    flex: 1;
}

.xp-banner .xp-level {
    font-weight: 700;
    color: var(--accent);
    font-size: 1.1rem;
}

.xp-banner .xp-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.xp-progress-bar {
    height: 8px;
    background: var(--bg-hover);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 8px;
}

.xp-progress-bar .xp-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-hover));
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* --- SCORECARD --- */
.scorecard {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 32px;
    max-width: 700px;
    margin: 0 auto;
    text-align: center;
}

.scorecard .score-main {
    font-size: 3rem;
    font-weight: 700;
    color: var(--accent);
    margin: 16px 0;
}

.scorecard .score-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.score-breakdown {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-top: 24px;
    text-align: center;
}

.score-breakdown .breakdown-item {
    padding: 16px;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
}

.score-breakdown .breakdown-item .item-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.score-breakdown .breakdown-item .item-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* --- DASHBOARD --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.history-table th,
.history-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem;
}

.history-table th {
    background: var(--bg-elevated);
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

.history-table td {
    color: var(--text-primary);
}

.history-table tr:last-child td {
    border-bottom: none;
}

.history-table tr:hover td {
    background: var(--bg-hover);
}

/* --- COMPANY HEADER --- */
.company-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.company-header .company-logo {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.company-header .company-info h2 {
    margin-bottom: 2px;
}

.company-header .company-info p {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* --- ERROR PAGE --- */
.error-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.error-card {
    text-align: center;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 48px 32px;
    max-width: 480px;
    width: 100%;
}

.error-card .error-code {
    font-size: 4rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 8px;
}

.error-card .error-message {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.error-card .btn {
    margin-top: 16px;
}

/* --- MINI LESSON & MODEL ANSWER --- */
.mini-lesson {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--link);
    border-radius: var(--radius-md);
    padding: 20px 24px;
    margin-top: 16px;
}

.mini-lesson h3 {
    color: var(--link);
    margin-bottom: 12px;
    font-size: 1rem;
}

.mini-lesson p,
.mini-lesson .markdown-body {
    color: var(--text-secondary);
    line-height: 1.6;
}

.model-answer {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--success);
    border-radius: var(--radius-md);
    padding: 20px 24px;
    margin-top: 16px;
}

.model-answer h3 {
    color: var(--success);
    margin-bottom: 12px;
    font-size: 1rem;
}

.model-answer p,
.model-answer .markdown-body {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* --- AUTOCOMPLETE --- */
.autocomplete-wrapper {
    position: relative;
    width: 100%;
}

.autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    max-height: 200px;
    overflow-y: auto;
    z-index: 50;
    box-shadow: 0 8px 24px var(--shadow-lg);
    margin-top: 4px;
}

.autocomplete-list .autocomplete-item {
    padding: 10px 16px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-primary);
    transition: background 0.1s ease;
}

.autocomplete-list .autocomplete-item:hover,
.autocomplete-list .autocomplete-item.active {
    background: var(--bg-hover);
}

.autocomplete-list .autocomplete-item.selected {
    background: var(--accent-light);
    color: var(--accent);
}

/* --- COLLAPSE CONTROLS --- */
.collapse-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.collapse-btn {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
}

.collapse-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* --- RESUME UPLOAD --- */
.resume-upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 40px;
    text-align: center;
    transition: all 0.2s ease;
    cursor: pointer;
}

.resume-upload-area:hover,
.resume-upload-area.dragover {
    border-color: var(--accent);
    background: var(--accent-light);
}

.resume-upload-area .upload-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
}

.resume-upload-area .upload-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.resume-upload-area .upload-hint {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 8px;
}

/* --- BOTTOM TABS (Mobile) --- */
.bottom-tabs {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--navbar-bg);
    border-top: 1px solid var(--border-color);
    align-items: center;
    justify-content: space-around;
    z-index: 100;
    padding: 0 8px;
}

.bottom-tabs .tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--text-muted);
    font-size: 0.7rem;
    text-decoration: none;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    transition: color 0.15s ease;
}

.bottom-tabs .tab-item .tab-icon {
    font-size: 1.25rem;
}

.bottom-tabs .tab-item.active {
    color: var(--accent);
}

.bottom-tabs .tab-item:hover {
    color: var(--accent-hover);
}

/* --- DRAWER (Mobile) --- */
.drawer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 200;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.drawer-overlay.active {
    opacity: 1;
}

.drawer {
    display: none;
    position: fixed;
    top: 0;
    right: -280px;
    width: 280px;
    height: 100vh;
    background: var(--bg-surface);
    border-left: 1px solid var(--border-color);
    z-index: 201;
    transition: right 0.3s ease;
    overflow-y: auto;
    padding: 24px;
}

.drawer.active {
    right: 0;
}

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

.drawer .drawer-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
}

.drawer .drawer-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.drawer .drawer-nav .nav-item {
    height: 44px;
}

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes skeleton-pulse {
    0% { background-position: -200px 0; }
    100% { background-position: calc(200px + 100%) 0; }
}

.animate-in {
    animation: fadeInUp 0.4s ease forwards;
    opacity: 0;
}

.animate-in:nth-child(1) { animation-delay: 0s; }
.animate-in:nth-child(2) { animation-delay: 0.05s; }
.animate-in:nth-child(3) { animation-delay: 0.1s; }
.animate-in:nth-child(4) { animation-delay: 0.15s; }
.animate-in:nth-child(5) { animation-delay: 0.2s; }
.animate-in:nth-child(6) { animation-delay: 0.25s; }
.animate-in:nth-child(7) { animation-delay: 0.3s; }
.animate-in:nth-child(8) { animation-delay: 0.35s; }
.animate-in:nth-child(9) { animation-delay: 0.4s; }
.animate-in:nth-child(10) { animation-delay: 0.45s; }
.animate-in:nth-child(11) { animation-delay: 0.5s; }
.animate-in:nth-child(12) { animation-delay: 0.55s; }

/* Skeleton loading */
.skeleton {
    background: linear-gradient(90deg, var(--bg-elevated) 0px, var(--bg-hover) 40px, var(--bg-elevated) 80px);
    background-size: 200px 100%;
    animation: skeleton-pulse 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

.skeleton-text {
    height: 14px;
    margin-bottom: 8px;
    width: 80%;
}

.skeleton-text:last-child {
    width: 60%;
}

.skeleton-title {
    height: 20px;
    width: 50%;
    margin-bottom: 16px;
}

.skeleton-card {
    height: 120px;
    border-radius: var(--radius-md);
}

/* --- QUIZ RESULTS PAGE --- */
.quiz-results {
    max-width: 700px;
    margin: 0 auto;
}

.quiz-results .results-header {
    text-align: center;
    margin-bottom: 32px;
}

.quiz-results .results-score {
    font-size: 3rem;
    font-weight: 700;
    color: var(--accent);
}

.quiz-results .results-summary {
    color: var(--text-secondary);
    margin-top: 8px;
}

/* --- ROLES PAGE --- */
.roles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.role-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.role-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px var(--shadow);
}

.role-card.selected {
    border-color: var(--accent);
    background: var(--accent-light);
}

.role-card h3 {
    margin-bottom: 8px;
    font-size: 1rem;
}

.role-card p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* --- HOME PAGE --- */
.hero-section {
    text-align: center;
    padding: 48px 16px;
    max-width: 700px;
    margin: 0 auto;
}

.hero-section h1 {
    margin-bottom: 16px;
}

.hero-section p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 24px;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 48px;
}

.feature-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    text-align: center;
    transition: all 0.2s ease;
}

.feature-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px var(--shadow);
}

.feature-card .feature-icon {
    font-size: 2rem;
    margin-bottom: 12px;
}

.feature-card h3 {
    margin-bottom: 8px;
    font-size: 1rem;
}

.feature-card p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.5;
}

/* --- INTERVIEW PAGE --- */
.interview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.interview-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.interview-meta .meta-tag {
    font-size: 0.8rem;
    padding: 4px 10px;
    background: var(--bg-elevated);
    border-radius: 12px;
    color: var(--text-secondary);
}

.question-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    margin-bottom: 20px;
}

.question-card .question-number {
    font-size: 0.8rem;
    color: var(--accent);
    font-weight: 600;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.question-card .question-text {
    font-size: 1.05rem;
    line-height: 1.6;
    color: var(--text-primary);
}

.answer-area {
    margin-top: 16px;
}

.answer-area textarea {
    min-height: 150px;
}

/* --- COMPANY SELECT --- */
.company-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.company-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.company-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.company-card.selected {
    border-color: var(--accent);
    background: var(--accent-light);
}

.company-card .company-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.company-card .company-name {
    font-weight: 600;
    font-size: 0.9rem;
}

/* --- RESUME INTERVIEW --- */
.resume-question-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
}

.resume-question-card .question-context {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-style: italic;
}

.resume-feedback {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius-md);
    padding: 20px 24px;
    margin-top: 16px;
}

/* --- LOADING STATES --- */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: inherit;
    z-index: 10;
}

/* --- HTMX STATES --- */
.htmx-indicator {
    display: none;
}

.htmx-request .htmx-indicator {
    display: inline-block;
}

.htmx-request.htmx-indicator {
    display: inline-block;
}

/* --- BADGES & TAGS --- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-accent {
    background: var(--accent-light);
    color: var(--accent);
}

.badge-success {
    background: rgba(0, 184, 163, 0.15);
    color: var(--success);
}

.badge-warning {
    background: rgba(255, 192, 30, 0.15);
    color: var(--warning);
}

.badge-danger {
    background: rgba(239, 71, 67, 0.15);
    color: var(--danger);
}

/* --- TABS --- */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
    gap: 0;
    overflow-x: auto;
}

.tab {
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    font-family: inherit;
}

.tab:hover {
    color: var(--text-primary);
}

.tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* --- TOOLTIPS --- */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-elevated);
    color: var(--text-primary);
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    box-shadow: 0 4px 12px var(--shadow);
    border: 1px solid var(--border-color);
}

.tooltip:hover::after {
    opacity: 1;
}

/* --- PROGRESS BARS --- */
.progress-bar {
    height: 8px;
    background: var(--bg-hover);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar .progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-bar.success .progress-fill {
    background: var(--success);
}

.progress-bar.warning .progress-fill {
    background: var(--warning);
}

.progress-bar.danger .progress-fill {
    background: var(--danger);
}

/* --- EMPTY STATES --- */
.empty-state {
    text-align: center;
    padding: 48px 16px;
    color: var(--text-muted);
}

.empty-state .empty-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.empty-state h3 {
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 0.9rem;
    max-width: 400px;
    margin: 0 auto 16px;
}

/* --- DIVIDERS --- */
.divider {
    height: 1px;
    background: var(--border-color);
    margin: 24px 0;
}

.divider-text {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin: 24px 0;
}

.divider-text::before,
.divider-text::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

/* --- SCROLLBAR --- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--bg-hover);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* --- UTILITY CLASSES --- */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }

.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mt-8 { margin-top: 32px; }
.mt-12 { margin-top: 48px; }
.mt-16 { margin-top: 64px; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mb-8 { margin-bottom: 32px; }
.mb-12 { margin-bottom: 48px; }

.p-0 { padding: 0; }
.p-2 { padding: 8px; }
.p-3 { padding: 12px; }
.p-4 { padding: 16px; }
.p-6 { padding: 24px; }
.p-8 { padding: 32px; }

.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }

.grid { display: grid; }

.hidden { display: none; }
.block { display: block; }

.w-full { width: 100%; }
.max-w-sm { max-width: 400px; }
.max-w-md { max-width: 600px; }
.max-w-lg { max-width: 800px; }
.max-w-xl { max-width: 1000px; }

.rounded { border-radius: var(--radius-sm); }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-full { border-radius: 9999px; }

.shadow { box-shadow: 0 4px 12px var(--shadow); }
.shadow-lg { box-shadow: 0 12px 40px var(--shadow-lg); }

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

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* --- RESPONSIVE --- */
@media (max-width: 768px) {
    .app-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: none;
    }

    .main-content {
        padding: 16px;
        padding-bottom: 72px;
    }

    .hamburger-btn {
        display: flex;
    }

    .bottom-tabs {
        display: flex;
    }

    .drawer,
    .drawer-overlay {
        display: block;
    }

    .navbar {
        padding: 0 16px;
    }

    .topic-grid,
    .mode-grid {
        grid-template-columns: 1fr;
    }

    .company-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

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

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

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

    .score-breakdown {
        grid-template-columns: repeat(2, 1fr);
    }

    .daily-challenge {
        flex-direction: column;
        text-align: center;
    }

    .chat-container {
        height: calc(100vh - 170px);
    }

    .chat-bubble {
        max-width: 90%;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .hero-section {
        padding: 32px 16px;
    }

    .auth-card {
        padding: 28px 20px;
    }

    .auth-card .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .interview-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .company-header {
        flex-direction: column;
        align-items: flex-start;
    }

    /* Mobile form sizing */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="url"],
    input[type="search"],
    input[type="tel"],
    textarea,
    select {
        font-size: 16px;
    }

    .history-table {
        display: block;
        overflow-x: auto;
    }

    .flashcard-container {
        margin: 16px auto;
    }

    .flashcard {
        min-height: 250px;
    }

    .xp-banner {
        flex-direction: column;
        text-align: center;
    }

    .tabs {
        gap: 0;
    }

    .tab {
        padding: 10px 14px;
        font-size: 0.8rem;
    }
}

/* Tablet adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
    .sidebar {
        width: 60px;
    }

    .sidebar .nav-label {
        display: none;
    }

    .sidebar .sidebar-logo span {
        display: none;
    }

    .sidebar .user-info {
        display: none;
    }

    .main-content {
        padding: 24px;
    }
}

/* --- REDUCED MOTION --- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .flashcard {
        transition: none;
    }

    .animate-in {
        animation: none;
        opacity: 1;
    }
}

/* --- PRINT --- */
@media print {
    .sidebar,
    .bottom-tabs,
    .navbar,
    .drawer,
    .drawer-overlay,
    .voice-controls,
    .theme-toggle {
        display: none !important;
    }

    .app-layout {
        grid-template-columns: 1fr;
    }

    .main-content {
        padding: 0;
    }

    body {
        background: #fff;
        color: #000;
    }

    .card,
    .topic-card,
    .mode-card,
    .stat-card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* --- FOCUS VISIBLE --- */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* --- SELECTION --- */
::selection {
    background: var(--accent);
    color: #000;
}

/* --- MOCK CHAT PAGE --- */
.mock-chat-layout {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 120px);
}

.mock-chat-layout .chat-container {
    flex: 1;
    height: auto;
}

/* --- VOICE INTERVIEW MODE --- */
.voice-mode-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--border-color);
}

.voice-mode-toggle {
    position: relative;
    display: inline-flex;
    cursor: pointer;
}

.voice-mode-toggle input { display: none; }

.voice-mode-track {
    width: 36px;
    height: 20px;
    background: var(--bg-hover);
    border-radius: 10px;
    position: relative;
    transition: background 0.2s;
}

.voice-mode-track::after {
    content: '';
    position: absolute;
    top: 2px; left: 2px;
    width: 16px; height: 16px;
    background: #888;
    border-radius: 50%;
    transition: all 0.2s;
}

.voice-mode-toggle input:checked + .voice-mode-track {
    background: rgba(245, 158, 11, 0.3);
}

.voice-mode-toggle input:checked + .voice-mode-track::after {
    left: 18px;
    background: var(--accent);
}

.voice-mode-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
}

.voice-mode-hint {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-left: auto;
}

/* Voice Interview Panel */
.voice-interview-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
    min-height: 280px;
    text-align: center;
    gap: 16px;
}

.voice-status-display {
    margin-bottom: 8px;
}

.voice-phase-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.voice-mic-btn {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    background: var(--bg-elevated);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.voice-mic-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.voice-mic-btn.ready {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-light);
}

.voice-mic-btn.ready:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.2);
}

.voice-mic-btn.recording {
    border-color: var(--danger);
    color: #fff;
    background: var(--danger);
    animation: mic-pulse 1.5s infinite;
}

@keyframes mic-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 71, 67, 0.4); }
    50% { box-shadow: 0 0 0 12px rgba(239, 71, 67, 0); }
}

.voice-mic-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0;
}

.voice-transcript-preview {
    width: 100%;
    max-height: 100px;
    overflow-y: auto;
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.6;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    text-align: left;
    min-height: 40px;
}

.voice-transcript-preview:empty {
    display: none;
}

.voice-submit-btn {
    margin-top: 4px;
}

/* --- INTERVIEW PAGE SPECIFIC --- */
.interview-controls {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.interview-progress {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.interview-progress .step {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-hover);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
}

.interview-progress .step.active {
    background: var(--accent);
    color: #000;
}

.interview-progress .step.completed {
    background: var(--success);
    color: #fff;
}

.interview-progress .step-connector {
    flex: 1;
    height: 2px;
    background: var(--border-color);
    max-width: 32px;
}

/* --- TOAST / NOTIFICATIONS --- */
.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    box-shadow: 0 8px 24px var(--shadow-lg);
    z-index: 1000;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.toast.success {
    border-left: 4px solid var(--success);
}

.toast.error {
    border-left: 4px solid var(--danger);
}

/* --- MODAL --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
    padding: 16px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px var(--shadow-lg);
    transform: scale(0.95);
    transition: transform 0.2s ease;
}

.modal-overlay.active .modal {
    transform: scale(1);
}

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

.modal-header h2 {
    font-size: 1.25rem;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

/* --- AVATAR SIZES --- */
.avatar-sm {
    width: 28px;
    height: 28px;
    font-size: 0.7rem;
}

.avatar-md {
    width: 40px;
    height: 40px;
    font-size: 0.9rem;
}

.avatar-lg {
    width: 56px;
    height: 56px;
    font-size: 1.2rem;
}

/* --- CHIP / TAG LIST --- */
.chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    cursor: default;
}

.chip.active {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent);
}

.chip .chip-remove {
    font-size: 1rem;
    cursor: pointer;
    color: var(--text-muted);
    margin-left: 2px;
}

.chip .chip-remove:hover {
    color: var(--danger);
}

/* --- TOGGLE SWITCH --- */
.toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.toggle-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    background: var(--bg-hover);
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.toggle-switch.active {
    background: var(--accent);
}

.toggle-label input[type="checkbox"]:checked + .toggle-switch {
    background: var(--accent);
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s ease;
}

.toggle-switch.active::after {
    transform: translateX(20px);
}

.toggle-label input[type="checkbox"]:checked + .toggle-switch::after {
    transform: translateX(20px);
}

/* --- DROPDOWN MENU --- */
.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 180px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: 0 8px 24px var(--shadow-lg);
    z-index: 50;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: all 0.15s ease;
}

.dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: 0.85rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.1s ease;
}

.dropdown-item:hover {
    background: var(--bg-hover);
}

.dropdown-item.danger {
    color: var(--danger);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}

/* --- INTERVIEW QUESTION PARTIAL --- */
.question-container {
    animation: fadeInUp 0.3s ease forwards;
}

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

.question-badge {
    font-size: 0.75rem;
    padding: 3px 10px;
    border-radius: 12px;
    font-weight: 600;
}

/* --- CHAT RESPONSE PARTIAL --- */
.chat-response {
    animation: fadeIn 0.3s ease;
}

.chat-response .response-content {
    margin-top: 8px;
}

/* --- RESUME FEEDBACK PARTIAL --- */
.resume-feedback-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    animation: fadeInUp 0.4s ease forwards;
}

.resume-feedback-card .feedback-category {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.resume-feedback-card .feedback-category:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.resume-feedback-card .category-title {
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 8px;
    font-size: 0.9rem;
}

/* --- STUDY PLAN RESULT PARTIAL --- */
.study-plan-result .plan-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.study-plan-result .plan-timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.study-plan-result .timeline-item {
    display: flex;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-color);
}

.study-plan-result .timeline-item:last-child {
    border-bottom: none;
}

.study-plan-result .timeline-marker {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
    margin-top: 6px;
    flex-shrink: 0;
}

/* --- PAGINATION --- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 24px;
}

.pagination .page-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.pagination .page-btn:hover {
    background: var(--bg-hover);
}

.pagination .page-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #000;
}

.pagination .page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* --- STREAK / GAMIFICATION --- */
.streak-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: var(--accent-light);
    border: 1px solid var(--accent);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent);
}

.streak-badge .streak-fire {
    font-size: 1rem;
}

/* --- SEARCH BAR --- */
.search-bar {
    position: relative;
    max-width: 400px;
    width: 100%;
}

.search-bar input {
    padding-left: 40px;
    width: 100%;
}

.search-bar .search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1rem;
    pointer-events: none;
}

/* --- FILTER BAR --- */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.filter-bar select {
    width: auto;
    min-width: 140px;
}

/* --- TABLE WRAPPER FOR OVERFLOW --- */
.table-wrapper {
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.table-wrapper .history-table {
    border: none;
    border-radius: 0;
}

/* --- ACCORDION --- */
.accordion-item {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    overflow: hidden;
}

.accordion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: var(--bg-surface);
    cursor: pointer;
    font-weight: 500;
    color: var(--text-primary);
    transition: background 0.15s ease;
}

.accordion-header:hover {
    background: var(--bg-hover);
}

.accordion-header .accordion-icon {
    transition: transform 0.2s ease;
    color: var(--text-muted);
}

.accordion-item.open .accordion-header .accordion-icon {
    transform: rotate(180deg);
}

.accordion-content {
    padding: 0 18px;
    max-height: 0;
    overflow: hidden;
    transition: all 0.2s ease;
}

.accordion-item.open .accordion-content {
    padding: 16px 18px;
    max-height: 500px;
}

/* --- QUESTION NAVIGATION --- */
.question-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

/* --- ALERT / NOTICE --- */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.alert-info {
    background: rgba(92, 179, 255, 0.1);
    color: var(--link);
    border: 1px solid rgba(92, 179, 255, 0.3);
}

.alert-success {
    background: rgba(0, 184, 163, 0.1);
    color: var(--success);
    border: 1px solid rgba(0, 184, 163, 0.3);
}

.alert-warning {
    background: rgba(255, 192, 30, 0.1);
    color: var(--warning);
    border: 1px solid rgba(255, 192, 30, 0.3);
}

.alert-danger {
    background: rgba(239, 71, 67, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 71, 67, 0.3);
}

/* --- INLINE CODE --- */
code {
    background: var(--bg-elevated);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85em;
    font-family: 'Fira Code', 'Consolas', monospace;
}

/* --- FORM ACTIONS ROW --- */
.form-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.form-actions .btn {
    min-width: 120px;
}

/* --- ICON BUTTON --- */
.icon-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 1.1rem;
}

.icon-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* --- BREADCRUMBS --- */
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.breadcrumbs a {
    color: var(--text-secondary);
}

.breadcrumbs a:hover {
    color: var(--accent);
}

.breadcrumbs .separator {
    color: var(--text-muted);
}

.breadcrumbs .current {
    color: var(--text-primary);
    font-weight: 500;
}

/* --- CONTAINER VARIANTS --- */
.container-sm {
    max-width: 600px;
    margin: 0 auto;
}

.container-md {
    max-width: 800px;
    margin: 0 auto;
}

.container-lg {
    max-width: 1000px;
    margin: 0 auto;
}

.container-xl {
    max-width: 1200px;
    margin: 0 auto;
}

/* --- LARGE SCREEN ADJUSTMENTS --- */
@media (min-width: 1400px) {
    .main-content {
        padding: 40px 48px;
    }

    .topic-grid,
    .mode-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* --- HIGH DPI ADJUSTMENTS --- */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    body {
        -webkit-font-smoothing: antialiased;
    }
}

/* --- SAFE AREA (notch devices) --- */
@supports (padding: env(safe-area-inset-bottom)) {
    .bottom-tabs {
        padding-bottom: env(safe-area-inset-bottom);
        height: calc(56px + env(safe-area-inset-bottom));
    }

    .main-content {
        padding-bottom: calc(72px + env(safe-area-inset-bottom));
    }
}

/* --- DARK MODE IMAGE HANDLING --- */
[data-theme="dark"] img {
    opacity: 0.9;
}

[data-theme="dark"] img:hover {
    opacity: 1;
}

/* --- RADIO & CHECKBOX CUSTOM --- */
input[type="checkbox"],
input[type="radio"] {
    accent-color: var(--accent);
}

/* --- FILE INPUT --- */
input[type="file"] {
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

input[type="file"]::file-selector-button {
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    margin-right: 12px;
    transition: all 0.15s ease;
}

input[type="file"]::file-selector-button:hover {
    background: var(--bg-hover);
}

/* --- LINK STYLES --- */
.link {
    color: var(--link);
    text-decoration: none;
    font-weight: 500;
}

.link:hover {
    text-decoration: underline;
}

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

.link-muted:hover {
    color: var(--text-primary);
}

/* --- END OF STYLESHEET --- */


/* ============================================
   PHASE 2: Dashboard Redesign
   Progress Rings, Heatmap, Badges, Feed, Toast
   ============================================ */

/* --- DASHBOARD PROFILE HEADER --- */
.dash-profile {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    padding: 24px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
}

.dash-profile-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.dash-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: #000;
    flex-shrink: 0;
}

.dash-username {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.dash-user-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.dash-level-badge {
    background: var(--accent-light);
    color: var(--accent);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.dash-level-title {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.dash-streak {
    font-size: 0.85rem;
    color: var(--warning);
}

.dash-streak.streak-fire {
    color: var(--danger);
    font-weight: 600;
}

.streak-celebration {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(239, 71, 67, 0.08);
    border: 1px solid rgba(239, 71, 67, 0.2);
    border-radius: var(--radius-md);
    margin-bottom: 20px;
}

.streak-fire-icon {
    font-size: 1.4rem;
}

.streak-msg {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--danger);
}

.dash-xp-section {
    min-width: 200px;
}

.dash-xp-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-align: right;
}

.dash-xp-bar {
    height: 8px;
    background: var(--bg-hover);
    border-radius: 4px;
    overflow: hidden;
}

.dash-xp-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-hover));
    border-radius: 4px;
    transition: width 1s ease-out;
}

/* --- SECTION TITLES --- */
.dash-section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

/* --- PROGRESS RINGS --- */
.dash-rings-section {
    margin-bottom: 24px;
}

.dash-rings-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.progress-ring-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.progress-ring {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: conic-gradient(
        var(--ring-color) calc(var(--progress) * 1%),
        var(--bg-hover) calc(var(--progress) * 1%)
    );
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.progress-ring-inner {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: var(--bg-surface);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.ring-count {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.ring-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stats-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 20px;
}

.stat-mini {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.stat-mini-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-mini-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* --- HEATMAP --- */
.dash-heatmap-section {
    margin-bottom: 24px;
    padding: 20px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.dash-heatmap-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.dash-heatmap-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.heatmap-grid {
    display: grid;
    grid-template-columns: repeat(18, 1fr);
    grid-template-rows: repeat(5, 1fr);
    gap: 3px;
    grid-auto-flow: column;
}

.heatmap-cell {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 3px;
    background: var(--bg-hover);
    min-width: 0;
}

.heatmap-cell[data-count="1"],
.heatmap-cell[data-count="2"] {
    background: rgba(0, 184, 163, 0.25);
}

.heatmap-cell[data-count="3"],
.heatmap-cell[data-count="4"],
.heatmap-cell[data-count="5"] {
    background: rgba(0, 184, 163, 0.5);
}

.heatmap-cell[data-count="6"],
.heatmap-cell[data-count="7"],
.heatmap-cell[data-count="8"],
.heatmap-cell[data-count="9"] {
    background: rgba(0, 184, 163, 0.75);
}

.heatmap-cell[data-count="10"],
.heatmap-cell[data-count="11"],
.heatmap-cell[data-count="12"],
.heatmap-cell[data-count="13"],
.heatmap-cell[data-count="14"],
.heatmap-cell[data-count="15"] {
    background: var(--success);
}

.heatmap-legend {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
    justify-content: flex-end;
}

.heatmap-legend-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin: 0 4px;
}

.heatmap-legend .heatmap-cell {
    width: 12px;
    height: 12px;
    aspect-ratio: unset;
}

/* --- BADGES --- */
.dash-badges-section {
    margin-bottom: 24px;
}

.dash-badges-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.dash-badges-count {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.dash-badges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.badge-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px 12px;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.badge-card.unlocked {
    border-color: var(--accent);
    box-shadow: 0 0 12px rgba(255, 161, 22, 0.15);
}

.badge-card.unlocked:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(255, 161, 22, 0.25);
}

.badge-card.locked {
    opacity: 0.45;
    filter: grayscale(0.8);
}

.badge-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.badge-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.badge-desc {
    font-size: 0.7rem;
    color: var(--text-secondary);
    line-height: 1.3;
}

.badge-date {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 6px;
}

/* --- TOPIC STRENGTHS BARS --- */
.dash-topics-section {
    margin-bottom: 24px;
    padding: 20px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.topic-bars {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.topic-bar-row {
    display: grid;
    grid-template-columns: 140px 1fr 40px;
    align-items: center;
    gap: 12px;
}

.topic-bar-name {
    font-size: 0.8rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topic-bar-track {
    height: 8px;
    background: var(--bg-hover);
    border-radius: 4px;
    overflow: hidden;
}

.topic-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 1s ease-out;
}

.topic-bar-fill.fill-success { background: var(--success); }
.topic-bar-fill.fill-warning { background: var(--warning); }
.topic-bar-fill.fill-danger { background: var(--danger); }

.topic-bar-score {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: right;
}

/* --- BOTTOM GRID (Feed + Sessions) --- */
.dash-bottom-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

.dash-feed-section,
.dash-sessions-section {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
}

/* Activity Feed */
.activity-feed {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.feed-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.feed-item:last-child {
    border-bottom: none;
}

.feed-icon {
    font-size: 1rem;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent-light);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.feed-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.feed-text {
    font-size: 0.8rem;
    color: var(--text-primary);
}

.feed-xp {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent);
}

.feed-time {
    font-size: 0.7rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* Sessions List */
.sessions-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.session-item {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    text-decoration: none;
    transition: background 0.2s ease;
}

.session-item:hover {
    background: var(--bg-hover);
}

.session-topic {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
}

.session-meta {
    display: flex;
    gap: 8px;
    align-items: center;
}

.session-mode {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--bg-hover);
    color: var(--text-secondary);
}

.session-date {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.session-score {
    font-size: 0.85rem;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 6px;
}

.session-score.score-good { color: var(--success); background: rgba(0,184,163,0.1); }
.session-score.score-ok { color: var(--warning); background: rgba(255,192,30,0.1); }
.session-score.score-low { color: var(--danger); background: rgba(239,71,67,0.1); }

/* Dashboard Empty State */
.dash-empty {
    text-align: center;
    padding: 64px 24px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
}

.dash-empty-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.dash-empty h3 {
    margin-bottom: 8px;
}

.dash-empty p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

/* --- TOAST NOTIFICATIONS --- */
.toast-container {
    position: fixed;
    bottom: 80px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    color: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    animation: toastIn 0.3s ease forwards;
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 320px;
}

.toast.toast-out {
    animation: toastOut 0.3s ease forwards;
}

.toast-xp { background: linear-gradient(135deg, #f5a623, #ff8c00); }
.toast-success { background: linear-gradient(135deg, #00b8a3, #009688); }
.toast-achievement { background: linear-gradient(135deg, #7c3aed, #5b21b6); }
.toast-info { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.toast-streak { background: linear-gradient(135deg, #ef4743, #dc2626); }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(100px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(100px); }
}

/* --- RESPONSIVE DASHBOARD --- */
@media (max-width: 768px) {
    .dash-profile {
        flex-direction: column;
        align-items: flex-start;
    }
    .dash-xp-section {
        width: 100%;
    }
    .dash-xp-label {
        text-align: left;
    }
    .dash-rings-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .heatmap-grid {
        grid-template-columns: repeat(13, 1fr);
        grid-template-rows: repeat(7, 1fr);
    }
    .dash-badges-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    }
    .topic-bar-row {
        grid-template-columns: 100px 1fr 35px;
    }
    .dash-bottom-grid {
        grid-template-columns: 1fr;
    }
    .toast-container {
        right: 12px;
        left: 12px;
        bottom: 70px;
    }
    .toast {
        max-width: 100%;
    }
}


/* ============================================
   PHASE 3: Split-Pane, Quiz, Animations,
   Landing Page, Mobile Polish
   ============================================ */

/* --- SPLIT PANE (Interview) --- */
.interview-page {
    max-width: 100%;
}

.split-pane {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
}

.pane-left {
    position: sticky;
    top: 24px;
}

.sticky-question {
    position: relative;
}

.question-actions {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.answer-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
}

.answer-textarea {
    width: 100%;
    min-height: 180px;
    resize: vertical;
    font-family: inherit;
    font-size: 0.95rem;
    line-height: 1.6;
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    color: var(--text-primary);
    transition: border-color 0.2s ease;
}

.answer-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.textarea-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.submit-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 16px;
}

.loading-indicator {
    display: none;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.htmx-request .loading-indicator {
    display: flex;
}

.htmx-request .btn-submit {
    opacity: 0.5;
    pointer-events: none;
}

.feedback-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    flex-wrap: wrap;
}

/* --- QUIZ PROGRESS BUBBLES --- */
.quiz-page {
    max-width: 800px;
    margin: 0 auto;
}

.quiz-bubbles {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 20px;
    padding: 12px 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    justify-content: center;
}

.bubble {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
    background: var(--bg-hover);
    color: var(--text-muted);
    border: 2px solid transparent;
    transition: all 0.2s ease;
}

.bubble.done {
    background: var(--success);
    color: #fff;
    border-color: var(--success);
}

.bubble.current {
    background: var(--accent-light);
    color: var(--accent);
    border-color: var(--accent);
    transform: scale(1.15);
}

/* Quiz options enhanced */
.quiz-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
    margin-bottom: 8px;
    background: var(--bg-elevated);
    min-height: 48px;
}

.quiz-option:hover {
    border-color: var(--accent);
    background: var(--accent-light);
}

.quiz-option.selected {
    border-color: var(--accent);
    background: var(--accent-light);
    box-shadow: 0 0 0 2px var(--accent-light);
}

.quiz-option input[type="radio"] {
    display: none;
}

.quiz-option .option-letter {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    background: var(--bg-hover);
    color: var(--text-secondary);
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.quiz-option.selected .option-letter {
    background: var(--accent);
    color: #000;
}

.quiz-option .option-text {
    flex: 1;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.quiz-option.correct {
    border-color: var(--success);
    background: rgba(0, 184, 163, 0.1);
}

.quiz-option.correct .option-letter {
    background: var(--success);
    color: #fff;
}

.quiz-option.wrong {
    border-color: var(--danger);
    background: rgba(239, 71, 67, 0.1);
}

.quiz-option.wrong .option-letter {
    background: var(--danger);
    color: #fff;
}

.quiz-explanation {
    padding: 16px;
    border-radius: var(--radius-sm);
    margin-top: 16px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.quiz-explanation.correct-bg {
    background: rgba(0, 184, 163, 0.08);
    border: 1px solid rgba(0, 184, 163, 0.3);
}

.quiz-explanation.wrong-bg {
    background: rgba(239, 71, 67, 0.08);
    border: 1px solid rgba(239, 71, 67, 0.3);
}

.explanation-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.explanation-text p {
    margin-top: 4px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.5;
}

.quiz-next-actions {
    margin-top: 20px;
    display: flex;
    gap: 12px;
}

/* --- QUIZ RESULTS SCORE RING --- */
.quiz-results-page {
    max-width: 800px;
    margin: 0 auto;
}

.results-header {
    text-align: center;
    margin-bottom: 24px;
}

.results-topic {
    color: var(--text-secondary);
    margin-top: 4px;
}

.results-ring-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    margin-bottom: 32px;
}

.results-ring {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: conic-gradient(
        var(--ring-color) calc(var(--progress) * 1%),
        var(--bg-hover) calc(var(--progress) * 1%)
    );
    display: flex;
    align-items: center;
    justify-content: center;
}

.results-ring-inner {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    background: var(--bg-surface);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.results-percent {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.results-fraction {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.results-grade {
    text-align: center;
}

.grade {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.grade-a { background: rgba(0,184,163,0.15); color: var(--success); }
.grade-b { background: rgba(92,179,255,0.15); color: var(--link); }
.grade-c { background: rgba(255,192,30,0.15); color: var(--warning); }
.grade-d { background: rgba(239,71,67,0.15); color: var(--danger); }
.grade-f { background: rgba(239,71,67,0.25); color: var(--danger); }

.results-review {
    margin-bottom: 24px;
}

.review-item {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    overflow: hidden;
}

.review-item.review-correct {
    border-left: 3px solid var(--success);
}

.review-item.review-wrong {
    border-left: 3px solid var(--danger);
}

.review-summary {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    background: var(--bg-surface);
    transition: background 0.2s ease;
}

.review-summary:hover {
    background: var(--bg-elevated);
}

.review-num {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.review-question-text {
    flex: 1;
    font-size: 0.85rem;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.review-status {
    flex-shrink: 0;
}

.review-detail {
    padding: 16px;
    background: var(--bg-elevated);
    border-top: 1px solid var(--border-color);
}

.review-full-question {
    font-size: 0.9rem;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.review-answers {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 8px;
    font-size: 0.8rem;
}

.correct-text { color: var(--success); font-weight: 600; }
.wrong-text { color: var(--danger); font-weight: 600; }

.review-explanation {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
}

.results-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* --- MICRO ANIMATIONS --- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeInUp 0.3s ease forwards;
}

.question-card,
.answer-panel,
.feedback-card,
.badge-card,
.feature-card,
.stat-card,
.progress-ring-card {
    animation: fadeInUp 0.3s ease forwards;
}

/* Staggered entrance */
.topic-grid .topic-card:nth-child(1) { animation-delay: 0s; }
.topic-grid .topic-card:nth-child(2) { animation-delay: 0.05s; }
.topic-grid .topic-card:nth-child(3) { animation-delay: 0.1s; }
.topic-grid .topic-card:nth-child(4) { animation-delay: 0.15s; }
.topic-grid .topic-card:nth-child(5) { animation-delay: 0.2s; }

.dash-badges-grid .badge-card:nth-child(odd) { animation-delay: 0.05s; }
.dash-badges-grid .badge-card:nth-child(even) { animation-delay: 0.1s; }

/* Card hover lift */
.topic-card,
.feature-card,
.session-item {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.topic-card:hover,
.feature-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px var(--shadow);
}

/* Button press */
.btn:active {
    transform: scale(0.96);
}

/* Skeleton shimmer */
.skeleton-shimmer {
    width: 100px;
    height: 16px;
    border-radius: 4px;
    background: linear-gradient(90deg,
        var(--bg-hover) 25%,
        var(--bg-elevated) 50%,
        var(--bg-hover) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* HTMX swap animation */
.htmx-swapping { opacity: 0; transition: opacity 0.15s ease; }
.htmx-settling { opacity: 1; transition: opacity 0.15s ease; }

/* --- LANDING PAGE (Option 9: Developer Terminal) --- */
.landing-page {
    max-width: 1100px;
    margin: 0 auto;
}

/* Hero: Split layout */
.lp-hero {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 50px;
    align-items: center;
    padding: 60px 0 50px;
}

.lp-headline {
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    font-weight: 800;
    line-height: 1.12;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.lp-headline span {
    color: var(--accent);
}

.lp-subheadline {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 24px;
    max-width: 480px;
}

.lp-cta-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.lp-trust-note {
    margin-top: 14px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Terminal Mockup */
.lp-terminal {
    background: #0d0d14;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}

.lp-terminal-bar {
    background: #111118;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 7px;
    border-bottom: 1px solid var(--border-color);
}

.lp-terminal-bar span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.lp-terminal-bar span:nth-child(1) { background: #ef4444; }
.lp-terminal-bar span:nth-child(2) { background: #f59e0b; }
.lp-terminal-bar span:nth-child(3) { background: #22c55e; }

.lp-terminal-body {
    padding: 20px;
    font-family: 'Fira Code', 'Consolas', 'Courier New', monospace;
    font-size: 0.78rem;
    line-height: 1.9;
}

.t-line { white-space: nowrap; }
.t-comment { color: #555; }
.t-keyword { color: var(--accent); }
.t-string { color: #22c55e; }
.t-func { color: #5cb3ff; }

/* Inline stats (below hero CTA) */
.lp-inline-stats {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 24px;
    flex-wrap: wrap;
}

.lp-inline-stat {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 400;
}

.lp-inline-stat strong {
    color: var(--text-primary);
    font-weight: 700;
}

.lp-inline-divider {
    width: 1px;
    height: 12px;
    background: var(--border-color);
}

/* Features section */
.lp-features-section {
    margin-top: 56px;
    margin-bottom: 56px;
}

.lp-section-heading {
    text-align: center;
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.lp-section-sub {
    text-align: center;
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 28px;
}

.lp-features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.lp-feature-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px 18px;
    border-top: 2px solid transparent;
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.lp-feature-card:hover {
    border-top-color: var(--accent);
    transform: translateY(-2px);
}

.lp-feature-card h3 {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.lp-feature-card p {
    font-size: 0.72rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 0;
}

.lp-feature-tag {
    display: inline-block;
    margin-top: 8px;
    font-size: 0.6rem;
    padding: 2px 7px;
    background: var(--accent-light);
    color: var(--accent);
    border-radius: 3px;
    font-weight: 500;
}

/* How it works */
.lp-how {
    margin-bottom: 48px;
}

.lp-how-steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 24px;
}

.lp-step {
    text-align: center;
    padding: 16px 12px;
}

.lp-step-num {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--accent);
    color: #000;
    font-weight: 700;
    font-size: 0.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
}

.lp-step h4 {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--text-primary);
}

.lp-step p {
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Social proof */
.lp-social-proof {
    text-align: center;
    padding: 20px 0;
    margin-bottom: 32px;
}

.lp-sp-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.lp-sp-logos {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.lp-sp-logos span {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Bottom CTA */
.lp-bottom-cta {
    text-align: center;
    padding: 36px 24px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 40px;
}

.lp-bottom-cta h2 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.lp-bottom-cta p {
    color: var(--text-muted);
    font-size: 0.82rem;
    margin-bottom: 16px;
}

/* --- MOBILE POLISH --- */
@media (max-width: 1024px) {
    .split-pane {
        grid-template-columns: 1fr;
    }
    .pane-left {
        position: static;
    }
    .lp-hero {
        grid-template-columns: 1fr;
        text-align: center;
        padding: 40px 0;
        gap: 40px;
    }
    .lp-subheadline {
        margin-left: auto;
        margin-right: auto;
    }
    .lp-cta-row {
        justify-content: center;
    }
    .lp-inline-stats {
        justify-content: center;
    }
    .lp-features-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .lp-hero-right {
        display: none;
    }
    .lp-features-grid {
        grid-template-columns: 1fr;
    }
    .lp-how-steps {
        grid-template-columns: 1fr;
        gap: 4px;
    }
    .lp-sp-logos {
        gap: 14px;
    }
    .lp-sp-logos span {
        font-size: 0.72rem;
    }
    .lp-bottom-cta {
        padding: 28px 16px;
    }
    .quiz-bubbles {
        gap: 4px;
        padding: 8px 12px;
    }
    .bubble {
        width: 24px;
        height: 24px;
        font-size: 0.6rem;
    }
    .quiz-option {
        padding: 12px;
        min-height: 44px;
    }
    .answer-textarea {
        min-height: 150px;
    }
    .submit-bar {
        position: sticky;
        bottom: 70px;
        background: var(--bg-surface);
        padding: 12px 0;
        margin: 0 -16px;
        padding-left: 16px;
        padding-right: 16px;
        border-top: 1px solid var(--border-color);
        z-index: 10;
    }
    .results-ring {
        width: 140px;
        height: 140px;
    }
    .results-ring-inner {
        width: 112px;
        height: 112px;
    }
}

/* Safe area for notched phones */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .bottom-tabs {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* Touch target minimum */
button, a.btn, .quiz-option, .topic-card, .nav-item, .tab-item {
    min-height: 44px;
}

/* Prevent iOS zoom on input focus */
input, textarea, select {
    font-size: 16px;
}


/* --- TOPIC SEARCH & SECTION HEADER --- */
.section-header-fixed {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: nowrap;
}

.section-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.topic-search-input {
    padding: 7px 14px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: var(--bg-elevated);
    color: var(--text-primary);
    font-size: 0.82rem;
    width: 180px;
    transition: border-color 0.2s ease;
}

.topic-search-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-light);
}

/* --- QUICK ACTIONS ROW --- */
.quick-actions-row {
    display: flex;
    gap: 12px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.quick-action-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    flex: 1;
    min-width: 180px;
}

.quick-action-card:hover {
    border-color: var(--accent);
    box-shadow: 0 2px 12px rgba(255, 161, 22, 0.08);
}

.qa-indicator {
    width: 8px;
    height: 36px;
    border-radius: 4px;
    flex-shrink: 0;
}

.qa-indicator.daily { background: var(--accent); }
.qa-indicator.weak { background: var(--danger); }
.qa-indicator.random { background: var(--link); }

.qa-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.qa-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.qa-value {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-primary);
}

.qa-arrow {
    font-size: 1.1rem;
    color: var(--text-muted);
    transition: transform 0.2s;
}

.quick-action-card:hover .qa-arrow {
    transform: translateX(3px);
    color: var(--accent);
}

@media (max-width: 768px) {
    .section-header-fixed {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    .section-toolbar {
        justify-content: space-between;
    }
    .topic-search-input {
        width: 100%;
        flex: 1;
    }
    .quick-actions-row {
        flex-direction: column;
    }
    .quick-action-card {
        min-width: 0;
    }
}


/* --- PRACTICE MODE TILES (Option 3) --- */
.practice-modes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 16px;
}

.practice-mode-tile {
    background: var(--bg-surface);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.practice-mode-tile:hover {
    border-color: var(--accent);
    background: var(--accent-light);
}

.practice-mode-tile.active {
    border-color: var(--accent);
    background: var(--accent-light);
    box-shadow: 0 0 0 1px var(--accent);
}

.pmt-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.pmt-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.pmt-badge {
    font-size: 0.6rem;
    padding: 2px 7px;
    border-radius: 8px;
    background: var(--bg-elevated);
    color: var(--text-muted);
    font-weight: 500;
}

.practice-mode-tile.active .pmt-badge {
    background: var(--accent);
    color: #000;
}

.pmt-desc {
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* --- CONFIG PANEL (Clean Settings) --- */
.practice-config {
    margin-top: 20px;
    margin-bottom: 24px;
}

.config-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 4px 20px;
    margin-bottom: 16px;
}

.config-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    border-bottom: 1px solid var(--border-color);
    gap: 16px;
}

.config-row:last-child {
    border-bottom: none;
}

.config-row-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex-shrink: 0;
}

.config-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
}

.config-hint {
    font-size: 0.68rem;
    color: var(--text-muted);
    line-height: 1.3;
}

.config-row-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.config-auto-badge {
    font-size: 0.68rem;
    color: var(--accent);
    background: var(--accent-light);
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 500;
    white-space: nowrap;
}

.config-pills {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.config-pill-option {
    cursor: pointer;
    display: inline-flex;
    margin: 0;
}

.config-pill-option input[type="radio"] {
    display: none;
}

.config-pill {
    display: inline-block;
    padding: 6px 14px;
    border: 1.5px solid var(--border-color);
    border-radius: 18px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    transition: all 0.15s ease;
    cursor: pointer;
    white-space: nowrap;
}

.config-pill:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.config-pill-option input:checked + .config-pill {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
    font-weight: 600;
}

/* Colored difficulty pills */
.config-pill.pill-green { border-color: rgba(0,184,163,0.5); }
.config-pill-option input:checked + .config-pill.pill-green {
    background: var(--success); color: #fff; border-color: var(--success);
}

.config-pill.pill-yellow { border-color: rgba(255,192,30,0.5); }
.config-pill-option input:checked + .config-pill.pill-yellow {
    background: var(--warning); color: #000; border-color: var(--warning);
}

.config-pill.pill-red { border-color: rgba(239,71,67,0.5); }
.config-pill-option input:checked + .config-pill.pill-red {
    background: var(--danger); color: #fff; border-color: var(--danger);
}

/* Config toggle switch */
.config-toggle {
    position: relative;
    display: inline-flex;
    cursor: pointer;
}

.config-toggle input[type="checkbox"] {
    display: none;
}

.config-toggle-track {
    position: relative;
    width: 38px;
    height: 20px;
    background: var(--bg-hover);
    border-radius: 10px;
    transition: background 0.2s ease;
}

.config-toggle-track::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: #888;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.config-toggle input:checked + .config-toggle-track {
    background: rgba(255, 161, 22, 0.3);
}

.config-toggle input:checked + .config-toggle-track::after {
    left: 20px;
    background: var(--accent);
}

/* Config select dropdown */
.config-select {
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    font-size: 0.75rem;
    cursor: pointer;
    appearance: auto;
    font-family: inherit;
}

.config-select:focus {
    outline: none;
    border-color: var(--accent);
}

/* Start button */
#start-btn {
    margin-top: 0;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .practice-modes {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .config-panel {
        padding: 4px 14px;
    }
    .config-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding: 12px 0;
    }
    .config-row-right {
        justify-content: flex-start;
        width: 100%;
    }
    .config-pills {
        gap: 5px;
    }
    .config-pill {
        padding: 5px 10px;
        font-size: 0.7rem;
    }
    .pmt-name {
        font-size: 0.78rem;
    }
    .pmt-desc {
        font-size: 0.65rem;
    }
}


/* ============================================
   GOVERNMENT EXAM MODULE
   ============================================ */

/* --- GOVT LANDING --- */
.govt-landing { max-width: 900px; margin: 0 auto; }

.govt-hero {
    text-align: center;
    margin-bottom: 32px;
}

.govt-hero h1 { margin-bottom: 8px; }
.govt-hero p { color: var(--text-secondary); }

.govt-quick-stats {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-top: 12px;
}

.gqs-item {
    font-size: 0.85rem;
    color: var(--text-secondary);
    background: var(--bg-elevated);
    padding: 4px 12px;
    border-radius: 16px;
}

.govt-exam-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
}

.govt-exam-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.govt-exam-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.govt-dashboard-card { border-left: 3px solid var(--accent); }

.gec-icon { font-size: 1.8rem; flex-shrink: 0; }
.gec-content h3 { font-size: 1rem; color: var(--text-primary); margin-bottom: 2px; }
.gec-content p { font-size: 0.8rem; color: var(--text-secondary); }
.gec-arrow { margin-left: auto; color: var(--text-muted); font-size: 1.2rem; }

/* --- GOVT SELECT --- */
.govt-select { max-width: 800px; margin: 0 auto; }

.govt-select-header {
    margin-bottom: 24px;
}

.govt-select-header h1 { margin: 8px 0 4px; }
.govt-select-header p { color: var(--text-secondary); }

.govt-config-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.govt-config-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
}

.config-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 14px;
    color: var(--text-primary);
}

/* Mode cards */
.mode-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.mode-card {
    cursor: pointer;
}

.mode-card input { display: none; }

.mode-card-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 16px 12px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    text-align: center;
    transition: all 0.15s ease;
}

.mode-card input:checked + .mode-card-inner {
    border-color: var(--accent);
    background: var(--accent-light);
}

.mode-icon { font-size: 1.5rem; }
.mode-name { font-weight: 600; font-size: 0.9rem; color: var(--text-primary); }
.mode-desc { font-size: 0.7rem; color: var(--text-secondary); line-height: 1.3; }

/* Subject chips */
.subject-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.subject-chip {
    cursor: pointer;
}

.subject-chip input { display: none; }

.subject-chip-text {
    display: inline-block;
    padding: 7px 14px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: var(--bg-elevated);
    transition: all 0.15s ease;
}

.subject-chip input:checked + .subject-chip-text {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
    font-weight: 600;
}

.subject-chip-text:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Settings */
.settings-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.setting-group {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.setting-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    min-width: 120px;
}

.setting-options {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.pill-option {
    cursor: pointer;
}

.pill-option input { display: none; }

.pill-option span {
    display: inline-block;
    padding: 6px 14px;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: var(--bg-elevated);
    transition: all 0.15s ease;
}

.pill-option input:checked + span {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
    font-weight: 600;
}

.pill-option span:hover {
    border-color: var(--accent);
}

.govt-start-btn { width: 100%; }

/* --- GOVT QUIZ --- */
.govt-quiz-page { max-width: 800px; margin: 0 auto; }

.govt-quiz-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.gqh-left, .gqh-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.gqh-subject {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-light);
    padding: 3px 10px;
    border-radius: 4px;
}

.gqh-progress {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.gqh-negative {
    font-size: 0.7rem;
    color: var(--danger);
    background: rgba(239,71,67,0.1);
    padding: 2px 8px;
    border-radius: 4px;
}

.gqh-mode {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mode-practice { background: rgba(0,184,163,0.15); color: var(--success); }
.mode-test { background: rgba(255,192,30,0.15); color: var(--warning); }
.mode-exam { background: rgba(239,71,67,0.15); color: var(--danger); }

.govt-progress-bar {
    height: 4px;
    background: var(--bg-hover);
    border-radius: 2px;
    margin-bottom: 20px;
    overflow: hidden;
}

.govt-progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.govt-question-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
}

.govt-question-text {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-primary);
    margin-bottom: 20px;
}

.govt-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.govt-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
    background: var(--bg-elevated);
}

.govt-option:hover {
    border-color: var(--accent);
    background: var(--accent-light);
}

.govt-option.selected {
    border-color: var(--accent);
    background: var(--accent-light);
    box-shadow: 0 0 0 2px var(--accent-light);
}

.govt-option input[type="radio"] { display: none; }

.go-letter {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    background: var(--bg-hover);
    color: var(--text-secondary);
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.govt-option.selected .go-letter {
    background: var(--accent);
    color: #000;
}

.go-text {
    font-size: 0.9rem;
    color: var(--text-primary);
    line-height: 1.4;
}

.govt-action-bar {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

/* --- GOVT RESULT CARD --- */
.govt-result-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
}

.govt-result-card.result-correct { border-left: 4px solid var(--success); }
.govt-result-card.result-wrong { border-left: 4px solid var(--danger); }

.result-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.result-icon { font-size: 1.3rem; }
.result-text { font-size: 1.1rem; font-weight: 700; }
.result-correct .result-text { color: var(--success); }
.result-wrong .result-text { color: var(--danger); }

.result-answers { margin-bottom: 12px; font-size: 0.9rem; }
.result-answers p { margin-bottom: 4px; }

.result-explanation {
    background: var(--bg-elevated);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.result-next-form { display: inline; }

/* --- GOVT RESULTS PAGE --- */
.govt-results-page { max-width: 800px; margin: 0 auto; }

.govt-results-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.govt-score-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    margin-bottom: 32px;
}

.govt-score-stats {
    display: flex;
    gap: 16px;
}

.gss-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    gap: 4px;
}

.gss-item.correct-bg { background: rgba(0,184,163,0.1); }
.gss-item.wrong-bg { background: rgba(239,71,67,0.1); }
.gss-item.skip-bg { background: rgba(255,192,30,0.1); }

.gss-num { font-size: 1.5rem; font-weight: 700; color: var(--text-primary); }
.gss-label { font-size: 0.75rem; color: var(--text-secondary); }

.govt-net-score {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 16px 20px;
    width: 100%;
    max-width: 400px;
}

.net-score-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 0.85rem;
}

.net-score-row.net-total {
    border-top: 1px solid var(--border-color);
    margin-top: 6px;
    padding-top: 8px;
    font-size: 1rem;
}

/* Section breakdown bars */
.govt-section-breakdown, .govt-subject-section, .govt-review-section, .govt-recent-section {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 20px;
}

.section-bars { display: flex; flex-direction: column; gap: 10px; }

.section-bar-row {
    display: grid;
    grid-template-columns: 140px 1fr 50px 45px;
    align-items: center;
    gap: 10px;
}

.sb-name { font-size: 0.8rem; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-track { height: 8px; background: var(--bg-hover); border-radius: 4px; overflow: hidden; }
.sb-fill { height: 100%; border-radius: 4px; transition: width 0.5s ease; }
.sb-fill.fill-success { background: var(--success); }
.sb-fill.fill-warning { background: var(--warning); }
.sb-fill.fill-danger { background: var(--danger); }
.sb-score { font-size: 0.75rem; color: var(--text-secondary); text-align: right; }
.sb-pct { font-size: 0.75rem; font-weight: 600; color: var(--text-primary); text-align: right; }

/* Review options */
.review-subj-badge {
    font-size: 0.65rem;
    background: var(--bg-hover);
    padding: 2px 6px;
    border-radius: 3px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.review-item.review-skipped { border-left: 3px solid var(--warning); }

.review-options-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin: 8px 0;
}

.ro {
    font-size: 0.8rem;
    padding: 6px 10px;
    border-radius: 4px;
    background: var(--bg-hover);
    color: var(--text-primary);
}

.ro.ro-correct { background: rgba(0,184,163,0.15); color: var(--success); font-weight: 600; }
.ro.ro-wrong { background: rgba(239,71,67,0.15); color: var(--danger); font-weight: 600; }

.weak-callout {
    margin-top: 16px;
    padding: 12px 16px;
    background: rgba(239,71,67,0.08);
    border: 1px solid rgba(239,71,67,0.2);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: var(--text-primary);
}

.weak-callout a { color: var(--accent); font-weight: 600; }

.govt-results-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 24px;
    flex-wrap: wrap;
}

/* --- GOVT DASHBOARD --- */
.govt-dashboard { max-width: 900px; margin: 0 auto; }

.govt-dash-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.govt-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.govt-stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    text-align: center;
}

.gsc-value { display: block; font-size: 1.5rem; font-weight: 700; color: var(--accent); }
.gsc-label { font-size: 0.75rem; color: var(--text-secondary); }

.palette-confirm {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px;
    background: rgba(0,184,163,0.1);
    border: 1px solid rgba(0,184,163,0.3);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    color: var(--success);
}

.palette-icon { font-size: 1.2rem; }

/* Responsive */
@media (max-width: 768px) {
    .mode-options { grid-template-columns: 1fr; }
    .setting-group { flex-direction: column; align-items: flex-start; gap: 8px; }
    .setting-label { min-width: auto; }
    .govt-stats-grid { grid-template-columns: repeat(2, 1fr); }
    .section-bar-row { grid-template-columns: 100px 1fr 40px 35px; }
    .review-options-list { grid-template-columns: 1fr; }
    .govt-score-stats { flex-wrap: wrap; justify-content: center; }
}


/* --- PROFILE PAGE --- */
.profile-page { max-width: 700px; margin: 0 auto; }

.profile-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
}

.profile-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    color: #000;
    flex-shrink: 0;
}

.profile-info h1 {
    font-size: 1.5rem;
    margin-bottom: 4px;
}

.profile-meta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.profile-level {
    font-size: 0.85rem;
    color: var(--accent);
    font-weight: 500;
}

.profile-joined {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.profile-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    margin-bottom: 20px;
}

.profile-card-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.profile-details {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.detail-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.detail-value {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
}

.profile-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 16px;
}

.profile-stat {
    text-align: center;
    padding: 16px 8px;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
}

.ps-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 4px;
}

.ps-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.profile-actions {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

/* Make sidebar user clickable */
.sidebar-user {
    color: inherit;
}

.sidebar-user:hover .user-name {
    color: var(--accent);
}


/* --- RESUME TIPS --- */
.resume-tips {
    margin-top: 24px;
    padding: 16px 20px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
}

.resume-tips h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.resume-steps {
    list-style: none;
    counter-reset: step;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 0;
    margin: 0;
}

.resume-steps li {
    counter-increment: step;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.resume-steps li::before {
    content: counter(step);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--accent-light);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    flex-shrink: 0;
}


/* --- GLOBAL SPACING FIX --- */
.home-header {
    margin-top: 8px;
    margin-bottom: 28px;
    padding-bottom: 0;
}

.home-header h1 {
    font-size: 1.6rem;
    font-weight: 700;
    margin: 0;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.section {
    margin-bottom: 36px;
}

.section h2 {
    margin-bottom: 16px;
}

.section-header-fixed {
    margin-bottom: 16px;
    gap: 16px;
}

.section-header-fixed h2 {
    margin-bottom: 0;
}

.quick-actions-row {
    margin-top: 0;
    margin-bottom: 36px;
}

.topic-category-tabs {
    margin-bottom: 14px;
}

.topic-pills {
    margin-bottom: 0;
}

.interview-container {
    padding-top: 8px;
}

.auth-card h2 {
    margin-bottom: 8px;
}

/* Category spacing */
.topic-category {
    margin-bottom: 16px;
}

.topic-category summary {
    margin-bottom: 12px;
}

.topic-grid {
    gap: 16px;
    margin-bottom: 8px;
}

/* Page titles spacing from navbar */
.page-container {
    padding-top: 16px;
}

/* Company/Govt page spacing */
.govt-hero, .govt-select-header {
    margin-bottom: 28px;
}

.govt-config-card {
    margin-bottom: 0;
}


/* --- MOCK CHAT LAYOUT FIX --- */
.mock-chat-layout > .chat-container {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    margin-top: 16px;
}

.chat-message {
    margin-bottom: 16px;
}

.chat-bubble {
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 14px 18px;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-primary);
}

.chat-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.chat-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
    min-height: 80px;
}

.chat-input:focus {
    outline: none;
    border-color: var(--accent);
}

.chat-form .btn {
    align-self: flex-start;
}

.chat-form .voice-controls {
    align-self: flex-start;
}

.chat-topic-select {
    margin-bottom: 8px;
}


/* ============================================
   MOBILE TOUCH & INTERACTION FIXES
   ============================================ */

/* Ensure all buttons/links are tappable */
button, .btn, a.btn, .topic-card, .govt-exam-card, .govt-option,
.quiz-option, .mode-card, .subject-chip, .pill-option,
.difficulty-option, .quiz-length-option, .quick-action-card,
.tab-item, .nav-item, .collapse-btn, .session-item {
    -webkit-tap-highlight-color: rgba(255, 161, 22, 0.2);
    touch-action: manipulation;
    cursor: pointer;
}

/* Remove hover effects on touch devices (they cause sticky states) */
@media (hover: none) and (pointer: coarse) {
    .topic-card:hover,
    .govt-exam-card:hover,
    .govt-option:hover,
    .quiz-option:hover,
    .feature-card:hover,
    .quick-action-card:hover,
    .session-item:hover,
    .badge-card.unlocked:hover {
        transform: none;
        box-shadow: none;
    }

    .btn:active {
        transform: scale(0.96);
        opacity: 0.8;
    }

    .topic-card:active,
    .govt-exam-card:active,
    .quick-action-card:active {
        opacity: 0.7;
    }
}

/* Mobile-specific layout fixes */
@media (max-width: 768px) {
    /* Ensure content doesn't hide behind bottom tabs */
    .page-container {
        padding-bottom: 80px;
    }

    /* Make all buttons full-width on mobile for easy tapping */
    .btn-lg, .govt-start-btn, #start-btn {
        width: 100%;
        padding: 14px 20px;
        font-size: 0.95rem;
    }

    /* Topic cards - larger touch area */
    .topic-card {
        padding: 16px;
        min-height: 80px;
    }

    /* Govt exam cards - full width */
    .govt-exam-grid {
        grid-template-columns: 1fr;
    }

    .govt-exam-card {
        padding: 16px;
    }

    /* Quiz options - larger for finger tapping */
    .govt-option, .quiz-option {
        padding: 14px 16px;
        min-height: 52px;
    }

    /* Chat input - bigger on mobile */
    .chat-input, .answer-textarea, textarea {
        min-height: 100px;
        font-size: 16px; /* Prevents iOS zoom */
    }

    /* Submit buttons always visible */
    .govt-action-bar, .submit-bar {
        position: sticky;
        bottom: 70px;
        background: var(--bg-primary);
        padding: 12px 0;
        z-index: 10;
        border-top: 1px solid var(--border-color);
        margin-top: 12px;
    }

    /* Quick actions - stack vertically */
    .quick-actions-row {
        flex-direction: column;
    }

    /* Profile avatar smaller on mobile */
    .profile-avatar {
        width: 56px;
        height: 56px;
        font-size: 1.5rem;
    }

    /* Results actions - stack */
    .govt-results-actions, .results-actions, .profile-actions {
        flex-direction: column;
    }

    .govt-results-actions .btn, .results-actions .btn, .profile-actions .btn {
        width: 100%;
        text-align: center;
    }

    /* Score stats wrap */
    .govt-score-stats {
        gap: 8px;
    }

    .gss-item {
        padding: 10px 12px;
    }

    /* Section bars - compact on mobile */
    .section-bar-row {
        grid-template-columns: 80px 1fr 35px 30px;
        gap: 6px;
    }

    .sb-name {
        font-size: 0.7rem;
    }

    /* Flashcard fix */
    .flashcard-container {
        max-width: 100%;
    }

    /* Mode cards full width */
    .mode-options {
        grid-template-columns: 1fr;
    }

    /* Bottom nav z-index above sticky elements */
    .bottom-tabs {
        z-index: 100;
    }

    /* Drawer above everything */
    .drawer {
        z-index: 1000;
    }

    .drawer-overlay {
        z-index: 999;
    }

    /* Fix select dropdowns on mobile */
    select, .select-input, .timer-select {
        font-size: 16px;
        padding: 12px 14px;
        width: 100%;
    }

    /* Nav items in drawer - bigger tap targets */
    .drawer-nav .nav-item {
        padding: 14px 20px;
        font-size: 1rem;
        border-bottom: 1px solid var(--border-color);
    }
}

/* Very small screens (320px - 375px) */
@media (max-width: 400px) {
    .main-content {
        padding: 12px;
        padding-bottom: 76px;
    }

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

    .quiz-bubbles {
        display: none; /* Too cramped on tiny screens */
    }

    .govt-stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .profile-stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .dash-rings-grid {
        grid-template-columns: 1fr;
    }
}


/* --- TIMER BAR --- */
.timer-bar {
    background: none;
    border: none;
    padding: 0;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.timer-display {
    display: flex;
    align-items: center;
    gap: 8px;
}

.timer-display #timer-text {
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
}

.timer-label {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.timer-icon {
    display: none;
}

.timer-progress {
    display: none;
}

.timer-progress-fill {
    display: none;
}

.timer-bar.timer-warning #timer-text {
    color: var(--warning);
}

.timer-bar.timer-critical #timer-text {
    color: var(--danger);
    animation: pulse-text 1s infinite;
}

@keyframes pulse-text {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* --- READ ALOUD BUTTON SPACING FIX --- */
.question-card .voice-btn,
.govt-question-card .voice-btn {
    margin-top: 16px;
}

.question-actions {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

/* Voice button on quiz pages */
.quiz-page .voice-btn {
    margin-top: 12px;
}

.govt-quiz-page .voice-btn {
    margin-top: 12px;
}


/* --- QUIZ TOP BAR (Bubbles + Timer) --- */
.quiz-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    margin-bottom: 20px;
    gap: 16px;
}

.quiz-top-bar .quiz-bubbles {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    padding: 0;
    border: none;
    background: none;
    border-radius: 0;
}

.quiz-timer {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    flex-shrink: 0;
}

.quiz-timer.timer-warning #timer-text,
.timer-bar.timer-warning #timer-text {
    color: var(--warning);
}

.quiz-timer.timer-critical #timer-text,
.timer-bar.timer-critical #timer-text {
    color: var(--danger);
    animation: pulse-text 1s infinite;
}

@keyframes pulse-text {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}


/* --- STUDY PLAN RESULT FORMATTING --- */
.study-plan-content h2 {
    color: var(--accent);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
    margin-top: 28px;
    margin-bottom: 16px;
}

.study-plan-content h3 {
    color: var(--text-primary);
    margin-top: 20px;
    margin-bottom: 10px;
    padding-left: 12px;
    border-left: 3px solid var(--accent);
}

.study-plan-content ul, .study-plan-content ol {
    padding-left: 20px;
    margin-bottom: 12px;
}

.study-plan-content li {
    margin-bottom: 6px;
    line-height: 1.6;
    color: var(--text-secondary);
    list-style: disc;
}

.study-plan-content ol li {
    list-style: decimal;
}

.study-plan-content strong {
    color: var(--text-primary);
}

.study-plan-content a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.study-plan-content a:hover {
    color: var(--accent-hover);
}

.study-plan-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    font-size: 0.85rem;
}

.study-plan-content th, .study-plan-content td {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    text-align: left;
}

.study-plan-content th {
    background: var(--bg-elevated);
    font-weight: 600;
    color: var(--text-primary);
}

.study-plan-content td {
    color: var(--text-secondary);
}

.study-plan-content hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 20px 0;
}

.study-plan-content p {
    margin-bottom: 8px;
    line-height: 1.6;
}


/* --- INTERVIEW INLINE TIMER --- */
.interview-timer {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
    background: var(--accent-light);
    padding: 3px 10px;
    border-radius: 4px;
}

.interview-timer.timer-warning {
    color: var(--warning);
    background: rgba(255, 192, 30, 0.1);
}

.interview-timer.timer-critical {
    color: var(--danger);
    background: rgba(239, 71, 67, 0.1);
    animation: pulse-text 1s infinite;
}


/* ===== CODE PRACTICE STYLES ===== */

.code-practice-page {
    padding: 0;
}

.code-landing-header {
    margin-bottom: 24px;
}

.code-landing-header h1 {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.code-landing-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Language selector grid */
.language-select-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.language-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 20px 12px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    cursor: pointer;
    transition: border-color 0.2s, transform 0.15s;
    text-align: center;
}

.language-card input[type="radio"] { display: none; }

.language-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.language-card.selected { border-color: var(--accent); background: var(--accent-light); }

.lang-icon { font-size: 1.8rem; }
.lang-name { font-weight: 600; font-size: 1rem; color: var(--text-primary); }
.lang-desc { font-size: 0.75rem; color: var(--text-secondary); }

/* Schema selector */
.schema-select-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.schema-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 16px 12px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    cursor: pointer;
    transition: border-color 0.2s;
    text-align: center;
}

.schema-card input[type="radio"] { display: none; }
.schema-card:hover { border-color: var(--accent); }
.schema-card.selected { border-color: var(--accent); background: var(--accent-light); }
.schema-name { font-weight: 600; font-size: 0.9rem; color: var(--text-primary); }
.schema-desc { font-size: 0.7rem; color: var(--text-muted); }

/* Options row */
.code-options-row {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.option-group {
    flex: 1;
    min-width: 200px;
}

.option-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.option-chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.chip {
    cursor: pointer;
}

.chip input[type="radio"] { display: none; }

.chip span {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-secondary);
    transition: all 0.2s;
}

.chip input:checked + span {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
    font-weight: 600;
}

.code-select {
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: 0.85rem;
    width: 100%;
    max-width: 250px;
}

.timer-sel { max-width: 160px; margin-top: 8px; }

.code-start-btn {
    margin-top: 24px;
    width: 100%;
    max-width: 400px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

/* Code session layout */
.code-session-active {
    display: flex;
    flex-direction: column;
    overflow: visible;
}

.code-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    margin-bottom: 8px;
    flex-shrink: 0;
}

.code-progress {
    display: flex;
    align-items: center;
    gap: 10px;
}

.code-lang-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.code-lang-badge.sql { background: rgba(92, 179, 255, 0.15); color: #5cb3ff; }
.code-lang-badge.python { background: rgba(0, 184, 163, 0.15); color: var(--success); }
.code-lang-badge.math { background: rgba(255, 161, 22, 0.15); color: var(--accent); }

.code-difficulty-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
}

.code-difficulty-badge.easy { background: rgba(0, 184, 163, 0.1); color: var(--success); }
.code-difficulty-badge.medium { background: rgba(255, 192, 30, 0.1); color: var(--warning); }
.code-difficulty-badge.hard { background: rgba(239, 71, 67, 0.1); color: var(--danger); }

.code-qcount {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.code-timer {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Split pane */
.code-split-pane {
    display: flex;
    gap: 12px;
    min-height: 0;
}

.code-left-panel {
    flex: 0 0 35%;
    padding-right: 8px;
}

.code-right-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 0;
}

.code-question-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
}

.code-question-card h3 {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 10px;
}

.code-question-text {
    font-size: 0.92rem;
    line-height: 1.6;
    color: var(--text-primary);
    white-space: pre-wrap;
}

.code-schema-toggle {
    margin-top: 12px;
}

.code-schema-viewer {
    margin-top: 10px;
    border-top: 1px solid var(--border-color);
    padding-top: 10px;
}

.schema-tables details {
    margin-bottom: 8px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.schema-tables summary {
    cursor: pointer;
    font-size: 0.82rem;
    padding: 8px 12px;
    background: var(--bg-elevated);
    transition: background 0.2s;
}

.schema-tables summary:hover {
    background: var(--bg-hover);
}

.schema-tables ul {
    list-style: none;
    padding: 6px 12px 8px 16px;
    margin: 0;
    background: var(--bg-primary);
}

.schema-tables li {
    font-size: 0.76rem;
    padding: 3px 0;
    color: var(--text-secondary);
}

.schema-tables li code {
    color: var(--accent);
    font-weight: 500;
}

/* Code editor */
.code-editor-container {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 12px;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.editor-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.editor-status {
    font-size: 0.72rem;
    color: var(--success);
}

.code-editor-textarea {
    width: 100%;
    padding: 12px;
    font-family: 'Courier New', Consolas, monospace;
    font-size: 0.85rem;
    line-height: 1.5;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: none;
    resize: vertical;
    outline: none;
    tab-size: 4;
    min-height: 80px;
    max-height: 300px;
    overflow-y: auto;
}

/* Button bar */
.code-btn-bar {
    display: flex;
    gap: 8px;
    padding: 8px 0;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.btn-hint {
    background: rgba(255, 161, 22, 0.1);
    color: var(--accent);
    border: 1px solid rgba(255, 161, 22, 0.3);
}

.btn-hint:hover {
    background: rgba(255, 161, 22, 0.2);
}

/* Output panel */
.code-output-panel {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    min-height: 100px;
    display: flex;
    flex-direction: column;
}

.output-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-elevated);
    flex-shrink: 0;
}

.output-tab {
    padding: 6px 14px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}

.output-tab:hover { color: var(--text-primary); }
.output-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.output-content {
    flex: 1;
    overflow-y: auto;
    position: relative;
}

.output-pane {
    display: none;
    padding: 10px 12px;
}

.output-pane.active { display: block; }

.output-text {
    font-family: 'Courier New', Consolas, monospace;
    font-size: 0.8rem;
    line-height: 1.5;
    color: var(--text-primary);
    white-space: pre-wrap;
    margin: 0;
}

.output-error { color: var(--danger); }
.output-time { display: block; margin-top: 6px; font-size: 0.7rem; color: var(--text-muted); }

/* SQL output table */
.code-output-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
    font-family: 'Courier New', Consolas, monospace;
}

.code-output-table th {
    background: var(--bg-elevated);
    padding: 6px 10px;
    text-align: left;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
    color: var(--accent);
}

.code-output-table td {
    padding: 5px 10px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.code-output-table tr:nth-child(even) td { background: var(--bg-hover); }

.result-count {
    margin-top: 6px;
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Test results */
.test-summary {
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 8px;
}

.test-summary.pass { background: rgba(0, 184, 163, 0.1); color: var(--success); }
.test-summary.fail { background: rgba(239, 71, 67, 0.1); color: var(--danger); }

.test-case {
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
    font-size: 0.8rem;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.test-case.pass { color: var(--success); }
.test-case.fail { color: var(--danger); }
.test-icon { font-weight: 700; }
.test-detail { font-size: 0.75rem; color: var(--text-secondary); margin-top: 2px; }

/* Code feedback card */
.code-feedback-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-top: 12px;
}

.feedback-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.feedback-status {
    font-weight: 600;
    font-size: 0.85rem;
}

.feedback-status.correct { color: var(--success); }
.feedback-status.incorrect { color: var(--danger); }

.feedback-body { margin-bottom: 12px; }
.feedback-text { font-size: 0.88rem; color: var(--text-primary); line-height: 1.5; }
.feedback-section { margin-top: 8px; font-size: 0.84rem; color: var(--text-secondary); }
.feedback-section strong { color: var(--text-primary); }

.feedback-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

/* Code hint box */
.code-hint-box {
    background: rgba(255, 161, 22, 0.06);
    border: 1px solid rgba(255, 161, 22, 0.2);
    border-radius: var(--radius-md);
    padding: 14px;
    margin-top: 12px;
}

.hint-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.hint-icon { font-size: 1.1rem; }
.hint-title { font-weight: 600; font-size: 0.85rem; color: var(--accent); }
.hint-cost { font-size: 0.72rem; color: var(--text-muted); margin-left: auto; }
.hint-body { font-size: 0.85rem; color: var(--text-primary); line-height: 1.5; }
.hint-more-btn { margin-top: 10px; }
.hint-max { font-size: 0.75rem; margin-top: 8px; }

/* Code solution box */
.code-solution-box {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px;
    margin-top: 12px;
}

.solution-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.solution-icon { font-size: 1.1rem; }
.solution-title { font-weight: 600; font-size: 0.85rem; color: var(--text-primary); }

.solution-code {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px;
    overflow-x: auto;
    font-family: 'Courier New', Consolas, monospace;
    font-size: 0.8rem;
    line-height: 1.5;
    color: var(--text-primary);
}

/* Code results page */
.code-results-page {
    max-width: 800px;
    margin: 0 auto;
}

.results-header {
    margin-bottom: 24px;
}

.results-header h1 {
    font-size: 1.4rem;
    margin-bottom: 8px;
}

.results-meta {
    display: flex;
    gap: 10px;
    align-items: center;
}

.results-topic {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.results-overview {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 20px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
}

.results-score-card {
    text-align: center;
}

.score-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2rem;
    margin-bottom: 6px;
}

.score-circle.high { background: rgba(0, 184, 163, 0.15); color: var(--success); border: 3px solid var(--success); }
.score-circle.mid { background: rgba(255, 192, 30, 0.15); color: var(--warning); border: 3px solid var(--warning); }
.score-circle.low { background: rgba(239, 71, 67, 0.15); color: var(--danger); border: 3px solid var(--danger); }

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

.results-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    flex: 1;
}

.results-stat {
    text-align: center;
}

.results-stat .stat-num { display: block; font-size: 1.3rem; font-weight: 700; color: var(--text-primary); }
.results-stat .stat-desc { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; }

/* Question breakdown */
.results-questions {
    margin-bottom: 24px;
}

.results-questions h2 {
    font-size: 1rem;
    margin-bottom: 12px;
}

.result-question-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    overflow: hidden;
}

.result-question-card summary {
    padding: 10px 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.84rem;
    background: var(--bg-surface);
}

.result-question-card.correct summary { border-left: 3px solid var(--success); }
.result-question-card.incorrect summary { border-left: 3px solid var(--danger); }

.rq-number { font-weight: 700; color: var(--text-muted); min-width: 28px; }
.rq-status { font-size: 1rem; }
.rq-text { flex: 1; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rq-score { font-weight: 600; color: var(--accent); }

.rq-detail {
    padding: 12px 14px;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
}

.rq-section { margin-bottom: 10px; font-size: 0.84rem; }
.rq-section strong { display: block; margin-bottom: 4px; color: var(--text-secondary); }

.rq-code {
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px;
    font-family: 'Courier New', Consolas, monospace;
    font-size: 0.78rem;
    overflow-x: auto;
    white-space: pre-wrap;
}

.rq-hint-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.68rem;
    background: rgba(255, 161, 22, 0.1);
    color: var(--accent);
    margin-right: 8px;
}

.rq-time {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.results-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* Score badges in feedback */
.score-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    font-weight: 700;
    font-size: 1rem;
}

.score-badge.score-high { background: rgba(0, 184, 163, 0.15); color: var(--success); border: 2px solid var(--success); }
.score-badge.score-mid { background: rgba(255, 192, 30, 0.15); color: var(--warning); border: 2px solid var(--warning); }
.score-badge.score-low { background: rgba(239, 71, 67, 0.15); color: var(--danger); border: 2px solid var(--danger); }

/* Responsive: mobile stacks panels vertically */
@media (max-width: 768px) {
    .code-split-pane {
        flex-direction: column;
    }

    .code-left-panel {
        flex: none;
        width: 100%;
        padding-right: 0;
        margin-bottom: 12px;
    }

    .code-right-panel {
        width: 100%;
    }

    .code-session-active {
        height: auto;
        overflow: visible;
    }

    .code-practice-page {
        padding: 0;
    }

    .schema-select-grid {
        grid-template-columns: 1fr;
    }

    .language-select-grid {
        grid-template-columns: 1fr;
    }

    .code-options-row {
        flex-direction: column;
        gap: 16px;
    }

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

    .code-editor-textarea {
        min-height: 100px;
        max-height: 250px;
        font-size: 0.8rem;
    }

    .code-btn-bar {
        flex-wrap: wrap;
        gap: 6px;
    }

    .code-btn-bar .btn {
        flex: 1 1 auto;
        min-width: 70px;
        font-size: 0.75rem;
        padding: 8px 10px;
    }

    .code-output-panel {
        min-height: 80px;
    }

    .code-output-table {
        font-size: 0.68rem;
    }

    .code-output-table th,
    .code-output-table td {
        padding: 4px 6px;
    }

    .output-text {
        font-size: 0.75rem;
    }

    .code-question-card {
        padding: 12px;
    }

    .code-question-text {
        font-size: 0.85rem;
    }

    .code-top-bar {
        flex-wrap: wrap;
        gap: 8px;
    }

    .code-feedback-card {
        padding: 12px;
    }

    .feedback-actions {
        flex-direction: column;
        gap: 8px;
    }

    .feedback-actions .btn {
        width: 100%;
        text-align: center;
    }

    .code-hint-box {
        padding: 10px;
    }

    .code-solution-box {
        padding: 10px;
    }

    .solution-code {
        font-size: 0.72rem;
        padding: 8px;
    }

    .btn-explore {
        font-size: 0.65rem;
        padding: 3px 8px;
    }

    .results-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .result-question-card summary {
        font-size: 0.78rem;
        padding: 8px 10px;
    }

    .rq-code {
        font-size: 0.7rem;
        padding: 8px;
    }

    .code-landing-header h1 {
        font-size: 1.2rem;
    }

    .code-start-btn {
        max-width: 100%;
    }
}

/* Pyodide / runner loading states */
.code-loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(26, 26, 46, 0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: var(--radius-md);
    gap: 12px;
}

.code-loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: code-spin 0.8s linear infinite;
}

@keyframes code-spin {
    to { transform: rotate(360deg); }
}

.code-loading-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-align: center;
}

.code-loading-progress {
    width: 120px;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    overflow: hidden;
}

.code-loading-progress-bar {
    height: 100%;
    background: var(--accent);
    transition: width 0.3s;
    border-radius: 2px;
}

[data-theme="light"] .code-loading-overlay {
    background: rgba(247, 248, 250, 0.9);
}

/* Explore table button in schema viewer */
.btn-explore {
    display: inline-block;
    padding: 4px 10px;
    font-size: 0.7rem;
    font-weight: 500;
    font-family: 'Courier New', Consolas, monospace;
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    color: var(--accent);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
    margin-top: 6px;
}

.btn-explore:hover {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent-hover);
}

.schema-table-actions {
    padding: 4px 0 8px 0;
}


/* ===== CHATBOT FLOAT ICON ===== */

.chatbot-float-icon {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 9999;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--accent);
    color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: 0 4px 16px rgba(255, 161, 22, 0.35);
    transition: transform 0.2s, box-shadow 0.2s;
    animation: floatPulse 3s ease-in-out infinite;
}

@keyframes floatPulse {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

.chatbot-float-icon:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(255, 161, 22, 0.5);
    animation: none;
}

/* Tooltip bubble */
.chatbot-float-icon::before {
    content: 'Need help?';
    position: absolute;
    right: 56px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: 0.75rem;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    opacity: 0;
    pointer-events: none;
    animation: tooltipPop 4s ease-in-out infinite;
    animation-delay: 2s;
}

.chatbot-float-icon::after {
    content: '';
    position: absolute;
    right: 52px;
    top: 50%;
    transform: translateY(-50%);
    border: 5px solid transparent;
    border-left-color: var(--border-color);
    opacity: 0;
    pointer-events: none;
    animation: tooltipPop 4s ease-in-out infinite;
    animation-delay: 2s;
}

@keyframes tooltipPop {
    0%, 30%, 100% { opacity: 0; }
    40%, 80% { opacity: 1; }
}

.chatbot-float-icon:hover::before,
.chatbot-float-icon:hover::after {
    animation: none;
    opacity: 0;
}

.chatbot-float-icon svg {
    width: 24px;
    height: 24px;
}

/* When panel is open, transform icon to indicate active state */
.chatbot-float-icon.active {
    animation: none;
    transform: scale(0.9);
    background: var(--bg-surface);
    color: var(--accent);
    border: 2px solid var(--accent);
}

.chatbot-float-icon.active::before,
.chatbot-float-icon.active::after {
    display: none;
}

/* ===== CHATBOT INLINE PANEL ===== */
.chatbot-panel {
    position: fixed;
    bottom: 84px;
    right: 24px;
    width: 480px;
    max-height: calc(100vh - 120px);
    z-index: 9998;
    display: flex;
    flex-direction: column;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    animation: panelSlideUp 0.25s ease;
}

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

.chatbot-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.chatbot-panel-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chatbot-panel-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.chatbot-panel-subtitle {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.chatbot-panel-close {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.chatbot-panel-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.chatbot-panel-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chatbot-panel-input {
    padding: 8px 12px;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .chatbot-float-icon {
        right: 16px;
        bottom: 80px;
        width: 44px;
        height: 44px;
    }

    .chatbot-panel {
        right: 8px;
        left: 8px;
        bottom: 136px;
        width: auto;
        max-height: calc(100vh - 160px);
    }

    .chatbot-float-icon svg {
        width: 20px;
        height: 20px;
    }
}


/* ===== CHAT PAGE STYLES ===== */

.chat-page {
    position: fixed;
    bottom: 16px;
    right: 16px;
    width: 440px;
    height: 620px;
    z-index: 9998;
    display: flex;
    flex-direction: column;
}

.chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: -4px 4px 24px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.chat-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-bot-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent);
    color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chat-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0;
}

.chat-subtitle {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Messages area */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-msg {
    display: flex;
    gap: 8px;
    max-width: 92%;
    animation: chatFadeIn 0.3s ease;
}

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

.chat-msg.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-msg.bot {
    align-self: flex-start;
}

.chat-msg-avatar {
    width: 24px;
    height: 24px;
    min-width: 24px;
    border-radius: 6px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    flex-shrink: 0;
}

.chat-msg-bubble {
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 0.84rem;
    line-height: 1.55;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}

.chat-msg.bot .chat-msg-bubble {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-top-left-radius: 3px;
}

.chat-msg.bot .chat-msg-bubble strong {
    color: var(--accent);
    font-weight: 600;
}

.chat-msg.bot .chat-msg-bubble code {
    background: var(--bg-primary);
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-family: 'Courier New', monospace;
}

.chat-msg.bot .chat-msg-bubble .chat-list-num {
    color: var(--accent);
    font-weight: 600;
    margin-right: 2px;
}

.chat-msg.bot .chat-msg-bubble .chat-list-bullet {
    color: var(--accent);
    margin-right: 4px;
}

/* Chat formatted content styles */
.chat-msg.bot .chat-msg-bubble .chat-heading-1 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--accent);
    margin: 8px 0 4px 0;
}

.chat-msg.bot .chat-msg-bubble .chat-heading-2 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 6px 0 3px 0;
}

.chat-msg.bot .chat-msg-bubble .chat-heading-3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 5px 0 2px 0;
}

.chat-msg.bot .chat-msg-bubble .chat-list {
    margin: 6px 0;
    padding-left: 18px;
    list-style: none;
}

.chat-msg.bot .chat-msg-bubble ol.chat-list {
    counter-reset: chat-counter;
}

.chat-msg.bot .chat-msg-bubble ol.chat-list li {
    counter-increment: chat-counter;
    margin-bottom: 4px;
    line-height: 1.5;
}

.chat-msg.bot .chat-msg-bubble ol.chat-list li::before {
    content: counter(chat-counter) ".";
    color: var(--accent);
    font-weight: 600;
    margin-right: 6px;
    margin-left: -18px;
    display: inline-block;
    width: 18px;
}

.chat-msg.bot .chat-msg-bubble ul.chat-list li {
    margin-bottom: 4px;
    line-height: 1.5;
    position: relative;
}

.chat-msg.bot .chat-msg-bubble ul.chat-list li::before {
    content: "\2022";
    color: var(--accent);
    font-weight: 700;
    margin-right: 6px;
    margin-left: -14px;
}

.chat-msg.bot .chat-msg-bubble pre.chat-code-block {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 12px;
    margin: 8px 0;
    overflow-x: auto;
    font-size: 0.8rem;
    line-height: 1.5;
}

.chat-msg.bot .chat-msg-bubble pre.chat-code-block code {
    background: none;
    padding: 0;
    border-radius: 0;
    font-size: 0.8rem;
    font-family: 'Courier New', monospace;
    color: var(--text-primary);
}

.chat-msg.bot .chat-msg-bubble em {
    font-style: italic;
    color: var(--text-secondary);
}

.chat-msg.user .chat-msg-bubble {
    background: var(--accent);
    color: #000;
    border-top-right-radius: 3px;
}

/* Typing indicator */
.chat-typing {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    border-top-left-radius: 4px;
}

.chat-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: chatBounce 1.2s infinite;
}

.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes chatBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-5px); }
}

/* Input area */
.chat-input-area {
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

/* Hide voice.js injected buttons inside chat */
.chat-input-area .voice-controls,
.chat-input-area .voice-btn {
    display: none !important;
}

.chat-input-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 4px 6px 4px 12px;
    transition: border-color 0.2s;
}

.chat-input-wrapper:focus-within {
    border-color: var(--accent);
}

.chat-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 0.84rem;
    color: var(--text-primary);
    outline: none;
    padding: 8px 0;
    min-width: 0;
}

.chat-input::placeholder {
    color: var(--text-muted);
}

.chat-send-btn {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--accent);
    border: none;
    color: #000;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    flex-shrink: 0;
}

.chat-send-btn svg {
    width: 14px;
    height: 14px;
}

.chat-send-btn:hover {
    transform: scale(1.05);
    opacity: 0.9;
}

.chat-send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.chat-mic-btn {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    flex-shrink: 0;
}

.chat-mic-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(var(--accent-rgb, 255, 165, 0), 0.08);
}

.chat-mic-btn.recording {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
    animation: micPulse 1s ease-in-out infinite;
}

@keyframes micPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.chat-disclaimer {
    text-align: center;
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 6px;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .chat-page {
        bottom: 70px;
        right: 8px;
        left: 8px;
        width: auto;
        height: 60vh;
    }

    .chat-container {
        border-radius: var(--radius-md);
    }

    .chat-msg {
        max-width: 95%;
    }
}


/* ===== TOPIC PILLS & CATEGORY TABS ===== */

.topic-category-tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 0;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.cat-tab {
    padding: 5px 12px;
    border-radius: 16px;
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.cat-tab:hover {
    border-color: var(--accent);
    color: var(--text-primary);
}

.cat-tab.active {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
    font-weight: 600;
}

.topic-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 0;
}

.topic-pill {
    padding: 7px 14px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 500;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.topic-pill:hover {
    border-color: var(--accent);
    color: var(--text-primary);
    background: var(--accent-light);
}

.topic-pill.selected {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
    font-weight: 600;
}

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

.topic-search-input {
    padding: 6px 12px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: 0.8rem;
    width: 180px;
    outline: none;
    transition: border-color 0.2s;
}

.topic-search-input:focus {
    border-color: var(--accent);
}

.topic-search-input::placeholder {
    color: var(--text-muted);
}

@media (max-width: 768px) {
    .topic-category-tabs {
        gap: 4px;
    }

    .cat-tab {
        padding: 4px 10px;
        font-size: 0.7rem;
    }

    .topic-pill {
        padding: 6px 11px;
        font-size: 0.72rem;
    }

    .topic-search-input {
        width: 100%;
        order: -1;
    }
}


/* ============================================
   DOCUMENT Q&A STYLES
   ============================================ */

/* --- Drop Zone --- */
.drop-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1.5rem;
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--bg-primary);
    margin-bottom: 1rem;
}

.drop-zone:hover {
    border-color: var(--accent);
    background: rgba(255, 161, 22, 0.03);
}

.drop-zone.dragover {
    border-color: var(--accent);
    background: rgba(255, 161, 22, 0.08);
    transform: scale(1.01);
}

.drop-zone-icon {
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    opacity: 0.7;
}

.drop-zone-text {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
    margin: 0 0 0.25rem 0;
}

.drop-zone-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
}

/* --- Selected File Display --- */
.selected-file {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 1rem;
}

.selected-file-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.selected-file-icon {
    font-size: 1.5rem;
}

.selected-file-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    margin: 0;
    word-break: break-all;
}

.selected-file-size {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0.15rem 0 0 0;
}

.selected-file-remove {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0 0.25rem;
    line-height: 1;
    transition: color 0.15s;
}

.selected-file-remove:hover {
    color: var(--error);
}

/* --- Supported Formats Info --- */
.doc-formats-info {
    margin-bottom: 1.25rem;
}

.doc-formats-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0 0 0.5rem 0;
    font-weight: 500;
}

.doc-format-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.5rem;
}

.doc-format-tag {
    font-size: 0.72rem;
    padding: 0.2rem 0.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* --- Processing Overlay --- */
.doc-processing-overlay {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
}

.doc-processing-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: doc-spin 0.8s linear infinite;
    margin-bottom: 1rem;
}

@keyframes doc-spin {
    to { transform: rotate(360deg); }
}

.doc-processing-text {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
    margin: 0 0 0.25rem 0;
}

/* --- Document List & Cards --- */
.doc-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.doc-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: border-color 0.15s;
}

.doc-card:hover {
    border-color: var(--accent);
}

.doc-card-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
    flex: 1;
}

.doc-card-icon {
    font-size: 1.4rem;
    flex-shrink: 0;
}

.doc-card-name {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-primary);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 250px;
}

.doc-card-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0.15rem 0 0 0;
}

.doc-card-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
    margin-left: 0.75rem;
}

/* Document status badges */
.doc-status-ready {
    color: var(--success, #22c55e);
    font-weight: 500;
}

.doc-status-processing {
    color: var(--accent);
    font-weight: 500;
}

.doc-status-error {
    color: var(--error, #ef4444);
    font-weight: 500;
}

/* --- Empty State --- */
.doc-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2.5rem 1rem;
    text-align: center;
}

.doc-empty-icon {
    margin-bottom: 1rem;
    color: var(--text-muted);
}

.doc-empty-text {
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--text-primary);
    margin: 0 0 0.25rem 0;
}

.doc-empty-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
}

/* --- Quick Action Buttons --- */
.doc-quick-actions {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-top: 1px solid var(--border-color);
    overflow-x: auto;
}

.doc-quick-btn {
    font-size: 0.78rem;
    padding: 0.35rem 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
    font-weight: 500;
}

.doc-quick-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(255, 161, 22, 0.05);
}

/* --- Responsive adjustments --- */
@media (max-width: 600px) {
    .doc-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .doc-card-actions {
        margin-left: 0;
        width: 100%;
    }

    .doc-card-actions .btn {
        flex: 1;
        text-align: center;
    }

    .doc-card-name {
        max-width: 200px;
    }

    .drop-zone {
        padding: 1.5rem 1rem;
    }

    .doc-quick-actions {
        padding: 0.5rem 0.75rem;
    }
}


/* ============================================
   DOC Q&A SPLIT LAYOUT (Chat Page Only)
   ============================================ */

.doc-qa-split {
    display: grid;
    grid-template-columns: 280px 1fr;
    height: calc(100vh - 64px);
    gap: 0;
    margin: -24px -24px -24px -24px;
}

/* --- Left Panel --- */
.doc-qa-left {
    display: flex;
    flex-direction: column;
    padding: 1.25rem;
    border-right: 1px solid var(--border-color);
    background: var(--bg-secondary);
    overflow-y: auto;
}

.doc-qa-left-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.doc-qa-left-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
}

/* Current document */
.doc-qa-current {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem;
    background: var(--bg-primary);
    border: 1px solid var(--accent);
    border-radius: 10px;
    margin-bottom: 1.25rem;
}

.doc-qa-current-icon {
    font-size: 1.8rem;
    flex-shrink: 0;
}

.doc-qa-current-info {
    min-width: 0;
}

.doc-qa-current-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.doc-qa-current-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0.15rem 0 0 0;
}

/* Stats */
.doc-qa-stats {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.doc-qa-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.6rem 0.25rem;
    background: var(--bg-primary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.doc-qa-stat-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}

.doc-qa-stat-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0.15rem;
}

/* Quick actions (left panel version) */
.doc-qa-actions {
    margin-bottom: 1.5rem;
}

.doc-qa-actions-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 0.6rem 0;
}

.doc-qa-action-btn {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.6rem 0.75rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    margin-bottom: 0.4rem;
}

.doc-qa-action-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(255, 161, 22, 0.04);
}

/* Navigation links */
.doc-qa-nav {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.doc-qa-nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.5rem;
    color: var(--text-muted);
    font-size: 0.82rem;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.15s;
}

.doc-qa-nav-link:hover {
    color: var(--accent);
    background: rgba(255, 161, 22, 0.04);
}

/* --- Right Panel (Chat) --- */
.doc-qa-right {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.doc-qa-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.doc-qa-chat-header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.doc-qa-chat-avatar {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 161, 22, 0.12);
    border-radius: 8px;
    color: var(--accent);
}

.doc-qa-chat-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    display: block;
}

.doc-qa-chat-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: block;
    margin-top: 0.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
}

/* Messages area */
.doc-qa-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Input area */
.doc-qa-input-area {
    padding: 0.75rem 1.25rem 1rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
    flex-shrink: 0;
}

/* --- Responsive: Stack on mobile --- */
@media (max-width: 768px) {
    .doc-qa-split {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
        height: auto;
        min-height: calc(100vh - 64px);
    }

    .doc-qa-left {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding: 1rem;
        max-height: none;
        overflow: visible;
    }

    .doc-qa-stats {
        margin-bottom: 1rem;
    }

    .doc-qa-actions {
        display: flex;
        gap: 0.5rem;
        margin-bottom: 0;
        flex-wrap: wrap;
    }

    .doc-qa-actions-label {
        display: none;
    }

    .doc-qa-action-btn {
        width: auto;
        flex: 1;
        justify-content: center;
        margin-bottom: 0;
        font-size: 0.75rem;
        padding: 0.5rem;
    }

    .doc-qa-nav {
        display: none;
    }

    .doc-qa-right {
        height: 60vh;
        min-height: 400px;
    }

    .doc-qa-messages {
        padding: 1rem;
    }

    .doc-qa-input-area {
        padding: 0.6rem 1rem 0.75rem;
    }
}


/* ============================================
   COMPANY PREP REDESIGN
   ============================================ */

/* --- Company Chips Grid --- */
.company-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.company-chip {
    padding: 0.6rem 1.1rem;
    background: var(--bg-secondary);
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
}

.company-chip:hover {
    border-color: var(--accent);
    background: rgba(255, 161, 22, 0.04);
}

.company-chip.selected {
    border-color: var(--accent);
    background: rgba(255, 161, 22, 0.1);
    box-shadow: 0 0 0 1px var(--accent);
}

.company-chip-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
}

.company-chip.selected .company-chip-name {
    color: var(--accent);
}

/* --- Role Chips Grid --- */
.role-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.role-chip {
    padding: 0.5rem 0.9rem;
    background: var(--bg-secondary);
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
}

.role-chip:hover {
    border-color: var(--accent);
    background: rgba(255, 161, 22, 0.04);
}

.role-chip.selected {
    border-color: var(--accent);
    background: rgba(255, 161, 22, 0.1);
    box-shadow: 0 0 0 1px var(--accent);
}

.role-chip-name {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.role-chip.selected .role-chip-name {
    color: var(--accent);
}

/* --- Topic Chips Grid --- */
.topic-chip-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.topic-chip {
    padding: 0.5rem 0.9rem;
    background: var(--bg-secondary);
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
}

.topic-chip:hover {
    border-color: var(--accent);
    background: rgba(255, 161, 22, 0.04);
}

.topic-chip.selected {
    border-color: var(--accent);
    background: rgba(255, 161, 22, 0.1);
    box-shadow: 0 0 0 1px var(--accent);
}

.topic-chip.suggested {
    border-color: rgba(255, 161, 22, 0.4);
    background: rgba(255, 161, 22, 0.05);
}

.topic-chip-name {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.topic-chip.selected .topic-chip-name {
    color: var(--accent);
}

.topic-chip.suggested .topic-chip-name {
    color: var(--accent);
    opacity: 0.8;
}

/* --- Difficulty Pills (Professional) --- */
.difficulty-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.difficulty-pill {
    cursor: pointer;
}

.difficulty-pill input[type="radio"] {
    display: none;
}

.difficulty-pill-label {
    display: inline-block;
    padding: 0.55rem 1.1rem;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: 8px;
    border: 1.5px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    transition: all 0.15s;
    cursor: pointer;
}

.difficulty-pill-label:hover {
    border-color: var(--text-muted);
}

.difficulty-pill input[type="radio"]:checked + .difficulty-pill-label {
    border-color: var(--accent);
    background: rgba(255, 161, 22, 0.1);
    color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
}

.difficulty-pill-label.auto {
    /* Default styling, no extra color */
}

.difficulty-pill-label.easy {
    /* Beginner gets green tint on select */
}

.difficulty-pill-label.medium {
    /* Intermediate gets orange tint on select */
}

.difficulty-pill-label.hard {
    /* Advanced gets red tint on select */
}

.difficulty-pill input[type="radio"]:checked + .difficulty-pill-label.easy {
    border-color: #22c55e;
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
    box-shadow: 0 0 0 1px #22c55e;
}

.difficulty-pill input[type="radio"]:checked + .difficulty-pill-label.medium {
    border-color: var(--accent);
    background: rgba(255, 161, 22, 0.1);
    color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
}

.difficulty-pill input[type="radio"]:checked + .difficulty-pill-label.hard {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    box-shadow: 0 0 0 1px #ef4444;
}

/* --- Start Section --- */
.company-start-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

/* --- Config Hint Text --- */
.config-hint-text {
    font-size: 0.8rem;
    color: var(--accent);
    font-style: italic;
}

/* --- Responsive --- */
@media (max-width: 600px) {
    .company-grid,
    .role-grid,
    .topic-chip-grid,
    .difficulty-pills {
        gap: 0.4rem;
    }

    .company-chip {
        padding: 0.5rem 0.8rem;
    }

    .company-chip-name {
        font-size: 0.8rem;
    }

    .role-chip,
    .topic-chip {
        padding: 0.4rem 0.7rem;
    }

    .role-chip-name,
    .topic-chip-name {
        font-size: 0.75rem;
    }

    .difficulty-pill-label {
        padding: 0.45rem 0.8rem;
        font-size: 0.78rem;
    }
}


/* --- Company Prep: Practice Mode Tiles --- */
.company-mode-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.6rem;
}

.company-mode-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.85rem 0.5rem;
    background: var(--bg-secondary);
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
}

.company-mode-tile:hover {
    border-color: var(--accent);
    background: rgba(255, 161, 22, 0.04);
}

.company-mode-tile.selected {
    border-color: var(--accent);
    background: rgba(255, 161, 22, 0.1);
    box-shadow: 0 0 0 1px var(--accent);
}

.company-mode-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.2rem;
}

.company-mode-tile.selected .company-mode-name {
    color: var(--accent);
}

.company-mode-desc {
    font-size: 0.7rem;
    color: var(--text-muted);
    line-height: 1.3;
}

@media (max-width: 600px) {
    .company-mode-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .company-mode-tile {
        padding: 0.7rem 0.4rem;
    }

    .company-mode-name {
        font-size: 0.78rem;
    }
}


/* ============================================
   STUDY PLAN - SAVED PLANS & CHECKLIST
   ============================================ */

/* --- Plan List Cards --- */
.plan-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.plan-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    transition: border-color 0.15s;
}

.plan-card:hover {
    border-color: var(--accent);
}

.plan-card-left {
    flex: 1;
    min-width: 0;
}

.plan-card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.2rem 0;
}

.plan-card-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin: 0 0 0.6rem 0;
}

.plan-card-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
    margin-left: 1rem;
}

/* --- Progress Bar (shared) --- */
.plan-progress-bar,
.plan-view-progress-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-primary);
    border-radius: 3px;
    overflow: hidden;
}

.plan-progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.plan-progress-text {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
}

/* --- Plan View Header --- */
.plan-view-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.25rem;
}

.plan-view-header-left {
    flex: 1;
}

.plan-back-link {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.15s;
}

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

.plan-view-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0.25rem 0 0.2rem 0;
}

.plan-view-meta {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin: 0;
}

.plan-view-header-right {
    flex-shrink: 0;
    margin-top: 1.5rem;
}

/* --- Plan View Progress --- */
.plan-view-progress {
    margin-bottom: 1.75rem;
}

.plan-view-progress .plan-view-progress-bar {
    height: 8px;
    border-radius: 4px;
}

.plan-view-progress-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.4rem;
    display: block;
}

/* --- Week Sections --- */
.plan-week-section {
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
}

.plan-week-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.85rem 1.1rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.plan-week-header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.plan-week-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.plan-week-progress {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--bg-primary);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

/* --- Day Groups --- */
.plan-day-group {
    padding: 0.5rem 1.1rem 0.25rem;
}

.plan-day-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* --- Task Items --- */
.plan-task-list {
    padding: 0.25rem 0 0.5rem;
}

.plan-task-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1.1rem;
    transition: background 0.1s;
}

.plan-task-item:hover {
    background: rgba(255, 255, 255, 0.02);
}

.plan-task-item.completed .plan-task-text {
    text-decoration: line-through;
    opacity: 0.5;
}

.plan-task-check {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    flex: 1;
    min-width: 0;
}

.plan-task-checkbox {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 2px solid var(--border-color);
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    flex-shrink: 0;
    position: relative;
    background: var(--bg-primary);
    transition: all 0.15s;
}

.plan-task-checkbox:checked {
    background: var(--accent);
    border-color: var(--accent);
}

.plan-task-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 5px;
    height: 9px;
    border: solid #000;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.plan-task-text {
    font-size: 0.85rem;
    color: var(--text-primary);
    line-height: 1.4;
}

.plan-task-practice-link {
    font-size: 0.75rem;
    color: var(--accent);
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    transition: background 0.15s;
    font-weight: 500;
}

.plan-task-practice-link:hover {
    background: rgba(255, 161, 22, 0.1);
}

/* --- Generating Overlay --- */
.plan-generating-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(4px);
}

/* --- Responsive --- */
@media (max-width: 600px) {
    .plan-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .plan-card-actions {
        margin-left: 0;
        width: 100%;
    }

    .plan-card-actions .btn {
        flex: 1;
        text-align: center;
    }

    .plan-view-header {
        flex-direction: column;
        gap: 0.75rem;
    }

    .plan-view-header-right {
        margin-top: 0;
    }

    .plan-week-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .plan-task-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.3rem;
    }

    .plan-task-practice-link {
        margin-left: 2.4rem;
    }
}


/* ============================================
   BRAIN BITS (FLASHCARDS) ENHANCEMENT
   ============================================ */

/* --- Header --- */
.fc-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.25rem;
}

.fc-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
}

.fc-subtitle {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin: 0.2rem 0 0 0;
}

.fc-header-stats {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.fc-stat {
    font-size: 0.78rem;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.fc-streak {
    color: var(--accent);
    font-weight: 600;
}

.fc-saved-link {
    text-decoration: none;
    transition: border-color 0.15s;
}

.fc-saved-link:hover {
    border-color: var(--accent);
}

/* --- Config Bar --- */
.fc-config {
    margin-bottom: 1.25rem;
}

.fc-config-form {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.fc-config-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.fc-config-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.fc-select {
    padding: 0.45rem 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.82rem;
    cursor: pointer;
    min-width: 120px;
}

.fc-select:focus {
    outline: none;
    border-color: var(--accent);
}

.fc-select option {
    background: #1a1a2e;
    color: #e0e0e0;
}

/* --- Progress Bar --- */
.fc-progress {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.fc-progress-bar {
    flex: 1;
    height: 6px;
    background: var(--bg-secondary);
    border-radius: 3px;
    overflow: hidden;
}

.fc-progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 0.4s ease;
}

.fc-progress-text {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* --- 3D Flip Card --- */
.fc-card-wrapper {
    perspective: 1000px;
    margin-bottom: 1.5rem;
}

.fc-card {
    width: 100%;
    min-height: 220px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.5s ease;
    cursor: pointer;
    border-radius: 14px;
}

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

.fc-card-face {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    min-height: 220px;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.5rem;
    border-radius: 14px;
    border: 1.5px solid var(--border-color);
}

.fc-card-front {
    background: var(--bg-secondary);
}

.fc-card-back {
    background: linear-gradient(135deg, rgba(255, 161, 22, 0.08), var(--bg-secondary));
    border-color: var(--accent);
    transform: rotateY(180deg);
}

.fc-card-text {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-primary);
    text-align: center;
    margin: 0;
}

.fc-flip-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 1rem;
    opacity: 0.7;
}

/* --- Controls --- */
.fc-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.fc-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.65rem 1.2rem;
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-secondary);
    cursor: pointer;
    transition: all 0.15s;
    font-size: 0.85rem;
    font-weight: 500;
}

.fc-btn:hover {
    transform: translateY(-1px);
}

.fc-btn-icon {
    font-size: 1.1rem;
}

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

.fc-btn-got-it {
    border-color: #22c55e;
    color: #22c55e;
}

.fc-btn-got-it:hover {
    background: rgba(34, 197, 94, 0.1);
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.2);
}

.fc-btn-got-it .fc-btn-label {
    color: #22c55e;
}

.fc-btn-review {
    border-color: var(--accent);
    color: var(--accent);
}

.fc-btn-review:hover {
    background: rgba(255, 161, 22, 0.1);
    box-shadow: 0 2px 8px rgba(255, 161, 22, 0.2);
}

.fc-btn-review .fc-btn-label {
    color: var(--accent);
}

.fc-btn-bookmark {
    padding: 0.65rem 0.85rem;
    border-color: var(--border-color);
}

.fc-btn-bookmark:hover {
    border-color: var(--accent);
    background: rgba(255, 161, 22, 0.05);
}

/* --- Shortcuts Hint --- */
.fc-shortcuts-hint {
    text-align: center;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin: 0;
}

.fc-shortcuts-hint kbd {
    display: inline-block;
    padding: 0.1rem 0.35rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    font-size: 0.68rem;
    font-family: inherit;
}

/* --- Session Complete --- */
.fc-complete {
    text-align: center;
    padding: 2rem 1rem;
}

.fc-complete-icon {
    font-size: 3rem;
    margin-bottom: 0.75rem;
}

.fc-complete-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0 0 1.25rem 0;
    color: var(--text-primary);
}

.fc-complete-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 1.25rem;
}

.fc-complete-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.fc-complete-stat-value {
    font-size: 1.8rem;
    font-weight: 700;
}

.fc-stat-known {
    color: #22c55e;
}

.fc-stat-review {
    color: var(--accent);
}

.fc-complete-stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.fc-complete-message {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0 0 1.5rem 0;
}

.fc-complete-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* --- Saved Cards Grid --- */
.fc-saved-section {
    padding: 1rem 0;
}

.fc-saved-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.75rem;
}

.fc-saved-card {
    padding: 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
}

.fc-saved-card-front {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.fc-saved-card-back {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 0.5rem;
}

.fc-saved-card-topic {
    font-size: 0.68rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* --- Responsive --- */
@media (max-width: 600px) {
    .fc-header {
        flex-direction: column;
        gap: 0.75rem;
    }

    .fc-header-stats {
        flex-wrap: wrap;
    }

    .fc-config-form {
        flex-direction: column;
    }

    .fc-select {
        min-width: unset;
        width: 100%;
    }

    .fc-card {
        min-height: 180px;
    }

    .fc-card-face {
        min-height: 180px;
        padding: 1.5rem 1rem;
    }

    .fc-controls {
        gap: 0.6rem;
    }

    .fc-btn {
        padding: 0.55rem 0.85rem;
        font-size: 0.78rem;
    }

    .fc-btn-label {
        display: none;
    }

    .fc-btn-icon {
        font-size: 1.3rem;
    }

    .fc-complete-stats {
        gap: 1.25rem;
    }

    .fc-saved-grid {
        grid-template-columns: 1fr;
    }
}


/* ============================================
   DSA LAB — Complete Styling
   Landing, Study, Practice, Notes, Results
   ============================================ */

/* --- DSA LANDING PAGE --- */
.dsa-landing-page {
    max-width: 1100px;
    margin: 0 auto;
}

.dsa-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.dsa-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0;
}

.dsa-subtitle {
    color: var(--text-secondary);
    margin: 0.3rem 0 0;
    font-size: 0.95rem;
}

.dsa-stats-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.dsa-stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1.25rem;
    text-align: center;
    min-width: 100px;
}

.dsa-stat-value {
    display: block;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--accent);
}

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

/* Overall Progress Bar */
.dsa-overall-progress {
    margin-bottom: 1.5rem;
}

.dsa-overall-progress-bar {
    height: 6px;
    background: var(--bg-elevated);
    border-radius: 3px;
    overflow: hidden;
}

.dsa-overall-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--success));
    border-radius: 3px;
    transition: width 0.5s ease;
}

/* Search */
.dsa-search-container {
    margin-bottom: 1.5rem;
}

.dsa-search-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.dsa-search-input:focus {
    outline: none;
    border-color: var(--accent);
}

/* Category Sections */
.dsa-category-section {
    margin-bottom: 1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.dsa-category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    cursor: pointer;
    transition: background 0.15s;
}

.dsa-category-header:hover {
    background: var(--bg-hover);
}

.dsa-category-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.dsa-category-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.dsa-category-info {
    display: flex;
    flex-direction: column;
}

.dsa-category-name {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0;
}

.dsa-category-count {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.dsa-category-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.dsa-category-progress-mini {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dsa-category-progress-bar-mini {
    width: 80px;
    height: 4px;
    background: var(--bg-elevated);
    border-radius: 2px;
    overflow: hidden;
}

.dsa-category-progress-fill-mini {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s ease;
}

.dsa-category-progress-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    min-width: 30px;
}

.dsa-category-chevron {
    font-size: 0.75rem;
    color: var(--text-muted);
    transition: transform 0.2s;
}

.dsa-collapse-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-muted);
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.2s;
}

.dsa-collapse-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--bg-hover);
}

/* Topic Grid */
.dsa-topic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.75rem;
    padding: 0 1.25rem 1.25rem;
    transition: max-height 0.3s ease, opacity 0.2s;
}

.dsa-topic-grid.collapsed {
    display: none;
}

/* Topic Cards */
.dsa-topic-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 1rem;
    text-decoration: none;
    color: var(--text-primary);
    transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
}

.dsa-topic-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow);
}

.dsa-topic-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.dsa-topic-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.dsa-topic-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 0 0 0.75rem;
    line-height: 1.4;
    flex: 1;
}

.dsa-topic-card-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
}

.dsa-topic-solved {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Difficulty Badges */
.dsa-difficulty-badge {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.dsa-diff-beginner {
    background: rgba(74, 222, 128, 0.15);
    color: #4ade80;
}

.dsa-diff-intermediate {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
}

.dsa-diff-advanced {
    background: rgba(248, 113, 113, 0.15);
    color: #f87171;
}

.dsa-diff-easy {
    background: rgba(74, 222, 128, 0.15);
    color: #4ade80;
}

.dsa-diff-medium {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
}

.dsa-diff-hard {
    background: rgba(248, 113, 113, 0.15);
    color: #f87171;
}

/* Progress Indicators */
.dsa-progress-icon {
    font-size: 1rem;
}

.dsa-progress-icon.completed {
    color: var(--success);
}

.dsa-progress-icon.in-progress {
    color: var(--warning);
}

.dsa-progress-icon.not-started {
    color: var(--text-muted);
}

/* --- DSA STUDY PAGE --- */
.dsa-study-page {
    max-width: 1400px;
    margin: 0 auto;
}

.dsa-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    font-size: 0.85rem;
}

.dsa-breadcrumb a {
    color: var(--link);
    text-decoration: none;
}

.dsa-breadcrumb a:hover {
    text-decoration: underline;
}

.dsa-breadcrumb-sep {
    color: var(--text-muted);
}

.dsa-breadcrumb-current {
    color: var(--text-primary);
    font-weight: 500;
}

.dsa-breadcrumb-cat {
    color: var(--text-secondary);
}

/* Study Layout */
.dsa-study-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 1.5rem;
    align-items: start;
}

.dsa-content-area {
    min-width: 0;
}

/* Study Header */
.dsa-study-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.dsa-study-title {
    font-size: 1.6rem;
    font-weight: 700;
    margin: 0 0 0.4rem;
}

.dsa-study-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.dsa-category-tag {
    font-size: 0.8rem;
    font-weight: 500;
}

.dsa-study-header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.study-status {
    font-size: 0.85rem;
    padding: 0.3rem 0.75rem;
    border-radius: 4px;
}

.study-status.completed {
    background: rgba(0, 184, 163, 0.15);
    color: var(--success);
    font-weight: 500;
}

.dsa-refresh-btn {
    font-size: 0.8rem;
}

/* Content Body */
.dsa-content-body {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 2rem;
    margin-bottom: 1.5rem;
}

.dsa-content-error {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

/* Markdown Content Styling */
.dsa-markdown-content h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 2rem 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.dsa-markdown-content h2:first-child {
    margin-top: 0;
}

.dsa-markdown-content h3 {
    font-size: 1.15rem;
    font-weight: 600;
    margin: 1.5rem 0 0.75rem;
    color: var(--accent);
}

.dsa-markdown-content h4 {
    font-size: 1rem;
    font-weight: 600;
    margin: 1rem 0 0.5rem;
    color: var(--text-primary);
}

.dsa-markdown-content p {
    margin: 0.75rem 0;
    line-height: 1.7;
    color: var(--text-secondary);
}

.dsa-markdown-content ul, .dsa-markdown-content ol {
    margin: 0.75rem 0;
    padding-left: 1.5rem;
}

.dsa-markdown-content li {
    margin: 0.4rem 0;
    line-height: 1.6;
    color: var(--text-secondary);
}

.dsa-markdown-content strong {
    color: var(--text-primary);
    font-weight: 600;
}

.dsa-markdown-content code {
    background: var(--bg-elevated);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.85em;
    font-family: 'Cascadia Code', 'Fira Code', monospace;
}

.dsa-markdown-content pre {
    background: #1e1e2e;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 1rem 1.25rem;
    overflow-x: auto;
    margin: 1rem 0;
}

.dsa-markdown-content pre code {
    background: none;
    padding: 0;
    font-size: 0.85rem;
    line-height: 1.6;
    color: #e0e0e0;
}

.dsa-markdown-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.9rem;
}

.dsa-markdown-content th,
.dsa-markdown-content td {
    border: 1px solid var(--border-color);
    padding: 0.6rem 0.8rem;
    text-align: left;
}

.dsa-markdown-content th {
    background: var(--bg-elevated);
    font-weight: 600;
    color: var(--text-primary);
}

.dsa-markdown-content td {
    color: var(--text-secondary);
}

/* Inline Code Editor */
.dsa-code-block-wrapper {
    position: relative;
    margin: 1rem 0;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.dsa-code-block-wrapper pre {
    margin: 0;
    border: none;
    border-radius: 0;
}

.dsa-code-toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-color);
}

.dsa-code-btn {
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-surface);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.15s;
}

.dsa-code-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.dsa-btn-run {
    border-color: var(--success);
    color: var(--success);
}

.dsa-btn-run:hover {
    background: rgba(0, 184, 163, 0.1);
}

.dsa-code-lang-label {
    margin-left: auto;
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.dsa-inline-editor {
    width: 100%;
    min-height: 120px;
    padding: 1rem 1.25rem;
    background: #1e1e2e;
    color: #e0e0e0;
    border: none;
    font-family: 'Cascadia Code', 'Fira Code', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    resize: vertical;
    outline: none;
}

.dsa-code-output {
    padding: 0.75rem 1rem;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
}

.dsa-output-result {
    color: var(--success);
    font-family: 'Cascadia Code', 'Fira Code', monospace;
    font-size: 0.8rem;
    margin: 0;
    white-space: pre-wrap;
}

.dsa-output-error {
    color: var(--danger);
    font-family: 'Cascadia Code', 'Fira Code', monospace;
    font-size: 0.8rem;
    margin: 0;
    white-space: pre-wrap;
}

.dsa-output-loading {
    color: var(--warning);
    font-size: 0.85rem;
}

/* Practice CTA */
.dsa-practice-cta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    gap: 1rem;
}

.dsa-practice-cta h3 {
    margin: 0 0 0.3rem;
    font-size: 1.1rem;
}

.dsa-practice-cta p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Topic Navigation */
.dsa-topic-nav {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.dsa-nav-btn {
    padding: 0.6rem 1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.85rem;
    transition: border-color 0.2s;
}

.dsa-nav-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* --- NOTES PANEL --- */
.dsa-notes-panel {
    position: sticky;
    top: 80px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: width 0.3s;
}

.dsa-notes-panel.collapsed {
    width: 48px;
    min-height: auto;
}

.dsa-notes-panel.collapsed .dsa-notes-header,
.dsa-notes-panel.collapsed .dsa-notes-body {
    display: none;
}

.dsa-notes-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.dsa-notes-header h3 {
    font-size: 0.9rem;
    margin: 0;
}

.dsa-notes-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.notes-save-status {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.notes-save-status.saved {
    color: var(--success);
}

.dsa-notes-body {
    padding: 0.75rem;
}

.dsa-notes-textarea {
    width: 100%;
    min-height: 300px;
    padding: 0.75rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: 'Cascadia Code', 'Fira Code', monospace;
    font-size: 0.82rem;
    line-height: 1.6;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s;
}

.dsa-notes-textarea:focus {
    border-color: var(--accent);
}

.dsa-notes-preview {
    padding: 0.75rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    min-height: 300px;
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

.dsa-notes-preview h2,
.dsa-notes-preview h3 {
    color: var(--text-primary);
}

.dsa-notes-preview code {
    background: var(--bg-primary);
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    font-size: 0.82em;
}

.dsa-notes-preview pre {
    background: #1e1e2e;
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    overflow-x: auto;
}

.dsa-notes-toggle-btn {
    display: none;
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.25rem;
}

.dsa-notes-panel.collapsed .dsa-notes-toggle-btn {
    display: block;
}

/* --- DSA PRACTICE PAGE --- */
.dsa-practice-page {
    max-width: 1400px;
    margin: 0 auto;
}

.dsa-practice-topbar {
    margin-bottom: 1rem;
}

.dsa-practice-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.dsa-practice-topic-badge {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.dsa-practice-progress {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-left: auto;
}

.dsa-practice-progress-bar {
    height: 4px;
    background: var(--bg-elevated);
    border-radius: 2px;
    overflow: hidden;
}

.dsa-practice-progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* Split Pane */
.dsa-practice-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    min-height: 500px;
}

.dsa-practice-left,
.dsa-practice-right {
    display: flex;
    flex-direction: column;
}

/* Problem Panel */
.dsa-practice-problem {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    flex: 1;
    overflow-y: auto;
}

.dsa-practice-problem h3 {
    font-size: 1.1rem;
    margin: 0 0 1rem;
    color: var(--text-primary);
}

.dsa-practice-problem-text {
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--text-secondary);
    white-space: pre-wrap;
}

.dsa-practice-test-cases {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.dsa-practice-test-cases h4 {
    font-size: 0.9rem;
    margin: 0 0 0.5rem;
    color: var(--text-primary);
}

.dsa-test-case {
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.8rem;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
}

.dsa-tc-label {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
}

.dsa-test-case code {
    background: var(--bg-primary);
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    font-size: 0.82rem;
}

/* Editor Panel */
.dsa-practice-editor-container {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    flex: 1;
}

.dsa-editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-color);
}

.dsa-editor-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
}

.dsa-editor-status {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.dsa-code-editor-textarea {
    width: 100%;
    min-height: 250px;
    padding: 1rem;
    background: #1e1e2e;
    color: #e0e0e0;
    border: none;
    font-family: 'Cascadia Code', 'Fira Code', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    resize: vertical;
    outline: none;
}

/* Button Bar */
.dsa-practice-btn-bar {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem 0;
}

.dsa-btn-hint {
    margin-left: auto;
    background: rgba(255, 161, 22, 0.1);
    border-color: var(--accent);
    color: var(--accent);
}

.dsa-btn-hint:hover {
    background: rgba(255, 161, 22, 0.2);
}

/* Output Panel */
.dsa-practice-output {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.dsa-output-header {
    padding: 0.4rem 0.75rem;
    background: var(--bg-elevated);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    border-bottom: 1px solid var(--border-color);
}

.dsa-output-content {
    padding: 0.75rem;
    margin: 0;
    min-height: 60px;
    max-height: 150px;
    overflow-y: auto;
    font-family: 'Cascadia Code', 'Fira Code', monospace;
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: var(--bg-primary);
    white-space: pre-wrap;
}

/* --- DSA FEEDBACK --- */
.dsa-feedback-loading {
    padding: 1.5rem;
    text-align: center;
    color: var(--text-muted);
}

.dsa-feedback-loading .spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
    margin-right: 0.5rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.dsa-feedback-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-top: 1rem;
}

.dsa-feedback-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.dsa-feedback-score {
    font-size: 1.4rem;
    font-weight: 700;
    padding: 0.3rem 0.8rem;
    border-radius: var(--radius-sm);
}

.dsa-feedback-score.score-high {
    background: rgba(0, 184, 163, 0.15);
    color: var(--success);
}

.dsa-feedback-score.score-mid {
    background: rgba(255, 192, 30, 0.15);
    color: var(--warning);
}

.dsa-feedback-score.score-low {
    background: rgba(239, 71, 67, 0.15);
    color: var(--danger);
}

.dsa-feedback-status {
    font-size: 0.9rem;
    font-weight: 600;
}

.dsa-feedback-status.correct {
    color: var(--success);
}

.dsa-feedback-status.incorrect {
    color: var(--danger);
}

.dsa-feedback-text {
    margin-bottom: 1rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.dsa-feedback-complexity {
    margin-bottom: 1rem;
}

.dsa-feedback-complexity h4 {
    font-size: 0.85rem;
    margin: 0 0 0.5rem;
    color: var(--text-primary);
}

.dsa-complexity-badges {
    display: flex;
    gap: 0.5rem;
}

.dsa-complexity-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    font-family: 'Cascadia Code', monospace;
    font-weight: 500;
}

.dsa-complexity-badge.time {
    background: rgba(96, 165, 250, 0.15);
    color: #60a5fa;
}

.dsa-complexity-badge.space {
    background: rgba(167, 139, 250, 0.15);
    color: #a78bfa;
}

.dsa-feedback-improvements {
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: rgba(255, 161, 22, 0.08);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--accent);
}

.dsa-feedback-improvements h4 {
    font-size: 0.85rem;
    margin: 0 0 0.4rem;
    color: var(--accent);
}

.dsa-feedback-improvements p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Approaches Grid */
.dsa-feedback-approaches {
    margin-bottom: 1.25rem;
}

.dsa-feedback-approaches h4 {
    font-size: 0.9rem;
    margin: 0 0 0.75rem;
    color: var(--text-primary);
}

.dsa-approaches-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 0.75rem;
}

.dsa-approach-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.dsa-approach-card.brute {
    border-top: 3px solid var(--danger);
}

.dsa-approach-card.optimal {
    border-top: 3px solid var(--success);
}

.dsa-approach-card.alternate {
    border-top: 3px solid #60a5fa;
}

.dsa-approach-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0.75rem;
    background: var(--bg-elevated);
}

.dsa-approach-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.dsa-approach-label.brute { color: var(--danger); }
.dsa-approach-label.optimal { color: var(--success); }
.dsa-approach-label.alternate { color: #60a5fa; }

.dsa-approach-complexity {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-family: 'Cascadia Code', monospace;
}

.dsa-approach-code-details {
    padding: 0.5rem 0.75rem;
}

.dsa-approach-code-details summary {
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--link);
    padding: 0.25rem 0;
}

.dsa-approach-code-details pre {
    margin: 0.5rem 0 0;
    padding: 0.75rem;
    background: #1e1e2e;
    border-radius: 4px;
    overflow-x: auto;
}

.dsa-approach-code-details code {
    font-size: 0.78rem;
    line-height: 1.5;
    color: #e0e0e0;
}

/* Feedback Actions */
.dsa-feedback-actions {
    display: flex;
    gap: 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

/* --- DSA HINT --- */
.dsa-hint-card {
    background: rgba(255, 161, 22, 0.08);
    border: 1px solid rgba(255, 161, 22, 0.3);
    border-radius: var(--radius-sm);
    padding: 1rem;
    margin-top: 1rem;
}

.dsa-hint-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.dsa-hint-icon {
    font-size: 1.1rem;
}

.dsa-hint-level {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent);
}

.dsa-hint-cost {
    font-size: 0.7rem;
    color: var(--danger);
    margin-left: auto;
}

.dsa-hint-text {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.dsa-hint-more {
    font-size: 0.75rem;
}

/* --- DSA RESULTS PAGE --- */
.dsa-results-page {
    max-width: 900px;
    margin: 0 auto;
}

.dsa-results-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.dsa-results-header h1 {
    font-size: 1.8rem;
    margin: 0;
}

.dsa-results-topic {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin: 0.3rem 0 0;
}

.dsa-results-overview {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.dsa-results-score-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    text-align: center;
}

.dsa-results-big-score {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
}

.dsa-results-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: block;
    margin-top: 0.25rem;
}

.dsa-results-questions {
    margin-bottom: 2rem;
}

.dsa-results-questions h2 {
    font-size: 1.2rem;
    margin: 0 0 1rem;
}

.dsa-results-question-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
    overflow: hidden;
}

.dsa-results-question-card.correct {
    border-left: 3px solid var(--success);
}

.dsa-results-question-card.incorrect {
    border-left: 3px solid var(--danger);
}

.dsa-results-q-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background 0.15s;
}

.dsa-results-q-header:hover {
    background: var(--bg-hover);
}

.dsa-results-q-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}

.dsa-results-q-num {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.dsa-results-q-status.correct {
    color: var(--success);
    font-weight: 700;
}

.dsa-results-q-status.incorrect {
    color: var(--danger);
    font-weight: 700;
}

.dsa-results-q-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dsa-results-q-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.dsa-results-q-score {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--accent);
}

.dsa-results-hint-badge {
    font-size: 0.65rem;
    padding: 0.15rem 0.4rem;
    background: rgba(255, 161, 22, 0.15);
    color: var(--accent);
    border-radius: 3px;
    font-weight: 600;
}

.dsa-results-expand {
    font-size: 0.7rem;
    color: var(--text-muted);
    transition: transform 0.2s;
}

.dsa-results-q-detail {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-elevated);
}

.dsa-results-section {
    margin-bottom: 1rem;
}

.dsa-results-section:last-child {
    margin-bottom: 0;
}

.dsa-results-section h4 {
    font-size: 0.85rem;
    margin: 0 0 0.5rem;
    color: var(--text-primary);
}

.dsa-results-section pre {
    background: #1e1e2e;
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin: 0;
}

.dsa-results-section code {
    font-size: 0.78rem;
    line-height: 1.5;
    color: #e0e0e0;
}

.dsa-complexity-info {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0.5rem 0 0;
    font-family: 'Cascadia Code', monospace;
}

.dsa-results-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* --- DSA RESPONSIVE --- */
@media (max-width: 1024px) {
    .dsa-study-layout {
        grid-template-columns: 1fr;
    }

    .dsa-notes-panel {
        position: static;
        margin-top: 1rem;
    }
}

@media (max-width: 768px) {
    .dsa-header {
        flex-direction: column;
    }

    .dsa-stats-row {
        width: 100%;
        justify-content: space-between;
    }

    .dsa-stat-card {
        flex: 1;
        min-width: 80px;
        padding: 0.5rem;
    }

    .dsa-stat-value {
        font-size: 1.1rem;
    }

    .dsa-topic-grid {
        grid-template-columns: 1fr;
    }

    .dsa-practice-split {
        grid-template-columns: 1fr;
    }

    .dsa-practice-left {
        max-height: 300px;
        overflow-y: auto;
    }

    .dsa-results-overview {
        grid-template-columns: repeat(2, 1fr);
    }

    .dsa-approaches-grid {
        grid-template-columns: 1fr;
    }

    .dsa-study-header {
        flex-direction: column;
    }

    .dsa-practice-cta {
        flex-direction: column;
        text-align: center;
    }

    .dsa-content-body {
        padding: 1.25rem;
    }

    .dsa-feedback-actions {
        flex-direction: column;
    }

    .dsa-results-q-text {
        display: none;
    }
}

@media (max-width: 480px) {
    .dsa-category-progress-mini {
        display: none;
    }

    .dsa-results-overview {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .dsa-results-big-score {
        font-size: 1.5rem;
    }
}


/* --- DSA SKELETON LOADER --- */
.dsa-skeleton {
    padding: 1rem 0;
}

.dsa-skeleton-line {
    height: 14px;
    background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-hover) 50%, var(--bg-elevated) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: 4px;
    margin-bottom: 0.75rem;
    width: 80%;
}

.dsa-skeleton-line.wide {
    width: 100%;
    height: 18px;
    margin-bottom: 1rem;
}

.dsa-skeleton-line.short {
    width: 50%;
}

.dsa-skeleton-block {
    height: 120px;
    background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-hover) 50%, var(--bg-elevated) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
    margin: 1.25rem 0;
}

.dsa-skeleton-msg {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 1.5rem;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* --- HTMX Indicators --- */
.htmx-indicator {
    display: none;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.htmx-request .htmx-indicator,
.htmx-indicator.htmx-request {
    display: inline-block;
}


/* ============================================
   CODE PLAYGROUND — IDE Style
   ============================================ */

.pg-page {
    max-width: 1200px;
    margin: 0 auto;
}

.pg-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    gap: 1rem;
}

.pg-header h1 {
    font-size: 1.6rem;
    font-weight: 700;
    margin: 0;
}

.pg-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 0.2rem 0 0;
}

.pg-header-right {
    display: flex;
    gap: 0.5rem;
}

/* Language Tabs */
.pg-lang-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 0;
    border-bottom: 2px solid var(--border-color);
}

.pg-lang-tab {
    padding: 0.6rem 1.25rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.pg-lang-tab:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.pg-lang-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.pg-lang-icon {
    font-size: 1.1rem;
}

/* IDE Container */
.pg-ide {
    border: 1px solid var(--border-color);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    overflow: hidden;
    background: var(--bg-surface);
}

/* Editor Section */
.pg-editor-section {
    border-bottom: 1px solid var(--border-color);
}

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

.pg-file-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    font-family: 'Cascadia Code', 'Fira Code', monospace;
}

.pg-lang-badge {
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    background: var(--accent-light);
    color: var(--accent);
    border-radius: 3px;
    font-weight: 600;
}

.pg-status {
    margin-left: auto;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.pg-editor-textarea {
    width: 100%;
    min-height: 350px;
    max-height: 600px;
    padding: 1rem 1.25rem;
    background: #1e1e2e;
    color: #e0e0e0;
    border: none;
    font-family: 'Cascadia Code', 'Fira Code', 'JetBrains Mono', monospace;
    font-size: 0.88rem;
    line-height: 1.7;
    resize: vertical;
    outline: none;
    tab-size: 4;
}

.pg-editor-textarea::placeholder {
    color: #555;
}

/* Action Bar */
.pg-action-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.6rem 1rem;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-color);
}

.pg-run-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
    padding: 0.5rem 1.25rem;
}

.pg-run-icon {
    font-size: 0.85rem;
}

.pg-shortcut-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 0.2rem 0.5rem;
    background: var(--bg-primary);
    border-radius: 3px;
    font-family: 'Cascadia Code', monospace;
}

.pg-exec-info {
    margin-left: auto;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Output Terminal */
.pg-output-section {
    background: var(--bg-primary);
}

.pg-output-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 1rem;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-color);
}

.pg-output-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pg-output-clear {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    transition: all 0.15s;
}

.pg-output-clear:hover {
    color: var(--danger);
    background: rgba(239, 71, 67, 0.1);
}

.pg-output-terminal {
    padding: 1rem 1.25rem;
    margin: 0;
    min-height: 120px;
    max-height: 300px;
    overflow-y: auto;
    font-family: 'Cascadia Code', 'Fira Code', monospace;
    font-size: 0.82rem;
    line-height: 1.6;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-word;
}

.pg-output-success {
    color: var(--success);
}

.pg-output-error {
    color: var(--danger);
}

/* Responsive */
@media (max-width: 768px) {
    .pg-header {
        flex-direction: column;
    }

    .pg-editor-textarea {
        min-height: 250px;
        font-size: 0.82rem;
    }

    .pg-shortcut-hint {
        display: none;
    }
}

/* ============================================
   SQL PLAYGROUND — Schema Selector, Viewer & Results
   ============================================ */

/* SQL Controls Bar */
.pg-sql-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.6rem 1rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0;
}

.pg-sql-controls-left {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex: 1;
}

.pg-sql-controls-right {
    display: flex;
    align-items: center;
}

.pg-sql-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

.pg-schema-select {
    flex: 1;
    max-width: 400px;
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.2s;
}

.pg-schema-select:hover {
    border-color: var(--accent);
}

.pg-schema-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

.pg-schema-toggle {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.78rem;
    white-space: nowrap;
}

/* Schema Viewer Panel */
.pg-schema-viewer {
    border: 1px solid var(--border-color);
    border-top: none;
    background: var(--bg-surface);
    max-height: 300px;
    overflow-y: auto;
}

.pg-schema-viewer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 2;
}

.pg-schema-viewer-title {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.pg-schema-viewer-title strong {
    color: var(--accent);
}

.pg-schema-viewer-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    transition: all 0.15s;
}

.pg-schema-viewer-close:hover {
    color: var(--danger);
    background: rgba(239, 71, 67, 0.1);
}

.pg-schema-viewer-body {
    padding: 0.75rem 1rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.75rem;
}

.pg-schema-empty {
    color: var(--text-muted);
    font-size: 0.82rem;
    text-align: center;
    padding: 1rem;
}

/* Schema Table Card */
.pg-schema-table {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bg-primary);
}

.pg-schema-table-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.6rem;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-color);
}

.pg-schema-table-icon {
    font-size: 0.75rem;
}

.pg-schema-table-name {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: 'Cascadia Code', 'Fira Code', monospace;
}

.pg-schema-col-count {
    margin-left: auto;
    font-size: 0.65rem;
    color: var(--text-muted);
}

.pg-schema-columns {
    padding: 0.3rem 0;
}

.pg-schema-col {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.2rem 0.6rem;
    font-size: 0.72rem;
    border-left: 2px solid transparent;
}

.pg-schema-col-pk {
    border-left-color: var(--accent);
    background: rgba(99, 102, 241, 0.04);
}

.pg-schema-col-fk {
    border-left-color: var(--warning, #f59e0b);
    background: rgba(245, 158, 11, 0.04);
}

.pg-schema-col-name {
    font-family: 'Cascadia Code', 'Fira Code', monospace;
    font-weight: 600;
    color: var(--text-primary);
}

.pg-schema-col-type {
    font-family: 'Cascadia Code', 'Fira Code', monospace;
    color: var(--text-muted);
    font-size: 0.68rem;
}

.pg-schema-col-badge {
    font-size: 0.6rem;
    padding: 0.05rem 0.3rem;
    border-radius: 2px;
    font-weight: 700;
    letter-spacing: 0.3px;
    margin-left: auto;
}

.pg-badge-pk {
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent);
}

.pg-badge-fk {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning, #f59e0b);
}

/* SQL Result Table */
.pg-sql-result-wrapper {
    overflow-x: auto;
    margin-bottom: 0.75rem;
}

.pg-sql-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Cascadia Code', 'Fira Code', monospace;
    font-size: 0.78rem;
    line-height: 1.4;
}

.pg-sql-table thead {
    position: sticky;
    top: 0;
    z-index: 1;
}

.pg-sql-table th {
    padding: 0.45rem 0.7rem;
    background: var(--bg-elevated);
    color: var(--accent);
    font-weight: 700;
    text-align: left;
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.pg-sql-table td {
    padding: 0.35rem 0.7rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    white-space: nowrap;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pg-sql-table tbody tr:hover {
    background: rgba(99, 102, 241, 0.05);
}

.pg-sql-table tbody tr:nth-child(even) {
    background: rgba(0, 0, 0, 0.02);
}

.pg-sql-table tbody tr:nth-child(even):hover {
    background: rgba(99, 102, 241, 0.07);
}

.pg-sql-null {
    color: var(--text-muted);
    font-style: italic;
    opacity: 0.7;
}

.pg-sql-message {
    padding: 0.5rem 0.75rem;
    font-size: 0.82rem;
    color: var(--success);
    border-left: 3px solid var(--success);
    margin-bottom: 0.5rem;
    background: rgba(34, 197, 94, 0.05);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.pg-sql-row-count {
    padding: 0.4rem 0;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: right;
    font-style: italic;
}

/* SQL-specific output adjustments (when table results are shown) */
.pg-output-terminal .pg-sql-result-wrapper,
.pg-output-terminal .pg-sql-message,
.pg-output-terminal .pg-sql-row-count {
    white-space: normal;
    font-family: inherit;
}

/* Responsive SQL */
@media (max-width: 768px) {
    .pg-sql-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .pg-sql-controls-left {
        flex-direction: column;
        align-items: stretch;
    }

    .pg-schema-select {
        max-width: 100%;
    }

    .pg-schema-viewer-body {
        grid-template-columns: 1fr;
    }

    .pg-sql-table {
        font-size: 0.7rem;
    }

    .pg-sql-table th,
    .pg-sql-table td {
        padding: 0.3rem 0.5rem;
    }
}

/* ============================================
   PLAYGROUND AI HELP — Button & Response Panel
   ============================================ */

/* AI Help Button */
.pg-ai-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
    padding: 0.5rem 1.25rem;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.pg-ai-btn:hover {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.pg-ai-btn:active {
    transform: translateY(0);
}

.pg-ai-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.pg-ai-icon {
    font-size: 0.95rem;
}

/* AI Response Panel */
.pg-ai-panel {
    border-top: 2px solid #6366f1;
    background: var(--bg-surface);
}

.pg-ai-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(139, 92, 246, 0.08));
    border-bottom: 1px solid var(--border-color);
}

.pg-ai-panel-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: #6366f1;
    letter-spacing: 0.3px;
}

.pg-ai-panel-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    transition: all 0.15s;
}

.pg-ai-panel-close:hover {
    color: var(--danger);
    background: rgba(239, 71, 67, 0.1);
}

.pg-ai-panel-body {
    padding: 1rem 1.25rem;
    max-height: 350px;
    overflow-y: auto;
    font-size: 0.85rem;
    line-height: 1.7;
    color: var(--text-primary);
}

/* AI Response Content */
.pg-ai-content {
    word-break: break-word;
}

.pg-ai-text {
    margin: 0 0 0.5rem;
    color: var(--text-primary);
}

.pg-ai-heading {
    margin: 1rem 0 0.4rem;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
}

h3.pg-ai-heading {
    font-size: 0.95rem;
}

.pg-ai-list {
    margin: 0.4rem 0 0.6rem 1.2rem;
    padding: 0;
}

.pg-ai-list li {
    margin-bottom: 0.3rem;
    color: var(--text-secondary);
}

.pg-ai-code-block {
    background: #1e1e2e;
    color: #e0e0e0;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    margin: 0.6rem 0;
    overflow-x: auto;
    font-family: 'Cascadia Code', 'Fira Code', monospace;
    font-size: 0.8rem;
    line-height: 1.6;
    border-left: 3px solid #6366f1;
}

.pg-ai-code-block code {
    background: none;
    padding: 0;
    color: inherit;
    font-size: inherit;
}

.pg-ai-inline-code {
    background: rgba(99, 102, 241, 0.1);
    color: #6366f1;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    font-family: 'Cascadia Code', 'Fira Code', monospace;
    font-size: 0.8rem;
}

.pg-ai-loading {
    color: #6366f1;
    font-style: italic;
    animation: pgAiPulse 1.5s ease-in-out infinite;
}

@keyframes pgAiPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.pg-ai-error {
    color: var(--danger);
    padding: 0.5rem;
    border-left: 3px solid var(--danger);
    background: rgba(239, 71, 67, 0.05);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* Responsive AI Panel */
@media (max-width: 768px) {
    .pg-ai-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.78rem;
    }

    .pg-ai-panel-body {
        padding: 0.75rem 1rem;
        max-height: 250px;
        font-size: 0.82rem;
    }

    .pg-ai-code-block {
        font-size: 0.72rem;
    }
}
