/* ============================================================
   HTML Form Elements – IDE Exercises  |  Premium Dark Theme
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ---------- design tokens ---------- */
:root {
    --bg-dark: #0a0e17;
    --bg-card: rgba(255, 255, 255, .04);
    --bg-glass: rgba(255, 255, 255, .06);
    --border-glass: rgba(255, 255, 255, .10);
    --accent: #6c63ff;
    --accent-glow: rgba(108, 99, 255, .35);
    --accent2: #00d4aa;
    --accent3: #ff6b9d;
    --accent4: #f59e0b;
    --text-primary: #e8eaf0;
    --text-secondary: #8b8fa3;
    --text-muted: #555a6e;
    --success: #22c55e;
    --success-bg: rgba(34, 197, 94, .12);
    --error: #ef4444;
    --error-bg: rgba(239, 68, 68, .12);
    --warning: #f59e0b;
    --radius: 16px;
    --radius-sm: 10px;
    --transition: .3s cubic-bezier(.4, 0, .2, 1);
}

/* ---------- reset ---------- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0
}

html {
    scroll-behavior: smooth
}

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.7;
    min-height: 100vh;
    overflow-x: hidden;
}

/* animated background */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(ellipse 600px 600px at 20% 20%, rgba(108, 99, 255, .12) 0%, transparent 60%),
        radial-gradient(ellipse 500px 500px at 80% 70%, rgba(0, 212, 170, .08) 0%, transparent 60%),
        radial-gradient(ellipse 400px 400px at 50% 90%, rgba(255, 107, 157, .06) 0%, transparent 60%);
    animation: bgShift 20s ease-in-out infinite alternate;
}

@keyframes bgShift {
    0% {
        filter: hue-rotate(0deg)
    }

    100% {
        filter: hue-rotate(25deg)
    }
}

/* ---------- layout ---------- */
.app-container {
    max-width: 960px;
    margin: 0 auto;
    padding: 24px 20px 80px
}

/* ---------- header ---------- */
.site-header {
    text-align: center;
    padding: 48px 0 32px;
}

.site-header h1 {
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    font-weight: 900;
    letter-spacing: -.03em;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.site-header .subtitle {
    font-size: .95rem;
    color: var(--text-secondary);
    margin-top: 8px;
    font-weight: 400;
}

/* ---------- navigation tabs ---------- */
.nav-tabs {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
    margin: 0 auto 40px;
    padding: 6px;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: 60px;
    max-width: 640px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.nav-tab {
    padding: 10px 24px;
    border-radius: 50px;
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    transition: var(--transition);
}

.nav-tab:hover {
    color: var(--text-primary)
}

.nav-tab.active {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 20px var(--accent-glow);
}

/* ---------- sections ---------- */
.section {
    display: none;
    animation: fadeUp .5s ease
}

.section.active {
    display: block
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(18px)
    }

    to {
        opacity: 1;
        transform: translateY(0)
    }
}

/* ---------- glass card ---------- */
.card {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius);
    padding: 28px 28px 24px;
    margin-bottom: 24px;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    transition: var(--transition);
}

.card:hover {
    border-color: rgba(255, 255, 255, .16);
    transform: translateY(-2px)
}

.card h2 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card h2 .icon {
    font-size: 1.3rem
}

.card h3 {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--accent2);
    margin: 18px 0 8px;
}

.card p,
.card li {
    font-size: .9rem;
    color: var(--text-secondary);
    line-height: 1.75
}

.card ul,
.card ol {
    padding-left: 20px;
    margin: 6px 0 10px
}

.card li {
    margin-bottom: 4px
}

/* inline code */
.card code,
code.inline {
    font-family: 'JetBrains Mono', monospace;
    font-size: .82rem;
    background: rgba(108, 99, 255, .15);
    color: #a5b4fc;
    padding: 2px 7px;
    border-radius: 5px;
    border: 1px solid rgba(108, 99, 255, .2);
}

/* code block */
pre.code-block {
    background: rgba(0, 0, 0, .35);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    padding: 16px 20px;
    margin: 10px 0 16px;
    overflow-x: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: .82rem;
    line-height: 1.8;
    color: #c4c9e0;
}

/* tag / badge */
.tag {
    display: inline-block;
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    padding: 3px 10px;
    border-radius: 20px;
    background: rgba(108, 99, 255, .14);
    color: var(--accent);
    margin-right: 6px;
}

.tag.css {
    background: rgba(0, 212, 170, .14);
    color: var(--accent2)
}

.tag.html5 {
    background: rgba(255, 107, 157, .14);
    color: var(--accent3)
}

/* ---------- revision topic card ---------- */
.topic-card {
    cursor: default
}

/* ---------- quiz/test shared ---------- */
.quiz-intro {
    text-align: center;
    padding: 12px 0 24px;
}

.quiz-intro h2 {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 4px;
    justify-content: center;
}

.quiz-intro p {
    color: var(--text-secondary);
    font-size: .88rem
}

/* progress bar */
.progress-bar-wrap {
    height: 6px;
    background: rgba(255, 255, 255, .06);
    border-radius: 20px;
    margin-bottom: 28px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 0%;
    border-radius: 20px;
    background: linear-gradient(90deg, var(--accent), var(--accent2));
    transition: width .5s ease;
}

/* ──────────────────────────────────────
   PRACTICAL EXERCISES
   ────────────────────────────────────── */
.exercise-card {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius);
    padding: 26px 26px 22px;
    margin-bottom: 28px;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    transition: var(--transition);
}

.exercise-card:hover {
    border-color: rgba(255, 255, 255, .16)
}

