/* ═══════════════════════════════════════
   Base Styles & CSS Variables (Dark Theme)
   ═══════════════════════════════════════ */
:root {
    --primary-color: #4F46E5;
    --primary-hover: #4338CA;
    --secondary-color: #10B981;
    --error-color: #EF4444;
    --font-family: 'Inter', sans-serif;

    /* Layout */
    --bg-color: #0F172A;
    --surface-color: #1E293B;
    --surface-color-2: #243349;
    --text-main: #F1F5F9;
    --text-muted: #94A3B8;
    --border-color: rgba(255, 255, 255, .08);
    --border-light: rgba(255, 255, 255, .05);

    /* Nav */
    --nav-bg: rgba(10, 10, 20, .95);

    /* Article */
    --article-th-bg: rgba(79, 70, 229, .2);
    --article-th-color: #A5B4FC;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

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

/* Background Glow Effect */
body::before {
    content: '';
    position: fixed;
    top: -20%;
    left: -10%;
    width: 60%;
    height: 60%;
    background: radial-gradient(circle, rgba(79, 70, 229, 0.15) 0%, rgba(15, 23, 42, 0) 70%);
    z-index: -1;
    pointer-events: none;
}

/* Container — tool section centered */
.container {
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    text-align: center;
    padding: 40px 20px 20px;
    animation: fadeIn 0.5s ease-out forwards;
}

/* Header */
.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    background: linear-gradient(to right, #60A5FA, #A78BFA);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header p {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: 30px;
}

/* Textarea Section */
.essay-input-area {
    background: var(--surface-color);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-light);
}

textarea {
    width: 100%;
    min-height: 300px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--text-main);
    font-family: var(--font-family);
    padding: 15px;
    font-size: 1rem;
    resize: vertical;
    transition: border-color 0.3s ease;
}

textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.2);
}

.word-count {
    text-align: right;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 5px;
    margin-bottom: 20px;
}

/* Buttons */
.primary-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.2s ease;
    width: 100%;
}

.primary-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

.secondary-btn {
    display: inline-block;
    background: var(--secondary-color);
    color: white;
    text-decoration: none;
    padding: 12px 25px;
    border-radius: 8px;
    font-weight: 600;
    margin-bottom: 10px;
    transition: background 0.3s ease;
}

.secondary-btn:hover {
    background: #059669;
}

.outline-btn {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--text-muted);
    padding: 12px 25px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.outline-btn:hover {
    color: white;
    border-color: white;
}

.pulse-animation {
    animation: pulse 2s infinite;
}

/* Error Messages */
.error-msg {
    color: var(--error-color);
    font-size: 0.9rem;
    margin-top: 10px;
    display: none;
}

/* Loading Section */
.loader-content {
    background: var(--surface-color);
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
}

.progress-container {
    width: 100%;
    height: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    margin: 20px 0 10px 0;
    overflow: hidden;
}

.progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #60A5FA, #4F46E5);
    border-radius: 6px;
    transition: width 0.1s linear;
}

#progress-text {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 30px;
}

/* Skeletons */
.skeleton-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    text-align: left;
}

.skeleton {
    background: linear-gradient(90deg, var(--border-light) 25%, rgba(255, 255, 255, 0.1) 50%, var(--border-light) 75%);
    background-size: 200% 100%;
    animation: skeletonLoading 1.5s infinite;
    border-radius: 4px;
}

.skeleton.title {
    height: 24px;
    width: 60%;
    margin-bottom: 10px;
}

.skeleton.line {
    height: 16px;
    width: 100%;
}

.skeleton.line.short {
    width: 80%;
}

/* Modal & Glassmorphism */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal.show {
    opacity: 1;
    visibility: visible;
}

