/* ==========================================================================
   Rush Model Test Platform - Design System & Modern CSS
   ========================================================================== */

:root {
    /* Telegram Theme Integration & Modern Color Palette */
    --tg-theme-bg-color: #0f172a;
    --tg-theme-secondary-bg-color: #1e293b;
    --tg-theme-text-color: #f8fafc;
    --tg-theme-hint-color: #94a3b8;
    --tg-theme-link-color: #38bdf8;
    --tg-theme-button-color: #3b82f6;
    --tg-theme-button-text-color: #ffffff;

    /* Custom Accents */
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --primary-glow: rgba(59, 130, 246, 0.35);
    
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.15);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.15);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.15);
    --info: #06b6d4;

    --ceo-gold: #f59e0b;
    --ceo-gold-glow: rgba(245, 158, 11, 0.4);

    /* Backgrounds and Surfaces */
    --bg-main: #0b0f19;
    --bg-card: rgba(30, 41, 59, 0.7);
    --bg-card-hover: rgba(51, 65, 85, 0.8);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-focus: rgba(59, 130, 246, 0.6);

    /* Typography */
    --font-family: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    
    /* Shadows & Radii */
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-full: 9999px;
    --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 20px var(--primary-glow);
}

/* Light Theme Overrides (if activated or light mode in Telegram) */
[data-theme="light"] {
    --bg-main: #f1f5f9;
    --bg-card: rgba(255, 255, 255, 0.85);
    --bg-card-hover: #ffffff;
    --tg-theme-text-color: #0f172a;
    --tg-theme-hint-color: #64748b;
    --border-color: rgba(0, 0, 0, 0.08);
    --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
}

/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-main);
    color: var(--tg-theme-text-color);
    min-height: 100vh;
    line-height: 1.5;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

#app-container {
    max-width: 640px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-bottom: 30px;
}

/* Glassmorphism Cards */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Header */
/* Top Sticky Navigation Wrapper */
.app-top-sticky-wrapper {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(11, 15, 25, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    padding-top: max(8px, env(safe-area-inset-top));
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    transition: all 0.3s ease;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px 6px 16px;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-logo-icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: linear-gradient(135deg, #10b981, #059669);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: #ffffff;
    line-height: 1.1;
}

.brand-badge {
    font-size: 0.65rem;
    font-weight: 700;
    color: #38bdf8;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

/* User Profile Badge */
.header-user-profile {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(30, 41, 59, 0.7);
    padding: 5px 12px 5px 6px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.25s ease;
}

.avatar-circle {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.9rem;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.user-meta {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.user-name {
    font-size: 0.82rem;
    font-weight: 700;
    color: #f8fafc;
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.2;
}

.user-role-tag {
    font-size: 0.65rem;
    font-weight: 800;
    color: #38bdf8;
    display: flex;
    align-items: center;
    gap: 3px;
    line-height: 1;
    margin-top: 1px;
}

/* CEO / O'qituvchi Gold Profile Styling */
.user-role-tag.ceo {
    color: #fbbf24;
    text-shadow: 0 0 8px rgba(245, 158, 11, 0.5);
}

.header-user-profile.ceo,
.header-user-profile:has(.user-role-tag.ceo) {
    border-color: rgba(245, 158, 11, 0.5);
    background: rgba(245, 158, 11, 0.12);
}

.header-user-profile.ceo .avatar-circle,
.header-user-profile:has(.user-role-tag.ceo) .avatar-circle {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    box-shadow: 0 2px 10px rgba(245, 158, 11, 0.4);
}

/* App Navbar & Tab Buttons */
.app-navbar {
    padding: 6px 12px 10px 12px;
}

.nav-group {
    display: none;
    grid-template-columns: repeat(3, 1fr);
    background: rgba(15, 23, 42, 0.7);
    padding: 4px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    gap: 4px;
}

.nav-group.active {
    display: grid;
}

.nav-tab {
    background: transparent;
    border: none;
    color: var(--tg-theme-hint-color);
    padding: 9px 4px;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.nav-tab i {
    font-size: 0.95rem;
}

.nav-tab:hover {
    color: #f8fafc;
    background: rgba(255, 255, 255, 0.05);
}

.nav-tab.active {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.4);
}

/* Gold active tab highlight for Teacher Mode */
#nav-group-ceo .nav-tab.active {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4);
}

/* Quick Code Strip Box on Home */
.quick-code-strip-box {
    margin-bottom: 12px;
}

.code-strip-inner {
    display: flex;
    align-items: center;
    background: rgba(16, 185, 129, 0.08);
    border: 1.5px solid rgba(16, 185, 129, 0.35);
    border-radius: var(--radius-md);
    padding: 4px 6px;
    gap: 6px;
    transition: all 0.2s ease;
}

.code-strip-inner:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 16px rgba(16, 185, 129, 0.25);
    background: rgba(16, 185, 129, 0.12);
}

.code-strip-icon {
    font-size: 1.1rem;
    color: var(--primary);
    margin-left: 6px;
}

.code-strip-inner input {
    flex: 1;
    border: none !important;
    background: transparent !important;
    padding: 6px 4px !important;
    font-size: 0.85rem !important;
    font-weight: 600 !important;
    color: var(--tg-theme-text-color) !important;
    outline: none !important;
}

.btn-strip-start {
    background: var(--primary);
    color: #ffffff;
    border: none;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.btn-strip-start:active {
    transform: scale(0.96);
}

.icon-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--tg-theme-text-color);
    width: 38px;
    height: 38px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.12);
}

/* Content Area */
.content-wrapper {
    padding: 16px;
    flex: 1;
}

.view-section {
    display: none;
    animation: fadeIn 0.3s ease forwards;
}

.view-section.active {
    display: block;
}

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

.hidden {
    display: none !important;
}

/* Section Hero */
.section-hero {
    margin-bottom: 18px;
}

.section-hero h2 {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.section-hero p {
    color: var(--tg-theme-hint-color);
    font-size: 0.85rem;
    margin-top: 3px;
}

/* Search Bar */
.search-bar-wrap {
    position: relative;
    margin-bottom: 16px;
}

.search-bar-wrap input {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 12px 16px 12px 42px;
    border-radius: var(--radius-md);
    color: var(--tg-theme-text-color);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-bar-wrap input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.search-bar-wrap .search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--tg-theme-hint-color);
    font-size: 0.95rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.btn-primary {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #ffffff;
    box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px var(--primary-glow);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--tg-theme-text-color);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.14);
}

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

.btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.78rem;
    border-radius: var(--radius-sm);
}

.btn-block {
    width: 100%;
}

/* Test Cards */
.tests-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.test-card {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    overflow: hidden;
}

.test-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary);
    border-radius: 4px 0 0 4px;
}

.test-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.test-card-header h3 {
    font-size: 1.05rem;
    font-weight: 700;
}

.test-subject-badge {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    text-transform: uppercase;
}

.test-meta-row {
    display: flex;
    gap: 16px;
    font-size: 0.82rem;
    color: var(--tg-theme-hint-color);
}

.test-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.test-meta-item i {
    color: var(--primary);
}

.test-card-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
}

.test-code-badge {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--tg-theme-hint-color);
}

.test-code-badge strong {
    color: var(--primary);
    background: rgba(59, 130, 246, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
}

/* Code Entry Card */
.code-entry-card {
    padding: 28px 20px;
    text-align: center;
}

.card-icon-header {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-full);
    background: rgba(59, 130, 246, 0.15);
    color: var(--primary);
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.code-input-group {
    display: flex;
    gap: 10px;
    margin: 20px 0;
}

.code-input-group input {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    padding: 14px 16px;
    border-radius: var(--radius-md);
    color: #ffffff;
    font-size: 1.2rem;
    font-weight: 700;
    text-align: center;
    letter-spacing: 2px;
    outline: none;
}

.quick-tips {
    font-size: 0.8rem;
    color: var(--tg-theme-hint-color);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* ================= TEST PLAYER ================= */

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

.player-info h3 {
    font-size: 0.95rem;
    font-weight: 700;
}

.player-subject-badge {
    font-size: 0.72rem;
    color: var(--primary);
    font-weight: 600;
}

.timer-badge {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
    padding: 6px 12px;
    border-radius: var(--radius-full);
    font-weight: 700;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 6px;
    animation: timerPulse 1s infinite alternate;
}

@keyframes timerPulse {
    from { transform: scale(1); }
    to { transform: scale(1.02); }
}

.test-progress-container {
    margin-bottom: 14px;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--tg-theme-hint-color);
    margin-bottom: 6px;
}

.progress-bar-bg {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #10b981);
    transition: width 0.3s ease;
}

.question-navigator-scroll {
    overflow-x: auto;
    padding-bottom: 8px;
    margin-bottom: 14px;
}

.question-nav-grid {
    display: flex;
    gap: 6px;
}

.q-nav-pill {
    min-width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--tg-theme-text-color);
    font-size: 0.82rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.q-nav-pill.current {
    border-color: var(--primary);
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 2px 8px var(--primary-glow);
}

.q-nav-pill.answered {
    background: rgba(16, 185, 129, 0.2);
    border-color: var(--success);
    color: var(--success);
}

.q-nav-pill.flagged {
    border-color: var(--warning);
    position: relative;
}

.q-nav-pill.flagged::after {
    content: '';
    position: absolute;
    top: 2px;
    right: 2px;
    width: 6px;
    height: 6px;
    background: var(--warning);
    border-radius: 50%;
}

.question-box {
    padding: 20px;
    margin-bottom: 18px;
}

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

.q-tag {
    font-size: 0.8rem;
    font-weight: 700;
    background: rgba(59, 130, 246, 0.15);
    color: var(--primary);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
}

.btn-flag {
    background: transparent;
    border: none;
    color: var(--tg-theme-hint-color);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px;
}

.btn-flag.active {
    color: var(--warning);
}

.question-text {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 20px;
    line-height: 1.45;
}

.options-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.option-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
}

