/* ═══════════════════════════════════════════════════════
   📝 TẠO ĐỀ THI — Premium Dark Theme
   Dark mode, glassmorphism, smooth animations
   ═══════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── RESET & VARIABLES ── */
:root {
    --bg-primary: #0a0a1a;
    --bg-secondary: #111128;
    --bg-card: rgba(255, 255, 255, 0.04);
    --bg-card-hover: rgba(255, 255, 255, 0.08);
    --bg-glass: rgba(255, 255, 255, 0.06);
    --border-glass: rgba(255, 255, 255, 0.08);
    --border-active: rgba(102, 126, 234, 0.5);

    --text-primary: #f0f0ff;
    --text-secondary: rgba(240, 240, 255, 0.65);
    --text-muted: rgba(240, 240, 255, 0.35);

    --accent-primary: #667eea;
    --accent-secondary: #764ba2;
    --accent-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --accent-glow: 0 0 30px rgba(102, 126, 234, 0.3);

    --success: #00b894;
    --warning: #fdcb6e;
    --danger: #e17055;
    --info: #74b9ff;

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 40px rgba(102, 126, 234, 0.15);

    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* ── BACKGROUND EFFECTS ── */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(ellipse at 30% 20%, rgba(102, 126, 234, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse at 70% 80%, rgba(118, 75, 162, 0.06) 0%, transparent 60%);
    animation: bgFloat 20s ease-in-out infinite alternate;
    z-index: 0;
    pointer-events: none;
}

@keyframes bgFloat {
    0% {
        transform: translate(0, 0) rotate(0deg);
    }

    100% {
        transform: translate(-30px, 20px) rotate(3deg);
    }
}

/* ── HEADER ── */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(10, 10, 26, 0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-glass);
    padding: 1rem 2rem;
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    font-size: 1.8rem;
    filter: drop-shadow(0 0 10px rgba(102, 126, 234, 0.5));
}

.logo-text {
    font-size: 1.3rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-badge {
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 20px;
    background: var(--accent-gradient);
    color: white;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.header-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.header-btn {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-glass);
    background: var(--bg-glass);
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition-normal);
    font-family: inherit;
}

.header-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: var(--border-active);
}

/* ── MAIN LAYOUT ── */
.main {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* ── HERO SECTION ── */
.hero {
    text-align: center;
    padding: 2.5rem 0 3rem;
}

.hero h1 {
    font-size: 2.8rem;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.75rem;
    letter-spacing: -0.5px;
}

.hero p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* ── STEPS INDICATOR ── */
.steps-bar {
    display: flex;
    justify-content: center;
    gap: 0;
    margin: 2rem auto;
    max-width: 700px;
}

.step-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    cursor: pointer;
}

.step-circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    background: var(--bg-card);
    border: 2px solid var(--border-glass);
    color: var(--text-muted);
    transition: var(--transition-normal);
    position: relative;
    z-index: 2;
}

.step-item.active .step-circle {
    background: var(--accent-gradient);
    border-color: var(--accent-primary);
    color: white;
    box-shadow: var(--accent-glow);
}

.step-item.completed .step-circle {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.step-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    font-weight: 500;
    transition: var(--transition-normal);
}

.step-item.active .step-label {
    color: var(--accent-primary);
    font-weight: 600;
}

.step-item.completed .step-label {
    color: var(--success);
}

.step-item:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 22px;
    left: 50%;
    width: 100%;
    height: 2px;
    background: var(--border-glass);
    z-index: 1;
}

.step-item.completed:not(:last-child)::after {
    background: var(--success);
}

/* ── FORM PANELS ── */
.form-container {
    position: relative;
}

.form-panel {
    display: none;
    animation: panelIn 0.4s ease-out;
}

.form-panel.active {
    display: block;
}

@keyframes panelIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── CARD COMPONENT ── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(12px);
    padding: 1.75rem;
    margin-bottom: 1.5rem;
    transition: var(--transition-normal);
}

.card:hover {
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: var(--shadow-md);
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-title .icon {
    font-size: 1.2rem;
}

/* ── SUBJECT GRID ── */
.subject-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
}