.glassmorphism {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 40px;
    border-radius: 16px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    transform: translateY(20px);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal.show .glassmorphism {
    transform: translateY(0);
}

.glassmorphism h2 {
    color: #FCD34D;
    margin-bottom: 15px;
}

.glassmorphism p {
    margin-bottom: 20px;
    color: var(--text-main);
}

.glassmorphism .highlight {
    font-size: 1.1rem;
    font-weight: 600;
    background: rgba(79, 70, 229, 0.2);
    padding: 10px;
    border-radius: 6px;
    border-left: 4px solid var(--primary-color);
}

@media (max-width: 600px) {
    .modal {
        align-items: flex-end;
        padding: 16px 0;
    }
    .glassmorphism {
        padding: 22px 18px;
        max-width: 100%;
        width: 100%;
        margin: 0 10px;
    }
    .glassmorphism h2 {
        font-size: 1.3rem;
    }
    .result-card h2 {
        font-size: 1.6rem;
    }
    .score-circle {
        width: 120px;
        height: 120px;
    }
}

/* Forms */
.input-group {
    margin-bottom: 20px;
    text-align: left;
}

.input-group label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.input-group input {
    width: 100%;
    padding: 12px 15px;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    font-size: 1rem;
    transition: border 0.3s;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Results */
.result-card {
    text-align: center;
}

.result-card h2 {
    color: var(--secondary-color);
    font-size: 2rem;
    margin-bottom: 20px;
}

.score-circle {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    border: 4px solid var(--primary-color);
    background: rgba(79, 70, 229, 0.1);
    margin-bottom: 20px;
    box-shadow: 0 0 20px rgba(79, 70, 229, 0.3);
}

.score-label {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

#final-band-score {
    font-size: 3rem;
    font-weight: 700;
    color: white;
}

/* Utilities */
.hidden {
    display: none !important;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(79, 70, 229, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(79, 70, 229, 0);
    }
}

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

    100% {
        background-position: -200% 0;
    }
}

/* Responsive */
@media (max-width: 600px) {
    .header h1 {
        font-size: 2rem;
    }

    .glassmorphism {
        padding: 30px 20px;
    }
}

/* Real-time validation feedback */
.field-feedback {
    display: block;
    font-size: 0.82rem;
    margin-top: 4px;
    min-height: 16px;
    transition: color 0.2s ease;
}

/* Leaderboard Widget */
.leaderboard-widget {
    margin-top: 24px;
    padding: 24px 28px;
    text-align: left;
    max-width: 800px;
    width: 100%;
}

.leaderboard-widget h3 {
    font-size: 1rem;
    font-weight: 700;
    color: #FCD34D;
    margin-bottom: 16px;
    letter-spacing: 0.5px;
}

.lb-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.lb-item {
    display: grid;
    grid-template-columns: 28px 1fr 44px 100px;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.lb-medal {
    font-size: 18px;
    text-align: center;
}

.lb-name {
    font-size: 0.88rem;
    color: var(--text-main);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lb-score {
    font-size: 0.95rem;
    font-weight: 700;
    color: #60A5FA;
    text-align: right;
}

.lb-bar-wrap {
    height: 6px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.lb-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #4F46E5, #7C3AED);
    border-radius: 4px;
    transition: width 0.6s ease;
}

.lb-empty {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
    padding: 12px 0;
}

/* ========================================= */
/* GLOBAL UI (Extracted from index.php) */
/* ========================================= */
/* ── NAV ─────────────────────────────────── */
.site-nav {
    position: sticky;
    top: 0;
    z-index: 200;
    background: var(--nav-bg);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    height: 56px;
}

.nav-brand {
    font-weight: 800;
    font-size: 1rem;
    color: #fff;
    text-decoration: none;
    letter-spacing: -.5px;
    flex-shrink: 0;
}

.nav-brand span {
    color: #818cf8;
}

.nav-links {
    display: flex;
    gap: 18px;
    align-items: center;
}

.nav-links a {
    color: var(--text-muted);
    font-size: .83rem;
    text-decoration: none;
    transition: color .2s;
    white-space: nowrap;
}

.nav-links a:hover {
    color: #e2e8f0;
}

.nav-cta {
    background: #4f46e5 !important;
    color: #fff !important;
    padding: 7px 14px;
    border-radius: 6px;
    font-weight: 600 !important;
}

.nav-cta:hover {
    background: #4338ca !important;
}

/* Hamburger */
.nav-hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    padding: 4px;
    background: none;
    border: none;
}

.nav-hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text-muted);
    border-radius: 2px;
    transition: all .3s;
}

.nav-hamburger.open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.nav-hamburger.open span:nth-child(2) {
    opacity: 0;
}

