/* ============================================
   BOT MANAGER - ROYAL NOIR GOLD 2026
   Professional Deep Navy + Gold/Amber Theme
   NO Purple, NO Green - Pure Elegance
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=Space+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    /* Deep Noir Background */
    --bg-base: #08090c;
    --bg-elevated: #0e1015;
    --bg-surface: #14161c;
    --bg-hover: #1c1f28;

    /* Glassmorphism */
    --glass-bg: rgba(20, 22, 28, 0.7);
    --glass-bg-light: rgba(30, 34, 45, 0.5);
    --glass-border: rgba(255, 255, 255, 0.05);
    --glass-border-light: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);

    /* Text */
    --text-primary: #f8f9fa;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;

    /* Primary - Deep Navy Blue */
    --accent-primary: #1e40af;
    --accent-primary-light: #3b82f6;
    --accent-primary-lighter: #60a5fa;
    --accent-primary-glow: rgba(59, 130, 246, 0.1);

    /* Secondary - Warm Gold/Amber */
    --accent-gold: #d97706;
    --accent-gold-light: #f59e0b;
    --accent-gold-bright: #fbbf24;
    --accent-gold-glow: rgba(245, 158, 11, 0.1);

    /* Status Colors */
    --status-success: #22c55e;
    --status-warning: #f59e0b;
    --status-danger: #ef4444;
    --status-info: #3b82f6;

    /* Cyan accent for data */
    --accent-cyan: #06b6d4;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    --gradient-gold: linear-gradient(135deg, #d97706 0%, #f59e0b 50%, #fbbf24 100%);
    --gradient-royal: linear-gradient(135deg, #1e3a8a 0%, #1e40af 50%, #2563eb 100%);
    --gradient-premium: linear-gradient(135deg, #1e40af 0%, #3b82f6 50%, #60a5fa 100%);

    /* Layout */
    --sidebar-width: 280px;
    --header-height: 72px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --transition-base: 200ms ease;
    --transition-smooth: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, sans-serif;
    background: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

.app-container {
    display: flex;
    min-height: 100vh;
    position: relative;
}

/* ============================================
   SUBTLE AMBIENT BACKGROUND
   ============================================ */
.ambient-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
    background:
        radial-gradient(ellipse at 0% 0%, rgba(30, 64, 175, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 100% 100%, rgba(217, 119, 6, 0.05) 0%, transparent 50%);
}

.gradient-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    animation: subtleFloat 25s ease-in-out infinite;
}

.orb-1 {
    width: 600px;
    height: 600px;
    background: var(--gradient-royal);
    top: -200px;
    left: -150px;
    opacity: 0.12;
}

.orb-2 {
    width: 400px;
    height: 400px;
    background: var(--gradient-gold);
    bottom: -100px;
    right: -100px;
    opacity: 0.08;
    animation-delay: -12s;
}

@keyframes subtleFloat {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    50% {
        transform: translate(20px, -20px) scale(1.02);
    }
}

/* ============================================
   SIDEBAR - Clean Professional
   ============================================ */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, rgba(14, 16, 21, 0.98) 0%, rgba(8, 9, 12, 0.99) 100%);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--glass-border);
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--glass-border);
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-logo {
    width: 46px;
    height: 46px;
    background: var(--gradient-primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px var(--accent-primary-glow);
    position: relative;
}

.brand-logo::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, transparent 50%);
    border-radius: var(--radius-md);
}

