/* Base CSS - extracted from base.html */
:root {
    /* Dark theme (default) - Medium dark like Discord/Figma */
    --bg-primary: #18181b;
    --bg-secondary: #111113;
    --bg-tertiary: #1f1f23;
    --bg-elevated: #202024;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --text-muted: #71717a;
    --border-color: rgba(255,255,255,0.08);
    --card-bg: #1c1c20;
    --card-border: rgba(255,255,255,0.06);
    --card-shadow: rgba(0,0,0,0.3);

    /* Theme: Violet (default) */
    --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --accent-color: #8b5cf6;
    --accent-rgb: 139, 92, 246;
    --accent-glow: rgba(139, 92, 246, 0.25);

    /* Success/error colors */
    --success-color: #22c55e;
    --error-color: #ef4444;
}

/* Theme variants */
[data-theme="matrix"] {
    --accent-gradient: linear-gradient(135deg, #15803d 0%, #22c55e 100%);
    --accent-color: #22c55e;
    --accent-rgb: 34, 197, 94;
    --accent-glow: rgba(34, 197, 94, 0.18);
}

[data-theme="amber"] {
    --accent-gradient: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
    --accent-color: #f59e0b;
    --accent-rgb: 245, 158, 11;
    --accent-glow: rgba(245, 158, 11, 0.25);
}

[data-theme="plasma"] {
    --accent-gradient: linear-gradient(135deg, #dc2626 0%, #7c3aed 100%);
    --accent-color: #a855f7;
    --accent-rgb: 168, 85, 247;
    --accent-glow: rgba(168, 85, 247, 0.25);
}

/* Light mode */
[data-mode="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f4f4f6;
    --bg-tertiary: #e8e8ec;
    --bg-elevated: #ffffff;
    --text-primary: #0f0f14;
    --text-secondary: #52525b;
    --text-muted: #a1a1aa;
    --border-color: rgba(0,0,0,0.08);
    --card-bg: #ffffff;
    --card-border: rgba(0,0,0,0.06);
    --card-shadow: rgba(0,0,0,0.08);
}

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

/* Remove browser defaults for buttons */
button {
    margin: 0;
    padding: 0;
    border: none;
    background: none;
    font: inherit;
    color: inherit;
    cursor: pointer;
    line-height: inherit;
}

html {
    scroll-padding-top: 80px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    padding-top: 70px;
}

/* Monospace for data/numbers */
.mono {
    font-family: 'JetBrains Mono', monospace;
}

/* Navbar */
nav {
    background: var(--bg-primary);
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--card-border);
}

.brand {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
    letter-spacing: -0.02em;
}

.brand .logo {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 800;
    font-size: 1rem;
    box-shadow: 0 0 20px var(--accent-glow);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 32px;
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.85rem;
    padding: 8px 14px;
    border-radius: 8px;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-links a:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.nav-links .btn-primary {
    background: var(--accent-gradient);
    color: white;
    border: none;
    padding: 10px 18px;
    font-weight: 600;
    box-shadow: 0 0 20px var(--accent-glow);
}

.nav-links .btn-primary:hover {
    box-shadow: 0 4px 24px var(--accent-glow);
    transform: translateY(-1px);
}

/* Container */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 30px 20px;
}

/* Flash Messages */
.flash {
    padding: 12px 20px;
    margin-bottom: 20px;
    border-radius: 10px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--card-border);
    background: var(--card-bg);
}

.flash.error {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
}

.flash.success {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
    border-color: rgba(34, 197, 94, 0.3);
}

/* Typography */
h1, h2, h3 {
    color: var(--text-primary);
    font-weight: 700;
    letter-spacing: -0.02em;
}

h1 { font-size: 1.75rem; font-weight: 800; margin-bottom: 20px; }
h2 { font-size: 1.25rem; font-weight: 700; margin-bottom: 15px; }
h3 { font-size: 1rem; font-weight: 700; margin-bottom: 12px; }

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: 14px;
    padding: 20px;
    border: 1px solid var(--card-border);
    transition: all 0.2s ease;
    position: relative;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent-gradient);
    opacity: 0.6;
    border-radius: 14px 14px 0 0;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.card-header h2 {
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-header h2 i {
    color: var(--accent-color);
}

/* Forms */
input, textarea, select {
    width: 100%;
    padding: 12px 16px;
    font-size: 0.95rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin-bottom: 15px;
    font-family: 'Inter', sans-serif;
    transition: all 0.15s ease;
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.15);
}

