@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --bg-base: #0f0f13;
    --bg-surface: #1c1c21;
    --bg-surface-rgb: 28, 28, 33;
    --bg-surface-hover: #26262c;
    --bg-sidebar: #0f0f13;
    --bg-header: #0f0f13;
    --border-color: rgba(255, 255, 255, 0.08);
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --accent: #3b82f6;
    --accent-rgb: 59, 130, 246;
    --accent-hover: #2563eb;
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.1);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.1);
    --radius-md: 12px;
    --radius-lg: 16px;
    --font-main: 'Inter', sans-serif;

    /* Semantic tokens — dark mode */
    --heading-color: #ffffff;
    --card-text: #ffffff;
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-hover-bg: rgba(255, 255, 255, 0.05);
    --overlay-text: rgba(255, 255, 255, 0.8);
    --overlay-muted: rgba(255, 255, 255, 0.5);
    --header-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    --table-header-bg: #1e1e24;
    --row-hover-bg: rgba(255, 255, 255, 0.02);
    --autofill-text: #fff;
    --autofill-bg: #1a1a20;

    /* Layout Variables - Central Source of Truth */
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 80px;
    --transition-base: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    --main-padding: 2.5rem;
    --header-height: 70px;
    --toggle-top: 24px;
    --toggle-size: 32px;
}

body.light-mode {
    --bg-base: #f8fafc;
    --bg-surface: #ffffff;
    --bg-surface-rgb: 255, 255, 255;
    --bg-surface-hover: #f1f5f9;
    --bg-sidebar: #f1f5f9;
    --bg-header: #ffffff;
    --border-color: rgba(15, 23, 42, 0.08);
    --text-main: #1e293b;
    --text-muted: #64748b;
    --accent: #2563eb;
    --accent-rgb: 37, 99, 235;
    --accent-hover: #1d4ed8;
    --success: #059669;
    --success-bg: rgba(5, 150, 105, 0.08);
    --danger: #dc2626;
    --danger-bg: rgba(220, 38, 38, 0.08);

    /* Semantic tokens — light mode */
    --heading-color: #0f172a;
    --card-text: #1e293b;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(15, 23, 42, 0.05);
    --glass-hover-bg: rgba(255, 255, 255, 0.8);
    --overlay-text: #0f172a;
    --overlay-muted: #475569;
    --header-shadow: 0 4px 20px rgba(15, 23, 42, 0.06);
    --table-header-bg: #f8fafc;
    --row-hover-bg: #f1f5f9;
    --autofill-text: #1e293b;
    --autofill-bg: #ffffff;
    --card-shadow: 0 10px 25px rgba(15, 23, 42, 0.04);
    --premium-shadow: 0 20px 50px rgba(15, 23, 42, 0.08);
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg-base);
    color: var(--text-main);
    display: flex;
    height: 100vh;
    overflow: hidden;
    position: relative;
}


/* Platform Layout */
.app-layout {
    display: flex;
    width: 100%;
    height: 100%;
    position: relative;
    background-color: var(--bg-base);
}

/* Subtle global atmospheric depth */
.app-layout::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 15% 15%, rgba(var(--accent-rgb), 0.05) 0%, transparent 40%),
        radial-gradient(circle at 85% 85%, rgba(139, 92, 246, 0.03) 0%, transparent 40%);
    pointer-events: none;
    z-index: 0;
}

/* Very subtle background texture */
.app-layout::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image: url('../images/fondoMTG.png');
    background-size: 120% auto;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.02;
    /* Extremely subtle */
    pointer-events: none;
    z-index: 0;
}

/* Specific override for Home: NO fondoMTG.png */
.home-page .app-layout::after {
    display: none !important;
}

/* Page Header Hero Section */
.page-header-hero {
    position: relative;
    width: 100%;
    min-height: 260px;
    padding: 3.5rem var(--main-padding);
    margin: 0 0 2.5rem 0;
    /* Aligned card-style - no bleed to avoid clashing with sidebar seam */
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    overflow: hidden;
    background: linear-gradient(to right, #0c0c10, #14141c);
    border-bottom: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
}

/* Fix for layouts with sidebars: prevent bleeding into or over other columns */
.page-header-hero.hero-no-bleed {
    margin: 0 0 2.5rem 0 !important;
    width: 100% !important;
    border-radius: var(--radius-lg);
}

.page-header-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: linear-gradient(to bottom,
            rgba(15, 15, 19, 0.3) 0%,
            rgba(15, 15, 19, 0.7) 50%,
            var(--bg-base) 100%),
        url('../images/fondoMTG.png');
    background-size: cover;
    background-position: center 25%;
    background-repeat: no-repeat;
    opacity: 0.8;
    z-index: 0;
}

/* Home Brand Signature Header (Introductory Signature) */
.home-brand-signature-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    padding: 1.5rem 2rem 0 2rem;
    /* Reduced bottom padding to connect with hero below */
    max-width: 1400px;
    margin: 0 auto -32px auto;
    /* Offset the 128px logo growth to keep hero distance exactly the same */
    animation: signaturePreamble 1s ease-out forwards;
}

@keyframes signaturePreamble {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

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

.signature-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(var(--accent-rgb), 0.3), transparent);
    opacity: 0.5;
}

.signature-main {
    display: flex;
    align-items: center;
    gap: 2.5rem;
    /* Wider gap for the much larger mark */
}

.home-brand-signature-header .signature-emblem {
    width: 128px;
    /* scaled 2x from 64px */
    height: 128px;
}

.home-brand-signature-header .signature-emblem img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 0 8px rgba(var(--accent-rgb), 0.3));
    opacity: 0.8;
}

.signature-title {
    display: flex;
    flex-direction: column;
}

.signature-title .brand-name {
    font-size: 1.1rem;
    /* Scaled up for better proportion with 128px mark */
    font-weight: 800;
    letter-spacing: 0.4em;
    text-transform: uppercase;
    color: var(--heading-color);
    line-height: 1;
    margin-bottom: 0.25rem;
}

.signature-title .brand-tagline {
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--accent);
    opacity: 0.7;
}

/* Home Hero Specific Styles */

.page-header-hero.home-hero {
    min-height: 400px;
    /* More compact hero height */
    padding: 1.5rem 2rem 2.5rem 2rem;
    /* Reduced top padding to pull branding closer */
    align-items: center;
    justify-content: center;
    background: #020617;
    /* Solid base */
    border-radius: var(--radius-lg);
    margin: 0 var(--main-padding) 1.5rem var(--main-padding);
    /* Reduced bottom margin */
    width: 100%;
    border: none;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}

/* Home Hero Specific: No fondoMTG */
.home-page .home-hero::before {
    display: none;
}

.home-hero .hero-content {
    position: relative;
    z-index: 10;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    padding: 0 2rem;
    min-height: 320px;
    /* Adjusted internal min-height */
    justify-content: center;
    align-items: center;
    text-align: center;
}

