/* ============================================================
   Eleven AI Dictionary — Custom Styles
   Stacks: Bootstrap 5 + Custom glass effects + System fonts
   ============================================================ */

/* --- CSS Custom Properties (design tokens) --- */
:root {
    --color-bg: #f0f4f8;
    --color-surface: #ffffff;
    --color-primary: #4f46e5;
    --color-primary-light: #eef2ff;
    --color-primary-dark: #3730a3;
    --color-text: #0f172a;
    --color-text-secondary: #475569;
    --color-text-muted: #64748b;
    --color-border: #e2e8f0;
    --color-border-light: #f1f5f9;
    --color-amber: #d97706;
    --color-amber-bg: #fffbeb;
    --color-emerald: #059669;
    --color-emerald-bg: #ecfdf5;
    --radius-sm: 0.75rem;
    --radius-md: 1rem;
    --radius-lg: 1.5rem;
    --radius-xl: 2rem;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.06), 0 2px 6px rgba(0,0,0,0.04);
    --shadow-lg: 0 12px 32px rgba(0,0,0,0.08), 0 4px 12px rgba(79,70,229,0.06);
    --shadow-xl: 0 25px 50px -12px rgba(0,0,0,0.12);
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-spring: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* --- Base --- */
body {
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 50%, #f0fdf4 100%);
    background-attachment: fixed;
    min-height: 100vh;
    color: var(--color-text);
    margin: 0;
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* --- Chinese Text Font Stack (system fonts, no Google CDN) --- */
.chinese-text,
.font-standard {
    font-family: 'FangSong', 'STFangsong', '仿宋', 'FangSong_GB2312', 'Noto Serif SC', serif;
}

.font-serif-standard {
    font-family: 'Noto Serif SC', serif;
}

/* --- Smooth Scrollbar --- */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
    background-clip: content-box;
}

/* --- Glass Effect --- */
.glass-panel {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(226, 232, 240, 0.7);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-smooth);
    overflow: hidden;
}
.glass-panel:hover {
    box-shadow: var(--shadow-md);
    border-color: rgba(203, 213, 225, 0.8);
}

/* Raised variant for hero cards & feature panels */
.glass-panel-raised {
    box-shadow: var(--shadow-lg);
}
.glass-panel-raised:hover {
    box-shadow: var(--shadow-xl);
}

/* --- Search Glow --- */
.search-glow {
    box-shadow: 0 8px 30px -8px rgba(79, 70, 229, 0.18);
    transition: box-shadow var(--transition-smooth);
}
.search-glow:focus-within {
    box-shadow: 0 12px 40px -8px rgba(79, 70, 229, 0.28);
}

