/* =========================================================================
   EarnHub Pro — Professional Gamified Micro-Earning & Fintech Design System
   Works 100% standalone AND with Bootstrap 5. Full Light & Dark Theme Support.
   ========================================================================= */
:root {
    --eh-primary: #4f46e5;
    --eh-primary-hover: #4338ca;
    --eh-primary-soft: rgba(79, 70, 229, 0.12);
    --eh-secondary: #0f172a;
    --eh-accent: #f59e0b;
    --eh-accent-soft: rgba(245, 158, 11, 0.16);
    --eh-emerald: #10b981;
    --eh-emerald-soft: rgba(16, 185, 129, 0.14);
    --eh-bg: #f1f5f9;
    --eh-surface: #ffffff;
    --eh-surface-alt: #f8fafc;
    --eh-text: #0f172a;
    --eh-text-muted: #475569;
    --eh-border: #e2e8f0;
    --eh-success: #15803d;
    --eh-warning: #b45309;
    --eh-danger: #b91c1c;
    --eh-info: #0369a1;
    --eh-radius: 0.875rem;
    --eh-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.06), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
    --eh-shadow-lg: 0 12px 32px -4px rgba(79, 70, 229, 0.15);
}

[data-theme="dark"] {
    --eh-primary: #6366f1;
    --eh-primary-hover: #818cf8;
    --eh-primary-soft: rgba(99, 102, 241, 0.2);
    --eh-secondary: #f8fafc;
    --eh-accent: #fbbf24;
    --eh-accent-soft: rgba(251, 191, 36, 0.2);
    --eh-bg: #0b1120;
    --eh-surface: #1e293b;
    --eh-surface-alt: #0f172a;
    --eh-text: #f8fafc;
    --eh-text-muted: #94a3b8;
    --eh-border: #334155;
    --eh-shadow: 0 6px 24px 0 rgba(0, 0, 0, 0.4);
}

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--eh-bg);
    color: var(--eh-text);
    line-height: 1.6;
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

a {
    color: var(--eh-primary);
    text-decoration: none;
    transition: all 0.2s ease;
}
a:hover {
    color: var(--eh-primary-hover);
}

/* Standalone Layout & Grid Fallbacks (ensures layout never breaks even if CDN is slow/blocked) */
.container, .eh-container {
    width: 100%;
    max-width: 1280px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
}
.container-fluid {
    width: 100%;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
}

.eh-grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
.eh-grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }
.eh-grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }

/* Top Navbar */
.navbar-earnhub {
    background-color: var(--eh-surface);
    border-bottom: 1px solid var(--eh-border);
    box-shadow: var(--eh-shadow);
    position: sticky;
    top: 0;
    z-index: 1030;
    padding: 0.65rem 0;
}

.eh-nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.eh-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 800;
    font-size: 1.3rem;
    color: var(--eh-text) !important;
    text-decoration: none !important;
}

.eh-nav-links {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
}

.eh-nav-links > li {
    position: relative;
}

.eh-nav-links .nav-link {
    color: var(--eh-text) !important;
    font-weight: 600;
    font-size: 0.92rem;
    padding: 0.5rem 0.85rem;
    border-radius: 0.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    text-decoration: none !important;
}
.eh-nav-links .nav-link:hover,
.eh-nav-links .nav-link.active {
    background-color: var(--eh-primary-soft);
    color: var(--eh-primary) !important;
}

/* Custom Dropdown Menu (Works via click & hover in Vanilla JS + CSS) */
.eh-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 230px;
    background-color: var(--eh-surface);
    border: 1px solid var(--eh-border);
    border-radius: 0.75rem;
    box-shadow: var(--eh-shadow-lg);
    padding: 0.5rem;
    list-style: none;
    margin: 0.25rem 0 0 0;
    z-index: 1050;
}
.eh-dropdown.open > .eh-dropdown-menu,
.eh-dropdown:hover > .eh-dropdown-menu {
    display: block;
}
.eh-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.85rem;
    color: var(--eh-text) !important;
    font-size: 0.88rem;
    font-weight: 600;
    border-radius: 0.5rem;
    text-decoration: none !important;
}
.eh-dropdown-item:hover {
    background-color: var(--eh-primary-soft);
    color: var(--eh-primary) !important;
}