.hero-narrative {
    animation: narrativeReveal 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

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

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

/* Internal branding removed for editorial clarity */

/* Hero Title Styling */
.home-hero .hero-title {
    font-size: 4.2rem;
    /* Slightly smaller for compactness */
    font-weight: 950;
    letter-spacing: -0.04em;
    line-height: 1;
    margin-bottom: 1.25rem;
    /* Tightened margin */
    max-width: 900px;
    background: linear-gradient(to bottom, #fff 50%, rgba(255, 255, 255, 0.5) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
    text-align: center;
}

.home-hero .hero-description-wrapper {
    max-width: 650px;
    margin-bottom: 3.5rem;
    position: relative;
    padding: 0 1rem;
}

.home-hero .hero-description-wrapper::before {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -1.5rem;
    transform: translateX(-50%);
    width: 60px;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--accent), transparent);
    opacity: 0.4;
}

.home-hero .hero-description {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.25rem;
    line-height: 1.6;
    text-align: center;
    font-weight: 400;
    margin-bottom: 0;
    letter-spacing: 0.01em;
}


.home-hero .hero-actions {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    width: 100%;
    margin-top: 2rem;
    /* Replaced auto to pull it up slightly */
    padding-bottom: 0.5rem;
}

.home-hero .cta-group.cta-personal {
    text-align: center;
}

.home-hero .cta-group.cta-meta {
    text-align: center;
}

.home-hero .cta-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: center;
    /* Center labels relative to buttons */
}

.home-hero .cta-label {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.7);
    /* Increased visibility */
}

.btn-premium-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 2rem;
    background: rgba(var(--accent-rgb), 0.1);
    border: 1px solid rgba(var(--accent-rgb), 0.3);
    color: var(--accent-color);
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 1.1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.btn-premium-outline:hover {
    background: rgba(var(--accent-rgb), 0.2);
    border-color: var(--accent-color);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(var(--accent-rgb), 0.2);
}

.home-hero .hero-visual {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    display: flex;
    overflow: hidden;
}

.home-hero .hero-visual-left {
    position: absolute;
    inset: 0;
    width: 60%;
    /* Occupy more space to provide background for text */
    z-index: 1;
}

.home-hero .hero-visual-right {
    position: absolute;
    inset: 0;
    left: auto;
    right: 0;
    width: 65%;
    /* Wider but clipped */
    z-index: 2;
    clip-path: polygon(35% 0, 100% 0, 100% 100%, 0% 100%);
    /* Diagonal Split - Restored traditional half-ish split */
}

.home-hero .hero-visual img {
    height: 100%;
    width: 100%;
    object-fit: cover;
    opacity: 0.95;
    /* Slightly brighter */
    filter: saturate(1) contrast(1.1) brightness(1.1);
    /* More natural and clear */
}

.home-hero .hero-visual-left img {
    object-fit: cover;
    object-position: 25% 15%;
    /* Shifted to reveal more of the upper composition */
    transform: scale(0.92);
    /* Subtle zoom out */
    filter: saturate(1.1) contrast(1.1) brightness(1.1);
}

.home-hero .hero-visual-right img {
    object-position: center;
}

.home-hero .hero-visual-overlay {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 50%, transparent 20%, rgba(2, 6, 23, 0.8) 100%),
        linear-gradient(to right, rgba(2, 6, 23, 1) 0%, transparent 30%, transparent 70%, rgba(2, 6, 23, 1) 100%),
        linear-gradient(to top, rgba(2, 6, 23, 1) 0%, transparent 50%);
    z-index: 3;
}

/* Page Hero Layout Utils */
.hero-flex-layout {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 3rem;
    width: 100%;
}

/* Empty Matchup State */
.empty-matchup-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 5rem 2rem;
    height: 100%;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--card-shadow);
}

.empty-matchup-state i {
    font-size: 3.5rem;
    color: var(--text-muted);
    opacity: 0.2;
    margin-bottom: 2rem;
}

.empty-matchup-state h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--heading-color);
}

.empty-matchup-state p {
    font-size: 1.1rem;
    color: var(--text-muted);
    max-width: 400px;
    margin-bottom: 1rem;
}

.empty-matchup-state .helper-text {
    font-size: 0.9rem;
    color: var(--overlay-muted);
    font-style: italic;
}

.hero-stats-panel {
    flex-shrink: 0;
    margin-bottom: 0.5rem;
}

.stat-card {
    background: var(--glass-bg);
    border: 1px solid var(--border-color);
    padding: 1.25rem 2rem;
    border-radius: var(--radius-lg);
    backdrop-filter: blur(10px);
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    margin-top: 1rem;
    border-bottom: 2px solid var(--accent);
}

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 900;
    color: var(--heading-color);
    line-height: 1;
    margin-bottom: 0.5rem;
    text-shadow: 0 0 20px rgba(var(--accent-rgb), 0.4);
}

.stat-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
}

/* Unified Toggle Positioning */
.sidebar-toggle-btn {
    position: absolute;
    right: calc(var(--toggle-size) / -2);
    /* Exactly centered on the seam */
    top: var(--toggle-top);
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    width: var(--toggle-size);
    height: var(--toggle-size);
    min-width: var(--toggle-size);
    min-height: var(--toggle-size);
    flex-shrink: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.85rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    z-index: 105;
}

.sidebar-toggle-btn:hover {
    color: var(--text-main);
    background: var(--bg-surface-hover);
    border-color: var(--accent);
    transform: translateY(0) scale(1.1);
}

.close-btn {
    display: flex !important;
}

.open-btn {
    display: none !important;
}

.sidebar-collapsed .open-btn {
    display: flex !important;
}

.sidebar-collapsed .close-btn {
    display: none !important;
}

/* Main Navigation Sidebar */
.main-nav {
    width: var(--sidebar-width);
    height: 100vh;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1rem;
    flex-shrink: 0;
    transition: var(--transition-base);
    position: relative;
    overflow: visible;
    z-index: 100;
}

.sidebar-collapsed .main-nav {
    padding-left: 0;
    padding-right: 0;
}

.nav-logo {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--heading-color);
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0 1.5rem;
    letter-spacing: -0.5px;
    height: 32px;
    overflow: visible;
    flex-shrink: 0;
}

