/* =====================================================
   QA Practice Lab — Theme matched với itlearn.edu.vn/v2/api.html
   Dark mode · Red + Navy brand · Bricolage Grotesque + Plus Jakarta Sans
   ===================================================== */

:root {
    /* --- Brand: red + navy from IT LEARN logo --- */
    --bg: #080d1f;
    --bg-2: #0e162e;
    --bg-3: #152043;
    --surface: #1a2750;
    --surface-2: #243466;
    --line: rgba(255, 255, 255, .08);
    --line-strong: rgba(255, 255, 255, .14);
    --text: #f1f5f9;
    --text-dim: #94a3b8;
    --text-mute: #64748b;

    --red: #dc2626;
    --red-2: #ef4444;
    --red-bright: #f87171;
    --red-soft: #fecaca;
    --red-deep: #991b1b;

    --navy: #1e3a8a;
    --navy-2: #3b82f6;
    --navy-bright: #60a5fa;
    --navy-soft: #bfdbfe;

    --gold: #fbbf24;
    --green: #10b981;

    --grad: linear-gradient(135deg, #ef4444 0%, #dc2626 60%, #991b1b 100%);
    --grad-navy: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%);
    --grad-mix: linear-gradient(120deg, #ef4444 0%, #dc2626 40%, #1e40af 100%);
    --shadow-red: 0 20px 60px -20px rgba(220, 38, 38, .55);
    --shadow-navy: 0 20px 60px -20px rgba(30, 58, 138, .5);

    --display: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
    --body: "Plus Jakarta Sans", ui-sans-serif, system-ui, sans-serif;
    --mono: "JetBrains Mono", ui-monospace, monospace;

    --r-sm: 10px;
    --r: 16px;
    --r-lg: 24px;
    --r-xl: 32px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--body);
    background: var(--bg);
    color: var(--text);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: 0; background: none; color: inherit; }

/* ---- Background glow + noise (đặc trưng của itlearn) ---- */
body::before {
    content: "";
    position: fixed; inset: 0;
    background:
        radial-gradient(900px 500px at 85% -10%, rgba(220, 38, 38, .18), transparent 60%),
        radial-gradient(700px 500px at -5% 30%, rgba(30, 64, 175, .22), transparent 60%),
        radial-gradient(800px 600px at 100% 90%, rgba(220, 38, 38, .10), transparent 60%);
    pointer-events: none;
    z-index: 0;
}
body::after {
    content: "";
    position: fixed; inset: 0;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .04 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
    pointer-events: none;
    opacity: .5;
    z-index: 0;
    mix-blend-mode: overlay;
}
main, header, footer, section { position: relative; z-index: 1; }

/* ---- Typography ---- */
h1, h2, h3, h4 {
    font-family: var(--display);
    font-weight: 600;
    letter-spacing: -.02em;
    line-height: 1.1;
    margin: 0;
}
h1 { font-size: clamp(36px, 5vw, 64px); letter-spacing: -.035em; font-weight: 500; }
h2 { font-size: clamp(28px, 3.6vw, 44px); letter-spacing: -.03em; font-weight: 500; }
h3 { font-size: clamp(20px, 2vw, 26px); font-weight: 600; }
h4 { font-size: 18px; font-weight: 600; }
p { margin: 0; }

.gradient-text {
    display: inline-block;
    font-style: italic;
    background-image: linear-gradient(120deg, #fca5a5 0%, #ef4444 40%, #f87171 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ---- Container ---- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ---- Header (sticky + glassmorphism) ---- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(8, 13, 31, .7);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    border-bottom: 1px solid var(--line);
}
.site-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    max-width: 1200px;
    margin: 0 auto;
    height: auto;
}
.site-header__logo img {
    height: 44px;
    width: auto;
    display: block;
    filter: drop-shadow(0 6px 12px rgba(220, 38, 38, .35));
}
.site-header__nav {
    display: flex;
    gap: 6px;
    align-items: center;
}
.site-header__nav a {
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 14px;
    color: var(--text-dim);
    transition: color .2s, background .2s;
}
.site-header__nav a:hover {
    color: var(--text);
    background: rgba(255, 255, 255, .05);
    text-decoration: none;
}

/* ---- Hero ---- */
.hero {
    padding: 80px 0 60px;
    text-align: center;
    position: relative;
}
.hero__badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--red-bright);
    margin-bottom: 20px;
}
.hero__badge::before {
    content: "";
    width: 24px;
    height: 1px;
    background: var(--red);
}
.hero h1 {
    max-width: 18ch;
    margin: 0 auto 22px;
}
.hero p {
    font-size: 18px;
    color: var(--text-dim);
    max-width: 640px;
    margin: 0 auto;
}

