/* ═══════════════════════════════════════════════════════════════════════════
   CAMEL Domain - Apple-Inspired Premium Design System
   Pristine, minimal, and meticulously crafted
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
    /* ─────────────────────────────────────────────────────────────────────────
       Color Palette - Apple Dark Mode
       ───────────────────────────────────────────────────────────────────────── */
    --bg-base: #000000;
    --bg-primary: #1c1c1e;
    --bg-secondary: #2c2c2e;
    --bg-tertiary: #3a3a3c;
    --bg-elevated: rgba(44, 44, 46, 0.72);

    /* Accent Colors - iOS System */
    --accent-blue: #0A84FF;
    --accent-blue-hover: #409CFF;
    --accent-green: #30D158;
    --accent-orange: #FF9F0A;
    --accent-red: #FF453A;
    --accent-purple: #BF5AF2;
    --accent-teal: #64D2FF;

    /* Text Colors */
    --text-primary: #FFFFFF;
    --text-secondary: rgba(235, 235, 245, 0.6);
    --text-tertiary: rgba(235, 235, 245, 0.3);

    /* Borders & Separators */
    --separator: rgba(84, 84, 88, 0.65);
    --separator-light: rgba(84, 84, 88, 0.35);

    /* Glass Effects */
    --glass-bg: rgba(30, 30, 30, 0.7);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-highlight: rgba(255, 255, 255, 0.05);

    /* Shadows - Layered Depth */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 40px rgba(10, 132, 255, 0.15);

    /* ─────────────────────────────────────────────────────────────────────────
       Typography System - SF Pro Inspired
       ───────────────────────────────────────────────────────────────────────── */
    --font-system: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Inter', system-ui, sans-serif;
    --font-mono: 'SF Mono', 'Roboto Mono', ui-monospace, monospace;

    /* Type Scale */
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 2rem;
    --text-4xl: 2.5rem;

    /* Letter Spacing */
    --tracking-tight: -0.025em;
    --tracking-normal: 0;
    --tracking-wide: 0.025em;

    /* ─────────────────────────────────────────────────────────────────────────
       Spacing & Layout
       ───────────────────────────────────────────────────────────────────────── */
    --container-max: 1200px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* ─────────────────────────────────────────────────────────────────────────
       Motion - Natural Easing
       ───────────────────────────────────────────────────────────────────────── */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
    --duration-fast: 150ms;
    --duration-normal: 250ms;
    --duration-slow: 400ms;
}

[data-theme="light"] {
    /* ─────────────────────────────────────────────────────────────────────────
       Color Palette - Apple Light Mode
       ───────────────────────────────────────────────────────────────────────── */
    --bg-base: #F5F5F7;
    --bg-primary: #FFFFFF;
    --bg-secondary: #FFFFFF;
    --bg-tertiary: #E5E5EA;
    --bg-elevated: rgba(255, 255, 255, 0.8);

    /* Text Colors */
    --text-primary: #1D1D1F;
    --text-secondary: rgba(60, 60, 67, 0.85);
    --text-tertiary: rgba(60, 60, 67, 0.5);

    /* Borders & Separators */
    --separator: rgba(60, 60, 67, 0.29);
    --separator-light: rgba(60, 60, 67, 0.12);

    /* Glass Effects */
    --glass-bg: rgba(255, 255, 255, 0.65);
    --glass-border: rgba(255, 255, 255, 0.4);
    --glass-highlight: rgba(255, 255, 255, 0.5);

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 12px 30px rgba(0, 0, 0, 0.12);
    --shadow-glow: 0 0 20px rgba(10, 132, 255, 0.25);
}

/* ═══════════════════════════════════════════════════════════════════════════
   Base Reset & Global Styles
   ═══════════════════════════════════════════════════════════════════════════ */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-family: var(--font-system);
    background: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;

    /* Subtle gradient background */
    background:
        radial-gradient(ellipse at 50% 0%, rgba(10, 132, 255, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 50%, rgba(191, 90, 242, 0.04) 0%, transparent 40%),
        var(--bg-base);
}

/* ═══════════════════════════════════════════════════════════════════════════
   Layout System
   ═══════════════════════════════════════════════════════════════════════════ */
.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 3rem 1.5rem;
}

.row {
    display: flex;
    flex-wrap: wrap;
    margin: -0.75rem;
}

.col-12 {
    width: 100%;
    padding: 0.75rem;
}

.col-md-4 {
    width: 100%;
    padding: 0.75rem;
}

.col-md-6 {
    width: 100%;
    padding: 0.75rem;
}