.brand-logo svg {
    width: 24px;
    height: 24px;
    color: white;
    position: relative;
    z-index: 1;
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-name {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    background: linear-gradient(135deg, #60a5fa 0%, #93c5fd 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.brand-tag {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--accent-gold-light);
    text-transform: uppercase;
    letter-spacing: 0.15em;
}

/* Navigation */
.nav-menu {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 24px;
}

.nav-label {
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    padding: 0 14px;
    margin-bottom: 8px;
    display: block;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.88rem;
    transition: var(--transition-base);
    margin-bottom: 3px;
    position: relative;
}

.nav-item svg {
    width: 19px;
    height: 19px;
    transition: var(--transition-base);
}

.nav-item:hover {
    background: rgba(59, 130, 246, 0.08);
    color: var(--text-primary);
}

.nav-item:hover svg {
    color: var(--accent-primary-light);
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(30, 64, 175, 0.2) 0%, rgba(59, 130, 246, 0.08) 100%);
    color: var(--text-primary);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 55%;
    background: var(--gradient-gold);
    border-radius: 0 3px 3px 0;
}

.nav-item.active svg {
    color: var(--accent-gold-light);
}

.nav-badge {
    margin-left: auto;
    padding: 3px 9px;
    background: var(--gradient-primary);
    color: white;
    font-size: 0.68rem;
    font-weight: 600;
    border-radius: 12px;
}

.nav-badge.danger {
    background: linear-gradient(135deg, #dc2626, #ef4444);
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 18px;
    border-top: 1px solid var(--glass-border);
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    padding: 10px 14px;
    background: var(--glass-bg);
    border-radius: var(--radius-md);
    border: 1px solid var(--glass-border);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-dot.connected {
    background: var(--status-success);
}

.status-dot.disconnected {
    background: var(--status-danger);
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    position: relative;
    z-index: 1;
    max-width: 100%;
    overflow-x: hidden;
}

.header {
    height: var(--header-height);
    padding: 0 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(8, 9, 12, 0.95);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.page-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
}

.header-right {
    display: flex;
    gap: 10px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ============================================
   SECTIONS
   ============================================ */
.section {
    display: none;
    padding: 28px;
    max-width: 100%;
    overflow-x: hidden;
}

.section.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-toolbar {
    margin-bottom: 22px;
}

.bot-selector {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.bot-selector label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.row-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ============================================
   GLASS CARDS - PREMIUM 2026
   ============================================ */
.content-card {
    margin-bottom: 22px;
}

.glass-card {
    background: linear-gradient(145deg, rgba(22, 25, 32, 0.85) 0%, rgba(12, 14, 18, 0.75) 100%);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-lg);
    padding: 24px;
    position: relative;
    overflow: hidden;
    box-shadow:
        0 4px 24px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.03) inset,
        0 1px 0 rgba(255, 255, 255, 0.05) inset;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(59, 130, 246, 0.3) 30%, rgba(245, 158, 11, 0.2) 70%, transparent 100%);
}

.glass-card:hover {
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.5),
        0 0 60px rgba(59, 130, 246, 0.08),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    transform: translateY(-2px);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.header-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-title svg {
    width: 22px;
    height: 22px;
    color: var(--accent-gold-light);
    filter: drop-shadow(0 2px 8px var(--accent-gold-glow));
}

.header-title h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.header-actions {
    display: flex;
    gap: 8px;
}

/* ============================================
   STATS - PREMIUM
   ============================================ */
.stats-row {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
    padding: 16px 0;
    border-bottom: 1px solid var(--glass-border);
}

.stat-mini {
    text-align: center;
    padding: 14px 20px;
    background: linear-gradient(145deg, rgba(30, 34, 45, 0.6) 0%, rgba(20, 22, 28, 0.5) 100%);
    border-radius: var(--radius-md);
    border: 1px solid var(--glass-border);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-mini::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent-primary-light), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.stat-mini:hover {
    border-color: var(--accent-primary-light);
    background: rgba(59, 130, 246, 0.08);
    transform: translateY(-2px);
}

.stat-mini:hover::before {
    opacity: 1;
}

.stat-mini .label {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-mini .value {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-mini .value.success {
    color: var(--status-success);
}

.stat-mini .value.danger {
    color: var(--status-danger);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 24px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 22px;
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.stat-icon::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
    border-radius: var(--radius-md);
}

.stat-icon svg {
    width: 26px;
    height: 26px;
    color: white;
    position: relative;
    z-index: 1;
}

.stat-info {
    flex: 1;
}

.stat-value {
    display: block;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.9rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Gradients - NO PURPLE, NO GREEN */
.gradient-purple {
    background: var(--gradient-primary);
}

.gradient-blue {
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
}

.gradient-green {
    background: var(--gradient-gold);
}

.gradient-red {
    background: linear-gradient(135deg, #b91c1c, #ef4444);
}

.gradient-cyan {
    background: linear-gradient(135deg, #0891b2, #06b6d4);
}

.gradient-orange {
    background: var(--gradient-gold);
}

.gradient-pink {
    background: linear-gradient(135deg, #ec4899, #f472b6);
}

/* ============================================
   DATABASE TREE
   ============================================ */
.db-url {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
    padding: 5px 10px;
    background: var(--glass-bg);
    border-radius: var(--radius-sm);
    border: 1px solid var(--glass-border);
}

.db-tree {
    max-height: 480px;
    overflow-y: auto;
    max-width: 100%;
    overflow-x: auto;
}

.db-node {
    margin-bottom: 6px;
}

.db-node-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: rgba(30, 64, 175, 0.06);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-base);
    border: 1px solid transparent;
    user-select: none;
}

.db-node-header:hover {
    background: rgba(30, 64, 175, 0.1);
    border-color: var(--glass-border);
}

.db-node-header svg {
    width: 16px;
    height: 16px;
    color: var(--accent-gold-light);
    flex-shrink: 0;
}

/* Chevron icon for expand/collapse */
.db-node-header .chevron-icon {
    width: 14px;
    height: 14px;
    color: var(--text-muted);
    transition: transform 0.3s ease;
}

.db-node.expanded>.db-node-header .chevron-icon {
    transform: rotate(90deg);
}

.db-node-key {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
}

.db-node-count {
    margin-left: auto;
    font-size: 0.72rem;
    color: var(--text-muted);
    background: var(--bg-surface);
    padding: 3px 9px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
}

.db-node-children {
    margin-left: 20px;
    margin-top: 4px;
    border-left: 2px solid var(--glass-border);
    padding-left: 12px;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.db-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.db-item svg {
    width: 14px;
    height: 14px;
    color: var(--text-muted);
}

.db-item .db-dot {
    width: 6px;
    height: 6px;
    color: var(--accent-gold-light);
    opacity: 0.6;
}

.db-item-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 400px;
    color: var(--accent-cyan);
}

.loading-state {
    text-align: center;
    padding: 44px;
    color: var(--text-muted);
}

.loading-state svg {
    width: 36px;
    height: 36px;
    margin-bottom: 14px;
    color: var(--accent-primary-light);
}

.spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   DATA LIST
   ============================================ */
.data-list {
    max-height: 420px;
    overflow-y: auto;
    max-width: 100%;
    overflow-x: auto;
}

.data-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    background: linear-gradient(145deg, rgba(30, 64, 175, 0.06) 0%, rgba(30, 64, 175, 0.02) 100%);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    transition: all 0.3s ease;
    position: relative;
}

.data-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: var(--gradient-primary);
    border-radius: 0 3px 3px 0;
    transition: height 0.3s ease;
}

.data-item:hover {
    background: linear-gradient(145deg, rgba(30, 64, 175, 0.12) 0%, rgba(59, 130, 246, 0.06) 100%);
    border-color: rgba(59, 130, 246, 0.15);
    transform: translateX(4px);
}

.data-item:hover::before {
    height: 60%;
}

.data-item .item-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(30, 64, 175, 0.15) 0%, rgba(59, 130, 246, 0.1) 100%);
    border: 1px solid rgba(59, 130, 246, 0.15);
}

.data-item .item-icon svg {
    width: 18px;
    height: 18px;
    color: var(--accent-gold-light);
}

.data-item .item-content {
    flex: 1;
    overflow: hidden;
}

.data-item .item-value {
    display: block;
    font-size: 0.88rem;
    font-family: 'JetBrains Mono', monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 400px;
    word-break: break-all;
}

.data-item .item-meta {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.data-item .item-actions {
    display: flex;
    gap: 6px;
}

.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: var(--text-muted);
}

.empty-state svg {
    width: 50px;
    height: 50px;
    margin-bottom: 14px;
    opacity: 0.4;
    color: var(--accent-primary-light);
}

.empty-state p {
    font-size: 0.9rem;
}

/* ============================================
   FORMS
   ============================================ */
.config-form,
.groq-config {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.input-modern {
    padding: 12px 16px;
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.92rem;
    font-family: 'Plus Jakarta Sans', sans-serif;
    transition: var(--transition-base);
    outline: none;
    width: 100%;
}

.input-modern:hover {
    border-color: var(--glass-border-light);
}

.input-modern:focus {
    border-color: var(--accent-primary-light);
    box-shadow: 0 0 0 3px var(--accent-primary-glow);
}

.input-modern::placeholder {
    color: var(--text-muted);
}

.input-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 3px;
}

.input-with-btn {
    display: flex;
    gap: 8px;
}

.input-with-btn .input-modern {
    flex: 1;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.select-modern {
    padding: 10px 16px;
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.92rem;
    cursor: pointer;
    outline: none;
    min-width: 190px;
    transition: var(--transition-base);
}

.select-modern:hover {
    border-color: var(--glass-border-light);
}

.select-modern:focus {
    border-color: var(--accent-primary-light);
}

/* ============================================
   BUTTONS - Professional Gold Accents
   ============================================ */
.btn-primary,
.btn-secondary,
.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    border: none;
    position: relative;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 4px 16px var(--accent-primary-glow);
}

.btn-primary::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
    border-radius: var(--radius-md);
    opacity: 0;
    transition: var(--transition-base);
}

.btn-primary:hover {
    box-shadow: 0 6px 24px var(--accent-primary-glow);
    transform: translateY(-2px);
}

.btn-primary:hover::before {
    opacity: 1;
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background: var(--glass-bg);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--glass-border-light);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.12);
    color: var(--status-danger);
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
}