.option-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.option-item.selected {
    background: rgba(59, 130, 246, 0.15);
    border-color: var(--primary);
    box-shadow: 0 0 12px var(--primary-glow);
}

.option-letter {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.85rem;
    margin-right: 12px;
    transition: all 0.2s ease;
}

.option-item.selected .option-letter {
    background: var(--primary);
    color: #ffffff;
}

.option-text {
    font-size: 0.95rem;
    font-weight: 500;
}

.player-footer-controls {
    display: grid;
    grid-template-columns: 1fr 1fr 1.2fr;
    gap: 8px;
}

/* ================= RESULTS / CERTIFICATE ================= */

.result-summary-card {
    padding: 24px 20px;
    text-align: center;
}

.result-celebration-icon {
    font-size: 3rem;
    margin-bottom: 8px;
}

.score-circle-wrapper {
    margin: 20px 0;
    display: flex;
    justify-content: center;
}

.score-circle {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    background: conic-gradient(var(--success) 0deg, var(--primary) 280deg, rgba(255,255,255,0.1) 280deg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.25);
    position: relative;
}

.score-circle::before {
    content: '';
    position: absolute;
    inset: 8px;
    background: var(--bg-main);
    border-radius: 50%;
}

.score-percent {
    position: relative;
    font-size: 1.8rem;
    font-weight: 800;
    color: #ffffff;
    line-height: 1;
}

.score-ratio {
    position: relative;
    font-size: 0.8rem;
    color: var(--tg-theme-hint-color);
    margin-top: 4px;
}

.result-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 16px 0;
}

.res-stat-item {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    padding: 12px;
    border-radius: var(--radius-sm);
    text-align: left;
    font-size: 0.8rem;
}

.res-stat-item i {
    margin-right: 4px;
}

.res-stat-item.correct i { color: var(--success); }
.res-stat-item.wrong i { color: var(--danger); }
.res-stat-item.time i { color: var(--info); }
.res-stat-item.rush i { color: var(--warning); }

.res-stat-item strong {
    display: block;
    font-size: 1.05rem;
    margin-top: 4px;
    color: var(--tg-theme-text-color);
}

.rush-rating-banner {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: var(--ceo-gold);
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 0.85rem;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.breakdown-heading {
    text-align: left;
    font-size: 0.95rem;
    margin: 20px 0 10px;
}

.breakdown-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    margin-bottom: 20px;
}

.breakdown-item {
    padding: 8px 4px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 700;
    text-align: center;
    border: 1px solid var(--border-color);
}

.breakdown-item.correct {
    background: var(--success-bg);
    border-color: var(--success);
    color: var(--success);
}