.eh-nav-actions {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex-wrap: wrap;
}

.eh-mobile-toggle {
    display: none;
    background: var(--eh-surface-alt);
    color: var(--eh-text);
    border: 1px solid var(--eh-border);
    border-radius: 0.5rem;
    padding: 0.45rem 0.7rem;
    font-size: 1.1rem;
    cursor: pointer;
    font-weight: 700;
}

@media (max-width: 991px) {
    .eh-mobile-toggle {
        display: inline-flex;
        align-items: center;
        gap: 0.35rem;
    }
    .eh-nav-collapse {
        display: none;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        padding-top: 0.85rem;
        border-top: 1px solid var(--eh-border);
        margin-top: 0.65rem;
    }
    .eh-nav-collapse.show {
        display: flex !important;
    }
    .eh-nav-links {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        margin-bottom: 0.75rem;
    }
    .eh-dropdown-menu {
        position: static;
        box-shadow: none;
        border: none;
        padding-left: 1rem;
    }
    .eh-nav-actions {
        width: 100%;
        justify-content: flex-start;
    }
}

@media (min-width: 992px) {
    .eh-nav-collapse {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        flex: 1;
        margin-left: 1rem;
    }
}

/* =========================================================================
   USER & ADMIN DASHBOARD SHELL (Fixes the stretched sidebar bug permanently!)
   ========================================================================= */
.eh-dashboard-shell {
    display: grid;
    grid-template-columns: 265px minmax(0, 1fr);
    gap: 1.5rem;
    max-width: 1440px;
    width: 100%;
    margin: 0 auto;
    padding: 1.5rem 1.25rem;
    align-items: start;
}

.eh-dashboard-main {
    min-width: 0;
    width: 100%;
}

.eh-sidebar {
    background-color: var(--eh-surface);
    border: 1px solid var(--eh-border);
    border-radius: var(--eh-radius);
    box-shadow: var(--eh-shadow);
    padding: 1.1rem 0.85rem;
    width: 265px;
    position: sticky;
    top: 76px;
    max-height: calc(100vh - 92px);
    overflow-y: auto;
}

.eh-sidebar-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.5rem 0.9rem;
    margin-bottom: 0.65rem;
    border-bottom: 1px solid var(--eh-border);
}

.eh-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4f46e5, #9333ea);
    color: #ffffff;
    font-weight: 800;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.eh-sidebar-group-title {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--eh-text-muted);
    padding: 0.55rem 0.65rem 0.25rem;
}

.eh-sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
}

.eh-sidebar .nav-link {
    color: var(--eh-text) !important;
    padding: 0.55rem 0.75rem;
    border-radius: 0.6rem;
    font-weight: 600;
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none !important;
    transition: all 0.15s ease;
}

.eh-sidebar .nav-link:hover {
    background-color: var(--eh-primary-soft);
    color: var(--eh-primary) !important;
}

.eh-sidebar .nav-link.active {
    background: linear-gradient(135deg, var(--eh-primary), #7c3aed);
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.28);
}

.eh-sidebar-coin-tag {
    margin-left: auto;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 0.12rem 0.45rem;
    border-radius: 999px;
    background-color: var(--eh-accent-soft);
    color: #d97706;
}
.eh-sidebar .nav-link.active .eh-sidebar-coin-tag {
    background-color: rgba(255, 255, 255, 0.22);
    color: #ffffff;
}

@media (max-width: 991px) {
    .eh-dashboard-shell {
        grid-template-columns: 1fr;
        padding: 1rem;
    }
    .eh-sidebar {
        width: 100%;
        position: static;
        max-height: none;
        display: none;
    }
    .eh-sidebar.mobile-open {
        display: block;
    }
}

/* =========================================================================
   BUTTONS, BADGES, COIN PILLS & FORM CONTROLS
   ========================================================================= */