input::placeholder, textarea::placeholder {
    color: var(--text-muted);
}

label {
    display: block;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 0 20px var(--accent-glow);
}

.btn-primary:hover {
    box-shadow: 0 4px 24px var(--accent-glow);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: none;
}

.btn-ghost:hover {
    color: var(--text-primary);
    background: rgba(var(--accent-rgb), 0.1);
}

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

.btn-outline:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
    background: rgba(var(--accent-rgb), 0.1);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.btn-xs {
    padding: 4px 8px;
    font-size: 0.7rem;
}

.btn-icon {
    padding: 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.btn-icon.primary {
    background: var(--accent-gradient);
    border: none;
    color: white;
}

.btn-danger {
    background: #dc2626;
    color: white;
}

.btn-danger:hover {
    background: #b91c1c;
}

/* Grid */
.grid {
    display: grid;
    gap: 20px;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }

/* Nav right section - language + hamburger */
.nav-right {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

/* Mobile nav toggle - hidden on desktop */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-primary);
    cursor: pointer;
    padding: 4px 8px;
}

/* Grid responsive - still use media query */
@media (max-width: 900px) {
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* Mobile nav mode - triggered by JS when nav overflows */
body.nav-mobile-mode nav {
    padding: 12px 16px;
    flex-wrap: wrap;
}

body.nav-mobile-mode .brand {
    font-size: 1.1rem;
}

body.nav-mobile-mode .brand .logo {
    width: 28px;
    height: 28px;
    font-size: 0.9rem;
}

/* ==========================================
   RESPONSIVE BREAKPOINTS (centralized)
   - Mobile: < 768px
   - Tablet: 768px - 1024px
   - Desktop: > 1024px
   ========================================== */

/* Mobile: hide nav-links, show nav in user menu dropdown */
@media (max-width: 767px) {
    nav {
        padding: 12px 16px;
    }

    .brand {
        font-size: 1.1rem;
    }

    .brand .logo {
        width: 28px;
        height: 28px;
        font-size: 0.9rem;
    }

    .nav-links {
        display: none !important;
    }

    .nav-toggle {
        display: none;
    }

    /* user-menu-nav display controlled by JS syncMobileNav() */

    .lang-switcher-btn,
    .user-menu-btn {
        width: 32px;
        height: 32px;
    }

    .lang-switcher-btn .flag {
        width: 24px;
        height: 24px;
    }

    .user-avatar {
        width: 24px;
        height: 24px;
        font-size: 0.7rem;
    }

}

/* Legacy support for JS-based overflow detection */
body.nav-mobile-mode .nav-links {
    display: none !important;
}

body.nav-mobile-mode .nav-toggle {
    display: none;
}

.nav-links .admin-link i {
    color: var(--accent-color);
}

/* Feature Icons */
.feature-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: white;
    background: var(--accent-gradient);
    box-shadow: 0 0 15px var(--accent-glow);
}

/* Progress Bar */
.progress-bar {
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent-gradient);
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* Stats */
.stat-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.03em;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 500;
}

.stat-change {
    font-size: 0.75rem;
    color: var(--success-color);
    font-weight: 600;
    margin-top: 4px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 15px;
    opacity: 0.5;
}

/* Collection Item */
.collection-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s ease;
}

.collection-item:last-child {
    border-bottom: none;
}

.collection-item:hover {
    background: var(--bg-secondary);
}

.collection-name {
    font-weight: 600;
    color: var(--text-primary);
}

.collection-meta {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Language Badge */
.lang-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: rgba(102, 126, 234, 0.1);
    color: var(--accent-color);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* Language Switcher - Compact flag-only style */
.lang-switcher {
    position: relative;
}

.lang-switcher-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
}

.lang-switcher-btn:hover {
    background: var(--bg-secondary);
}

.lang-switcher-btn .flag {
    border-radius: 50%;
    width: 26px;
    height: 26px;
}

.lang-switcher-dropdown {
    position: fixed;
    top: var(--nav-height, 57px);
    right: 16px;
    margin-top: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    min-width: 180px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1001;
}

.lang-switcher.open .lang-switcher-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.lang-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.15s;
}

.lang-option:first-child {
    border-radius: 12px 12px 0 0;
}

.lang-option:last-child {
    border-radius: 0 0 12px 12px;
}