/* Profile Pill */
.profile-pill {
    background: var(--glass-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.45rem 1.15rem 0.45rem 0.5rem;
    border-radius: 40px;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
}

.profile-pill:hover {
    border-color: rgba(var(--accent-rgb), 0.4);
    background: rgba(var(--accent-rgb), 0.08);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    transform: translateY(-1px);
}

.profile-pill.active {
    border-color: var(--accent);
    background: var(--bg-surface-hover);
}

.profile-container {
    position: relative;
    z-index: 1000;
}

.profile-dropdown-menu {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: 240px;
    background: rgba(var(--bg-surface-rgb), 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 18px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    padding: 0.6rem;
    display: none;
    flex-direction: column;
    z-index: 1100;
    animation: dropdownSlideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.profile-dropdown-menu.active {
    display: flex;
}

@keyframes dropdownFade {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

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

@keyframes dropdownSlideUp {
    from {
        opacity: 0;
        transform: translateY(15px) scale(0.98);
    }

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

.dropdown-header {
    padding: 0.75rem 1rem;
    display: flex;
    flex-direction: column;
}

.dropdown-header strong {
    font-size: 0.9rem;
    color: var(--heading-color);
}

.dropdown-header span {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0.4rem 0.5rem;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.85rem 1rem;
    border-radius: 10px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.dropdown-item:hover {
    background: var(--glass-hover-bg);
    color: var(--heading-color);
    padding-left: 1.15rem;
}

.dropdown-item.logout:hover {
    background: rgba(var(--danger-bg-rgb, 239, 68, 68), 0.15);
    color: var(--danger);
}

.dropdown-item i {
    font-size: 1rem;
    width: 20px;
    text-align: center;
}

.dropdown-item:hover {
    background: var(--bg-base);
    color: #fff;
}

.dropdown-item.logout:hover {
    color: var(--danger);
}

.profile-avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 800;
    font-size: 0.85rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.profile-text {
    display: flex;
    flex-direction: column;
}

.profile-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.2;
}

.profile-rank {
    font-size: 0.65rem;
    color: var(--accent);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.pill-chevron {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-left: auto;
}

.login-pill {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 1.25rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s;
}

.login-pill:hover {
    border-color: var(--accent);
    background: var(--bg-surface-hover);
    transform: translateY(-1px);
}

/* Search bar improvements */
.search-wrapper {
    position: relative;
    width: 320px;
}

.search-container {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    display: flex;
    align-items: center;
    padding: 0 1rem;
    height: 48px;
    /* Slightly taller for more presence */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    width: 320px;
}

.search-container:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 15px rgba(var(--accent-rgb), 0.15);
    background: var(--bg-surface-hover);
}

.search-icon {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-right: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
    transition: all 0.3s;
}

.search-container:focus-within .search-icon {
    color: var(--accent);
    opacity: 1;
}

.search-bar {
    background: transparent !important;
    border: none !important;
    color: var(--text-main);
    font-size: 0.95rem;
    width: 100%;
    outline: none !important;
    padding: 0;
    display: flex;
    align-items: center;
    letter-spacing: 0.02em;
}

.search-bar::placeholder {
    color: var(--text-muted);
    opacity: 0.5;
}

/* Autocomplete list & Suggestions */
.autocomplete-list {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6);
    z-index: 1200;
    max-height: 400px;
    overflow-y: auto;
    display: none;
    padding: 0.5rem;
    animation: dropdownFade 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.autocomplete-list.active {
    display: flex;
    flex-direction: column;
}

.autocomplete-item {
    padding: 0.85rem 1rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.95rem;
    color: var(--text-muted);
}

.autocomplete-item:hover,
.autocomplete-item.active {
    background: var(--bg-surface-hover);
    color: var(--heading-color);
    transform: translateX(4px);
}

.deck-suggestion-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
}

.deck-suggestion-row i {
    color: var(--accent);
    font-size: 0.9rem;
    opacity: 0.6;
}

.autocomplete-item:hover .deck-suggestion-row i {
    opacity: 1;
}

.deck-name-suggestion {
    flex-grow: 1;
    font-weight: 600;
}

.suggestion-type {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(var(--accent-rgb), 0.1);
    color: var(--accent);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-weight: 800;
}

.nav-logo-icon {
    width: 38px;
    height: 38px;
    background: transparent;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.brand-logo-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.nav-logo:hover .brand-logo-img {
    transform: scale(1.1) rotate(5deg);
}

.logo-text {
    transition: opacity 0.2s, visibility 0.2s;
    white-space: nowrap;
    font-weight: 800;
    letter-spacing: -0.02em;
    text-transform: none;
    background: linear-gradient(to right, var(--heading-color), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-toggle:active {
    transform: scale(0.95);
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    flex-grow: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 1rem;
    scrollbar-width: none;
    /* Hide scrollbar for clean look */
}

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

.nav-separator {
    height: 1px;
    background: var(--border-color);
    margin: 1.25rem 0.5rem;
    opacity: 0.6;
}

.nav-section-label {
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.1em;
    padding: 0 1rem 0.5rem;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.sidebar-collapsed .nav-section-label {
    opacity: 0;
    visibility: hidden;
}

.nav-links li a {
    text-decoration: none;
    color: var(--text-muted);
    padding: 0.8rem 1rem;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 1rem;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-links li a i {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
    opacity: 0.8;
}

.nav-links li a:hover {
    color: var(--text-main);
    background-color: var(--bg-surface);
    transform: translateX(4px);
}

.nav-links li a.active {
    color: var(--heading-color);
    background-color: var(--bg-surface);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.nav-links li a.active i {
    color: var(--accent);
    opacity: 1;
}

.nav-links li a.disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.nav-links li a.disabled:hover {
    transform: none;
    background: transparent;
}

.nav-links li a span:not(.badge) {
    transition: opacity 0.2s, visibility 0.2s;
    white-space: nowrap;
}

/* Sidebar Collapsed State */
.sidebar-collapsed .main-nav {
    width: var(--sidebar-collapsed-width);
}

.sidebar-collapsed .logo-text,
.sidebar-collapsed .nav-links li a span:not(.badge),
.sidebar-collapsed .badge,
.sidebar-collapsed .premium-card,
.sidebar-collapsed .nav-footer .nav-links li a span {
    opacity: 0;
    visibility: hidden;
    position: absolute;
    pointer-events: none;
}

.sidebar-collapsed .nav-logo {
    justify-content: center;
    padding: 0;
    margin-bottom: 2.5rem;
}

.sidebar-collapsed .sidebar-toggle:hover {
    transform: rotate(180deg) scale(1.1);
    border-color: var(--accent);
}

.sidebar-collapsed .nav-links {
    gap: 0.75rem;
    padding: 0;
    /* Remove internal padding when collapsed to prevent icon cut-off */
}

.sidebar-collapsed .nav-links li a {
    justify-content: center;
    padding: 0.8rem;
    height: 44px;
    width: 44px;
    margin: 0 auto;
}

.sidebar-collapsed .nav-links li a i {
    margin: 0;
    font-size: 1.25rem;
}

.sidebar-collapsed .nav-links li a.active {
    box-shadow: 0 0 15px rgba(var(--accent-rgb), 0.2);
}

.sidebar-collapsed .nav-footer {
    padding-top: 1.5rem;
    padding-left: 0;
    padding-right: 0;
}

.nav-footer {
    margin-top: auto;
    border-top: 1px solid var(--border-color);
    padding: 1.25rem 1rem 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex-shrink: 0;
}

.premium-card {
    background: linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%);
    padding: 1.25rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    text-align: center;
}

.premium-card h4 {
    color: #fff;
    /* Intentionally always white — sits on gradient bg */
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.premium-card p {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 1rem;
    line-height: 1.4;
}

.premium-card button,
.btn-premium-sidebar {
    background: #111827;
    color: #fff;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.85rem;
    cursor: pointer;
    width: 100%;
    display: block;
    /* Ensure <a> tags take full width */
    text-align: center;
    text-decoration: none;
    transition: var(--transition-base);
}

.btn-premium-sidebar:hover {
    background: #1f2937;
    transform: translateY(-1px);
}

/* Main WorkspaceWrapper */
.main-wrapper {
    flex: 1;
    min-width: 0;
    /* Crucial for flex shrink behavior */
    display: flex;
    flex-direction: column;
    background-color: transparent;
    position: relative;
    z-index: 10;
    transition: var(--transition-base);
    /* Sync with sidebar toggle */
    overflow: hidden;
    /* Prevent content from sitting underneath sidebar or causing horizontal scroll */
}

/* Top Header */
.top-header {
    height: 70px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--main-padding);
    flex-shrink: 0;
    background-color: var(--bg-header);
    z-index: 10;
    box-shadow: var(--header-shadow);
}

.header-title {
    font-size: 1.25rem;
    font-weight: 600;
}

/* Standardized header actions spacing */
.header-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.search-bar:focus {
    width: 350px;
    border-color: var(--accent);
    outline: none;
}

.profile-pill {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg-surface);
    padding: 0.35rem 0.35rem 0.35rem 1rem;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    font-size: 0.9rem;
    font-weight: 500;
}

.profile-avatar {
    width: 28px;
    height: 28px;
    background: #3b82f6;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 0.7rem;
    font-weight: bold;
}

/* Content Area inside main wrapper */
.content-scrollable {
    flex: 1;
    overflow-y: auto;
    position: relative;
    background-color: var(--bg-base);
    scrollbar-gutter: stable;
    /* Keeps layout stable when scrollbars appear */
}

.scroll-content-inner {
    position: relative;
    min-height: 100%;
    padding: 2.5rem var(--main-padding);
    /* Standardized outer padding */
    z-index: 1;
}


.dashboard-container {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
    min-width: 0;
}

.config-sidebar {
    width: 320px;
    flex-shrink: 0;
}

.dashboard-results {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding-right: 0;
    /* Removed custom right padding; respects scroll-content-inner standard padding */
}

/* Surface Cards */
.ui-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
}

/* Typography & Components inside dashboard */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.section-title {
    font-size: 1.25rem;
    /* Slightly larger */
    font-weight: 700;
    color: var(--heading-color);
    margin-bottom: 2.5rem;
    /* Increased from 2rem for better breathing room */
    display: flex;
    align-items: center;
    gap: 0.85rem;
    position: relative;
}

.section-title i {
    color: var(--accent);
    font-size: 1rem;
    opacity: 0.9;
}

.section-title::after {
    content: "";
    position: absolute;
    bottom: -0.75rem;
    left: 0;
    width: 40px;
    height: 3px;
    background: var(--accent);
    border-radius: 2px;
    opacity: 0.5;
}

/* Forms & Inputs */
.form-group {
    margin-bottom: 2.25rem;
    /* Increased base spacing */
}

.form-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    /* Slightly clearer size */
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.85rem;
    /* More space from the input itself */
    letter-spacing: 0.01em;
}

/* Tooltip implementation */
.tooltip-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--glass-border);
    color: var(--text-muted);
    font-size: 0.7rem;
    cursor: help;
}

.tooltip-text {
    visibility: hidden;
    background-color: var(--heading-color);
    color: var(--bg-surface);
    text-align: left;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    position: absolute;
    z-index: 100;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    width: max-content;
    max-width: 200px;
    font-size: 0.75rem;
    line-height: 1.4;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity 0.2s;
}

.tooltip-wrap:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* --- Global Form & Input Polish --- */
.form-group {
    margin-bottom: 2.5rem;
    /* Max space for grouped form blocks */
    display: flex;
    flex-direction: column;
}

.form-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.02em;
    display: block;
    margin-bottom: 0.8rem;
    /* Consistent large gap below label */
}

input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
textarea,
select {
    width: 100%;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 0.85rem 1rem;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

select {
    padding-right: 3rem !important;
    /* Ensure text never hits the arrow */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M10.293 3.293L6 7.586 1.707 3.293A1 1 0 00.293 4.707l5 5a1 1 0 001.414 0l5-5a1 1 0 10-1.414-1.414z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 1.25rem center !important;
    background-size: 0.8rem !important;
    appearance: none !important;
}

input:hover,
textarea:hover,
select:hover {
    border-color: var(--glass-border);
    background: var(--glass-hover-bg);
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--accent);
    background: rgba(var(--accent-rgb), 0.04);
    box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0.1), inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

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

/* Fix browser autofill highlight */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
textarea:-webkit-autofill:hover,
textarea:-webkit-autofill:focus,
select:-webkit-autofill,
select:-webkit-autofill:hover,
select:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--autofill-text) !important;
    -webkit-box-shadow: 0 0 0px 1000px var(--autofill-bg) inset !important;
    transition: background-color 5000s ease-in-out 0s;
}

input:disabled,
textarea:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--glass-bg);
    border-style: dashed;
}