.subject-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.25rem 0.75rem;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    border: 2px solid transparent;
    cursor: pointer;
    transition: var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.subject-card::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.3s;
    border-radius: inherit;
}

.subject-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-glass);
    background: var(--bg-card-hover);
}

.subject-card.selected {
    border-color: var(--accent-primary);
    background: rgba(102, 126, 234, 0.1);
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.15);
}

.subject-card .emoji {
    font-size: 2rem;
}

.subject-card .name {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-align: center;
}

.subject-card.selected .name {
    color: var(--text-primary);
}

/* ── GRADE SELECTOR ── */
.grade-group {
    margin-bottom: 1.25rem;
}

.grade-group-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    margin-bottom: 0.6rem;
    font-weight: 600;
}

.grade-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.grade-btn {
    width: 52px;
    height: 42px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 2px solid transparent;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-normal);
    font-family: inherit;
}

.grade-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-glass);
}

.grade-btn.selected {
    background: var(--accent-gradient);
    border-color: var(--accent-primary);
    color: white;
    box-shadow: var(--accent-glow);
}

/* ── EXAM TYPE CARDS ── */
.exam-type-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.exam-type-card {
    padding: 1.5rem;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    border: 2px solid transparent;
    cursor: pointer;
    transition: var(--transition-normal);
    text-align: center;
}

.exam-type-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-glass);
}

.exam-type-card.selected {
    border-color: var(--accent-primary);
    background: rgba(102, 126, 234, 0.1);
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.15);
}

.exam-type-card .icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

.exam-type-card .type-name {
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.exam-type-card .type-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ── DURATION SELECTOR ── */
.duration-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.75rem;
}

.duration-card {
    padding: 1rem;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    border: 2px solid transparent;
    cursor: pointer;
    transition: var(--transition-normal);
    text-align: center;
}

.duration-card:hover {
    border-color: var(--border-glass);
    background: var(--bg-card-hover);
}

.duration-card.selected {
    border-color: var(--accent-primary);
    background: rgba(102, 126, 234, 0.1);
}

.duration-card .time {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-primary);
}

.duration-card .type-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* ── FORM INPUTS ── */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-glass);
    background: var(--bg-card);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    transition: var(--transition-fast);
    outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--text-muted);
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
}

.form-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23666' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

.form-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* ── DIFFICULTY SLIDER ── */
.difficulty-bar {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.difficulty-chip {
    flex: 1;
    padding: 0.6rem 0.5rem;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 2px solid transparent;
    cursor: pointer;
    text-align: center;
    transition: var(--transition-normal);
    font-family: inherit;
}

.difficulty-chip:hover {
    border-color: var(--border-glass);
}

.difficulty-chip.selected {
    border-color: var(--accent-primary);
    background: rgba(102, 126, 234, 0.1);
}

.difficulty-chip .diff-name {
    font-size: 0.8rem;
    font-weight: 600;
}

.difficulty-chip .diff-percent {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* ── NUMBER INPUT ── */
.number-input-group {
    display: flex;
    align-items: center;
    gap: 0;
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bg-card);
    width: fit-content;
}

.number-btn {
    width: 42px;
    height: 42px;
    border: none;
    background: var(--bg-glass);
    color: var(--text-primary);
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition-fast);
    font-family: inherit;
}

.number-btn:hover {
    background: var(--bg-card-hover);
}

.number-input-group input {
    width: 60px;
    text-align: center;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    outline: none;
}

/* ── BUTTONS ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.85rem 1.75rem;
    border-radius: var(--radius-md);
    border: none;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: var(--accent-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border-glass);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.btn-lg {
    padding: 1rem 2.5rem;
    font-size: 1.05rem;
    border-radius: var(--radius-lg);
}

.btn-block {
    width: 100%;
}

.btn-group {
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin-top: 2rem;
}

/* ── REVIEW PANEL (Step 3) ── */
.review-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.review-item {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
}