.breakdown-item.wrong {
    background: var(--danger-bg);
    border-color: var(--danger);
    color: var(--danger);
}

/* ================= CEO VIEWS ================= */

.ceo-stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.ceo-stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
}

.stat-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.stat-icon.purple { background: rgba(139, 92, 246, 0.2); color: #a78bfa; }
.stat-icon.blue { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.stat-icon.green { background: rgba(16, 185, 129, 0.2); color: #34d399; }

.stat-data h3 {
    font-size: 1.25rem;
    font-weight: 800;
}

.stat-data span {
    font-size: 0.72rem;
    color: var(--tg-theme-hint-color);
}

.ceo-quick-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 16px;
}

.card-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

/* Forms */
.create-test-card {
    padding: 20px;
}

.form-group {
    margin-bottom: 16px;
}

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

label {
    display: block;
    font-size: 0.82rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.label-with-hint {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.badge-hint {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--primary);
    background: rgba(59, 130, 246, 0.15);
    padding: 2px 6px;
    border-radius: 4px;
}

input[type="text"],
input[type="number"],
select,
textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    padding: 12px 14px;
    border-radius: var(--radius-md);
    color: var(--tg-theme-text-color);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.input-with-action {
    display: flex;
    gap: 6px;
}

.form-help-text {
    font-size: 0.75rem;
    color: var(--tg-theme-hint-color);
    margin-top: 4px;
    display: block;
}

.form-help-text code {
    background: rgba(255, 255, 255, 0.1);
    padding: 1px 4px;
    border-radius: 4px;
    color: var(--primary);
}

.keypad-builder-box {
    background: rgba(0, 0, 0, 0.2);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
    margin-bottom: 20px;
}

.keypad-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--tg-theme-hint-color);
}

.keypad-grid {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 200px;
    overflow-y: auto;
}

.keypad-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.keypad-q-label {
    width: 30px;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--tg-theme-hint-color);
}

.keypad-btn-group {
    display: flex;
    gap: 4px;
    flex: 1;
}

.key-opt-btn {
    flex: 1;
    padding: 6px 0;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--tg-theme-text-color);
    font-weight: 700;
    font-size: 0.8rem;
    cursor: pointer;
}

.key-opt-btn.active {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}

/* Mode Switcher Tabs */
.test-type-selector-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    background: rgba(0, 0, 0, 0.3);
    padding: 6px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    margin-bottom: 18px;
}

.type-tab-btn {
    padding: 10px 8px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--tg-theme-hint-color);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.type-tab-btn.active {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 4px 12px var(--primary-glow);
}

/* Detailed Questions Builder Stack */
.section-divider-title {
    margin: 16px 0 10px;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.detailed-questions-stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 14px;
}

.question-builder-card {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    position: relative;
    transition: border-color 0.2s;
}

.question-builder-card:focus-within {
    border-color: var(--border-focus);
}

.q-builder-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.q-badge-num {
    font-size: 0.8rem;
    font-weight: 800;
    color: #ffffff;
    background: var(--primary);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
}

.btn-remove-q {
    background: transparent;
    border: none;
    color: #ef4444;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
}

.btn-remove-q:hover {
    background: rgba(239, 68, 68, 0.15);
}

.q-text-input {
    width: 100%;
    margin-bottom: 12px;
}

.options-builder-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.opt-builder-row {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.03);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.opt-radio-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.opt-radio-wrap input[type="radio"] {
    accent-color: var(--success);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.opt-letter-tag {
    font-weight: 800;
    font-size: 0.85rem;
    color: var(--primary);
    width: 16px;
}

.opt-text-input {
    flex: 1;
    background: transparent !important;
    border: none !important;
    padding: 6px 4px !important;
    font-size: 0.88rem !important;
    box-shadow: none !important;
}

.opt-text-input:focus {
    border-bottom: 1px solid var(--primary) !important;
    border-radius: 0 !important;
}

.add-question-btn {
    border: 1px dashed var(--primary);
    color: var(--primary);
}

/* Math Symbols Quick Toolbar */
.math-symbols-quick-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.35);
    padding: 8px 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    margin-bottom: 12px;
    overflow-x: auto;
}