.btn-sm {
    padding: 8px 14px;
    font-size: 0.82rem;
}

.btn-full {
    width: 100%;
}

.btn-primary svg,
.btn-secondary svg,
.btn-danger svg {
    width: 16px;
    height: 16px;
}

.btn-icon {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-base);
}

.btn-icon svg {
    width: 16px;
    height: 16px;
}

.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--accent-gold-light);
    border-color: var(--glass-border-light);
}

.btn-icon.danger:hover {
    background: rgba(239, 68, 68, 0.12);
    color: var(--status-danger);
}

.btn-icon-ghost {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-base);
}

.btn-icon-ghost svg {
    width: 18px;
    height: 18px;
}

.btn-icon-ghost:hover {
    background: var(--glass-bg);
    color: var(--text-primary);
}

/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(8, 9, 12, 0.92);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    width: 100%;
    max-width: 440px;
    animation: modalIn 0.25s ease;
}

.modal.modal-sm {
    max-width: 380px;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

.modal-header h3 {
    display: flex;
    align-items: center;
    gap: 9px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.15rem;
}

.modal-header h3 svg {
    width: 20px;
    height: 20px;
    color: var(--accent-gold-light);
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.modal-desc {
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 8px;
}

/* ============================================
   TOAST
   ============================================ */
.toast-container {
    position: fixed;
    bottom: 22px;
    right: 22px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: rgba(14, 16, 21, 0.98);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    animation: slideIn 0.35s ease;
    min-width: 280px;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(80px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.toast.success {
    border-left: 3px solid var(--status-success);
}

.toast.success svg {
    color: var(--status-success);
}

.toast.error {
    border-left: 3px solid var(--status-danger);
}

.toast.error svg {
    color: var(--status-danger);
}

.toast.info {
    border-left: 3px solid var(--accent-primary-light);
}

.toast.info svg {
    color: var(--accent-primary-light);
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    font-size: 0.9rem;
    display: block;
}

.toast-message {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.loading {
    opacity: 0.5;
    pointer-events: none;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--bg-surface);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}

/* Webshare */
.webshare-entry {
    margin-bottom: 10px;
}

.item-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 5px;
}

.item-meta {
    font-size: 0.72rem;
    color: var(--text-muted);
    padding: 3px 8px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    border: 1px solid var(--glass-border);
}

.item-meta.success {
    color: var(--status-success);
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.2);
}

.item-meta.warning {
    color: var(--accent-gold-light);
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.2);
}

.proxy-expand {
    margin-top: 10px;
    margin-left: 52px;
    padding: 14px;
    background: rgba(30, 64, 175, 0.06);
    border-radius: var(--radius-md);
    border-left: 2px solid var(--accent-primary-light);
}

.proxy-list-mini {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 6px;
    max-height: 200px;
    overflow-y: auto;
}

.proxy-item {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 7px 10px;
    background: var(--glass-bg);
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-secondary);
    border: 1px solid var(--glass-border);
}

.proxy-item svg {
    width: 13px;
    height: 13px;
    color: var(--accent-cyan);
    flex-shrink: 0;
}

.proxy-more {
    grid-column: 1 / -1;
    text-align: center;
    padding: 8px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* Firebase Stats */
.firebase-stats {
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin-top: 18px;
}

.firebase-stat-row {
    display: flex;
    gap: 14px;
}

.firebase-stat-row.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
}

.firebase-stat-row.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
}

.firebase-stat-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: rgba(30, 64, 175, 0.05);
    border-radius: var(--radius-md);
    border: 1px solid var(--glass-border);
    transition: var(--transition-base);
}

.firebase-stat-item:hover {
    border-color: var(--glass-border-light);
    background: rgba(30, 64, 175, 0.08);
}

.firebase-stat-item.main {
    flex: 1;
    padding: 20px;
}

.stat-icon-sm {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
}

.stat-icon-sm::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
    border-radius: var(--radius-sm);
}

.stat-icon-sm svg {
    width: 20px;
    height: 20px;
    color: white;
    position: relative;
    z-index: 1;
}

