/* ============================================================
   page.css — Shared stylesheet (Sarabun font)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Sarabun:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800&display=swap');

:root {
    --primary: #1a237e;
    --primary-light: #3949ab;
    --secondary: #0097a7;
    --accent: #ff6f00;
    --positive: #2e7d32;
    --negative: #c62828;
    --zero: #6a1b9a;
    --bg: #f0f4ff;
    --card-bg: #ffffff;
    --text: #1a1a2e;
    --text-muted: #5c6bc0;
    --border: #c5cae9;
    --shadow: 0 4px 24px rgba(26, 35, 126, 0.10);
    --radius: 18px;
    --radius-sm: 10px;
}

html {
    font-size: 16px;
}

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

body {
    font-family: 'Sarabun', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

/* ── Header ── */
.page-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 60%, var(--secondary) 100%);
    color: #fff;
    padding: 40px 24px 32px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.page-header::before {
    content: '';
    position: absolute;
    top: -60px;
    right: -60px;
    width: 220px;
    height: 220px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 50%;
}

.page-header::after {
    content: '';
    position: absolute;
    bottom: -80px;
    left: -40px;
    width: 280px;
    height: 280px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 50%;
}

.header-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50px;
    padding: 4px 18px;
    font-size: 16px;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.page-header h1 {
    font-size: clamp(2rem, 6vw, 3.5rem);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 6px;
}

.page-header .subtitle {
    font-size: clamp(1rem, 3vw, 1.4rem);
    opacity: 0.85;
    margin-bottom: 20px;
}

.lang-switcher {
    display: inline-flex;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50px;
    padding: 4px;
    gap: 4px;
}

.lang-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.75);
    padding: 8px 22px;
    border-radius: 50px;
    cursor: pointer;
    font-family: 'Sarabun', sans-serif;
    font-size: 17px;
    font-weight: 600;
    transition: all 0.25s;
}

.lang-btn.active {
    background: #fff;
    color: var(--primary);
}

.lang-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

/* ── Layout ── */
.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 32px 16px 60px;
}

.intro-block {
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 30px;
    margin-bottom: 40px;
    text-align: center;
    font-size: 1.15rem;
    line-height: 1.8;
}

/* ── Section Cards ── */
.section-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 30px 28px;
    margin-bottom: 24px;
    border-left: 6px solid var(--primary-light);
    transition: transform 0.2s, box-shadow 0.2s;
}

.section-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(26, 35, 126, 0.14);
}

.section-card.green {
    border-left-color: var(--positive);
}

.section-card.orange {
    border-left-color: var(--accent);
}

.section-card.purple {
    border-left-color: var(--zero);
}

.section-card.teal {
    border-left-color: var(--secondary);
}

.section-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 14px;
}

.section-card.green .section-num {
    background: var(--positive);
}

.section-card.orange .section-num {
    background: var(--accent);
}

.section-card.purple .section-num {
    background: var(--zero);
}

.section-card.teal .section-num {
    background: var(--secondary);
}

.section-card h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.section-card .en-title {
    font-size: 1.05rem;
    color: var(--text-muted);
    margin-bottom: 18px;
    font-style: italic;
}

/* ── Bilingual content blocks ── */
.bilingual-block {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.lang-block {
    padding: 16px 18px;
    border-radius: var(--radius-sm);
    font-size: 1.05rem;
    line-height: 1.75;
}

.lang-block.th {
    background: #f3f4ff;
    border: 1px solid #c5cae9;
}

.lang-block.en {
    background: #f0fff4;
    border: 1px solid #b2dfdb;
}

.lang-label {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    padding: 2px 10px;
    border-radius: 4px;
    margin-bottom: 8px;
}

.lang-block.th .lang-label {
    background: var(--primary);
    color: #fff;
}

.lang-block.en .lang-label {
    background: var(--positive);
    color: #fff;
}

/* ── Vocab Table ── */
.vocab-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 16px;
    font-size: 1rem;
}

.vocab-table th {
    background: var(--primary);
    color: #fff;
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
}

.vocab-table th:first-child {
    border-radius: 8px 0 0 0;
}

.vocab-table th:last-child {
    border-radius: 0 8px 0 0;
}

.vocab-table td {
    padding: 11px 16px;
    border-bottom: 1px solid var(--border);
}

.vocab-table tr:nth-child(even) td {
    background: #f5f6ff;
}

.vocab-table tr:last-child td {
    border-bottom: none;
}

.vocab-table .vocab-word {
    font-weight: 700;
    color: var(--primary-light);
}

.vocab-table .vocab-root {
    font-family: monospace;
    color: var(--secondary);
    font-size: 0.9rem;
}

.vocab-table .vocab-meaning {
    color: var(--text);
}

/* ── Note box ── */
.note-box {
    background: #fff8e1;
    border: 1.5px solid #ffe082;
    border-radius: var(--radius-sm);
    padding: 14px 18px;
    font-size: 1rem;
    color: #5d4037;
    margin-top: 14px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.note-icon {
    font-size: 1.4rem;
    flex-shrink: 0;
}

/* ── Compare table ── */
.compare-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 16px;
}

.compare-table th {
    background: #e8eaf6;
    color: var(--primary);
    padding: 10px 14px;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 700;
}

.compare-table td {
    padding: 10px 14px;
    text-align: center;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
}

.compare-table tr:nth-child(even) td {
    background: #f5f6ff;
}

.check {
    color: var(--positive);
    font-size: 1.2rem;
}

.cross {
    color: var(--negative);
    font-size: 1.2rem;
}

/* ── Back button ── */
.back-btn {
    position: absolute;
    top: 24px;
    left: 24px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 8px 16px;
    background: var(--card-bg);
    border-radius: 50px;
    box-shadow: 0 2px 8px rgba(26, 35, 126, 0.08);
    transition: box-shadow 0.2s, transform 0.2s;
    z-index: 10;
}

.back-btn:hover {
    box-shadow: 0 4px 16px rgba(26, 35, 126, 0.16);
    transform: translateX(-3px);
}

/* ── Language visibility ── */

/* default: show both lang-block th and en */
.lang-block.th,
.lang-block.en {
    display: block;
}

/* Thai only: hide English blocks */
body.show-th .lang-block.en {
    display: none;
}

/* English only: hide Thai blocks */
body.show-en .lang-block.th {
    display: none;
}

/* Collapse grid to 1 column when only one language shown */
body.show-th .bilingual-block,
body.show-en .bilingual-block {
    display: flex;
    flex-direction: column;
}

/* ── Floating Language Toggle (FAB) ── */
.lang-fab {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 10px 18px 10px 14px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(26, 35, 126, 0.35);
    font-family: 'Sarabun', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    transition: background 0.22s, box-shadow 0.22s, transform 0.15s;
    white-space: nowrap;
    user-select: none;
}

.lang-fab:hover {
    background: var(--primary-light);
    box-shadow: 0 6px 24px rgba(26, 35, 126, 0.45);
    transform: translateY(-2px);
}

.lang-fab:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(26, 35, 126, 0.3);
}

.lang-fab .fab-icon {
    font-size: 1.25rem;
    line-height: 1;
}

.lang-fab .fab-label {
    font-size: 0.95rem;
    letter-spacing: 0.3px;
}

/* colour changes per active language */
body.show-th .lang-fab {
    background: #1565c0;
}

body.show-en .lang-fab {
    background: #2e7d32;
}

/* ══════════════════════════════════════════
   VOCAB SECTION — distinct dark-gradient style
══════════════════════════════════════════ */