.btn-eh-primary {
    background: linear-gradient(135deg, var(--eh-primary) 0%, #7c3aed 100%);
    color: #ffffff !important;
    border: none;
    font-weight: 700;
    padding: 0.58rem 1.25rem;
    border-radius: 0.6rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    cursor: pointer;
    text-decoration: none !important;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-eh-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(79, 70, 229, 0.35);
    color: #ffffff !important;
}

.btn-eh-gold {
    background: linear-gradient(135deg, #f59e0b 0%, #ea580c 100%);
    color: #ffffff !important;
    border: none;
    font-weight: 800;
    padding: 0.65rem 1.4rem;
    border-radius: 0.65rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    cursor: pointer;
    text-decoration: none !important;
    box-shadow: 0 6px 18px rgba(245, 158, 11, 0.35);
}
.btn-eh-gold:hover {
    transform: translateY(-1px);
    color: #ffffff !important;
}

.btn-eh-outline {
    background-color: var(--eh-surface);
    color: var(--eh-primary) !important;
    border: 1.5px solid var(--eh-primary);
    font-weight: 700;
    padding: 0.52rem 1.15rem;
    border-radius: 0.6rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    cursor: pointer;
    text-decoration: none !important;
}
.btn-eh-outline:hover {
    background-color: var(--eh-primary);
    color: #ffffff !important;
}

.btn-eh-theme {
    background-color: var(--eh-surface-alt);
    color: var(--eh-text) !important;
    border: 1px solid var(--eh-border);
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0.45rem 0.85rem;
    border-radius: 0.55rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
}
.btn-eh-theme:hover {
    border-color: var(--eh-primary);
}

.eh-coin-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.18), rgba(234, 88, 12, 0.18));
    color: #d97706;
    border: 1px solid rgba(245, 158, 11, 0.4);
    padding: 0.25rem 0.7rem;
    border-radius: 999px;
    font-weight: 800;
    font-size: 0.82rem;
}
[data-theme="dark"] .eh-coin-pill {
    color: #fbbf24;
}