/* Custom Select Refinements */
.custom-select .select-trigger {
    padding-right: 3rem !important;
    /* Guaranteed clearing room for absolute chevron */
    position: relative;
    /* Anchor the absolute chevron */
}

.custom-select .fa-chevron-down {
    position: absolute !important;
    right: 1.25rem !important;
    top: 50% !important;
    transform: translateY(-50%);
    opacity: 0.5;
    font-size: 0.8rem;
    pointer-events: none;
    /* Ignore clicks so trigger fires cleanly */
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.custom-select.active .fa-chevron-down {
    transform: translateY(-50%) rotate(180deg) !important;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-main);
    cursor: pointer;
}

.checkbox-group input {
    accent-color: var(--accent);
    width: 16px;
    height: 16px;
}

/* Deck List */
.deck-list {
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem;
    background: var(--bg-base);
}

.deck-list::-webkit-scrollbar {
    width: 6px;
}

.deck-list::-webkit-scrollbar-track {
    background: transparent;
}

.deck-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

.deck-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.4rem 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 0.9rem;
}

.deck-item:hover {
    background: var(--bg-surface-hover);
}

/* Button */
.btn-primary {
    background-color: var(--accent);
    color: #fff;
    border: none;
    padding: 0.8rem;
    border-radius: 8px;
    width: 100%;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition-base);
    box-shadow: 0 4px 15px rgba(var(--accent-rgb), 0.2);
}