.nav-hamburger.open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Mobile menu drawer */
.nav-drawer {
    display: none;
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    background: var(--nav-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 16px 20px;
    flex-direction: column;
    gap: 2px;
    z-index: 199;
}

.nav-drawer.open {
    display: flex;
}

.nav-drawer a {
    color: var(--text-muted);
    font-size: .95rem;
    text-decoration: none;
    padding: 11px 0;
    border-bottom: 1px solid var(--border-light);
}

.nav-drawer a:hover {
    color: #fff;
}

.nav-drawer .nav-cta {
    background: #4f46e5;
    color: #fff !important;
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    border: none;
    margin-top: 6px;
}

@media(max-width:680px) {
    .nav-links {
        display: none;
    }

    .nav-hamburger {
        display: flex;
    }
}

/* ── HERO ────────────────────────────────── */
.hero-badge {
    display: inline-block;
    background: rgba(99, 102, 241, .15);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, .3);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .6px;
    text-transform: uppercase;
    margin-bottom: 12px;
}

/* ── SECTION WRAPPER ─────────────────────── */
.page-section {
    max-width: 1100px;
    margin: 0 auto;
    padding: 52px 20px 0;
}

.section-heading {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 5px;
}

.section-sub {
    font-size: .85rem;
    color: var(--text-muted);
    margin-bottom: 24px;
}

/* ── CATEGORY PILLS ──────────────────────── */
.cat-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 28px;
}

.cat-pill {
    padding: 6px 16px;
    border-radius: 20px;
    font-size: .8rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    border: 1px solid rgba(255, 255, 255, .1);
    color: var(--text-muted);
    transition: all .2s;
}

.cat-pill:hover,
.cat-pill.active {
    background: #4f46e5;
    color: #fff;
    border-color: #4f46e5;
}

/* ── ARTICLE CARDS ───────────────────────── */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.article-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 7px;
    text-decoration: none;
    transition: transform .2s, border-color .2s;
}

.article-card:hover {
    transform: translateY(-3px);
    border-color: rgba(99, 102, 241, .4);
    text-decoration: none;
}

.card-niche {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .7px;
    color: #818cf8;
}

.card-title {
    font-size: .92rem;
    font-weight: 600;
    color: #e2e8f0;
    line-height: 1.4;
}

.card-desc {
    font-size: .8rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.card-meta {
    font-size: .72rem;
    color: var(--text-muted);
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px solid var(--border-light);
}

/* ── CATEGORY CARDS ──────────────────────── */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}

.category-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 18px 20px;
    display: flex;
    gap: 14px;
    align-items: flex-start;
    text-decoration: none;
    transition: transform .2s, border-color .2s;
}

.category-card:hover {
    transform: translateY(-3px);
    border-color: rgba(99, 102, 241, .35);
    text-decoration: none;
}

.cat-icon {
    font-size: 1.7rem;
    line-height: 1;
    flex-shrink: 0;
}

.cat-name {
    font-size: .95rem;
    font-weight: 700;
    color: #e2e8f0;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.cat-count {
    font-size: .7rem;
    background: rgba(99, 102, 241, .2);
    color: #a5b4fc;
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 600;
}

.cat-desc {
    font-size: .78rem;
    color: var(--text-muted);
    margin-top: 4px;
    line-height: 1.4;
}