.stat-detail {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.stat-value-lg {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-hint {
    font-size: 0.68rem;
    color: var(--text-muted);
}

.usage-bar-lg {
    height: 6px;
    background: var(--bg-surface);
    border-radius: 3px;
    overflow: hidden;
    margin: 5px 0;
}

.usage-fill {
    height: 100%;
    background: var(--gradient-gold);
    border-radius: 3px;
    transition: width 0.4s ease;
}

.firebase-note {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 18px;
    background: rgba(30, 64, 175, 0.08);
    border-radius: var(--radius-md);
    border: 1px solid rgba(59, 130, 246, 0.15);
    margin-top: 18px;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.firebase-note svg {
    width: 16px;
    height: 16px;
    color: var(--accent-primary-light);
    flex-shrink: 0;
    margin-top: 2px;
}

.firebase-note a {
    color: var(--accent-primary-light);
    text-decoration: underline;
}

.firebase-note a:hover {
    color: var(--accent-gold-light);
}

.usage-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
}

.usage-item {
    text-align: center;
    padding: 18px;
    background: var(--glass-bg);
    border-radius: var(--radius-md);
    border: 1px solid var(--glass-border);
}

.usage-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.usage-value {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.usage-bar {
    margin-top: 8px;
    height: 5px;
    background: var(--bg-surface);
    border-radius: 3px;
    overflow: hidden;
}

/* ============================================
   RESPONSIVE DESIGN - FULL DEVICE SUPPORT
   ============================================ */

/* Hamburger Menu Button */
.btn-menu-toggle {
    display: none;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    color: var(--text-secondary);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: var(--transition-base);
    flex-shrink: 0;
}

.btn-menu-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-menu-toggle svg {
    width: 20px;
    height: 20px;
}

/* Sidebar Overlay for Mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.visible {
    opacity: 1;
}

/* Desktop Large (1400px+) */
@media (min-width: 1400px) {

    .dashboard-grid,
    .firebase-stat-row.grid-4 {
        grid-template-columns: repeat(4, 1fr);
    }

    .section {
        padding: 28px;
    }
}

/* Desktop (1200px - 1400px) */
@media (max-width: 1400px) {

    .dashboard-grid,
    .firebase-stat-row.grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Tablet Landscape (1024px - 1200px) */
@media (max-width: 1200px) {
    :root {
        --sidebar-width: 260px;
    }

    .firebase-stat-row.grid-4,
    .firebase-stat-row.grid-3,
    .usage-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .section {
        padding: 22px;
    }
}

/* Tablet Portrait (768px - 1024px) */
@media (max-width: 1024px) {
    :root {
        --sidebar-width: 240px;
    }

    .sidebar {
        width: var(--sidebar-width);
    }

    .main-content {
        margin-left: var(--sidebar-width);
    }

    .brand-name {
        font-size: 1.1rem;
    }

    .nav-item {
        padding: 11px 16px;
        font-size: 0.9rem;
    }

    .page-title {
        font-size: 1.4rem;
    }

    .glass-card {
        padding: 18px;
    }

    .section-title {
        font-size: 1rem;
    }
}

/* Mobile Landscape / Small Tablet (768px) */
@media (max-width: 768px) {

    /* Show hamburger menu */
    .btn-menu-toggle {
        display: flex;
    }

    /* Sidebar becomes overlay - fix 100vh issue on iOS */
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        height: 100dvh;
        /* Dynamic viewport height - better on iOS */
        max-height: -webkit-fill-available;
        /* iOS Safari fallback */
        width: 280px;
        transform: translateX(-100%);
        z-index: 200;
        transition: transform 0.3s ease;
        display: flex;
        flex-direction: column;
    }

    /* Ensure footer is always visible at bottom */
    .sidebar-footer {
        flex-shrink: 0;
        margin-top: auto;
    }

    /* Nav menu takes remaining space but scrolls */
    .nav-menu {
        flex: 1;
        overflow-y: auto;
        min-height: 0;
        /* Important for flex scrolling */
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 30px rgba(0, 0, 0, 0.4);
    }

    .sidebar-overlay {
        display: block;
    }

    .main-content {
        margin-left: 0;
        width: 100%;
    }

    .header {
        padding: 0 16px;
    }

    .header-left {
        gap: 12px;
    }

    .page-title {
        font-size: 1.25rem;
    }

    .section {
        padding: 16px;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .firebase-stat-row.grid-4,
    .firebase-stat-row.grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }

    .bot-selector {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .bot-selector .select-modern {
        width: 100%;
    }

    .glass-card {
        padding: 16px;
    }

    .section-title {
        font-size: 0.95rem;
    }

    /* Modal adjustments */
    .modal-content {
        width: 95%;
        max-width: 400px;
        margin: 20px;
        max-height: 90vh;
    }

    .modal-body {
        padding: 18px;
    }

    /* Data items */
    .data-item {
        flex-wrap: wrap;
    }

    .item-actions {
        width: 100%;
        justify-content: flex-end;
        margin-top: 10px;
        padding-top: 10px;
        border-top: 1px solid var(--glass-border);
    }

    /* Button text hide on mobile */
    .btn-secondary span {
        display: none;
    }

    .btn-secondary {
        padding: 10px;
        min-width: 40px;
    }

    /* Theme toggle smaller */
    .btn-theme-toggle {
        width: 40px;
        height: 40px;
    }
}

/* Mobile Portrait (600px and below) */
@media (max-width: 600px) {

    .firebase-stat-row.grid-4,
    .firebase-stat-row.grid-3,
    .usage-stats {
        grid-template-columns: 1fr;
    }

    .stats-row {
        flex-direction: column;
        gap: 10px;
    }

    .stat-mini {
        padding: 14px;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .header {
        height: 60px;
    }

    .page-title {
        font-size: 1.1rem;
    }

    .section {
        padding: 12px;
    }

    .glass-card {
        padding: 14px;
        border-radius: var(--radius-md);
    }

    .toast {
        min-width: auto;
        margin: 0 12px;
        font-size: 0.85rem;
    }

    .toast-container {
        bottom: 12px;
    }

    /* DB Tree adjustments */
    .db-tree {
        max-height: 350px;
    }

    .db-node-header {
        padding: 8px 12px;
        font-size: 0.85rem;
    }

    .db-node-children {
        margin-left: 12px;
        padding-left: 10px;
    }

    .db-item {
        font-size: 0.78rem;
        padding: 5px 8px;
    }

    /* Form elements */
    .input-modern,
    .select-modern {
        padding: 10px 12px;
        font-size: 0.9rem;
    }

    .btn-primary {
        padding: 10px 18px;
        font-size: 0.9rem;
    }

    /* Firebase info card */
    .firebase-stat-item {
        padding: 12px;
    }

    .firebase-note {
        font-size: 0.78rem;
        padding: 10px 14px;
    }

    /* Proxy items */
    .proxy-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .proxy-item .btn-icon {
        align-self: flex-end;
    }
}

/* Very Small Mobile (480px and below) */
@media (max-width: 480px) {
    .sidebar {
        width: 100%;
    }

    .brand-logo {
        width: 36px;
        height: 36px;
    }

    .brand-name {
        font-size: 1rem;
    }

    .login-card {
        padding: 24px 18px;
    }

    .login-title {
        font-size: 1.4rem;
    }

    .upload-zone {
        padding: 28px 16px;
    }

    .upload-icon svg {
        width: 36px;
        height: 36px;
    }

    .upload-text {
        font-size: 0.9rem;
    }

    .format-code {
        font-size: 0.72rem;
    }

    .header-right {
        gap: 6px;
    }

    .btn-theme-toggle,
    .btn-secondary {
        width: 36px;
        height: 36px;
        min-width: 36px;
    }

    .btn-theme-toggle svg,
    .btn-secondary svg {
        width: 16px;
        height: 16px;
    }

    /* Stat cards */
    .stat-icon {
        width: 40px;
        height: 40px;
    }

    .stat-icon svg {
        width: 18px;
        height: 18px;
    }

    .stat-value {
        font-size: 1.3rem;
    }

    .stat-label {
        font-size: 0.72rem;
    }

    /* Usage bar */
    .usage-bar-lg {
        height: 6px;
    }

    /* Item value truncate */
    .item-value,
    .db-item-value {
        max-width: 180px;
    }
}

/* Height-based adjustments for landscape mode */
@media (max-height: 600px) and (orientation: landscape) {
    .sidebar {
        overflow-y: auto;
    }

    .nav-menu {
        max-height: calc(100vh - 180px);
        overflow-y: auto;
    }

    .sidebar-footer {
        position: relative;
    }

    .login-card {
        max-height: 90vh;
        overflow-y: auto;
    }
}

/* Print styles */
@media print {

    .sidebar,
    .btn-menu-toggle,
    .btn-theme-toggle,
    .btn-logout,
    .toast-container {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
    }

    .glass-card {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}

.item-value {
    max-width: 400px;
    word-break: break-all;
}

/* ============================================
   MOBILE UI FIXES
   ============================================ */

/* Fix URL/text overflow on mobile */
@media (max-width: 768px) {

    /* Database URL wrapping */
    .db-url {
        word-break: break-all;
        white-space: normal;
        line-height: 1.5;
    }

    /* Login screen format code */
    .format-code {
        font-size: 0.7rem;
        line-height: 1.4;
        word-break: break-all;
        white-space: pre-wrap;
        overflow-x: hidden;
    }

    .config-format {
        padding: 12px;
        overflow: hidden;
    }

    /* Upload zone adjustments */
    .upload-zone {
        padding: 30px 16px;
    }

    .upload-icon svg {
        width: 40px;
        height: 40px;
    }

    .login-title {
        font-size: 1.5rem;
    }

    .login-subtitle {
        font-size: 0.85rem;
    }

    /* Firebase stat cards - tighter layout */
    .firebase-info-card {
        padding: 14px;
    }

    .firebase-stat-row {
        gap: 10px;
    }

    /* Tree node improvements for touch */
    .db-node-header {
        min-height: 44px;
        padding: 10px 14px;
    }

    .db-node-key {
        flex: 1;
        word-break: break-word;
    }

    .db-node-count {
        flex-shrink: 0;
        font-size: 0.68rem;
        padding: 2px 6px;
    }

    /* Item values truncate properly */
    .db-item-value,
    .item-value {
        max-width: 150px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Sidebar footer on mobile */
    .sidebar-footer {
        padding: 12px 16px;
    }

    .connection-status {
        padding: 8px 12px;
        font-size: 0.8rem;
    }

    .btn-logout {
        padding: 8px 12px;
        font-size: 0.8rem;
    }

    /* Reduce section gaps */
    .section>.glass-card+.glass-card {
        margin-top: 12px;
    }
}

@media (max-width: 480px) {

    /* Extra small screen fixes */
    .db-item-value,
    .item-value {
        max-width: 120px;
    }

    .login-card {
        padding: 20px 14px;
    }

    .format-code {
        font-size: 0.65rem;
    }

    .upload-text {
        font-size: 0.85rem;
    }

    .upload-hint {
        font-size: 0.75rem;
    }

    .db-node-header {
        gap: 6px;
        padding: 8px 10px;
    }

    .chevron-icon {
        width: 12px !important;
        height: 12px !important;
    }

    .db-node-key {
        font-size: 0.82rem;
    }

    .db-item {
        gap: 6px;
    }
}

/* ============================================
   THEME TOGGLE BUTTON
   ============================================ */
.btn-theme-toggle {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.btn-theme-toggle:hover {
    background: var(--bg-hover);
    border-color: var(--accent-gold-light);
    color: var(--accent-gold-light);
    transform: scale(1.05);
}

.btn-theme-toggle svg {
    width: 20px;
    height: 20px;
    transition: var(--transition-smooth);
    position: absolute;
}

/* Dark Mode - show sun icon */
.btn-theme-toggle .icon-light {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

.btn-theme-toggle .icon-dark {
    opacity: 0;
    transform: rotate(-90deg) scale(0.5);
}

/* Light Mode - show moon icon */
[data-theme="light"] .btn-theme-toggle .icon-light {
    opacity: 0;
    transform: rotate(90deg) scale(0.5);
}

[data-theme="light"] .btn-theme-toggle .icon-dark {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

/* ============================================
   LIGHT MODE THEME
   ============================================ */
[data-theme="light"] {
    /* Light Background */
    --bg-base: #f8fafc;
    --bg-elevated: #ffffff;
    --bg-surface: #f1f5f9;
    --bg-hover: #e2e8f0;

    /* Glass for Light */
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-bg-light: rgba(255, 255, 255, 0.9);
    --glass-border: rgba(0, 0, 0, 0.08);
    --glass-border-light: rgba(0, 0, 0, 0.12);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);

    /* Text for Light */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    /* Adjusted accents for Light */
    --accent-primary: #1e40af;
    --accent-primary-light: #2563eb;
    --accent-primary-lighter: #3b82f6;
    --accent-primary-glow: rgba(37, 99, 235, 0.2);

    --accent-gold: #b45309;
    --accent-gold-light: #d97706;
    --accent-gold-bright: #f59e0b;
    --accent-gold-glow: rgba(217, 119, 6, 0.2);

    --accent-cyan: #0891b2;
}

/* Light Mode Sidebar */
[data-theme="light"] .sidebar {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 250, 252, 0.99) 100%);
    border-right-color: var(--glass-border);
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .brand-name {
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

[data-theme="light"] .nav-item:hover {
    background: rgba(30, 64, 175, 0.06);
}

[data-theme="light"] .nav-item.active {
    background: linear-gradient(90deg, rgba(30, 64, 175, 0.1) 0%, rgba(59, 130, 246, 0.05) 100%);
    border-color: rgba(30, 64, 175, 0.15);
}

/* Light Mode Header */
[data-theme="light"] .header {
    background: rgba(255, 255, 255, 0.95);
    border-bottom-color: var(--glass-border);
}

[data-theme="light"] .page-title {
    color: var(--text-primary);
}

/* Light Mode Cards */
[data-theme="light"] .glass-card {
    background: rgba(255, 255, 255, 0.9);
    border-color: var(--glass-border);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .glass-card::before {
    background: linear-gradient(90deg, transparent 0%, rgba(30, 64, 175, 0.15) 30%, rgba(217, 119, 6, 0.1) 70%, transparent 100%);
}

[data-theme="light"] .glass-card:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
}

/* Light Mode Inputs */
[data-theme="light"] .input-modern,
[data-theme="light"] .select-modern {
    background: var(--bg-elevated);
    border-color: var(--glass-border);
    color: var(--text-primary);
}

[data-theme="light"] .input-modern:focus {
    border-color: var(--accent-primary-light);
    box-shadow: 0 0 0 3px var(--accent-primary-glow);
}

/* Light Mode Data Items */
[data-theme="light"] .data-item {
    background: rgba(30, 64, 175, 0.03);
}

[data-theme="light"] .data-item:hover {
    background: rgba(30, 64, 175, 0.06);
    border-color: var(--glass-border);
}

[data-theme="light"] .data-item .item-icon {
    background: linear-gradient(135deg, rgba(30, 64, 175, 0.1) 0%, rgba(59, 130, 246, 0.08) 100%);
    border-color: rgba(30, 64, 175, 0.12);
}

/* Light Mode Stats */
[data-theme="light"] .stat-mini {
    background: var(--bg-elevated);
}

[data-theme="light"] .firebase-stat-item {
    background: rgba(30, 64, 175, 0.03);
}

[data-theme="light"] .firebase-stat-item:hover {
    background: rgba(30, 64, 175, 0.06);
}

/* Light Mode DB Tree */
[data-theme="light"] .db-node-header {
    background: rgba(30, 64, 175, 0.04);
}

[data-theme="light"] .db-node-header:hover {
    background: rgba(30, 64, 175, 0.08);
}

/* Light Mode Buttons */
[data-theme="light"] .btn-secondary {
    background: var(--bg-elevated);
    border-color: var(--glass-border);
    color: var(--text-primary);
}

[data-theme="light"] .btn-secondary:hover {
    background: var(--bg-surface);
    border-color: var(--glass-border-light);
}

[data-theme="light"] .btn-icon {
    background: var(--bg-elevated);
    border-color: var(--glass-border);
}

[data-theme="light"] .btn-theme-toggle {
    background: var(--bg-elevated);
    border-color: var(--glass-border);
}

/* Light Mode Modal */
[data-theme="light"] .modal-overlay {
    background: rgba(15, 23, 42, 0.5);
}

/* Light Mode Toast */
[data-theme="light"] .toast {
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

/* Light Mode Connection Status */
[data-theme="light"] .connection-status {
    background: var(--bg-surface);
}

/* Light Mode Ambient */
[data-theme="light"] .ambient-bg {
    background:
        radial-gradient(ellipse at 0% 0%, rgba(30, 64, 175, 0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 100% 100%, rgba(217, 119, 6, 0.03) 0%, transparent 50%);
}

[data-theme="light"] .gradient-orb {
    opacity: 0.05;
}

/* Light Mode Scrollbar */
[data-theme="light"] ::-webkit-scrollbar-thumb {
    background: #cbd5e1;
}

[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}

/* Light Mode Usage Bar */
[data-theme="light"] .usage-bar-lg {
    background: #e2e8f0;
}

/* Light Mode Firebase Note */
[data-theme="light"] .firebase-note {
    background: rgba(30, 64, 175, 0.05);
    border-color: rgba(30, 64, 175, 0.1);
}

/* Light Mode Proxy Expand */
[data-theme="light"] .proxy-expand {
    background: rgba(30, 64, 175, 0.04);
}

[data-theme="light"] .proxy-item {
    background: var(--bg-elevated);
}

/* Smooth transition for theme switch */
body,
.sidebar,
.header,
.glass-card,
.btn-secondary,
.btn-icon,
.btn-theme-toggle,
.input-modern,
.select-modern,
.data-item,
.stat-mini,
.toast,
.modal-overlay,
.connection-status,
.db-node-header {
    transition: background 0.3s ease,
        border-color 0.3s ease,
        color 0.3s ease,
        box-shadow 0.3s ease;
}

/* ============================================
   LOGIN / UPLOAD SCREEN
   ============================================ */
.login-screen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-base);
}

.login-screen .ambient-bg {
    position: absolute;
    inset: 0;
}

.login-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 480px;
    padding: 20px;
}

.login-card {
    padding: 40px;
    text-align: center;
}

.login-header {
    margin-bottom: 32px;
}

.login-header .brand-logo {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    font-size: 1.5rem;
}

.login-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--accent-primary-light) 0%, var(--accent-gold-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Upload Zone */
.upload-zone {
    border: 2px dashed var(--glass-border-light);
    border-radius: var(--radius-lg);
    padding: 40px 24px;
    cursor: pointer;
    transition: var(--transition-smooth);
    background: var(--glass-bg);
    margin-bottom: 24px;
}

.upload-zone:hover,
.upload-zone.drag-over {
    border-color: var(--accent-primary-light);
    background: rgba(59, 130, 246, 0.08);
}

.upload-zone.drag-over {
    transform: scale(1.02);
    box-shadow: 0 0 40px var(--accent-primary-glow);
}

.upload-icon {
    margin-bottom: 16px;
}

.upload-icon svg {
    width: 48px;
    height: 48px;
    color: var(--accent-primary-light);
}

.upload-text {
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.upload-text strong {
    color: var(--accent-gold-light);
}

.upload-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Config Format Preview */
.config-format {
    text-align: left;
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 20px;
}

.format-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.format-code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: var(--accent-cyan);
    background: none;
    margin: 0;
    line-height: 1.6;
}

/* Login Status */
.login-status {
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 0.9rem;
}

.login-status.loading {
    color: var(--accent-primary-light);
}

.login-status.loading svg {
    animation: spin 1s linear infinite;
}

.login-status.error {
    color: var(--status-danger);
    background: rgba(239, 68, 68, 0.1);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.login-status.success {
    color: var(--status-success);
}

/* Logout Button */
.btn-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px 14px;
    margin-top: 12px;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-base);
}

.btn-logout svg {
    width: 16px;
    height: 16px;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.15);
    color: var(--status-danger);
    border-color: rgba(239, 68, 68, 0.3);
}

/* Light Mode adjustments for Login */
[data-theme="light"] .login-screen {
    background: var(--bg-base);
}

[data-theme="light"] .upload-zone {
    background: var(--bg-elevated);
    border-color: var(--glass-border);
}

[data-theme="light"] .upload-zone:hover,
[data-theme="light"] .upload-zone.drag-over {
    background: rgba(30, 64, 175, 0.05);
}

[data-theme="light"] .config-format {
    background: var(--bg-surface);
}

[data-theme="light"] .btn-logout {
    background: rgba(239, 68, 68, 0.05);
}

/* ============================================
   PREMIUM FEATURES - LOADING SKELETON
   ============================================ */
.skeleton {
    background: linear-gradient(90deg,
            rgba(255, 255, 255, 0.03) 0%,
            rgba(255, 255, 255, 0.08) 50%,
            rgba(255, 255, 255, 0.03) 100%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
}

.skeleton-text {
    height: 14px;
    margin-bottom: 8px;
    border-radius: 4px;
}

.skeleton-text.short {
    width: 60%;
}

.skeleton-text.medium {
    width: 80%;
}

.skeleton-card {
    height: 120px;
    margin-bottom: 16px;
}

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

@keyframes skeletonShimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

[data-theme="light"] .skeleton {
    background: linear-gradient(90deg,
            rgba(0, 0, 0, 0.04) 0%,
            rgba(0, 0, 0, 0.08) 50%,
            rgba(0, 0, 0, 0.04) 100%);
    background-size: 200% 100%;
}

/* ============================================
   PREMIUM FEATURES - RIPPLE EFFECT
   ============================================ */
.btn-primary,
.btn-secondary,
.nav-item {
    position: relative;
    overflow: hidden;
}

.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transform: scale(0);
    animation: rippleEffect 0.6s linear;
    pointer-events: none;
}

@keyframes rippleEffect {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* ============================================
   PREMIUM FEATURES - INPUT FOCUS GLOW
   ============================================ */
.input-modern,
.select-modern,
textarea {
    position: relative;
}

.input-modern:focus,
.select-modern:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent-primary-light);
    box-shadow:
        0 0 0 3px rgba(59, 130, 246, 0.15),
        0 0 20px rgba(59, 130, 246, 0.1),
        0 0 0 1px var(--accent-primary-light);
    background: rgba(59, 130, 246, 0.03);
}

.input-modern::placeholder {
    color: var(--text-muted);
    transition: all 0.3s ease;
}

.input-modern:focus::placeholder {
    opacity: 0.5;
    transform: translateX(4px);
}

[data-theme="light"] .input-modern:focus,
[data-theme="light"] .select-modern:focus {
    box-shadow:
        0 0 0 3px rgba(30, 64, 175, 0.1),
        0 0 20px rgba(30, 64, 175, 0.08);
}

/* ============================================
   PREMIUM FEATURES - TOAST UPGRADED
   ============================================ */
.toast {
    position: relative;
    overflow: hidden;
    animation: toastSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: var(--accent-primary-light);
    animation: toastProgress 4s linear forwards;
}

.toast.success::after {
    background: var(--status-success);
}

.toast.error::after {
    background: var(--status-danger);
}

.toast.warning::after {
    background: var(--status-warning);
}

@keyframes toastSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes toastProgress {
    from {
        width: 100%;
    }

    to {
        width: 0%;
    }
}

/* Toast hover pause animation */
.toast:hover::after {
    animation-play-state: paused;
}

/* ============================================
   PREMIUM FEATURES - EMPTY STATES
   ============================================ */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
    border-radius: 50%;
    background: linear-gradient(145deg, rgba(59, 130, 246, 0.1) 0%, rgba(245, 158, 11, 0.05) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: emptyFloat 3s ease-in-out infinite;
}

.empty-state-icon svg {
    width: 36px;
    height: 36px;
    color: var(--text-muted);
}

.empty-state-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-state-text {
    font-size: 0.9rem;
    color: var(--text-muted);
    max-width: 300px;
    line-height: 1.6;
}

@keyframes emptyFloat {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-8px);
    }
}

/* ============================================
   PREMIUM FEATURES - SCROLL REVEAL
   ============================================ */
.scroll-reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.scroll-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger children animation */
.stagger-children>* {
    opacity: 0;
    transform: translateY(15px);
    animation: staggerFadeIn 0.5s ease forwards;
}

.stagger-children>*:nth-child(1) {
    animation-delay: 0.05s;
}

.stagger-children>*:nth-child(2) {
    animation-delay: 0.1s;
}

.stagger-children>*:nth-child(3) {
    animation-delay: 0.15s;
}

.stagger-children>*:nth-child(4) {
    animation-delay: 0.2s;
}

.stagger-children>*:nth-child(5) {
    animation-delay: 0.25s;
}

.stagger-children>*:nth-child(6) {
    animation-delay: 0.3s;
}

@keyframes staggerFadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   PREMIUM FEATURES - BUTTON PULSE
   ============================================ */
.btn-primary {
    position: relative;
}

.btn-primary::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    background: var(--gradient-primary);
    opacity: 0;
    z-index: -1;
    transition: opacity 0.3s ease;
    filter: blur(12px);
}

.btn-primary:hover::before {
    opacity: 0.5;
}

/* Active press effect */
.btn-primary:active,
.btn-secondary:active {
    transform: scale(0.97);
}

/* ============================================
   PREMIUM FEATURES - LOADING SPINNER
   ============================================ */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--glass-border);
    border-top-color: var(--accent-primary-light);
    border-radius: 50%;
    animation: spinnerRotate 0.8s linear infinite;
}