@media (min-width: 768px) {
    .col-md-4 {
        width: 33.333%;
    }

    .col-md-6 {
        width: 50%;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Typography
   ═══════════════════════════════════════════════════════════════════════════ */
h1 {
    font-size: var(--text-4xl);
    font-weight: 700;
    letter-spacing: var(--tracking-tight);
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

h3 {
    font-size: var(--text-2xl);
    font-weight: 600;
    letter-spacing: var(--tracking-tight);
    margin-bottom: 1.5rem;
}

h5 {
    font-size: var(--text-lg);
    font-weight: 600;
    letter-spacing: var(--tracking-normal);
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-secondary);
}

.text-end {
    text-align: right;
}

/* Spacing Utilities */
.mt-2 {
    margin-top: 0.5rem;
}

.mt-3 {
    margin-top: 1rem;
}

.mt-4 {
    margin-top: 1.5rem;
}

.mt-5 {
    margin-top: 3rem;
}

.mb-3 {
    margin-bottom: 1rem;
}

.mb-4 {
    margin-bottom: 1.5rem;
}

.d-flex {
    display: flex;
}

.justify-content-between {
    justify-content: space-between;
}

.justify-content-center {
    justify-content: center;
}

.justify-content-end {
    justify-content: flex-end;
}

.align-items-center {
    align-items: center;
}

.flex-column {
    flex-direction: column;
}

.flex-grow-1 {
    flex-grow: 1;
}

.gap-2 {
    gap: 0.5rem;
}

.h-100 {
    height: 100%;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Header & Branding
   ═══════════════════════════════════════════════════════════════════════════ */
header {
    text-align: center;
    padding: 2rem 0 3rem;
}

.logo-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1.5rem;
    position: relative;
}

.theme-toggle {
    position: absolute;
    right: 70px;
    top: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--separator-light);
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all var(--duration-normal) var(--ease-out);
    box-shadow: var(--shadow-sm);
}

.theme-toggle:hover {
    background: var(--bg-tertiary);
    transform: scale(1.1);
}

.instructions-toggle {
    position: absolute;
    right: 20px;
    top: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--separator-light);
    background: var(--bg-secondary);
    color: var(--accent-blue);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all var(--duration-normal) var(--ease-out);
    box-shadow: var(--shadow-sm);
}

.instructions-toggle:hover {
    background: var(--bg-tertiary);
    transform: scale(1.1);
    color: var(--accent-blue-hover);
}

[data-theme="light"] .theme-toggle i:before {
    content: "\f185";
    /* sun icon */
    color: var(--accent-orange);

}

.logo-container img {
    width: 100px;
    height: 100px;
    border-radius: 24px;
    background: linear-gradient(145deg, var(--bg-secondary), var(--bg-primary));
    padding: 12px;
    box-shadow:
        var(--shadow-lg),
        inset 0 1px 0 var(--glass-highlight);
    object-fit: contain;
    transition: transform var(--duration-normal) var(--ease-out);
}

.logo-container img:hover {
    transform: scale(1.05);
}

header h1 {
    margin-bottom: 0.5rem;
    animation: fadeInUp 0.6s var(--ease-out) both;
}

header p {
    color: var(--text-secondary);
    font-size: var(--text-lg);
    animation: fadeInUp 0.6s var(--ease-out) 0.1s both;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Card Components - Glassmorphism
   ═══════════════════════════════════════════════════════════════════════════ */
.card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition:
        transform var(--duration-normal) var(--ease-out),
        box-shadow var(--duration-normal) var(--ease-out);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.card-body {
    padding: 1.75rem;
}

.card-title {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
}

.card-text.h2 {
    font-size: var(--text-3xl);
    font-weight: 700;
    color: var(--accent-blue);
    margin-top: 0.5rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Form Controls
   ═══════════════════════════════════════════════════════════════════════════ */
.form-control {
    width: 100%;
    padding: 0.875rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--separator-light);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: var(--text-base);
    transition: all var(--duration-fast) var(--ease-out);
    resize: vertical;
}

.form-control::placeholder {
    color: var(--text-tertiary);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 4px rgba(10, 132, 255, 0.2);
}

.form-group {
    margin-bottom: 0;
}

/* Input Group */
.input-group {
    display: flex;
    gap: 0.5rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Tab Navigation - Apple Style
   ═══════════════════════════════════════════════════════════════════════════ */
.nav-tabs {
    display: flex;
    gap: 0.25rem;
    border-bottom: 1px solid var(--separator-light);
    margin-bottom: 1.5rem;
    list-style: none;
    padding-bottom: 0;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.nav-tabs::-webkit-scrollbar {
    display: none;
}

.nav-item {
    flex-shrink: 0;
}

.nav-link {
    position: relative;
    padding: 0.75rem 1.25rem;
    background: transparent;
    border: none;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    color: var(--text-secondary);
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
    white-space: nowrap;
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--glass-highlight);
}

.nav-link.active {
    color: var(--accent-blue);
    background: transparent;
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent-blue);
    border-radius: 2px 2px 0 0;
}

/* Summary Tab Highlight */
.nav-link.summary-tab-highlight {
    background: linear-gradient(135deg, rgba(10, 132, 255, 0.15) 0%, rgba(191, 90, 242, 0.15) 100%);
    border: 1px solid rgba(10, 132, 255, 0.3);
    font-weight: 600;
    animation: pulse-glow 2s ease-in-out infinite;
}

.nav-link.summary-tab-highlight:hover {
    background: linear-gradient(135deg, rgba(10, 132, 255, 0.25) 0%, rgba(191, 90, 242, 0.25) 100%);
    border-color: rgba(10, 132, 255, 0.5);
}

.nav-link.summary-tab-highlight.active {
    background: linear-gradient(135deg, rgba(10, 132, 255, 0.3) 0%, rgba(191, 90, 242, 0.3) 100%);
    border-color: var(--accent-blue);
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 10px rgba(10, 132, 255, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(10, 132, 255, 0.5);
    }
}

.tab-pane {
    display: none;
    animation: fadeIn var(--duration-normal) var(--ease-out);
}

.tab-pane.active {
    display: block;
}

.tab-content {
    min-height: 200px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Buttons - Premium Style
   ═══════════════════════════════════════════════════════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-full);
    font-family: inherit;
    font-size: var(--text-sm);
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: all var(--duration-fast) var(--ease-out);
    white-space: nowrap;
}