/* ---- Section ---- */
.section { padding: 60px 0; }

.section__title {
    font-family: var(--display);
    font-size: clamp(24px, 2.6vw, 32px);
    font-weight: 600;
    margin: 0 0 8px;
    color: var(--text);
}
.section__subtitle {
    color: var(--text-dim);
    margin: 0 0 32px;
    font-size: 15px;
}

/* ---- Card grid bài tập ---- */
.exercises-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 18px;
}

.exercise-card {
    background: linear-gradient(180deg, rgba(255, 255, 255, .04), rgba(255, 255, 255, .01));
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 26px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    transition: border-color .25s, transform .25s, background .25s;
}
.exercise-card:hover {
    border-color: rgba(248, 113, 113, .3);
    transform: translateY(-4px);
    background: linear-gradient(180deg, rgba(220, 38, 38, .08), rgba(255, 255, 255, .02));
}
.exercise-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}
.exercise-card__number {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: .15em;
    color: var(--text-mute);
}
.exercise-card__lock {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, #7a1f1f, #1a0f33);
    border: 1px solid rgba(248, 113, 113, .25);
    color: var(--red-bright);
    display: grid;
    place-items: center;
    font-size: 14px;
}
.exercise-card__title {
    font-family: var(--display);
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 10px;
    color: var(--text);
    line-height: 1.25;
    letter-spacing: -.01em;
}
.exercise-card__summary {
    color: var(--text-dim);
    font-size: 14.5px;
    line-height: 1.55;
    margin: 0 0 18px;
    flex: 1;
}
.exercise-card__footer {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

/* ---- Badges ---- */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .03em;
    font-family: var(--mono);
    text-transform: uppercase;
}
.badge--easy {
    background: rgba(16, 185, 129, .15);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, .3);
}
.badge--medium {
    background: rgba(251, 191, 36, .15);
    color: var(--gold);
    border: 1px solid rgba(251, 191, 36, .3);
}
.badge--hard {
    background: rgba(220, 38, 38, .18);
    color: var(--red-bright);
    border: 1px solid rgba(220, 38, 38, .35);
}
.badge--tag {
    background: rgba(59, 130, 246, .12);
    color: var(--navy-bright);
    border: 1px solid rgba(59, 130, 246, .25);
    text-transform: lowercase;
    font-size: 11px;
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 22px;
    border-radius: 999px;
    border: 0;
    font-family: var(--body);
    font-weight: 600;
    font-size: 14.5px;
    cursor: pointer;
    text-decoration: none;
    background: var(--grad);
    color: #fff;
    box-shadow: var(--shadow-red), inset 0 1px 0 rgba(255, 255, 255, .25);
    transition: transform .25s, box-shadow .25s;
    white-space: nowrap;
}
.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 25px 70px -20px rgba(220, 38, 38, .75), inset 0 1px 0 rgba(255, 255, 255, .3);
    color: #fff;
    text-decoration: none;
}
.btn:disabled {
    opacity: .6;
    cursor: not-allowed;
    transform: none;
}
.btn--lg { padding: 14px 28px; font-size: 16px; }
.btn--secondary,
.btn--ghost {
    background: rgba(255, 255, 255, .04);
    border: 1px solid var(--line-strong);
    color: var(--text);
    box-shadow: none;
    backdrop-filter: blur(10px);
}
.btn--secondary:hover,
.btn--ghost:hover {
    background: rgba(255, 255, 255, .08);
    box-shadow: none;
    color: var(--text);
}