.loading-spinner.small {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

@keyframes spinnerRotate {
    to {
        transform: rotate(360deg);
    }
}

/* Spinner inside button */
.btn-loading {
    pointer-events: none;
    opacity: 0.7;
}

.btn-loading .spinner {
    animation: spinnerRotate 0.8s linear infinite;
}

/* ============================================
   PREMIUM FEATURES - GRADIENT TEXT
   ============================================ */
.gradient-text {
    background: var(--gradient-gold);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.gradient-text-blue {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ============================================
   PREMIUM FEATURES - TOOLTIP
   ============================================ */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-4px);
    padding: 6px 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    color: var(--text-primary);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 1000;
    box-shadow: var(--glass-shadow);
}

[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-8px);
}

/* ============================================
   PREMIUM FEATURES - FOCUS VISIBLE
   ============================================ */
:focus-visible {
    outline: 2px solid var(--accent-primary-light);
    outline-offset: 2px;
}

button:focus:not(:focus-visible),
a:focus:not(:focus-visible) {
    outline: none;
}

/* ============================================
   PREMIUM FEATURES - SMOOTH SCROLLBAR
   ============================================ */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-base);
}

::-webkit-scrollbar-thumb {
    background: var(--glass-border-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--glass-border-light) var(--bg-base);
}