.btn-primary:hover {
    background-color: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(var(--accent-rgb), 0.3);
}

/* Mode Toggle */
.mode-toggle {
    display: flex;
    background: var(--bg-base);
    border-radius: 8px;
    padding: 0.25rem;
    border: 1px solid var(--border-color);
    margin-bottom: 1rem;
}

.mode-label {
    flex: 1;
    text-align: center;
    padding: 0.4rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: 0.2s;
}

.mode-input {
    display: none;
}

.mode-input:checked+.mode-label {
    background: var(--bg-surface-hover);
    color: var(--heading-color);
    border: 1px solid var(--glass-border);
}

.extra-options {
    display: none;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.extra-options.active {
    display: block;
}

/* Matrix Table Usability Fixes */
.matrix-container {
    width: 100%;
    max-height: 600px;
    overflow: auto;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-base);
    padding-right: 0;
    /* Remove internal surplus space */
    padding-bottom: 2px;
}

.matrix-table {
    width: max-content;
    min-width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.85rem;
    table-layout: fixed;
}

.matrix-table th,
.matrix-table td {
    padding: 0.65rem 1rem;
    text-align: center;
    white-space: nowrap;
    border-bottom: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    color: var(--text-main);
}

.matrix-table th {
    background: var(--table-header-bg);
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: inset 0 -1px 0 var(--border-color), 1px 0 0 var(--border-color);
}

/* Sticky First Column */
.matrix-table tbody tr th:first-child {
    position: sticky;
    left: 0;
    z-index: 10;
    background: var(--table-header-bg);
    font-weight: 600;
    text-align: left;
    box-shadow: 1px 0 0 var(--border-color), inset 0 -1px 0 var(--border-color);
}

/* Top-Left Corner Intersection */
.matrix-table thead tr th:first-child {
    position: sticky;
    top: 0;
    left: 0;
    z-index: 30;
    background: var(--table-header-bg) !important;
    box-shadow: 1px 1px 0 var(--border-color), inset 0 -1px 0 var(--border-color) !important;
}

.matrix-table tbody tr td {
    background: var(--bg-base);
}

.matrix-table tbody tr:hover td {
    background: var(--row-hover-bg);
}

.matrix-table th:last-child,
.matrix-table td:last-child {
    border-right: none;
}

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

/* Home Page Styles */
.home-container {
    max-width: 1600px;
    /* Significantly increased from 1200px for a much wider presence */
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 4rem;
    padding-bottom: 4rem;
}

.hero-section {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    display: flex;
    min-height: 480px;
}

.hero-content {
    flex: 1.2;
    padding: 4rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    z-index: 2;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 1.5rem;
    padding-bottom: 0.05em;
    background: linear-gradient(135deg, #fff 0%, #9ca3af 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: 1.15rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 2.5rem;
    max-width: 500px;
}

.hero-actions {
    display: flex;
    gap: 1rem;
}

.btn-primary-large {
    background-color: var(--accent);
    color: #fff;
    padding: 1rem 2.5rem;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1.05rem;
    text-decoration: none;
    transition: var(--transition-base);
    box-shadow: 0 8px 24px rgba(var(--accent-rgb), 0.25);
    display: inline-block;
}

.btn-primary-large:hover {
    background-color: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(var(--accent-rgb), 0.35);
}

.btn-secondary-large {
    background-color: var(--bg-surface-hover);
    color: #fff;
    padding: 1rem 2rem;
    border-radius: 10px;
    font-weight: 700;
    font-size: 1rem;
    text-decoration: none;
    border: 1px solid var(--border-color);
    transition: all 0.2s;
}

.btn-secondary-large:hover {
    background-color: var(--bg-surface);
    border-color: #fff;
}

.hero-visual {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.hero-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.8;
    mask-image: linear-gradient(to left, black 60%, transparent);
}

/* Product Showcase (Narrative Layout) */
.product-showcase {
    display: flex;
    flex-direction: column;
    gap: 5rem;
    /* Reduced gap between items */
    padding: 1rem 0;
    margin-top: 1rem;
    /* Significantly reduced top margin */
}

.showcase-item {
    display: flex;
    align-items: center;
    gap: 5rem;
    min-height: 350px;
}

.showcase-item:nth-child(even) {
    flex-direction: row-reverse;
    /* Alternating layout */
}

.showcase-text {
    flex: 1;
}

.showcase-tag {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 1rem;
}

.showcase-title {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--heading-color);
    margin-bottom: 1.25rem;
    line-height: 1.2;
    background: linear-gradient(to bottom, var(--heading-color) 40%, rgba(var(--accent-rgb), 0.7) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.showcase-description {
    font-size: 1.05rem;
    /* Slightly smaller for hierarchy */
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 1.75rem;
    max-width: 500px;
}

.showcase-actions {
    margin-top: 1rem;
}

.btn-text-accent {
    color: var(--accent);
    text-decoration: none;
    font-weight: 700;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.3s;
}

.btn-text-accent i {
    font-size: 0.85rem;
    transition: transform 0.3s;
}

.btn-text-accent:hover {
    color: var(--accent-hover);
    gap: 1rem;
}

.btn-text-accent:hover i {
    transform: translateX(4px);
}

.showcase-visual {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    height: 320px;
    background: var(--glass-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
    overflow: hidden;
}

.showcase-image-wrapper {
    padding: 0;
    background: transparent;
    border: none;
}

.showcase-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-lg);
    box-shadow: var(--card-shadow);
    border: 1px solid var(--glass-border);
    transition: transform 0.3s ease;
}

.showcase-item:hover .showcase-image {
    transform: scale(1.02);
}

.showcase-visual i {
    font-size: 6rem;
    color: var(--glass-border);
    position: relative;
    z-index: 2;
}

.visual-glow {
    position: absolute;
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, rgba(var(--accent-rgb), 0.15) 0%, transparent 70%);
    border-radius: 50%;
    filter: blur(40px);
    z-index: 1;
}

.visual-glow.highlight {
    background: radial-gradient(circle, rgba(255, 214, 10, 0.1) 0%, transparent 70%);
}

.visual-glow.search {
    background: radial-gradient(circle, rgba(168, 85, 247, 0.1) 0%, transparent 70%);
}

/* Redefine feature grid styles as they are no longer used for landing */
.features-grid {
    display: none;
}

.premium-banner {
    display: flex;
    align-items: center;
    gap: 4rem;
    padding: 5rem 4rem;
    background: radial-gradient(circle at top right, rgba(59, 130, 246, 0.1), transparent 70%);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: var(--radius-lg);
    margin: 4rem 0;
}

.premium-badge {
    background: var(--accent);
    color: #fff;
    padding: 4px 12px;
    border-radius: 4px;
    font-weight: 800;
    font-size: 0.75rem;
    letter-spacing: 1px;
    margin-bottom: 1rem;
    display: inline-block;
}