.lang-option:hover {
    background: var(--bg-secondary);
}

.lang-option.active {
    background: rgba(102, 126, 234, 0.1);
    color: var(--accent-color);
}

.lang-option .flag {
    border-radius: 50%;
}

.lang-option .name {
    font-weight: 500;
}

/* User Menu Dropdown */
.user-menu {
    position: relative;
}

.user-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
}

.user-menu-btn:hover {
    background: var(--bg-secondary);
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent-gradient);
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-menu-dropdown {
    position: fixed;
    top: var(--nav-height, 57px);
    right: 16px;
    margin-top: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1001;
    overflow: hidden;
}

.user-menu.open .user-menu-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-menu-header {
    padding: 14px 16px;
    background: var(--bg-secondary);
}

.user-menu-header .user-name {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.user-menu-header .user-email {
    display: block;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 2px;
}

.user-menu-divider {
    height: 1px;
    background: var(--border-color);
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.15s;
}

.user-menu-item:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.user-menu-item i {
    font-size: 1rem;
    width: 18px;
    text-align: center;
}

.user-menu-item.logout:hover {
    color: #ef4444;
}

.user-menu-item.disabled {
    color: var(--text-muted);
    opacity: 0.5;
    pointer-events: none;
}

/* Mobile Menu (logged-out hamburger) */
.mobile-menu {
    position: relative;
}

/* Guest nav-right: hidden on desktop, shown on mobile */
.nav-right-guest {
    display: none;
}

.mobile-cta-btn {
    font-size: 0.8rem;
    padding: 8px 14px;
}

@media (max-width: 767px) {
    .nav-right-guest {
        display: flex;
    }
}

.mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 1.4rem;
    transition: all 0.2s;
}

.mobile-menu-btn:hover {
    background: var(--bg-secondary);
}

.mobile-menu-dropdown {
    position: fixed;
    top: var(--nav-height, 57px);
    right: 16px;
    margin-top: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    min-width: 180px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1001;
    overflow: hidden;
}

.mobile-menu.open .mobile-menu-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.mobile-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.15s;
}

.mobile-menu-item:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.mobile-menu-item i {
    font-size: 1rem;
    width: 18px;
    text-align: center;
}

.mobile-menu-item.accent {
    color: var(--accent-color);
    font-weight: 500;
}

.mobile-menu-item.accent:hover {
    background: var(--accent-color);
    color: white;
}

.mobile-menu-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}


/* Mobile nav items in user menu - controlled by JS */
.user-menu-nav {
    display: none;
}

/* Disabled nav links */
.nav-links a.disabled {
    color: var(--text-muted);
    opacity: 0.5;
    pointer-events: none;
}

/* Modal Overlay */
body.modal-open {
    overflow: hidden;
}

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1100;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
}

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

.modal {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 24px;
    width: 90%;
    max-width: 450px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.2rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.modal-actions .btn {
    flex: 1;
}

/* Form Elements */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: inherit;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent-color);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

.form-help {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ============================================================================
   CHANNEL SELECTION BUTTONS - Reusable 2-state system
   ============================================================================ */

/* Base channel button - UNCHECKED STATE */
.channel-btn,
label.channel-btn,
button.channel-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.15s ease;
    user-select: none;
    text-decoration: none;
}

.channel-btn:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
    background: rgba(var(--accent-rgb), 0.1);
}

/* CHECKED STATE */
.channel-btn.selected {
    border-color: var(--accent-color);
    background: rgba(var(--accent-rgb), 0.1);
    color: var(--accent-color);
}

.channel-btn.selected i {
    color: var(--accent-color);
}

/* DISABLED STATE (e.g., Telegram not connected) */
.channel-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.channel-btn.disabled:hover {
    border-color: var(--border-color);
    color: var(--text-secondary);
    background: transparent;
}

/* LOCKED STATE (Premium only feature) */
.channel-btn.locked {
    opacity: 0.6;
    cursor: pointer; /* Still clickable for upgrade CTA */
}

/* Hide actual checkbox input */
.channel-btn input[type="checkbox"] {
    display: none;
}

/* ============================================================================
   TOAST NOTIFICATION SYSTEM - Global reusable toasts
   ============================================================================ */

.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    min-width: 320px;
    max-width: 500px;
    padding: 16px 20px;
    border-radius: 12px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    animation: slideIn 0.3s ease-out;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