.review-item .label {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.review-item .value {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.85rem;
}

.review-item.full-width {
    grid-column: 1 / -1;
}

/* ── RESULT DISPLAY ── */
.result-area {
    display: none;
    margin-top: 2rem;
    animation: panelIn 0.5s ease-out;
}

.result-area.visible {
    display: block;
}

.result-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 2rem;
    backdrop-filter: blur(12px);
}

.result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-glass);
}

.result-title {
    font-size: 1.3rem;
    font-weight: 700;
}

.result-content {
    font-size: 0.95rem;
    line-height: 1.8;
    color: var(--text-secondary);
    white-space: pre-line;
}

/* ── RESULT SINGLE VIEW (Trắc nghiệm) ── */
.result-single-view {
    display: block !important;
    height: 600px;
    /* Chiều cao cố định */
    overflow-y: auto;
    /* Cho phép cuộn */
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.2);
    padding: 1.5rem;
}

/* Tùy chỉnh thanh cuộn cho đẹp */
.result-single-view::-webkit-scrollbar {
    width: 8px;
}

.result-single-view::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.result-single-view::-webkit-scrollbar-thumb {
    background: var(--accent-primary);
    border-radius: 4px;
}

.result-single-view::-webkit-scrollbar-thumb:hover {
    background: var(--accent-secondary);
}

/* ── RESULT TABS ── */
.result-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border-glass);
    margin-bottom: 1.5rem;
}

.result-tab {
    flex: 1;
    padding: 0.85rem 1.25rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-normal);
    border-bottom: 3px solid transparent;
    position: relative;
}

.result-tab:hover {
    color: var(--text-secondary);
    background: var(--bg-card-hover);
}

.result-tab.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
    background: rgba(102, 126, 234, 0.06);
}

.result-tab-content {
    display: none;
    animation: panelIn 0.3s ease-out;
}

.result-tab-content.active {
    display: block;
}

.tab-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1rem;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
}

.meta-bar {
    margin-top: 1.5rem;
    padding: 0.75rem 1rem;
    background: rgba(102, 126, 234, 0.08);
    border-radius: 8px;
    border-left: 3px solid var(--accent-primary);
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ── SUGGESTION AUTOCOMPLETE ── */
.suggestion-wrapper {
    position: relative;
}

.suggestion-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 220px;
    overflow-y: auto;
    background: rgba(17, 17, 40, 0.95);
    border: 1px solid var(--border-glass);
    border-top: none;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    backdrop-filter: blur(16px);
    z-index: 50;
    box-shadow: var(--shadow-md);
}

.suggestion-dropdown.visible {
    display: block;
}

.suggestion-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.65rem 1rem;
    cursor: pointer;
    transition: var(--transition-fast);
    font-size: 0.85rem;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background: rgba(102, 126, 234, 0.12);
    color: var(--text-primary);
}

.suggestion-icon {
    font-size: 0.9rem;
    flex-shrink: 0;
}

.suggestion-text {
    flex: 1;
}

.suggestion-text mark {
    background: rgba(102, 126, 234, 0.3);
    color: var(--accent-primary);
    border-radius: 2px;
    padding: 0 2px;
}

/* ── CUSTOM FORMAT SAVE ── */
.custom-format-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.5rem;
}

.btn-save-format {
    background: linear-gradient(135deg, #00b894, #00cec9);
    color: white;
    border: none;
    padding: 0.45rem 1rem;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-normal);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.btn-save-format:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 184, 148, 0.35);
}

.saved-formats-list {
    margin-top: 0.6rem;
    padding: 0.6rem 0.8rem;
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
}

.saved-formats-title {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.saved-format-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    transition: var(--transition-fast);
    margin-bottom: 0.25rem;
}

.saved-format-item:hover {
    background: rgba(102, 126, 234, 0.1);
}