/* ============================================
   ENHANCED MOBILE RESPONSIVENESS 2026
   Touch-friendly, Premium Mobile Experience
   ============================================ */

/* Global Touch-Friendly Scrolling */
@media (max-width: 768px) {

    html,
    body {
        -webkit-overflow-scrolling: touch;
        overflow-x: hidden;
    }

    /* Ensure main content is scrollable */
    .main-content {
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
    }

    /* Fix z-index stacking for mobile */
    .sidebar-overlay {
        z-index: 150;
    }

    .sidebar {
        z-index: 200;
    }

    .modal-overlay {
        z-index: 300;
    }

    .toast-container {
        z-index: 400;
        left: 12px;
        right: 12px;
        bottom: 12px;
    }

    /* Touch-Friendly Touch Targets (min 44px) */
    .btn-menu-toggle,
    .btn-theme-toggle,
    .btn-secondary,
    .btn-icon,
    .nav-item {
        min-height: 44px;
        min-width: 44px;
    }

    .btn-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        padding: 0;
    }

    /* Prevent text selection on interactive elements */
    .nav-item,
    .btn-menu-toggle,
    .db-node-header,
    .data-item {
        -webkit-user-select: none;
        user-select: none;
        -webkit-tap-highlight-color: transparent;
    }

    /* Better tap feedback */
    .nav-item:active,
    .btn-menu-toggle:active,
    .btn-primary:active,
    .btn-secondary:active {
        opacity: 0.8;
        transform: scale(0.97);
    }

    /* Card header responsive layout */
    .card-header {
        flex-wrap: wrap;
        gap: 12px;
    }

    .card-header .header-title {
        flex: 1;
        min-width: 0;
    }

    .card-header .header-title h3 {
        font-size: 0.95rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .header-actions {
        flex-wrap: wrap;
        gap: 8px;
    }

    /* Improved data list for mobile */
    .data-list {
        -webkit-overflow-scrolling: touch;
    }

    .data-item {
        padding: 14px;
        gap: 12px;
    }

    .data-item .item-content {
        min-width: 0;
        flex: 1;
    }

    .data-item .item-value {
        font-size: 0.82rem;
        word-break: break-all;
    }

    /* Better button layout on mobile cards */
    .btn-primary.btn-sm,
    .btn-secondary.btn-sm {
        padding: 10px 14px;
        font-size: 0.82rem;
    }

    /* Section toolbar mobile layout */
    .section-toolbar {
        flex-direction: column;
        gap: 12px;
    }

    .bot-selector {
        width: 100%;
    }

    .bot-selector label {
        margin-bottom: 6px;
        display: block;
    }

    .bot-selector .select-modern {
        width: 100%;
        min-width: unset;
    }

    .bot-selector .btn-sm {
        width: 100%;
        justify-content: center;
        margin-top: 8px;
    }
}