/* Progress toast - compact/tucked by default, expands on hover */
.toast.progress {
    min-width: auto;
    max-width: none;
    padding: 10px 14px;
    border-radius: 20px;
    border-left: 3px solid var(--accent-color);
    cursor: pointer;
    transition: all 0.2s ease;
}

.toast.progress .toast-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toast.progress .toast-title {
    display: none;
    margin: 0;
}

.toast.progress .toast-message {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-primary);
    white-space: nowrap;
}

.toast.progress .toast-progress-bar {
    display: none;
}

/* Expanded state on hover */
.toast.progress:hover {
    min-width: 280px;
    padding: 14px 18px;
    border-radius: 12px;
}

.toast.progress:hover .toast-content {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
}

.toast.progress:hover .toast-title {
    display: block;
}

.toast.progress:hover .toast-message {
    font-weight: 400;
    color: var(--text-secondary);
}

.toast.progress:hover .toast-progress-bar {
    display: block;
}

.toast.success {
    border-left: 4px solid #22c55e;
}

.toast.error {
    border-left: 4px solid #ef4444;
}

.toast.warning {
    border-left: 4px solid #f59e0b;
}

.toast-icon {
    font-size: 20px;
    line-height: 1;
    flex-shrink: 0;
}

.toast.success .toast-icon {
    color: #22c55e;
}

.toast.error .toast-icon {
    color: #ef4444;
}

.toast.warning .toast-icon {
    color: #f59e0b;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.toast-message {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.toast-close:hover {
    opacity: 1;
}

.toast.progress .toast-icon {
    color: var(--accent-color);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.toast-progress-bar {
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    margin-top: 10px;
    overflow: hidden;
}

.toast-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-color), #a78bfa);
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* ==========================================
   UTILITY CLASSES
   Reusable atomic classes for common patterns
   ========================================== */

/* Display */
.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }
.d-grid { display: grid; }
.d-inline-flex { display: inline-flex; }

/* Flexbox */
.flex-row { flex-direction: row; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }

/* Gap */
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-10 { gap: 10px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.gap-24 { gap: 24px; }

/* Margin */
.m-0 { margin: 0; }
.mt-0 { margin-top: 0; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-4 { margin-bottom: 4px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-15 { margin-bottom: 15px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }
.ml-8 { margin-left: 8px; }
.ml-12 { margin-left: 12px; }
.ml-auto { margin-left: auto; }
.mr-auto { margin-right: auto; }
.mx-auto { margin-left: auto; margin-right: auto; }

/* Padding */
.p-0 { padding: 0; }
.p-8 { padding: 8px; }
.p-12 { padding: 12px; }
.p-16 { padding: 16px; }
.p-20 { padding: 20px; }
.p-24 { padding: 24px; }
.py-20 { padding-top: 20px; padding-bottom: 20px; }
.px-12 { padding-left: 12px; padding-right: 12px; }
.px-16 { padding-left: 16px; padding-right: 16px; }

/* Width */
.w-full { width: 100%; }
.w-auto { width: auto; }
.max-w-400 { max-width: 400px; }
.max-w-500 { max-width: 500px; }
.max-w-580 { max-width: 580px; }

/* Text alignment */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* Text colors */
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent-color); }
.text-success { color: var(--success-color); }
.text-error { color: var(--error-color); }
.text-white { color: white; }

/* Links */
.link-accent { color: var(--accent-color); text-decoration: none; }
.link-accent:hover { text-decoration: underline; }
.no-underline { text-decoration: none; }

/* Font size */
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.85rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.1rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 2rem; }
.text-4xl { font-size: 4rem; }

/* Text transform */
.uppercase { text-transform: uppercase; }
.lowercase { text-transform: lowercase; }
.capitalize { text-transform: capitalize; }
.tracking-wide { letter-spacing: 0.5px; }

/* Font weight */
.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* Border radius */
.rounded { border-radius: 8px; }
.rounded-lg { border-radius: 12px; }
.rounded-xl { border-radius: 16px; }
.rounded-full { border-radius: 9999px; }

/* Opacity */
.opacity-50 { opacity: 0.5; }
.opacity-70 { opacity: 0.7; }

/* Cursor */
.cursor-pointer { cursor: pointer; }
.cursor-not-allowed { cursor: not-allowed; }

/* Visibility */
.invisible { visibility: hidden; }
.visible { visibility: visible; }