/* Share to X Button Highlight */
.share-button-highlight {
    position: relative;
    display: inline-block;
}

.share-button-pulse {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    border-radius: var(--radius-full);
    background: rgba(10, 132, 255, 0.4);
    animation: pulse-ring 2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
    pointer-events: none;
}

@keyframes pulse-ring {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 0;
    }
}

.share-to-x-btn {
    background: linear-gradient(135deg, #000000 0%, #1a1a1a 100%);
    color: white;
    font-size: var(--text-base);
    padding: 0.875rem 2rem;
    box-shadow:
        0 4px 15px rgba(0, 0, 0, 0.4),
        0 0 20px rgba(10, 132, 255, 0.3);
    border: 2px solid rgba(10, 132, 255, 0.5);
    position: relative;
    z-index: 1;
}

.share-to-x-btn:hover {
    background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
    box-shadow:
        0 6px 25px rgba(0, 0, 0, 0.5),
        0 0 30px rgba(10, 132, 255, 0.5);
    transform: translateY(-2px) scale(1.05);
    border-color: var(--accent-blue);
}

.share-to-x-btn:active {
    transform: translateY(0) scale(1);
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-blue) 0%, #0066CC 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(10, 132, 255, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--accent-blue-hover) 0%, var(--accent-blue) 100%);
    box-shadow: 0 6px 20px rgba(10, 132, 255, 0.4);
    transform: translateY(-1px);
}

.btn-success {
    background: linear-gradient(135deg, var(--accent-green) 0%, #28A745 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(48, 209, 88, 0.3);
}

.btn-success:hover {
    box-shadow: 0 6px 20px rgba(48, 209, 88, 0.4);
    transform: translateY(-1px);
}

.btn-outline-secondary {
    background: transparent;
    border: 1px solid var(--separator);
    color: var(--text-secondary);
}

.btn-outline-secondary:hover {
    background: var(--glass-highlight);
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: var(--text-xs);
}

/* ═══════════════════════════════════════════════════════════════════════════
   Upload Area - Enhanced Drag & Drop
   ═══════════════════════════════════════════════════════════════════════════ */
.upload-container {
    padding: 1rem 0;
}

.upload-area {
    border: 2px dashed var(--separator);
    border-radius: var(--radius-xl);
    padding: 3rem 2rem;
    text-align: center;
    background: var(--bg-secondary);
    transition: all var(--duration-normal) var(--ease-out);
    cursor: pointer;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--accent-blue);
    background: rgba(10, 132, 255, 0.05);
    box-shadow: 0 0 0 4px rgba(10, 132, 255, 0.1);
}

.upload-area i {
    font-size: 3rem;
    color: var(--accent-blue);
    margin-bottom: 1rem;
    opacity: 0.8;
}

.upload-area p {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Tables - Clean Data Display
   ═══════════════════════════════════════════════════════════════════════════ */
.table-responsive {
    overflow-x: auto;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    background: rgba(255, 255, 255, 0.03);
    padding: 1rem 1.25rem;
    text-align: left;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
    border-bottom: 1px solid var(--separator-light);
    white-space: nowrap;
}

.table td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--separator-light);
    font-size: var(--text-sm);
    transition: background var(--duration-fast) var(--ease-out);
}