.no-articles {
    padding: 32px;
    text-align: center;
    color: var(--text-muted);
    font-size: .9rem;
    background: var(--surface-color);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

/* ── DIVIDER ─────────────────────────────── */
.section-divider {
    max-width: 1100px;
    margin: 48px auto 0;
    padding: 0 20px;
}

.section-divider hr {
    border: none;
    border-top: 1px solid var(--border-color);
}

/* ── FOOTER ──────────────────────────────── */
.site-footer {
    max-width: 1100px;
    margin: 48px auto 0;
    padding: 32px 20px 20px;
    border-top: 1px solid var(--border-color);
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 28px;
}

.footer-brand-name {
    font-weight: 800;
    font-size: .95rem;
    color: var(--text-main);
}

.footer-brand-name span {
    color: #818cf8;
}

.footer-brand p {
    font-size: .78rem;
    color: var(--text-muted);
    margin-top: 6px;
    line-height: 1.6;
}

.site-footer h4 {
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.site-footer ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.site-footer ul a {
    font-size: .8rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: color .2s;
}

.site-footer ul a:hover {
    color: #e2e8f0;
}

.footer-bottom {
    max-width: 1100px;
    margin: 0 auto;
    padding: 14px 20px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: .74rem;
    color: #334155;
    flex-wrap: wrap;
    gap: 8px;
}

.footer-bottom a {
    color: #334155;
    text-decoration: none;
}

.footer-bottom a:hover {
    color: var(--text-muted);
}

@media(max-width:700px) {
    .site-footer {
        grid-template-columns: 1fr 1fr;
    }

    .footer-brand {
        grid-column: 1/-1;
    }

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

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

@media(max-width:420px) {
    .site-footer {
        grid-template-columns: 1fr;
    }
}

/* ========================================= */
/* ARTICLE UI (Extracted from article.php) */
/* ========================================= */
/* BREADCRUMB */
.breadcrumb {
    max-width: 900px;
    margin: 0 auto;
    padding: 16px 24px 0;
    font-size: 0.82rem;
    color: var(--muted);
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.breadcrumb a {
    color: var(--muted);
}

.breadcrumb a:hover {
    color: var(--text);
}

.breadcrumb-sep {
    opacity: 0.4;
}

/* HERO */
.article-hero {
    max-width: 900px;
    margin: 0 auto;
    padding: 32px 24px 24px;
}

.niche-badge {
    display: inline-block;
    background: rgba(79, 70, 229, 0.15);
    color: #A5B4FC;
    border: 1px solid rgba(79, 70, 229, 0.3);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 14px;
}

.article-title {
    font-size: clamp(1.6rem, 4vw, 2.4rem);
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.5px;
    margin-bottom: 16px;
    background: linear-gradient(to right, var(--text-main), var(--text-muted));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.article-meta {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    font-size: 0.83rem;
    color: var(--muted);
    align-items: center;
}

.article-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* LAYOUT */
.article-layout {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 24px 60px;
    display: grid;
    grid-template-columns: 1fr 260px;
    gap: 40px;
    align-items: start;
}

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

    .sidebar {
        display: none;
    }
}

/* CONTENT */
.article-content {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 36px 40px;
}

@media (max-width: 600px) {
    .article-layout {
        padding: 0 16px 40px;
    }

    .article-content {
        padding: 24px 16px;
    }
}

.article-content h1 {
    display: none;
}

.article-content h2 {
    font-size: 1.4rem;
    font-weight: 700;
    border-bottom: 1px solid var(--border);
    margin: 36px 0 14px;
    padding-bottom: 8px;
}

.article-content h3 {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--article-p);
    margin: 24px 0 10px;
}

.article-content p {
    margin-bottom: 16px;
    color: var(--article-p);
}

.article-content ul,
.article-content ol {
    margin: 10px 0 18px 20px;
    color: var(--article-p);
}

.article-content li {
    margin-bottom: 8px;
}

.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 0.9rem;
}

.article-content th {
    background: rgba(79, 70, 229, 0.2);
    color: #A5B4FC;
    padding: 10px 14px;
    text-align: left;
}

.article-content td {
    padding: 9px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--article-p);
}

.article-content details {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 10px;
    overflow: hidden;
}

.article-content summary {
    padding: 14px 16px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.article-content summary::after {
    content: '+';
    font-size: 1.2rem;
    color: var(--primary);
}

.article-content details[open] summary::after {
    content: '−';
}

.article-content details>*:not(summary) {
    padding: 0 16px 16px;
    color: var(--article-p);
}

.article-content .model-answer {
    background: rgba(16, 185, 129, 0.07);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-left: 4px solid var(--accent);
    border-radius: 8px;
    padding: 20px 24px;
    margin: 20px 0;
}

.article-content .cue-card {
    background: rgba(79, 70, 229, 0.1);
    border: 1px solid rgba(79, 70, 229, 0.25);
    border-left: 4px solid var(--primary);
    border-radius: 8px;
    padding: 20px 24px;
    margin: 20px 0;
}

.article-content .grammar-box {
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: 8px;
    padding: 16px 20px;
    margin: 16px 0;
    font-family: monospace;
    font-size: 0.95rem;
}

.article-content .quick-ref {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px 24px;
    margin: 20px 0;
}

strong {
    color: var(--text);
}

code {
    background: rgba(255, 255, 255, 0.07);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.88em;
}

/* SIDEBAR */
.sidebar {
    position: sticky;
    top: 80px;
}

.sidebar-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.sidebar-card h4 {
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--muted);
    margin-bottom: 14px;
}

.sidebar-cta {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.2), rgba(124, 58, 237, 0.2));
    border: 1px solid rgba(79, 70, 229, 0.3);
}