/* ---- Modal nhập PIN (dark) ---- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(8, 13, 31, .78);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
    backdrop-filter: blur(8px);
}
.modal-overlay.is-open {
    display: flex;
    animation: fadeIn .15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
    background: linear-gradient(180deg, var(--bg-2), var(--bg));
    border: 1px solid var(--line-strong);
    border-radius: var(--r-lg);
    max-width: 440px;
    width: 100%;
    padding: 36px 32px;
    box-shadow: 0 30px 70px -20px rgba(0, 0, 0, .6);
    animation: slideUp .25s ease;
    position: relative;
    overflow: hidden;
}
.modal::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(400px 200px at 50% -50px, rgba(220, 38, 38, .15), transparent 70%);
    pointer-events: none;
}
@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.modal > * { position: relative; }

.modal__icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #7a1f1f, #1a0f33);
    border: 1px solid rgba(248, 113, 113, .3);
    color: var(--red-bright);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    margin: 0 auto 18px;
}
.modal__title {
    font-family: var(--display);
    font-size: 22px;
    font-weight: 600;
    margin: 0 0 8px;
    text-align: center;
    color: var(--text);
    letter-spacing: -.01em;
}
.modal__subtitle {
    color: var(--text-dim);
    text-align: center;
    margin: 0 0 26px;
    font-size: 14px;
}

.pin-input {
    display: flex;
    justify-content: center;
    margin: 0 0 14px;
}
.pin-input input {
    width: 100%;
    max-width: 280px;
    height: 64px;
    text-align: center;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 8px;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    outline: none;
    background: rgba(255, 255, 255, .04);
    color: var(--text);
    font-family: var(--mono);
    transition: border-color .15s, box-shadow .15s, background .15s;
    padding: 0 12px;
}
.pin-input input::placeholder {
    color: var(--text-mute);
    letter-spacing: 6px;
}
.pin-input input:focus {
    border-color: var(--red-2);
    background: rgba(220, 38, 38, .08);
    box-shadow: 0 0 0 4px rgba(220, 38, 38, .15);
}
.pin-input input.error {
    border-color: var(--red-2);
    animation: shake .3s ease;
}
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}

.modal__error {
    color: var(--red-bright);
    font-size: 13px;
    text-align: center;
    margin: 8px 0 18px;
    min-height: 18px;
}

.modal__actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}
.modal__actions .btn { flex: 1; }

/* ---- Trang bài tập ---- */
.exercise-header {
    padding: 32px 0 24px;
    border-bottom: 1px solid var(--line);
}
.exercise-header__back {
    color: var(--text-dim);
    font-size: 13px;
    margin-bottom: 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--mono);
    letter-spacing: .05em;
}
.exercise-header__back:hover { color: var(--red-bright); text-decoration: none; }
.exercise-header h1 {
    font-size: clamp(28px, 3.2vw, 40px);
    margin: 0 0 10px;
    font-weight: 500;
    letter-spacing: -.025em;
}
.exercise-header__meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
}

/* ---- Tabs ---- */
.tabs {
    background: rgba(8, 13, 31, .7);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 72px;
    z-index: 40;
}
.tabs__nav {
    display: flex;
    gap: 4px;
    padding: 0;
}
.tabs__btn {
    padding: 14px 20px;
    background: transparent;
    font-family: var(--body);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dim);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color .2s, border-color .2s;
    display: flex;
    align-items: center;
    gap: 8px;
}
.tabs__btn:hover { color: var(--text); }
.tabs__btn.is-active {
    color: var(--red-bright);
    border-bottom-color: var(--red-2);
}

.tabs__btn--admin {
    margin-left: auto;
    color: var(--text-mute);
    font-size: 13px;
}
.tabs__btn--admin.is-active {
    color: var(--gold);
    border-bottom-color: var(--gold);
}
.tabs__lock {
    font-size: 11px;
    opacity: 0.7;
}
.tabs__badge {
    font-family: var(--mono);
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(251, 191, 36, .15);
    color: var(--gold);
    border: 1px solid rgba(251, 191, 36, .35);
    letter-spacing: .05em;
    text-transform: uppercase;
}

/* ---- Admin lock screen (tab Lỗi chưa unlock) ---- */
.admin-lock {
    text-align: center;
    padding: 48px 32px;
    max-width: 560px;
    margin: 0 auto;
}
.admin-lock__icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, #7a1f1f, #1a0f33);
    border: 1px solid rgba(248, 113, 113, .3);
    border-radius: 20px;
    display: grid;
    place-items: center;
    font-size: 36px;
}
.admin-lock h2 {
    font-family: var(--display);
    font-size: 24px;
    margin: 0 0 12px;
    color: var(--text);
}
.admin-lock > p {
    color: var(--text-dim);
    margin: 0 0 28px;
    font-size: 14.5px;
    line-height: 1.6;
}
.admin-lock__input {
    display: flex;
    gap: 10px;
    max-width: 380px;
    margin: 0 auto;
}
.admin-lock__input input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: rgba(255, 255, 255, .04);
    color: var(--text);
    font-size: 15px;
    font-family: var(--mono);
    letter-spacing: 4px;
    text-align: center;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.admin-lock__input input::placeholder {
    color: var(--text-mute);
    letter-spacing: 1px;
}
.admin-lock__input input:focus {
    border-color: var(--red-2);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, .15);
}
.admin-lock__error {
    color: var(--red-bright);
    font-size: 13px;
    margin-top: 14px;
    min-height: 18px;
}

.tabs__panel {
    display: none;
    padding: 32px 0;
}
.tabs__panel.is-active { display: block; }