/* --- Hanzi Grid Background --- */
.hanzi-cross-lines {
    background:
        linear-gradient(to right, transparent 49.5%, #f1f5f9 49.5%, #f1f5f9 50.5%, transparent 50.5%),
        linear-gradient(to bottom, transparent 49.5%, #f1f5f9 49.5%, #f1f5f9 50.5%, transparent 50.5%);
}

/* --- Animations --- */
@keyframes marquee {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}
.animate-marquee {
    display: inline-block;
    white-space: nowrap;
    animation: marquee 35s linear infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(200%); }
}
.animate-shimmer {
    animation: shimmer 2s infinite linear;
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}
.animate-scale-in {
    animation: scaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* --- Badge Variants (Bootstrap extensions) --- */
.badge-indigo {
    background-color: var(--color-primary-light);
    color: var(--color-primary-dark);
    border: 1px solid #e0e7ff;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}
.badge-slate {
    background-color: #f8fafc;
    color: #64748b;
    border: 1px solid var(--color-border-light);
    font-size: 0.7rem;
    font-weight: 700;
}
.badge-emerald {
    background-color: var(--color-emerald-bg);
    color: var(--color-emerald);
    border: 1px solid #d1fae5;
    font-size: 0.7rem;
    font-weight: 700;
}
.badge-amber {
    background-color: var(--color-amber-bg);
    color: var(--color-amber);
    border: 1px solid #fef3c7;
    font-size: 0.7rem;
    font-weight: 700;
}

/* --- Section toggle chevron rotation --- */
.section-chevron {
    transition: transform var(--transition-smooth);
}
.section-chevron.rotated {
    transform: rotate(180deg);
}

/* --- Section Toggle Button --- */
.section-toggle-btn {
    transition: all var(--transition-fast);
    border-radius: var(--radius-md);
}
.section-toggle-btn:hover {
    background: rgba(238, 242, 255, 0.6) !important;
}

/* --- Responsive container --- */
#app {
    max-width: 1024px;
    margin: 0 auto;
    min-height: 100vh;
    padding: 0 1rem;
}

/* --- Loader ring --- */
.loader-ring {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}
.loader-ring::before {
    content: '';
    position: absolute;
    width: 6rem;
    height: 6rem;
    border: 3px solid var(--color-primary-light);
    border-radius: 50%;
}
.loader-ring-inner {
    position: absolute;
    width: 6rem;
    height: 6rem;
    border: 3px solid transparent;
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* --- HSK quiz option buttons --- */
.quiz-option {
    padding: 1rem 1.25rem;
    background: #f8fafc;
    border: 1.5px solid var(--color-border-light);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    text-align: left;
    transition: all var(--transition-fast);
    cursor: pointer;
    color: var(--color-text);
}
.quiz-option:hover {
    background: #eef2ff;
    border-color: #c7d2fe;
    box-shadow: var(--shadow-sm);
}
.quiz-option-selected,
.quiz-option-selected:hover {
    background: #eef2ff;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
    color: var(--color-primary);
}

/* --- Clickable text hover --- */
.clickable-zh {
    transition: color var(--transition-fast);
}
.clickable-zh:hover {
    color: var(--color-primary);
}

/* --- Interactive cards --- */
.card-hover {
    transition: all var(--transition-smooth);
    cursor: pointer;
}
.card-hover:hover {
    border-color: #c7d2fe !important;
    box-shadow: var(--shadow-md);
}

/* --- Button press feedback --- */
.btn-press {
    transition: all var(--transition-fast);
}

/* --- Word chips / clickable pills --- */
.word-chip {
    transition: all var(--transition-fast);
    cursor: pointer;
}
.word-chip:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--color-primary) !important;
}

/* --- Focus styles --- */
input:focus {
    outline: none;
    box-shadow: none;
}

/* --- Smooth scroll --- */
html {
    scroll-behavior: smooth;
}

/* --- Text readability --- */
.text-body-readable {
    font-size: 0.9375rem;
    line-height: 1.65;
    color: var(--color-text-secondary);
}

/* --- Section header text --- */
.section-label {
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-text-muted);
}

/* --- Language label (Chinese 中文 / English Meaning / မြန်မာစာ Burmese 缅甸语) --- */
.lang-label {
    font-size: 0.6875rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

/* --- Pinyin text --- */
.pinyin-text {
    font-style: italic;
    font-weight: 600;
    letter-spacing: -0.01em;
}

/* --- Definition text --- */
.definition-text {
    font-size: 1.0625rem;
    font-weight: 700;
    line-height: 1.5;
}

/* --- Cultural fact improvements --- */
.cultural-fact-zh {
    font-size: 1rem;
    font-weight: 700;
    font-style: italic;
    line-height: 1.7;
}
.cultural-fact-en,
.cultural-fact-my {
    font-size: 0.9375rem;
    font-weight: 500;
    font-style: italic;
    line-height: 1.65;
}
.cultural-label {
    font-size: 0.6875rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

/* --- Recent word card --- */
.recent-word-card {
    transition: all var(--transition-smooth);
    cursor: pointer;
}
.recent-word-card:hover {
    box-shadow: var(--shadow-md);
}