.exercise-card .ex-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.exercise-card .ex-number {
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--accent2);
}

.exercise-card .ex-difficulty {
    font-size: .65rem;
    padding: 3px 10px;
    border-radius: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.exercise-card .ex-difficulty.beginner {
    background: rgba(34, 197, 94, .15);
    color: var(--success);
}

.exercise-card .ex-difficulty.intermediate {
    background: rgba(245, 158, 11, .15);
    color: var(--accent4);
}

.exercise-card .ex-difficulty.advanced {
    background: rgba(239, 68, 68, .15);
    color: var(--error);
}

.exercise-card .ex-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.exercise-card .ex-description {
    font-size: .88rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 16px;
}

.exercise-card .ex-description code {
    font-family: 'JetBrains Mono', monospace;
    font-size: .8rem;
    background: rgba(108, 99, 255, .15);
    color: #a5b4fc;
    padding: 1px 5px;
    border-radius: 4px;
}

.exercise-card .ex-requirements {
    font-size: .84rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    background: rgba(0, 212, 170, .05);
    border: 1px solid rgba(0, 212, 170, .12);
}

.exercise-card .ex-requirements strong {
    color: var(--accent2)
}

.exercise-card .ex-requirements ul {
    padding-left: 18px;
    margin: 6px 0 0
}

.exercise-card .ex-requirements li {
    margin-bottom: 3px;
    line-height: 1.6;
}

.exercise-card .ex-requirements li code {
    font-family: 'JetBrains Mono', monospace;
    font-size: .78rem;
    background: rgba(108, 99, 255, .15);
    color: #a5b4fc;
    padding: 1px 5px;
    border-radius: 4px;
}

/* code editor */
.code-editor-wrap {
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border-glass);
    margin-bottom: 14px;
}

.code-editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 14px;
    background: rgba(0, 0, 0, .4);
    border-bottom: 1px solid var(--border-glass);
}

.code-editor-header .file-label {
    font-size: .72rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .06em;
}

.code-editor-header .lang-badge {
    font-size: .65rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 700;
    text-transform: uppercase;
    background: rgba(108, 99, 255, .2);
    color: var(--accent);
}

.code-editor {
    width: 100%;
    min-height: 220px;
    padding: 16px 18px;
    background: rgba(0, 0, 0, .3);
    color: #a8ffa8;
    border: none;
    font-family: 'JetBrains Mono', monospace;
    font-size: .84rem;
    line-height: 1.7;
    resize: vertical;
    tab-size: 4;
    outline: none;
}

.code-editor::placeholder {
    color: rgba(168, 255, 168, .3)
}

/* action buttons */
.ex-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.run-btn {
    background: linear-gradient(135deg, #00d4aa, #00b894);
    color: #fff;
    font-weight: 700;
    padding: 10px 24px;
    border-radius: 50px;
    border: none;
    cursor: pointer;
    font-size: .82rem;
    transition: var(--transition);
}

.run-btn:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 6px 20px rgba(0, 212, 170, .35);
}

.solution-btn {
    background: rgba(108, 99, 255, .12);
    color: var(--accent);
    border: 1px solid rgba(108, 99, 255, .25);
    padding: 10px 24px;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 600;
    font-size: .82rem;
    transition: var(--transition);
}

.solution-btn:hover {
    background: rgba(108, 99, 255, .22)
}

.reset-btn {
    background: rgba(255, 255, 255, .06);
    color: var(--text-secondary);
    border: 1px solid var(--border-glass);
    padding: 10px 24px;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 600;
    font-size: .82rem;
    transition: var(--transition);
}

.reset-btn:hover {
    background: rgba(255, 255, 255, .1);
    color: var(--text-primary);
}

/* preview */
.preview-wrap {
    display: none;
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-bottom: 14px;
}

.preview-wrap.visible {
    display: block;
    animation: fadeUp .4s ease
}

.preview-header {
    display: flex;
    align-items: center;
    padding: 8px 14px;
    background: rgba(0, 0, 0, .35);
    border-bottom: 1px solid var(--border-glass);
    font-size: .72rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .06em;
}

.preview-header .dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    margin-right: 8px;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1
    }

    50% {
        opacity: .4
    }
}

.preview-iframe {
    width: 100%;
    min-height: 120px;
    border: none;
    background: #fff;
}

/* solution block */
.solution-block {
    display: none;
    border: 1px solid rgba(0, 212, 170, .2);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-bottom: 8px;
}

.solution-block.visible {
    display: block;
    animation: fadeUp .4s ease
}

.solution-header {
    padding: 10px 16px;
    background: rgba(0, 212, 170, .08);
    font-weight: 700;
    font-size: .82rem;
    color: var(--accent2);
    border-bottom: 1px solid rgba(0, 212, 170, .12);
}

.solution-block pre {
    padding: 16px 18px;
    background: rgba(0, 0, 0, .3);
    color: #c4c9e0;
    font-family: 'JetBrains Mono', monospace;
    font-size: .82rem;
    line-height: 1.7;
    white-space: pre-wrap;
    overflow-x: auto;
    margin: 0;
}

/* ---------- responsive ---------- */
@media (max-width: 640px) {
    .app-container {
        padding: 16px 12px 60px
    }

    .card {
        padding: 18px 16px 16px
    }

    .exercise-card {
        padding: 18px 16px 16px
    }

    .code-editor {
        min-height: 180px;
        font-size: .78rem
    }

    .ex-actions {
        flex-direction: column
    }

    .run-btn,
    .solution-btn,
    .reset-btn {
        width: 100%;
        text-align: center
    }
}