/* Extra Small Mobile Enhancements */
@media (max-width: 480px) {

    /* Full-width modals */
    .modal {
        margin: 10px;
        max-width: calc(100vw - 20px);
        max-height: calc(100vh - 20px);
        overflow-y: auto;
    }

    .modal-body {
        padding: 16px;
    }

    /* Stacked button layout in modals */
    .modal-actions {
        flex-direction: column-reverse;
        gap: 8px;
    }

    .modal-actions button {
        width: 100%;
    }

    /* Improve input fields */
    .input-modern,
    .select-modern {
        font-size: 16px;
        /* Prevents iOS zoom on focus */
        padding: 12px 14px;
    }

    /* Stats in single column */
    .stats-row {
        flex-direction: column;
    }

    .stat-mini {
        width: 100%;
        text-align: left;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .stat-mini .label {
        margin-bottom: 0;
    }

    /* Firebase stats better layout */
    .firebase-stat-item {
        padding: 12px;
    }

    .stat-icon-sm {
        width: 36px;
        height: 36px;
    }

    .stat-icon-sm svg {
        width: 16px;
        height: 16px;
    }

    .stat-detail .stat-label {
        font-size: 0.7rem;
    }

    .stat-detail .stat-value {
        font-size: 1rem;
    }

    /* Compact header */
    .header {
        padding: 0 12px;
        height: 56px;
    }

    .page-title {
        font-size: 1rem;
    }
}

/* iOS Safe Area Support */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .sidebar-footer {
        padding-bottom: calc(18px + env(safe-area-inset-bottom));
    }

    .toast-container {
        bottom: calc(12px + env(safe-area-inset-bottom));
    }
}