.premium-content {
    flex: 1;
}

.premium-content h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--heading-color);
}

.premium-content p {
    color: var(--text-muted);
    margin-bottom: 2rem;
    line-height: 1.6;
    font-size: 1.1rem;
}

.premium-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.premium-list li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.95rem;
    color: var(--text-main);
}

.premium-list li i {
    color: var(--success);
}

.btn-premium {
    background: var(--heading-color);
    color: var(--bg-surface);
    border: none;
    padding: 1rem 2.5rem;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s;
    display: inline-block;
    text-decoration: none;
}

.btn-premium:hover {
    transform: scale(1.05);
}

.ai-preview {
    padding: 6rem 4rem;
    background: linear-gradient(to bottom, rgba(168, 85, 247, 0.05), transparent);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(168, 85, 247, 0.1);
    margin-top: 4rem;
}

.ai-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.ai-icon {
    font-size: 2.5rem;
    color: #a855f7;
}

.ai-tag {
    background: rgba(168, 85, 247, 0.2);
    color: #c084fc;
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.7rem;
}

.ai-preview h2 {
    font-size: 2.25rem;
    color: var(--heading-color);
}

.ai-description {
    color: var(--text-muted);
    max-width: 700px;
    font-size: 1.1rem;
    margin-bottom: 3rem;
    line-height: 1.6;
}

.ai-examples {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.ai-example-card {
    background: var(--glass-bg);
    border: 1px solid var(--border-color);
    padding: 2rem;
    border-radius: var(--radius-md);
    position: relative;
}

.ai-example-card h4 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--accent);
    margin-bottom: 1rem;
    font-size: 1rem;
}

.ai-example-card p {
    font-style: italic;
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.6;
}

/* Auth Pages */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}

.auth-card {
    width: 100%;
    max-width: 480px;
    padding: 3.5rem;
    background: rgba(var(--bg-surface-rgb), 0.7);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--premium-shadow);
    border-radius: 24px;
}

body.light-mode .auth-card {
    background: rgba(255, 255, 255, 0.85);
    box-shadow: 0 10px 40px rgba(15, 23, 42, 0.08);
}

.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-icon i {
    position: absolute;
    left: 1.25rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    pointer-events: none;
    transition: color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.input-with-icon input {
    padding-left: 3.25rem !important;
}

.input-with-icon:focus-within i {
    color: var(--accent);
}

.auth-subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 2rem;
    line-height: 1.5;
}

.auth-footer {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.auth-footer a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    margin-left: 0.5rem;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* Mis Mazos */
.my-decks-container {
    max-width: 1000px;
    margin: 0 auto;
}

.deck-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.my-deck-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition-base);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.my-deck-card:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
    box-shadow: var(--card-shadow);
}

body.light-mode .my-deck-card {
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
}

body.light-mode .my-deck-card:hover {
    box-shadow: var(--card-shadow);
}

.my-deck-info h4 {
    color: var(--heading-color);
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.my-deck-info span {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.btn-remove {
    background: var(--danger-bg);
    color: var(--danger);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: all 0.2s;
}

.btn-remove:hover {
    background: var(--danger);
    color: #fff;
}

.add-deck-section {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    padding: 2rem;
    border-radius: var(--radius-md);
    margin-bottom: 3rem;
}

.add-deck-form {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.add-deck-form select {
    flex: 1;
    background: var(--bg-base);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    outline: none;
}

.add-deck-form select:focus {
    border-color: var(--accent);
}

.add-deck-form .btn-primary {
    width: auto;
    padding-left: 2rem;
    padding-right: 2rem;
}

.form-row {
    display: flex;
    gap: 1rem;
}

.form-row .form-group {
    flex: 1;
}

.stat-bar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-item {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--heading-color);
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.solutions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.solution-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    padding: 1rem;
    border-radius: var(--radius-md);
}

.solution-header {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--heading-color);
    margin-bottom: 0.75rem;
}

.matchup-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--glass-border);
}

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

.score {
    font-weight: 600;
    color: var(--accent);
    background: rgba(59, 130, 246, 0.1);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
}

.team {
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    white-space: normal;
    overflow: hidden;
    word-break: break-word;
    line-height: 1.3;
}

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

.vs {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0 0.5rem;
    font-weight: 600;
}

.info-card {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    background: var(--success-bg);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--success);
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.error-message {
    background: var(--danger-bg);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger);
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

@media (max-width: 1024px) {
    .dashboard-container {
        flex-direction: column;
    }

    .config-sidebar {
        width: 100%;
    }
}

/* --- Premium Custom Dropdowns --- */
.custom-select {
    position: relative;
    width: 100%;
    z-index: 10;
    /* Base z-index */
}

.custom-select.active {
    z-index: 5001;
    /* High z-index when open to ensure it overlaps everything including sidebars */
}

.select-trigger {
    width: 100%;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.75rem 1rem 0.75rem 3.5rem;
    border-radius: 12px;
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 48px;
}

.select-trigger:hover {
    border-color: rgba(var(--accent-rgb), 0.5);
    background: var(--bg-surface-hover);
}

.custom-select.active .select-trigger {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0.1);
}

.select-options {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--bg-surface);
    /* Explicitly solid deep dark */
    opacity: 1 !important;
    /* Force opacity to prevent visual mixing */
    border: 1px solid var(--accent);
    /* More prominent accent border */
    border-radius: 14px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4), 0 0 0 1px var(--glass-border);
    /* Stronger shadow and inner glow */
    z-index: 5000;
    /* Increased to be safe */
    max-height: 350px;
    overflow-y: auto;
    display: none;
    padding: 0.5rem;
    animation: dropdownFade 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.custom-select.active .select-options {
    display: block;
}

.option-item {
    padding: 0.75rem 1rem;
    border-radius: 10px;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s;
    font-size: 0.9rem;
}

.option-item:hover,
.option-item.selected {
    background: var(--bg-surface-hover);
    color: var(--heading-color);
}

.option-item.selected {
    background: rgba(var(--accent-rgb), 0.1);
    color: var(--accent);
}

.select-search-input {
    background: transparent;
    border: none;
    color: var(--text-main);
    width: 100%;
    padding: 0;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: text;
    font-family: inherit;
}

.select-search-input:focus {
    outline: none;
}

.select-search-input::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

/* Ensure the search icon is accounted for in my_decks.html */
.select-wrapper .search-icon+.custom-select .select-search-input {
    padding-left: 0.5rem;
}

/* Custom dropdown search icon override */
.select-wrapper i.search-icon {
    position: absolute;
    left: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    z-index: 5;
}

/* --- Enhanced Search Suggestion Styles --- */
.autocomplete-item {
    border-bottom: 1px solid var(--glass-bg);
}

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