.symbols-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 4px;
}

.symbols-btns {
    display: flex;
    gap: 6px;
}

.sym-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-color);
    color: var(--tg-theme-text-color);
    border-radius: var(--radius-sm);
    padding: 4px 10px;
    font-family: 'JetBrains Mono', monospace, sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.sym-btn:hover {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
    transform: translateY(-1px);
}

.sym-btn:active {
    transform: translateY(1px);
}

/* Question Type Selector in Question Builder */
.q-type-toggle-row {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
}

.q-type-btn {
    flex: 1;
    padding: 6px 8px;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-sm);
    color: var(--tg-theme-hint-color);
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.15s ease;
}

.q-type-btn.active {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}

/* Written Question Builder Container */
.written-opt-builder {
    background: rgba(255, 255, 255, 0.02);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-top: 6px;
}

.written-opt-builder label {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 6px;
    display: block;
}

/* Written Answer Box in Student Player */
.written-answer-box {
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.written-input-wrap {
    position: relative;
    width: 100%;
}

.written-answer-input {
    width: 100%;
    padding: 14px 16px;
    font-size: 1.15rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace, sans-serif;
    color: var(--tg-theme-text-color);
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.written-answer-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 16px var(--primary-glow);
}

.written-quick-pad {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.pad-btn {
    padding: 6px 12px;
    font-size: 0.9rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace, sans-serif;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--tg-theme-text-color);
    cursor: pointer;
    transition: all 0.15s ease;
}

.pad-btn:hover {
    background: var(--primary);
    color: #ffffff;
}

/* Teacher Manual Inspection & Grading */
.teacher-grading-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 14px;
}

.grading-item-card {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 14px;
}

.grading-item-card.correct {
    border-left: 4px solid var(--success);
}

.grading-item-card.wrong {
    border-left: 4px solid var(--danger);
}

.grading-item-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.grading-q-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--tg-theme-text-color);
}

.grading-q-type {
    font-size: 0.72rem;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--tg-theme-hint-color);
}

.grading-answers-compare {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    font-size: 0.82rem;
    margin: 8px 0;
    background: rgba(255, 255, 255, 0.02);
    padding: 8px;
    border-radius: var(--radius-sm);
}