.sidebar-cta h4 {
    color: #A5B4FC;
}

.sidebar-cta p {
    font-size: 0.88rem;
    color: var(--muted);
    margin-bottom: 14px;
}

.sidebar-cta a {
    display: block;
    background: var(--primary);
    color: #fff;
    padding: 10px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.88rem;
    text-align: center;
}

.sidebar-cta a:hover {
    text-decoration: none;
    background: var(--primary-h);
}

.related-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.related-list li a {
    display: block;
    font-size: 0.85rem;
    color: var(--muted);
    line-height: 1.4;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
}

.related-list li:last-child a {
    border-bottom: none;
}

.related-list li a:hover {
    color: var(--text);
    text-decoration: none;
}

/* FOOTER */
.footer {
    border-top: 1px solid var(--border);
    text-align: center;
    padding: 32px 24px;
    font-size: 0.82rem;
    color: var(--muted);
}

.footer a {
    color: var(--muted);
    margin: 0 10px;
}

.footer a:hover {
    color: var(--text);
}

/* ========================================= */
/* MOBILE OVERFLOW & RESPONSIVE FIXES */
/* ========================================= */
img,
video,
iframe {
    max-width: 100%;
    height: auto;
}

body {
    overflow-x: hidden;
    width: 100%;
}

.article-content {
    max-width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
    /* Prevents long URLs/words from breaking layout */
}

/* Make tables scrollable horizontally on small screens to prevent breaking the flexbox layout */
.article-content table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    white-space: nowrap;
    /* Required for horizontal scroll inside block table */
    -webkit-overflow-scrolling: touch;
}

.article-content td,
.article-content th {
    white-space: normal;
    /* Keep cell content wrapping if possible */
    min-width: 120px;
    /* Ensure columns don't compress too much */
}

.article-content pre,
.article-content code,
.grammar-box {
    max-width: 100%;
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

@media (max-width: 600px) {
    .article-layout {
        padding: 0 16px 40px;
        /* Slight padding reduction on mobile */
    }

    .article-content {
        padding: 20px 16px;
    }
}


/* ============================================================
   PHASE 2: UI/UX Component Styles
   ============================================================ */

/* Theme Toggle Button */
.theme-toggle-btn {
    background: transparent;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
    margin-left: 10px;
}

.theme-toggle-btn:hover {
    background: var(--border-color);
}

.theme-icon.hidden {
    display: none;
}

/* Reading Progress Bar */
#scroll-progress {
    position: fixed;
    top: 60px;
    /* Below navbar */
    left: 0;
    height: 4px;
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    width: 0%;
    z-index: 99;
    transition: width 0.1s ease-out;
}

/* Social Share (Float Left on Desktop, Bottom on Mobile) */
.social-share {
    position: absolute;
    left: 20px;
    top: 200px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 50;
}

.social-share span {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 1px;
    text-align: center;
    margin-bottom: 4px;
}

.social-share a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--surface-color);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    transition: all 0.3s;
}

.social-share a:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.2);
}

/* Mobile CTA Box */
.mobile-cta-box {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--nav-bg);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border-color);
    padding: 12px 20px;
    z-index: 100;
    text-align: center;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
}

.mobile-cta-box a {
    display: block;
    background: var(--primary-color);
    color: #fff;
    padding: 14px;
    border-radius: 8px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: background 0.3s;
}

.mobile-cta-box a:hover {
    background: var(--primary-hover);
    text-decoration: none;
}

/* Enhanced Typography & Callouts */
.article-content {
    line-height: 1.85;
    font-size: 1.05rem;
}

.article-content blockquote {
    border-left: 4px solid var(--primary-color);
    padding: 16px 24px;
    margin: 24px 0;
    background: var(--code-bg);
    border-radius: 0 8px 8px 0;
    font-style: italic;
    color: var(--text-main);
}