.deck-suggestion-row {
    display: flex;
    align-items: center;
    width: 100%;
}

.deck-name-suggestion {
    flex: 1;
    font-weight: 600;
}

.suggestion-type {
    font-size: 0.7rem;
    background: rgba(var(--accent-rgb), 0.1);
    color: var(--accent);
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    text-transform: uppercase;
    font-weight: 800;
}

/* Results highlight for safe enter */
.autocomplete-item.auto-highlight {
    border-left: 3px solid var(--accent);
}

/* --- Diversion Equilibrada Refinements --- */
.help-section {
    background: rgba(var(--accent-rgb), 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.75rem;
    margin-bottom: 2.5rem;
    /* Significant breathing room under the box */
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    position: relative;
    overflow: hidden;
}

.summary-stat-box.primary {
    background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.1) 0%, rgba(var(--accent-rgb), 0.02) 100%);
    border-color: rgba(var(--accent-rgb), 0.2);
}

.summary-stat-box::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle at top right, rgba(var(--accent-rgb), 0.1), transparent 70%);
    pointer-events: none;
}

.help-toggle {
    width: 100%;
    padding: 0.75rem 1rem;
    background: none;
    border: none;
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.help-toggle:hover {
    background: rgba(var(--accent-rgb), 0.08);
}

.help-content {
    padding: 0 1rem 1rem 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
    display: none;
}

.help-section.active .help-content {
    display: block;
}

.help-section.active .help-toggle i {
    transform: rotate(180deg);
}

.help-step {
    margin-bottom: 0.75rem;
}

.help-step strong {
    color: var(--text-main);
    display: block;
    margin-bottom: 0.15rem;
}

.setup-step {
    margin-bottom: 2rem;
    position: relative;
}

.step-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.step-number {
    width: 24px;
    height: 24px;
    background: var(--accent);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 800;
}

.step-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--heading-color);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.helper-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.4rem;
    line-height: 1.4;
}

.selected-decks-summary {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.summary-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.summary-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
}