.eh-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25em 0.7em;
    font-size: 0.74rem;
    font-weight: 700;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.eh-badge-success { background-color: #dcfce7; color: #166534; }
.eh-badge-warning { background-color: #fef3c7; color: #92400e; }
.eh-badge-danger  { background-color: #fee2e2; color: #991b1b; }
.eh-badge-info    { background-color: #e0e7ff; color: #3730a3; }
.eh-badge-neutral { background-color: #e2e8f0; color: #334155; }

/* Cards & Stat Cards */
.eh-card {
    background-color: var(--eh-surface);
    border: 1px solid var(--eh-border);
    border-radius: var(--eh-radius);
    box-shadow: var(--eh-shadow);
    padding: 1.35rem;
    margin-bottom: 1.25rem;
}

.eh-stat-card {
    background-color: var(--eh-surface);
    border: 1px solid var(--eh-border);
    border-top: 4px solid var(--eh-primary);
    border-radius: var(--eh-radius);
    padding: 1.15rem 1.25rem;
    box-shadow: var(--eh-shadow);
    height: 100%;
    transition: transform 0.15s ease;
}
.eh-stat-card:hover {
    transform: translateY(-2px);
}
.eh-stat-card .stat-label {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--eh-text-muted);
    margin-bottom: 0.35rem;
}
.eh-stat-card .stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--eh-text);
    margin-bottom: 0.15rem;
}

/* =========================================================================
   HERO SECTION & ANIMATED EARNING MODULE CARDS
   ========================================================================= */
.eh-hero {
    background: radial-gradient(circle at 80% 20%, #4338ca 0%, #1e1b4b 55%, #0f172a 100%);
    color: #ffffff;
    padding: 4rem 0;
    position: relative;
    overflow: hidden;
}

.eh-earning-card {
    background-color: var(--eh-surface);
    border: 1px solid var(--eh-border);
    border-radius: 1rem;
    box-shadow: var(--eh-shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.eh-earning-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--eh-shadow-lg);
    border-color: var(--eh-primary);
}
.eh-earning-card-body {
    padding: 1.15rem 1.25rem 1.25rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.eh-anim-stage {
    position: relative;
    width: 100%;
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-bottom: 1px solid var(--eh-border);
    padding: 0.5rem;
}

.eh-svg-scene {
    width: 100%;
    max-width: 240px;
    height: 92px;
}

.eh-anim-caption {
    font-size: 0.72rem;
    font-weight: 700;
    color: #e2e8f0;
    background: rgba(255, 255, 255, 0.08);
    padding: 0.15rem 0.65rem;
    border-radius: 999px;
    margin-top: 2px;
    letter-spacing: 0.02em;
}

.eh-floating-coin {
    position: absolute;
    top: 8px;
    right: 10px;
    background: linear-gradient(135deg, #f59e0b, #ea580c);
    color: #ffffff;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.5);
    animation: ehFloatCoin 2.6s ease-in-out infinite;
    z-index: 2;
}
.eh-fc-2 {
    top: auto;
    bottom: 26px;
    left: 10px;
    right: auto;
    animation-delay: 1.2s;
}

/* Keyframe Animations for Earning Visuals */
@keyframes ehFloatCoin {
    0%, 100% { transform: translateY(0px) scale(1); }
    50% { transform: translateY(-5px) scale(1.05); }
}
@keyframes ehSpinWheel {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
@keyframes ehPulseBadge {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.06); opacity: 0.9; }
}
@keyframes ehCardSwipe {
    0%, 100% { transform: rotate(0deg) translateX(0); }
    35% { transform: rotate(8deg) translateX(12px); }
    70% { transform: rotate(-6deg) translateX(-10px); }
}
@keyframes ehProgressFill {
    0% { width: 25px; }
    70%, 100% { width: 156px; }
}
@keyframes ehFlowDot {
    0%, 100% { opacity: 0.25; transform: scale(0.85); }
    50% { opacity: 1; transform: scale(1.25); }
}

.eh-wheel-spin-anim { animation: ehSpinWheel 9s linear infinite; }
.eh-pulse-badge { animation: ehPulseBadge 2s ease-in-out infinite; transform-origin: center; }
.eh-pulse-ring { animation: ehPulseBadge 2.4s ease-in-out infinite; transform-origin: center; }
.eh-card-swipe-anim { animation: ehCardSwipe 3.2s ease-in-out infinite; }
.eh-progress-fill-anim { animation: ehProgressFill 3.5s ease-in-out infinite; }
.eh-flow-dot-1 { animation: ehFlowDot 1.5s infinite 0s; }
.eh-flow-dot-2 { animation: ehFlowDot 1.5s infinite 0.3s; }
.eh-flow-dot-3 { animation: ehFlowDot 1.5s infinite 0.6s; }

/* =========================================================================
   PAYMENT METHOD SELECTOR CARDS (UPI, GPay, Paytm, PhonePe, Bank)
   ========================================================================= */
.eh-payment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
    gap: 0.65rem;
    margin-bottom: 1rem;
}

.eh-payment-option {
    border: 2px solid var(--eh-border);
    background-color: var(--eh-surface-alt);
    border-radius: 0.75rem;
    padding: 0.65rem 0.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    font-weight: 700;
    font-size: 0.8rem;
}
.eh-payment-option:hover {
    border-color: var(--eh-primary);
}
.eh-payment-option.active {
    border-color: var(--eh-primary);
    background-color: var(--eh-primary-soft);
    color: var(--eh-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.eh-pay-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.6rem;
    border-radius: 0.5rem;
    font-size: 0.78rem;
    font-weight: 700;
    background-color: var(--eh-surface-alt);
    border: 1px solid var(--eh-border);
}

/* Tables & Forms */
.table-eh {
    width: 100%;
    border-collapse: collapse;
    color: var(--eh-text);
}
.table-eh th {
    background-color: var(--eh-surface-alt);
    color: var(--eh-text-muted);
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--eh-border);
    text-align: left;
}
.table-eh td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--eh-border);
    vertical-align: middle;
}

.form-control, .form-select {
    width: 100%;
    padding: 0.55rem 0.85rem;
    font-size: 0.92rem;
    border-radius: 0.55rem;
    background-color: var(--eh-surface);
    color: var(--eh-text);
    border: 1.5px solid var(--eh-border);
    transition: border-color 0.15s ease;
}
.form-control:focus, .form-select:focus {
    outline: none;
    background-color: var(--eh-surface);
    color: var(--eh-text);
    border-color: var(--eh-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.18);
}

.eh-auth-wrap {
    max-width: 540px;
    margin: 0 auto;
}

footer.eh-footer {
    background-color: #0b1120;
    color: #cbd5e1;
    margin-top: auto;
    padding: 3.5rem 0 2rem;
    border-top: 1px solid #1e293b;
}
footer.eh-footer a {
    color: #94a3b8;
    text-decoration: none;
}
footer.eh-footer a:hover {
    color: #ffffff;
}