.table tbody tr:hover td {
    background: rgba(255, 255, 255, 0.03);
}

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

.table-sm td,
.table-sm th {
    padding: 0.75rem 1rem;
}

/* Split words styling */
.split-words {
    display: inline-block;
    background: rgba(10, 132, 255, 0.15);
    padding: 0.25rem 0.625rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--accent-teal);
}

/* Confidence cell */
.confidence-cell {
    position: relative;
}

.confidence-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-green), var(--accent-teal));
    opacity: 0.6;
    border-radius: 0 2px 2px 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Word Cloud & Visualizations
   ═══════════════════════════════════════════════════════════════════════════ */
.word-cloud-container {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--radius-xl);
    border: 1px solid var(--glass-border);
    height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#sldBarGraph,
#tldBarGraph,
#summarySldGraph,
#summaryTldGraph {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    padding: 1rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Custom Toggle Switch
   ═══════════════════════════════════════════════════════════════════════════ */
.form-check {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.form-check-label {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    cursor: pointer;
    user-select: none;
}

.form-check-input {
    appearance: none;
    width: 44px;
    height: 24px;
    background: var(--bg-tertiary);
    border: none;
    border-radius: var(--radius-full);
    position: relative;
    cursor: pointer;
    transition: background var(--duration-fast) var(--ease-out);
    flex-shrink: 0;
}

.form-check-input:checked {
    background: var(--accent-green);
}

.form-check-input::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    transition: transform var(--duration-fast) var(--ease-out);
}

.form-check-input:checked::after {
    transform: translateX(20px);
}

/* Badge */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.625rem;
    font-size: var(--text-xs);
    font-weight: 600;
    border-radius: var(--radius-full);
}

.bg-primary {
    background: var(--accent-blue) !important;
    color: white;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Loading & Processing States
   ═══════════════════════════════════════════════════════════════════════════ */
.spinner-border {
    display: inline-block;
    width: 2.5rem;
    height: 2.5rem;
    vertical-align: -0.125em;
    border: 3px solid rgba(10, 132, 255, 0.2);
    border-right-color: var(--accent-blue);
    border-radius: 50%;
    animation: spinner-border 0.8s linear infinite;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@keyframes spinner-border {
    100% {
        transform: rotate(360deg);
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Alert Messages
   ═══════════════════════════════════════════════════════════════════════════ */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    background: rgba(255, 69, 58, 0.1);
    border: 1px solid rgba(255, 69, 58, 0.2);
    color: var(--accent-red);
    font-size: var(--text-sm);
}

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

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

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Scrollbar Styling
   ═══════════════════════════════════════════════════════════════════════════ */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--separator);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--separator) transparent;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Selection Styling
   ═══════════════════════════════════════════════════════════════════════════ */
::selection {
    background: rgba(10, 132, 255, 0.3);
    color: white;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Responsive Adjustments
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    :root {
        --text-4xl: 2rem;
        --text-3xl: 1.5rem;
    }

    .container {
        padding: 2rem 1rem;
    }

    .card-body {
        padding: 1.25rem;
    }

    .btn {
        padding: 0.625rem 1.25rem;
    }

    .word-cloud-container {
        height: 350px;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Instructions Modal
   ═══════════════════════════════════════════════════════════════════════════ */
.instructions-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    animation: fadeIn var(--duration-normal) var(--ease-out);
}

.instructions-modal.show {
    display: flex;
}

.instructions-modal-content {
    background: var(--glass-bg);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    max-width: 700px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideInUp 0.4s var(--ease-out);
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.instructions-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 2rem 1rem;
    border-bottom: 1px solid var(--separator-light);
}

.instructions-modal-header h2 {
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.close-instructions {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all var(--duration-fast) var(--ease-out);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
}

.close-instructions:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    transform: rotate(90deg);
}

.instructions-modal-body {
    padding: 1.5rem 2rem 2rem;
}

.instruction-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--separator-light);
}

.instruction-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.instruction-section h3 {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--accent-blue);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.instruction-section h3 i {
    font-size: 1.2rem;
}

.instruction-section p {
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    line-height: 1.6;
}

.instruction-section ul {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.instruction-section ul li {
    color: var(--text-secondary);
    padding-left: 1.5rem;
    margin-bottom: 0.5rem;
    position: relative;
    line-height: 1.6;
}

.instruction-section ul li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--accent-blue);
    font-weight: bold;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Focus Visible - Accessibility
   ═══════════════════════════════════════════════════════════════════════════ */
:focus-visible {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
}

button:focus:not(:focus-visible),
input:focus:not(:focus-visible) {
    outline: none;
}