.saved-format-name {
    font-size: 0.82rem;
    color: var(--text-secondary);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-delete-format {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    transition: var(--transition-fast);
    line-height: 1;
    opacity: 0.5;
}

.btn-delete-format:hover {
    color: var(--danger);
    background: rgba(225, 112, 85, 0.15);
    opacity: 1;
}

.form-textarea[readonly] {
    background: rgba(0, 0, 0, 0.2);
    border-color: rgba(102, 126, 234, 0.3);
    color: var(--text-muted);
    cursor: default;
}

/* ── LOADING STATE ── */
.loading-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 26, 0.9);
    backdrop-filter: blur(10px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 1.5rem;
}

.loading-overlay.visible {
    display: flex;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 3px solid var(--border-glass);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-text {
    font-size: 1.1rem;
    color: var(--text-secondary);
    animation: loadPulse 1.5s ease-in-out infinite;
}

@keyframes loadPulse {

    0%,
    100% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }
}

/* ── Toast Notification ── */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    padding: 0.85rem 1.25rem;
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    font-size: 0.85rem;
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow-md);
    animation: toastIn 0.3s ease-out;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    max-width: 350px;
}

.toast.success {
    border-left: 3px solid var(--success);
}

.toast.error {
    border-left: 3px solid var(--danger);
}

.toast.info {
    border-left: 3px solid var(--info);
}

@keyframes toastIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ── HISTORY TABLE ── */
.history-table {
    width: 100%;
    border-collapse: collapse;
}

.history-table th,
.history-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-glass);
    font-size: 0.85rem;
}

.history-table th {
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 1px;
}

.history-table tr:hover td {
    background: var(--bg-card-hover);
}

.status-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-badge.pending {
    background: rgba(253, 203, 110, 0.15);
    color: var(--warning);
}

.status-badge.completed {
    background: rgba(0, 184, 148, 0.15);
    color: var(--success);
}

.status-badge.error {
    background: rgba(225, 112, 85, 0.15);
    color: var(--danger);
}

/* ── LESSON SELECTION ── */
.lesson-toolbar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}

.lesson-search {
    flex: 1;
    min-width: 200px;
    padding: 0.6rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-glass);
    background: var(--bg-card);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.85rem;
    outline: none;
    transition: var(--transition-fast);
}

.lesson-search:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.lesson-search::placeholder {
    color: var(--text-muted);
}

.lesson-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-glass);
    padding: 0.45rem 0.8rem;
    font-size: 0.78rem;
}

.btn-outline:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: var(--accent-primary);
}

.lesson-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.15);
}

.lesson-list::-webkit-scrollbar {
    width: 6px;
}

.lesson-list::-webkit-scrollbar-track {
    background: transparent;
}

.lesson-list::-webkit-scrollbar-thumb {
    background: var(--border-glass);
    border-radius: 3px;
}

.lesson-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1rem;
    cursor: pointer;
    transition: var(--transition-fast);
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.lesson-item:last-child {
    border-bottom: none;
}

.lesson-item:hover {
    background: rgba(102, 126, 234, 0.08);
    color: var(--text-primary);
}

.lesson-checkbox {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-primary);
    cursor: pointer;
    flex-shrink: 0;
}

.lesson-name {
    flex: 1;
    line-height: 1.4;
}

.lesson-name mark {
    background: rgba(102, 126, 234, 0.3);
    color: var(--accent-primary);
    border-radius: 2px;
    padding: 0 2px;
}

.lesson-count-badge {
    display: none;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    background: var(--accent-gradient);
    color: white;
    margin-left: auto;
}

.lesson-hint {
    margin-top: 0.6rem;
    font-size: 0.78rem;
    color: var(--text-muted);
    padding: 0.5rem 0;
}

.lesson-empty {
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
    .main {
        padding: 1rem;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .subject-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .exam-type-grid {
        grid-template-columns: 1fr;
    }

    .duration-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .review-grid {
        grid-template-columns: 1fr;
    }

    .btn-group {
        flex-direction: column;
    }

    .header-inner {
        padding: 0 1rem;
    }

    .steps-bar {
        padding: 0 0.5rem;
    }
}

@media (max-width: 480px) {
    .subject-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .grade-btn {
        width: 44px;
        height: 38px;
        font-size: 0.8rem;
    }

    .hero h1 {
        font-size: 1.6rem;
    }
}