.article-content mark {
    background: rgba(16, 185, 129, 0.2);
    color: var(--text-main);
    padding: 2px 6px;
    border-radius: 4px;
}

.article-content .important-tip {
    border-left: 4px solid var(--error-color);
    background: rgba(239, 68, 68, 0.05);
    padding: 16px 20px;
    border-radius: 0 8px 8px 0;
    margin: 20px 0;
}

/* Dynamic TOC */
.toc-container {
    max-height: 60vh;
    overflow-y: auto;
}

.toc-container::-webkit-scrollbar {
    width: 4px;
}

.toc-container::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.toc-list {
    margin-top: 12px;
}

.toc-item a {
    display: block;
    padding: 6px 0;
    color: var(--text-muted);
    font-size: 0.88rem;
    transition: color 0.2s;
    border-bottom: 1px solid var(--border-light);
}

.toc-item a:hover {
    color: var(--primary-color);
}

.toc-h3 a {
    padding-left: 16px;
    font-size: 0.82rem;
    position: relative;
}

.toc-h3 a::before {
    content: '-';
    position: absolute;
    left: 4px;
    color: var(--border-color);
}

/* Responsive Table Scroll Indicator */
.table-wrapper {
    position: relative;
    width: 100%;
}

.table-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 40px;
    background: linear-gradient(to right, transparent, var(--surface-color));
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

/* Enhanced Footer Grid */
.footer-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1.5fr;
    gap: 40px;
    max-width: 900px;
    margin: 0 auto;
    text-align: left;
    padding-bottom: 30px;
    border-bottom: 1px solid var(--border-color);
}

.footer-col h4 {
    color: var(--text-main);
    margin-bottom: 16px;
    font-size: 1rem;
}

.footer-col ul {
    list-style: none;
    padding: 0;
}

.footer-col ul li {
    margin-bottom: 10px;
}