.selection-count {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent);
    background: rgba(var(--accent-rgb), 0.1);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.deck-chip {
    background: var(--glass-hover-bg);
    border: 1px solid var(--border-color);
    padding: 0.35rem 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.deck-chip:hover {
    border-color: var(--danger);
    background: var(--danger-bg);
}

.remove-chip {
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.2s;
}

.deck-chip:hover .remove-chip {
    color: var(--danger);
}

.deck-pool-container {
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--glass-bg);
    padding: 0.5rem;
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
    width: 100%;
    padding: 0.75rem;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

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

/* Modal Styles */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

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

.modal-content {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    animation: modalIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }

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

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

.modal-title {
    font-size: 1.1rem;
    font-weight: 700;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
}

.modal-footer {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

.empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 1rem;
    opacity: 0.3;
}

/* --- COMPREHENSIVE LIGHT MODE OVERRIDES --- */

/* 1. Global / Layout Bases */
body.light-mode {
    color: var(--text-main);
}

/* 2. Atmospheric overlay: softer in light mode */
body.light-mode .app-layout::before {
    background: radial-gradient(circle at 15% 15%, rgba(var(--accent-rgb), 0.03) 0%, transparent 40%),
        radial-gradient(circle at 85% 85%, rgba(139, 92, 246, 0.02) 0%, transparent 40%);
}

body.light-mode .app-layout::after {
    opacity: 0.015;
}

body.light-mode .nav-separator {
    background: rgba(0, 0, 0, 0.08);
}

body.light-mode .nav-section-label {
    color: var(--text-muted);
    opacity: 0.7;
}

/* 3. Hero Sections */
body.light-mode .page-header-hero {
    background: linear-gradient(to right, #e2e8f0, #f1f5f9);
    border-bottom: 1px solid var(--border-color);
}

body.light-mode .page-header-hero::before {
    background-image: linear-gradient(135deg,
            rgba(255, 255, 255, 0.85) 0%,
            rgba(255, 255, 255, 0.6) 50%,
            rgba(255, 255, 255, 0) 100%), url('../images/fondoMTG.png');
    opacity: 0.8;
}

body.light-mode .home-hero {
    background: #f1f5f9;
    /* Solid base vs gradient to reduce washing out */
    box-shadow: 0 10px 40px rgba(15, 23, 42, 0.08);
}

body.light-mode .home-hero .hero-title,
body.light-mode .hero-title {
    background: linear-gradient(to bottom, #020617 30%, #1e293b 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
    /* More defined shadow for readability */
}

body.light-mode .home-hero .hero-description-wrapper {
    background: transparent;
    backdrop-filter: none;
    box-shadow: none;
    border: none;
    max-width: 650px;
    margin-bottom: 3.5rem;
}

body.light-mode .home-hero .hero-description-wrapper::before {
    background: linear-gradient(to right, transparent, var(--accent), transparent);
    opacity: 0.3;
    /* Increased opacity for visibility */
}

body.light-mode .home-hero .hero-description {
    color: #1e293b;
    /* Deeper slate for high contrast in light mode */
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
    /* Subtle highlight behind text to make it pop */
}

body.light-mode .home-hero .hero-visual-overlay {
    background: radial-gradient(circle at 50% 50%, rgba(241, 245, 249, 0.2) 0%, rgba(241, 245, 249, 0.8) 100%),
        linear-gradient(to right, #f1f5f9 0%, transparent 40%, transparent 60%, #f1f5f9 100%),
        linear-gradient(to top, #f1f5f9 0%, transparent 50%);
    z-index: 3;
}

body.light-mode .home-hero .cta-label {
    color: #475569;
    font-weight: 700;
}

/* Pre-Hero Signature Light Mode Overrides */
body.light-mode .home-brand-signature-header .signature-line {
    background: linear-gradient(to right, transparent, rgba(0, 0, 0, 0.1), transparent);
}

body.light-mode .signature-title .brand-name {
    color: var(--text-main);
    opacity: 0.8;
}

body.light-mode .home-brand-signature-header .signature-emblem img {
    filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.1));
    opacity: 0.9;
}

/* 4. Sidebar, Branding & Navigation */
body.light-mode .nav-logo-icon {
    background: linear-gradient(135deg, var(--accent), #4f46e5);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

body.light-mode .logo-text {
    background: linear-gradient(to right, #0f172a, var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
}

body.light-mode .nav-links li a:hover {
    background-color: rgba(0, 0, 0, 0.03);
}

body.light-mode .nav-links li a.active {
    background-color: #ffffff;
    color: var(--accent);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
    border: 1px solid rgba(15, 23, 42, 0.03);
    font-weight: 700;
}

body.light-mode .nav-links li a.active i {
    color: var(--accent);
    opacity: 1;
}

body.light-mode .profile-pill {
    border: 1px solid rgba(0, 0, 0, 0.1);
}

body.light-mode .profile-pill:hover {
    background: rgba(var(--accent-rgb), 0.05);
    border-color: rgba(var(--accent-rgb), 0.3);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

body.light-mode .dropdown-item:hover {
    background: rgba(0, 0, 0, 0.04);
}

body.light-mode .autocomplete-item:hover,
body.light-mode .autocomplete-item.active {
    background: rgba(0, 0, 0, 0.05);
}

body.light-mode .autocomplete-item:hover .deck-suggestion-row i {
    color: var(--text-main);
    opacity: 0.8;
}

/* 5. Cards & Surfaces */
body.light-mode .hero-stats-panel .stat-card {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: var(--premium-shadow);
}

body.light-mode .stat-card {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

body.light-mode .stat-number {
    text-shadow: none;
}

body.light-mode .showcase-visual {
    background: var(--bg-surface-hover);
    border: 1px solid var(--border-color);
    box-shadow: inset 0 2px 8px rgba(15, 23, 42, 0.05);
}

body.light-mode .showcase-visual i {
    color: rgba(0, 0, 0, 0.08);
}

body.light-mode .showcase-title {
    background: linear-gradient(to bottom, #0f172a 40%, rgba(15, 23, 42, 0.7) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

body.light-mode .showcase-image {
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
}

/* 6. Home Page Premium/AI Sections */
body.light-mode .premium-banner {
    background: radial-gradient(circle at top right, rgba(37, 99, 235, 0.05), transparent 70%);
    background-color: #ffffff;
    border: 1px solid rgba(37, 99, 235, 0.2);
}

body.light-mode .premium-content h2,
body.light-mode .ai-preview h2 {
    background: linear-gradient(to bottom, #0f172a 40%, rgba(15, 23, 42, 0.7) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

body.light-mode .btn-premium {
    background: #0f172a;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.2);
}

body.light-mode .btn-premium:hover {
    background: #1e293b;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(15, 23, 42, 0.25);
}

body.light-mode .ai-preview {
    background: linear-gradient(to bottom, rgba(168, 85, 247, 0.03), transparent);
    border: 1px solid rgba(168, 85, 247, 0.15);
}

body.light-mode .ai-example-card {
    background: #ffffff;
    border-color: var(--border-color);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
}

body.light-mode .ai-example-card h4 {
    color: var(--accent);
}

body.light-mode .ai-example-card p {
    color: var(--text-muted);
}

/* 7. Inputs, Selects, Form Controls */
body.light-mode input,
body.light-mode textarea,
body.light-mode select,
body.light-mode .premium-input {
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.03);
}

body.light-mode input:focus,
body.light-mode textarea:focus,
body.light-mode select:focus,
body.light-mode .premium-input:focus {
    background: #fff;
    border-color: var(--accent);
}

body.light-mode select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='rgba(0,0,0,0.6)' d='M10.293 3.293L6 7.586 1.707 3.293A1 1 0 00.293 4.707l5 5a1 1 0 001.414 0l5-5a1 1 0 10-1.414-1.414z'/%3E%3C/svg%3E") !important;
}

body.light-mode .custom-select .fa-chevron-down {
    color: var(--text-main);
    opacity: 0.6;
}

body.light-mode .select-options {
    background: #ffffff;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
    border: 1px solid var(--border-color);
}

body.light-mode .matchup-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(241, 245, 249, 0.9) 100%);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.08);
}

body.light-mode .vs-badge {
    background: var(--bg-surface);
    color: var(--text-main);
    box-shadow: 0 0 0 6px #f8fafc, 0 10px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border-color);
}

body.light-mode .info-card {
    background: #ffffff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

body.light-mode .btn-premium-outline:hover {
    color: #fff;
}

/* 8. Settings Page */
body.light-mode .settings-nav {
    background: rgba(255, 255, 255, 0.8);
}

body.light-mode .settings-nav .nav-item {
    color: var(--text-muted);
}

body.light-mode .settings-nav .nav-item:hover {
    background: rgba(0, 0, 0, 0.03);
    color: var(--text-main);
}

body.light-mode .settings-nav .nav-item.active {
    background: rgba(var(--accent-rgb), 0.1);
    color: var(--accent);
}

body.light-mode .theme-option {
    border-color: rgba(0, 0, 0, 0.15);
    background: rgba(0, 0, 0, 0.02);
}

body.light-mode .theme-option:hover {
    border-color: var(--accent);
    background: rgba(var(--accent-rgb), 0.05);
}

body.light-mode .theme-option.active {
    border-color: var(--accent);
    background: rgba(var(--accent-rgb), 0.1);
}

/* 9. History & Tables */
body.light-mode .deck-stat-item {
    background: rgba(0, 0, 0, 0.02);
    border-color: rgba(0, 0, 0, 0.05);
}

body.light-mode .deck-stat-item:hover {
    background: rgba(var(--accent-rgb), 0.05);
    border-color: rgba(var(--accent-rgb), 0.3);
}

body.light-mode .ds-info strong {
    color: var(--text-main);
}

body.light-mode .premium-table th {
    border-color: rgba(0, 0, 0, 0.05);
    color: var(--text-muted);
    background: var(--table-header-bg);
}

body.light-mode .premium-table td {
    border-color: rgba(0, 0, 0, 0.05);
}

body.light-mode .match-row:hover td {
    background: rgba(0, 0, 0, 0.02);
}

body.light-mode .notes-row td {
    background: var(--bg-base);
    border-color: var(--border-color);
}

body.light-mode .notes-row em {
    color: var(--text-main);
}

/* 10. Auth cards */
body.light-mode .auth-card {
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.1);
    border-color: rgba(0, 0, 0, 0.08);
}

/* 11. Tooltip */
body.light-mode .tooltip-text {
    background-color: #1e293b;
    color: #fff;
    border-color: rgba(0, 0, 0, 0.1);
}

/* 12. Autocomplete & search */
body.light-mode .autocomplete-list {
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.1);
}

body.light-mode .profile-dropdown-menu {
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.1);
    border-color: rgba(0, 0, 0, 0.1);
}

/* 13. Deck pool and help section */
body.light-mode .deck-pool-container {
    background: rgba(0, 0, 0, 0.01);
    border-color: rgba(0, 0, 0, 0.08);
}

body.light-mode .help-section {
    background: rgba(var(--accent-rgb), 0.02);
    border-color: rgba(0, 0, 0, 0.06);
}

/* 14. Sidebar collapsed state */
body.light-mode .sidebar-collapsed .nav-links li a.active {
    box-shadow: 0 0 15px rgba(var(--accent-rgb), 0.15);
}

/* 15. Header shadow */
body.light-mode .top-header {
    box-shadow: var(--header-shadow);
}

/* 16. Matrix table */
body.light-mode .matrix-table tbody tr:hover td {
    background: rgba(var(--accent-rgb), 0.03);
}