.grading-ans-box {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.grading-ans-label {
    font-size: 0.7rem;
    color: var(--tg-theme-hint-color);
    font-weight: 600;
}

.grading-ans-val {
    font-weight: 800;
    font-family: 'JetBrains Mono', monospace, sans-serif;
}

.grading-ans-val.student {
    color: var(--primary);
}

.grading-ans-val.teacher {
    color: var(--success);
}

.grading-actions-bar {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    margin-top: 6px;
}

.btn-grade {
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.15s ease;
}

.btn-grade.mark-correct {
    color: var(--success);
    border-color: var(--success);
}

.btn-grade.mark-correct.active,
.btn-grade.mark-correct:hover {
    background: var(--success);
    color: #ffffff;
}

.btn-grade.mark-wrong {
    color: var(--danger);
    border-color: var(--danger);
}

.btn-grade.mark-wrong.active,
.btn-grade.mark-wrong:hover {
    background: var(--danger);
    color: #ffffff;
}

.btn-save-grading {
    margin-top: 14px;
}

/* ==========================================================================
   Milliy Sertifikat (1-35 MCQ + 36-45 Written a/b) Table Styles
   ========================================================================== */

.milliy-banner-header {
    text-align: center;
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: var(--radius-md);
    padding: 12px;
    margin-bottom: 16px;
}

.milliy-banner-header h3 {
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: var(--success);
    margin-bottom: 2px;
}

.milliy-banner-header p {
    font-size: 0.78rem;
    color: var(--tg-theme-hint-color);
}

.milliy-section-heading {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* 1-35 MCQ Grid Table (5 Columns) */
.milliy-mcq-grid-wrap {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    background: rgba(0, 0, 0, 0.35);
    padding: 8px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    overflow-x: auto;
}

@media (max-width: 480px) {
    .milliy-mcq-grid-wrap {
        grid-template-columns: repeat(3, 1fr);
    }
}

.milliy-col-stack {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.milliy-row-cell {
    display: grid;
    grid-template-columns: 28px 1fr;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: rgba(255, 255, 255, 0.02);
}

.milliy-num-badge {
    background: rgba(16, 185, 129, 0.35);
    color: #ffffff;
    font-weight: 800;
    font-size: 0.78rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-right: 1px solid var(--border-color);
}

.milliy-opt-select {
    width: 100%;
    border: none !important;
    background: transparent !important;
    color: var(--tg-theme-text-color) !important;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 800;
    font-size: 0.85rem;
    padding: 4px 6px !important;
    text-align: center;
    cursor: pointer;
    outline: none;
}

.milliy-opt-select:focus {
    background: rgba(59, 130, 246, 0.25) !important;
}

/* 36-45 Written Grid Table (5 Columns x 2 Rows) */
.milliy-written-grid-wrap {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    background: rgba(0, 0, 0, 0.35);
    padding: 8px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    overflow-x: auto;
}

@media (max-width: 480px) {
    .milliy-written-grid-wrap {
        grid-template-columns: repeat(2, 1fr);
    }
}

.milliy-written-card {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: rgba(255, 255, 255, 0.02);
}

.milliy-written-num-header {
    background: rgba(16, 185, 129, 0.4);
    color: #ffffff;
    font-weight: 800;
    font-size: 0.82rem;
    padding: 3px 6px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.milliy-sub-inputs-stack {
    padding: 6px 4px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.milliy-sub-input-row {
    display: flex;
    align-items: center;
    gap: 3px;
}

.sub-tag-label {
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--primary);
    width: 14px;
}

.sub-val-input {
    flex: 1;
    min-width: 0;
    padding: 3px 4px !important;
    font-size: 0.78rem !important;
    font-family: 'JetBrains Mono', monospace !important;
    font-weight: 700 !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 4px !important;
    background: rgba(0, 0, 0, 0.4) !important;
}

.sub-val-input:focus {
    border-color: var(--primary) !important;
}

/* CEO Logs Section */
.logs-filter-bar {
    padding: 14px;
    margin-bottom: 14px;
}

.filter-inputs {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 8px;
    margin-bottom: 10px;
}

.filter-item {
    position: relative;
}

.filter-item.search i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--tg-theme-hint-color);
    font-size: 0.85rem;
}

.filter-item.search input {
    padding-left: 36px;
}

.filter-buttons {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.logs-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.log-item-card {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    cursor: pointer;
}

.log-item-card:hover {
    border-color: var(--primary);
}

.log-item-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.student-info h4 {
    font-size: 0.95rem;
    font-weight: 700;
}

.student-info span {
    font-size: 0.75rem;
    color: var(--tg-theme-hint-color);
}

.score-badge-pill {
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.82rem;
    font-weight: 800;
}

.score-badge-pill.high { background: var(--success-bg); color: var(--success); border: 1px solid var(--success); }
.score-badge-pill.med { background: var(--warning-bg); color: var(--warning); border: 1px solid var(--warning); }
.score-badge-pill.low { background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger); }

.log-item-bottom {
    display: flex;
    justify-content: space-between;
    font-size: 0.78rem;
    color: var(--tg-theme-hint-color);
    border-top: 1px solid var(--border-color);
    padding-top: 6px;
}

/* Modals */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.modal-content {
    width: 100%;
    max-width: 500px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 20px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.modal-close-btn {
    background: transparent;
    border: none;
    color: var(--tg-theme-text-color);
    font-size: 1.5rem;
    cursor: pointer;
}

.confirm-box {
    text-align: center;
}

.confirm-icon {
    font-size: 2.5rem;
    color: var(--warning);
    margin-bottom: 12px;
}

.confirm-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 20px;
}

/* Toast */
.toast-notification {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    border: 1px solid var(--primary);
    color: #ffffff;
    padding: 10px 20px;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
    z-index: 200;
    animation: slideUpToast 0.3s ease;
}

@keyframes slideUpToast {
    from { opacity: 0; transform: translate(-50%, 20px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--tg-theme-hint-color);
    gap: 12px;
}

.loading-spinner i {
    font-size: 2rem;
    color: var(--primary);
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--tg-theme-hint-color);
}

.empty-state i {
    font-size: 2.5rem;
    margin-bottom: 10px;
    opacity: 0.5;
}