.footer-col ul li a {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.footer-col ul li a:hover {
    color: var(--primary-color);
}

.newsletter-form {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.newsletter-form input {
    flex: 1;
    padding: 10px 14px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--surface-color-2);
    color: var(--text-main);
}

.newsletter-form button {
    background: var(--primary-color);
    color: #fff;
    border: none;
    padding: 0 16px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
}

.footer-bottom {
    text-align: center;
    padding-top: 24px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Media Queries for UI components */
@media (max-width: 1024px) {
    .social-share {
        display: none;
        /* Hide float on intermediate screens */
    }
}

@media (max-width: 768px) {
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .mobile-cta-box {
        display: block;
        /* Show mobile CTA */
    }

    .article-layout {
        padding-bottom: 90px;
        /* Space for mobile CTA */
    }

    .social-share {
        display: flex;
        flex-direction: row;
        position: static;
        justify-content: center;
        margin: 30px 0;
        gap: 16px;
    }

    .social-share span {
        display: none;
    }

    .table-wrapper::after {
        opacity: 1;
        /* Show swipe indicator on mobile */
    }
}
/* ════════════════════════════════
   ARTICLE CARD (index.php layout)
   ════════════════════════════════ */
.article-card {
    background: #1E293B;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 14px;
    padding: 20px;
    display: flex;
    flex-direction: row;
    gap: 14px;
    align-items: flex-start;
    text-decoration: none;
    transition: transform .2s, border-color .2s, box-shadow .2s;
}
.article-card:hover {
    transform: translateY(-4px);
    border-color: rgba(99,102,241,.4);
    box-shadow: 0 8px 28px rgba(79,70,229,.12);
    text-decoration: none;
}
.article-card-icon { font-size:2rem; line-height:1; flex-shrink:0; width:44px; text-align:center; }
.article-card-body  { display:flex; flex-direction:column; gap:5px; flex:1; min-width:0; }
.article-card-niche { font-size:.68rem; font-weight:700; text-transform:uppercase; letter-spacing:.8px; color:#818CF8; }
.article-card-title { font-size:.92rem; font-weight:600; color:#E2E8F0; line-height:1.45; }
.article-card-title a { color:inherit; text-decoration:none; }
.article-card-title a:hover { color:#A5B4FC; }
.article-card-desc  { font-size:.78rem; color:#64748B; line-height:1.55; overflow:hidden; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; }
.article-card-meta  { display:flex; gap:14px; font-size:.7rem; color:#475569; margin-top:4px; flex-wrap:wrap; }

/* CATEGORY CARD */
.category-card {
    background:#1E293B; border:1px solid rgba(255,255,255,.08);
    border-radius:14px; padding:18px 20px;
    display:flex; flex-direction:column; gap:6px;
    text-decoration:none; transition:transform .2s, border-color .2s;
}
.category-card:hover { transform:translateY(-4px); border-color:rgba(99,102,241,.35); text-decoration:none; }
.category-icon  { font-size:2rem; line-height:1; }
.category-label { font-size:.95rem; font-weight:700; color:#E2E8F0; }
.category-desc  { font-size:.78rem; color:#64748B; line-height:1.5; }
.category-count { font-size:.7rem; color:#A5B4FC; background:rgba(99,102,241,.15); padding:2px 8px; border-radius:12px; font-weight:600; display:inline-block; width:fit-content; }

/* ESSAYS RESULTS */
.band-score-card { background:#1E293B; border:1px solid rgba(255,255,255,.08); border-radius:16px; padding:32px 24px; text-align:center; margin-bottom:20px; }
.band-label { font-size:.78rem; font-weight:700; text-transform:uppercase; letter-spacing:.8px; color:#64748B; margin-bottom:12px; }
.band-score { font-size:4.5rem; font-weight:800; background:linear-gradient(135deg,#60A5FA,#A78BFA); -webkit-background-clip:text; background-clip:text; -webkit-text-fill-color:transparent; line-height:1; margin-bottom:18px; }
.score-breakdown { display:flex; flex-wrap:wrap; gap:10px; justify-content:center; margin-top:12px; }
.score-item { background:rgba(255,255,255,.05); border:1px solid rgba(255,255,255,.08); border-radius:8px; padding:8px 16px; text-align:center; min-width:100px; }
.score-item span { display:block; font-size:.7rem; color:#64748B; text-transform:uppercase; letter-spacing:.6px; margin-bottom:4px; }
.score-item strong { font-size:1.3rem; color:#A5B4FC; }
.feedback-card { background:#1E293B; border:1px solid rgba(255,255,255,.08); border-radius:16px; padding:28px; margin-bottom:20px; text-align:left; font-size:.92rem; line-height:1.75; color:#CBD5E1; }
.error-card { background:rgba(239,68,68,.08); border:1px solid rgba(239,68,68,.25); border-radius:16px; padding:28px; text-align:center; color:#FCA5A5; }

/* SPINNER */
.spinner { width:44px; height:44px; border:4px solid rgba(255,255,255,.1); border-top-color:#4F46E5; border-radius:50%; animation:spin .8s linear infinite; margin:0 auto; }
@keyframes spin { to { transform:rotate(360deg); } }

/* SITE FOOTER (index.php) */
.site-footer { background:#111827; border-top:1px solid rgba(255,255,255,.07); margin:60px 0 0; max-width:100%; }
.footer-inner { max-width:1100px; margin:0 auto; padding:48px 20px 32px; display:grid; grid-template-columns:1.5fr 1fr 1fr; gap:36px; }
.footer-brand strong { font-size:1rem; font-weight:800; color:#F1F5F9; display:block; margin-bottom:8px; }
.footer-brand p { font-size:.82rem; color:#475569; line-height:1.7; }
.footer-links strong { display:block; font-size:.72rem; font-weight:700; text-transform:uppercase; letter-spacing:.8px; color:#64748B; margin-bottom:14px; }
.footer-links a { display:block; font-size:.83rem; color:#475569; text-decoration:none; padding:4px 0; transition:color .2s; }
.footer-links a:hover { color:#A5B4FC; }
.site-footer .footer-bottom { max-width:1100px; margin:0 auto; padding:16px 20px 36px; border-top:1px solid rgba(255,255,255,.05); color:#334155; font-size:.78rem; text-align:left; }
@media(max-width:768px) { .footer-inner { grid-template-columns:1fr 1fr; } .footer-brand { grid-column:1/-1; } }
@media(max-width:500px) { .footer-inner { grid-template-columns:1fr; } }