/* Overflow */
.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }

/* Position */
.relative { position: relative; }
.absolute { position: absolute; }
.sticky { position: sticky; }

/* Border */
.border { border: 1px solid var(--border-color); }
.border-t { border-top: 1px solid var(--border-color); }
.border-b { border-bottom: 1px solid var(--border-color); }
.border-none { border: none; }

/* Background */
.bg-primary { background: var(--bg-primary); }
.bg-secondary { background: var(--bg-secondary); }
.bg-card { background: var(--card-bg); }
.bg-transparent { background: transparent; }

/* Common component patterns */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
}

.divider {
    height: 1px;
    background: var(--border-color);
    margin: 16px 0;
}

/* Modal components */
.modal-icon {
    width: 40px;
    height: 40px;
    margin: 0;
}

.modal-icon i {
    font-size: 1rem;
}

.modal-description {
    color: var(--text-muted);
    margin-bottom: 20px;
}

.modal-sm {
    max-width: 400px;
}

.modal-md {
    max-width: 580px;
}

/* Label hint for optional fields */
.label-hint {
    color: var(--text-muted);
    font-weight: normal;
}

/* Flag placeholder icon - aligns with flag images */
.flag-icon-placeholder {
    width: 22px;
    text-align: center;
}

/* Spinner */
.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(var(--accent-rgb), 0.3);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.spinner-sm {
    width: 12px;
    height: 12px;
}

.spinner-lg {
    width: 24px;
    height: 24px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

/* ============================================
   Level Pills - Shared across all components
   ============================================ */

.level-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

/* HSK Levels (Chinese) */
.level-hsk-1, .level-1 { background: #e8f5e9; color: #2e7d32; }
.level-hsk-2, .level-2 { background: #e3f2fd; color: #1565c0; }
.level-hsk-3, .level-3 { background: #fff3e0; color: #ef6c00; }
.level-hsk-4, .level-4 { background: #fce4ec; color: #c2185b; }
.level-hsk-5, .level-5 { background: #f3e5f5; color: #7b1fa2; }
.level-hsk-6, .level-6 { background: #ffebee; color: #c62828; }
.level-hsk-7, .level-7 { background: #eceff1; color: #546e7a; }

/* CEFR Levels (European languages) */
.level-a1, .level-cefr-a1 { background: #e0f7fa; color: #00838f; }
.level-a2, .level-cefr-a2 { background: #e0f2f1; color: #00796b; }
.level-b1, .level-cefr-b1 { background: #e8f5e9; color: #388e3c; }
.level-b2, .level-cefr-b2 { background: #fff8e1; color: #f9a825; }
.level-c1, .level-cefr-c1 { background: #fce4ec; color: #c2185b; }
.level-c2, .level-cefr-c2 { background: #ede7f6; color: #5e35b1; }

/* JLPT Levels (Japanese) */
.level-n5, .level-jlpt-n5 { background: #e8f5e9; color: #2e7d32; }
.level-n4, .level-jlpt-n4 { background: #e3f2fd; color: #1565c0; }
.level-n3, .level-jlpt-n3 { background: #fff3e0; color: #ef6c00; }
.level-n2, .level-jlpt-n2 { background: #fce4ec; color: #c2185b; }
.level-n1, .level-jlpt-n1 { background: #c5cae9; color: #303f9f; }

/* TOPIK Levels (Korean) */
.level-topik-1 { background: #e3f2fd; color: #1565c0; }
.level-topik-2 { background: #bbdefb; color: #0d47a1; }
.level-topik-3 { background: #c8e6c9; color: #2e7d32; }
.level-topik-4 { background: #a5d6a7; color: #1b5e20; }
.level-topik-5 { background: #ffcdd2; color: #c62828; }
.level-topik-6 { background: #ef9a9a; color: #b71c1c; }

/* TORFL Levels (Russian) */
.level-torfl-a1 { background: #fff3e0; color: #e65100; }
.level-torfl-a2 { background: #ffebee; color: #c62828; }
.level-torfl-b1 { background: #fce4ec; color: #ad1457; }
.level-torfl-b2 { background: #f3e5f5; color: #6a1b9a; }
.level-torfl-c1 { background: #ede7f6; color: #4527a0; }
.level-torfl-c2 { background: #e8eaf6; color: #283593; }

/* Unknown/Default */
.level-unknown { background: #f5f5f5; color: #757575; }