/* ---- Description content (đề bài) — dark surface card ---- */
.description-content {
    background: linear-gradient(180deg, rgba(255, 255, 255, .03), rgba(255, 255, 255, .01));
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 36px;
    width: 100%;
    color: var(--text);
}
.description-content h2 {
    font-family: var(--display);
    font-size: 26px;
    margin: 0 0 16px;
    font-weight: 600;
    letter-spacing: -.02em;
}
.description-content h3 {
    font-family: var(--display);
    font-size: 19px;
    margin: 28px 0 12px;
    font-weight: 600;
    color: var(--text);
}
.description-content p {
    margin: 0 0 14px;
    color: var(--text-dim);
    font-size: 15px;
    line-height: 1.65;
}
.description-content strong { color: var(--text); }
.description-content ul,
.description-content ol {
    margin: 0 0 16px;
    padding-left: 22px;
    color: var(--text-dim);
}
.description-content li { margin-bottom: 6px; }
.description-content li::marker { color: var(--red-bright); }

.description-content code {
    background: rgba(220, 38, 38, .12);
    color: var(--red-bright);
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 13px;
    font-family: var(--mono);
    border: 1px solid rgba(220, 38, 38, .2);
}

.description-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    background: rgba(255, 255, 255, .02);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--line);
}
.description-content th,
.description-content td {
    border-bottom: 1px solid var(--line);
    border-right: 1px solid var(--line);
    padding: 12px 14px;
    text-align: left;
    font-size: 14px;
    color: var(--text-dim);
    vertical-align: top;
}
.description-content th:last-child,
.description-content td:last-child { border-right: 0; }
.description-content tr:last-child td { border-bottom: 0; }
.description-content th {
    background: rgba(220, 38, 38, .08);
    color: var(--red-bright);
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: .05em;
    text-transform: uppercase;
    font-weight: 600;
}

.note-box {
    border-left: 3px solid var(--red-2);
    background: rgba(220, 38, 38, .06);
    border-radius: 0 var(--r-sm) var(--r-sm) 0;
    padding: 14px 18px;
    margin: 18px 0;
    color: var(--text-dim);
    font-size: 14.5px;
}
.note-box strong { color: var(--red-bright); }
.note-box--warning {
    border-left-color: var(--gold);
    background: rgba(251, 191, 36, .07);
}
.note-box--warning strong { color: var(--gold); }

/* ---- Form playground (tab "thực hành") — dark surface ---- */
.playground {
    background: linear-gradient(180deg, rgba(255, 255, 255, .03), rgba(255, 255, 255, .01));
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 36px;
    width: 100%;
    color: var(--text);
}
.playground h2 {
    font-family: var(--display);
    font-size: 24px;
    color: var(--text);
    font-weight: 600;
    letter-spacing: -.02em;
    margin: 0 0 12px;
}
.playground > p { color: var(--text-dim); }

/* Form fields cho form mặc định (chỉ dùng khi bài không có style riêng) */
.form-field { margin-bottom: 18px; }
.form-field label {
    display: block;
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 8px;
    color: var(--text);
    font-family: var(--mono);
    letter-spacing: .03em;
}
.form-field label .required { color: var(--red-bright); }
.form-field input[type="text"],
.form-field input[type="email"],
.form-field input[type="password"],
.form-field input[type="number"],
.form-field input[type="tel"],
.form-field input[type="date"],
.form-field input[type="url"],
.form-field select,
.form-field textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--line-strong);
    background: rgba(255, 255, 255, .04);
    color: var(--text);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color .15s, background .15s;
}
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
    border-color: var(--red-2);
    background: rgba(220, 38, 38, .04);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, .12);
}
.form-field .hint { font-size: 12px; color: var(--text-mute); margin-top: 6px; }
.form-field .error-msg { color: var(--red-bright); font-size: 13px; margin-top: 4px; }

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--line);
}

/* ---- Footer ---- */
.site-footer {
    border-top: 1px solid var(--line);
    padding: 32px 0;
    margin-top: 80px;
    color: var(--text-mute);
    font-size: 13px;
    text-align: center;
    font-family: var(--mono);
    letter-spacing: .03em;
}

/* ---- Empty state ---- */
.empty-state {
    text-align: center;
    padding: 64px 24px;
    color: var(--text-dim);
}
.empty-state__icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: .6;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .site-header__inner { padding: 12px 16px; }
    .site-header__logo img { height: 36px; }
    .site-header__nav a { padding: 6px 10px; font-size: 13px; }
    .hero { padding: 50px 0 40px; }
    .exercises-grid { grid-template-columns: 1fr; gap: 14px; }
    .modal { padding: 24px; }
    .pin-input input { width: 44px; height: 56px; font-size: 22px; }
    .description-content,
    .playground { padding: 22px; }
    .tabs { top: 64px; }
    .tabs__btn { padding: 12px 14px; font-size: 13px; }
}