/* Landscape Mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .sidebar {
        width: 280px;
    }

    .login-card {
        max-height: 80vh;
        overflow-y: auto;
    }

    .login-header .brand-logo {
        width: 48px;
        height: 48px;
        margin-bottom: 12px;
    }

    .login-title {
        font-size: 1.4rem;
    }

    .upload-zone {
        padding: 24px 16px;
    }
}

/* ============================================
   TOUCH SCREEN SUPPORT - Simplified
   ============================================ */

/* Global touch improvements */
* {
    -webkit-tap-highlight-color: rgba(59, 130, 246, 0.2);
}

/* Allow scroll everywhere by default */
html,
body {
    touch-action: pan-x pan-y;
    -webkit-overflow-scrolling: touch;
}

/* Only buttons and interactive elements should have manipulation */
button,
a,
.btn-primary,
.btn-secondary,
.btn-icon,
.btn-sm,
.btn-menu-toggle,
.btn-theme-toggle,
.btn-logout,
.nav-item,
.upload-zone,
.db-node-header,
.data-item,
select,
input,
.select-modern,
.input-modern {
    touch-action: manipulation;
    cursor: pointer;
}

/* Scrollable areas need pan-y */
.main-content,
.section,
.data-list,
.db-tree,
.nav-menu,
.modal-body {
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
}

/* Touch active state */
.touch-active,
button:active,
.btn-primary:active,
.btn-secondary:active,
.nav-item:active {
    opacity: 0.8;
    transform: scale(0.98);
}

/* Ensure menu toggle is always tappable */
.btn-menu-toggle {
    pointer-events: auto;
    z-index: 10;
}

/* Overlay touch handling */
.sidebar-overlay {
    pointer-events: none;
}

.sidebar-overlay.visible {
    pointer-events: auto;
    touch-action: auto;
}

/* ============================================
   MOBILE RESPONSIVENESS FIXES
   Edge-to-Edge List & Compact Spacing
   ============================================ */
@media (max-width: 768px) {

    /* Reduce card padding for mobile to save space */
    .glass-card {
        padding: 16px !important;
    }

    /* Edge-to-edge proxy list container */
    .proxy-expand {
        margin-left: -16px !important;
        margin-right: -16px !important;
        width: calc(100% + 32px) !important;
        border-radius: 0 !important;
        border-left: none !important;
        border-right: none !important;
        margin-top: 12px !important;
        background: rgba(0, 0, 0, 0.2) !important;
    }

    /* Remove grid gap and padding for list */
    .proxy-list-mini {
        padding: 0 !important;
        gap: 0 !important;
    }

    /* Compact item styling */
    .proxy-item {
        padding: 12px 16px !important;
        border-radius: 0 !important;
        border: none !important;
        border-bottom: 1px solid var(--glass-border) !important;
        background: transparent !important;
    }

    /* Remove border from last item */
    .proxy-item:last-child {
        border-bottom: none !important;
    }

    .webshare-entry {
        padding-bottom: 0;
    }
}