/* ==========================================================================
   IMPORTS & FONTS (Outfit + Space Grotesk)
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Space+Grotesk:wght@400;500;600;700&display=swap');

/* ==========================================================================
   ROOT VARIABLES & THEME SETUP
   ========================================================================== */
:root {
    /* --- Deep Glass Palette --- */
    --bg-void: #030014;
    --glass-surface: rgba(10, 10, 18, 0.6);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-highlight: rgba(255, 255, 255, 0.15);

    /* --- Neon Accents --- */
    --neon-primary: #8B5CF6;
    /* Violet */
    --neon-secondary: #EC4899;
    /* Pink */
    --neon-accent: #06B6D4;
    /* Cyan */

    /* --- Status Colors --- */
    --success-color: #34D399;
    --warning-color: #F59E0B;
    --danger-color: #F472B6;

    /* --- Mapped Variables for Compatibility --- */
    --primary-accent: var(--neon-primary);
    --secondary-accent: var(--neon-secondary);
    --accent-glow: rgba(139, 92, 246, 0.3);

    --background-main: var(--bg-void);
    --panel-bg: var(--glass-surface);
    --panel-bg-hover: rgba(255, 255, 255, 0.05);

    --panel-border: var(--glass-border);
    --panel-border-hover: rgba(255, 255, 255, 0.3);

    --text-primary: #FFFFFF;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;
    --text-dim: #475569;

    /* --- Fonts --- */
    --font-data: 'Space Grotesk', monospace;
    --font-body: 'Outfit', sans-serif;
}

/* ==========================================================================
   BASE & BODY STYLING
   ========================================================================== */
body {
    font-family: var(--font-body);
    color: var(--text-secondary);
    background-color: var(--bg-void);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;

    /* Ambient Lighting Background */
    background-image:
        radial-gradient(circle at 15% 10%, rgba(139, 92, 246, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 85% 20%, rgba(6, 182, 212, 0.12) 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, rgba(236, 72, 153, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 90% 90%, rgba(139, 92, 246, 0.15) 0%, transparent 40%);
    background-attachment: fixed;
    background-size: cover;
}

/* --- Typography Overrides --- */
h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--text-primary);
    font-family: var(--font-body);
    letter-spacing: -0.02em;
}

/* Force data fonts on numbers */
#btc-price,
#gmt-price,
#earnings,
#profit-after-fees,
#electricity-cost,
#service-cost,
#fee-savings-display,
#net-profit-usd,
#net-profit-btc,
#net-profit-gmt,
.stat-value-v2,
.kpi-grid-value,
.hero-stat-value,
.compare-value,
.breakdown-row .value,
.breakdown-card-value {
    font-family: var(--font-data);
    font-weight: 700;
}

/* ==========================================================================
   UTILITY OVERRIDES (Tailwind Fixes)
   ========================================================================== */
/* Force glass look onto existing hardcoded Tailwind classes */
.bg-slate-700,
.bg-slate-800,
.bg-slate-900 {
    background-color: rgba(255, 255, 255, 0.03) !important;
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
}

.bg-slate-900 {
    background-color: rgba(0, 0, 0, 0.3) !important;
}

.text-slate-100 {
    color: #fff !important;
}

.text-slate-200 {
    color: #e2e8f0 !important;
}

.text-slate-300 {
    color: #cbd5e1 !important;
}

.text-slate-400 {
    color: #94a3b8 !important;
}

/* Gradients for text overrides */
.text-indigo-400,
.text-indigo-500 {
    color: var(--neon-primary) !important;
}

.text-green-400,
.text-green-500 {
    color: var(--success-color) !important;
}

.text-red-400,
.text-red-500 {
    color: var(--danger-color) !important;
}

/* ==========================================================================
   IMAGES & SVGS
   ========================================================================== */
/* Generic SVG styling for icons inside widgets */
.card svg,
.glass-panel svg {
    filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.1));
}

/* Make images fit better in dark mode */
img {
    max-width: 100%;
    height: auto;
}

/* Coin Icons (e.g. BTC/GMT logos) */
.coin-icon,
img[src*="icon"] {
    filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.2));
    border-radius: 50%;
}

/* ==========================================================================
   HEADER & NAVIGATION (Complete Overhaul)
   ========================================================================== */
/* Override specific Tailwind header classes */
header,
header.bg-slate-800 {
    background: rgba(3, 0, 20, 0.75) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    position: sticky;
    top: 0;
    z-index: 50;
    height: auto;
    min-height: 5rem;
    /* Ensure enough height for logo */
}

/* Logo Area styling */
header img {
    filter: drop-shadow(0 0 8px rgba(139, 92, 246, 0.5));
}

/* Navigation Links */
nav a,
header a {
    position: relative;
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    /* Pill shape */
    color: var(--text-secondary) !important;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 1px solid transparent;
    text-decoration: none;
}

nav a:hover,
header a:hover {
    color: white !important;
    background-color: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

nav a.nav-active,
header a.nav-active {
    color: white !important;
    background-color: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.3);
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.2);
}

/* "Support This Project" Special Button Styling */
a[href="#"].donate-btn-trigger {
    background: linear-gradient(90deg, rgba(139, 92, 246, 0.2), rgba(236, 72, 153, 0.2)) !important;
    border: 1px solid rgba(139, 92, 246, 0.3) !important;
    color: #fff !important;
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.2);
}

/* Mobile Menu Button - Interactive Fix */
#mobile-menu-button {
    cursor: pointer;
    position: relative;
    z-index: 60;
    /* Ensure it's above other header elements */
    padding: 0.5rem;
    border-radius: 0.5rem;
    transition: background-color 0.2s ease, color 0.2s ease;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
}

#mobile-menu-button:hover,
#mobile-menu-button.active {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-color: var(--neon-primary);
}

/* Explicitly toggle icons based on active state */
#mobile-menu-button svg:first-of-type {
    display: block;
}

#mobile-menu-button svg:last-of-type {
    display: none;
}

#mobile-menu-button.active svg:first-of-type {
    display: none;
}

#mobile-menu-button.active svg:last-of-type {
    display: block;
}


/* Mobile Menu Dropdown Styling */
#mobile-menu {
    position: absolute;
    /* Detach from flow */
    top: 100%;
    /* Push below header */
    left: 0;
    width: 100%;
    background: rgba(3, 0, 20, 0.98) !important;
    /* Nearly opaque background */
    backdrop-filter: blur(24px);
    border-bottom: 1px solid var(--glass-border);
    border-top: 1px solid var(--glass-border);

    /* Animation Properties */
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

#mobile-menu.open {
    max-height: 500px;
    /* Arbitrary large height */
    opacity: 1;
    padding: 1rem 0;
    display: block !important;
    /* Force display if hidden by utility */
}

#mobile-menu a {
    display: block;
    margin: 0.5rem 1rem;
    text-align: center;
}

/* ==========================================================================
   DEEP GLASS CARDS (Widgets) & SIDE PANEL
   ========================================================================== */
.card,
.glass-panel {
    background: var(--glass-surface);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
    border-top: 1px solid var(--glass-highlight);
    border-radius: 24px;
    padding: 1.5rem;
    /* Adjusted for mobile */
    position: relative;
    box-shadow:
        0 20px 40px -10px rgba(0, 0, 0, 0.5),
        inset 0 0 0 1px rgba(255, 255, 255, 0.02);
    transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Widget Side Panel Specific Styles */
#widget-panel {
    background: var(--bg-void);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-right: 1px solid var(--glass-border);
    /* Essential for hiding off-screen */
    transform: translateX(-100%);
    transition: transform 0.3s ease-in-out;
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    z-index: 60;
    width: 320px;
    /* Or whatever width is desired */
    box-shadow: 5px 0 30px rgba(0, 0, 0, 0.5);
}

#widget-panel.open {
    transform: translateX(0);
}

#widget-panel-overlay {
    z-index: 50;
    /* Below panel, above content */
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}


@media (min-width: 768px) {

    .card,
    .glass-panel {
        padding: 2rem;
    }
}

.card:hover {
    transform: translateY(-4px);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 30px 60px -12px rgba(139, 92, 246, 0.15);
}

/* Inner Panels (used inside cards) */
.inner-panel {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    transition: all 0.3s ease;
}

.inner-panel:hover {
    border-color: var(--neon-accent);
    box-shadow: 0 0 15px rgba(6, 182, 212, 0.1);
}

/* Side/Breakdown Cards Fix */
.breakdown-card,
.sidebar-card {
    background: var(--glass-surface);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
    border-top: 1px solid var(--glass-highlight);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s ease, border-color 0.3s ease;
    margin-bottom: 0;
    /* Grid handles gap */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.breakdown-card:hover,
.sidebar-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Dashboard Grid System */
.financial-breakdown-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-top: 2rem;
}

@media (min-width: 1024px) {
    .financial-breakdown-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
}

/* Dashboard Typography Specifics */
.breakdown-card-header {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.breakdown-card-value {
    font-size: 1.5rem;
    color: white;
    font-family: var(--font-data);
    background: linear-gradient(90deg, #fff, var(--text-secondary));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* --- Dashboard Data Picking (Date Pickers) Fix --- */
.dashboard-controls-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.dashboard-controls-wrapper input[type="date"] {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 10px;
    font-family: var(--font-data);
    color-scheme: dark;
    /* Forces browser calendar to be dark */
    outline: none;
    transition: all 0.3s ease;
}

.dashboard-controls-wrapper input[type="date"]:focus {
    border-color: var(--neon-accent);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.2);
}

/* --- Dashboard KPI/Button Icons Fix (Under Graph) --- */
.kpi-grid-card,
.hero-stat-item {
    background: var(--glass-surface);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Center content like a button/tile */
    justify-content: center;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    /* Imply interactivity */
    position: relative;
    overflow: hidden;
}

.kpi-grid-card:hover,
.hero-stat-item:hover {
    transform: translateY(-4px);
    border-color: var(--neon-primary);
    background: rgba(139, 92, 246, 0.1);
    /* Slight purple tint on hover */
    box-shadow: 0 10px 20px -5px rgba(139, 92, 246, 0.2);
}

/* Ensure Icons are properly sized and centered */
.kpi-grid-card img,
.kpi-grid-card svg,
.hero-stat-item img,
.hero-stat-item svg,
.dashboard-stat-icon {
    width: 48px;
    height: 48px;
    object-fit: contain;
    margin-bottom: 0.75rem;
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.3));
    /* Base glow */
    transition: filter 0.3s ease;
    /* Ensure icon is visible against any background */
    position: relative;
    z-index: 10;
}

.kpi-grid-card:hover img,
.kpi-grid-card:hover svg {
    filter: drop-shadow(0 0 12px var(--neon-primary));
    /* Neon glow on hover */
}

/* Stat Values Text Styling */
.kpi-grid-value,
.hero-stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    font-family: var(--font-data);
    margin-top: 0.25rem;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.kpi-grid-label,
.hero-stat-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

/* Dashboard Edit Mode */
.edit-mode-card {
    border: 2px dashed var(--neon-primary) !important;
    background: rgba(139, 92, 246, 0.05) !important;
    cursor: grab;
    animation: pulse-border 2s infinite;
}

.edit-mode-card h2 {
    cursor: grab;
}

@keyframes pulse-border {
    50% {
        border-color: var(--neon-secondary);
    }
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 14px;
    font-weight: 700;
    font-family: var(--font-body);
    letter-spacing: 0.03em;
    text-transform: uppercase;
    font-size: 0.85rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    background: linear-gradient(90deg, var(--neon-primary), var(--neon-secondary));
    color: white;
    box-shadow: 0 10px 20px -5px rgba(236, 72, 153, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px -5px rgba(236, 72, 153, 0.6);
    filter: brightness(1.1);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.btn-danger {
    background: rgba(244, 114, 182, 0.15);
    color: #F472B6;
    border: 1px solid rgba(244, 114, 182, 0.3);
}

.btn-danger:hover {
    background: rgba(244, 114, 182, 0.3);
    box-shadow: 0 0 15px rgba(244, 114, 182, 0.2);
    color: white;
}

/* Tool Buttons (e.g. Snapshot) */
.tool-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    border: 1px solid var(--glass-border);
    padding: 0.5rem 0.875rem;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    transition: all 0.2s ease;
    cursor: pointer;
}

.tool-btn:hover {
    background: var(--neon-primary);
    border-color: var(--neon-primary);
    color: white;
}

/* ==========================================================================
   INPUTS & CHECKBOXES
   ========================================================================== */
.input-field,
select.input-field,
.date-picker-input {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: white;
    padding: 1rem 1.25rem;
    width: 100%;
    font-family: var(--font-data);
    transition: all 0.3s ease;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.input-field:focus,
select.input-field:focus,
.date-picker-input:focus {
    outline: none;
    border-color: var(--neon-primary);
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.15), inset 0 2px 4px rgba(0, 0, 0, 0.3);
    background: rgba(0, 0, 0, 0.5);
}

.custom-select {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="white"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7" /></svg>');
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1em;
    padding-right: 2.5rem;
    appearance: none;
}

/* --- Input with Icon (Fixed for Calculator) --- */
.input-with-icon {
    position: relative;
    display: flex;
    flex-direction: column;
}

.input-with-icon label {
    order: 1;
    /* Ensure label comes first visually if flex is used */
    margin-bottom: 0.5rem;
}

.input-with-icon .input-field {
    order: 2;
    padding-left: 3.25rem;
    /* Make space for the icon */
}

.input-with-icon .input-icon {
    position: absolute;
    bottom: 0.9rem;
    /* Vertically center in the input field area */
    left: 1rem;
    width: 1.5rem;
    height: 1.5rem;
    color: var(--text-secondary);
    pointer-events: none;
    z-index: 10;
    transition: color 0.3s ease, filter 0.3s ease;
}

/* Neon Glow on Focus */
.input-with-icon:focus-within .input-icon {
    color: var(--neon-accent);
    filter: drop-shadow(0 0 8px rgba(6, 182, 212, 0.6));
}

/* --- Custom Checkbox Styling --- */
/* --- Custom Checkbox Styling --- */
/* Use :not clause to exclude the hidden inputs used for toggles */
input[type="checkbox"]:not(.sr-only):not(.peer) {
    appearance: none;
    -webkit-appearance: none;
    width: 1.25rem;
    height: 1.25rem;
    background-color: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    vertical-align: middle;
}

input[type="checkbox"]:not(.sr-only):not(.peer):checked {
    background-color: var(--neon-primary);
    border-color: var(--neon-primary);
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.4);
}

input[type="checkbox"]:not(.sr-only):not(.peer):checked::after {
    content: '✔';
    font-size: 0.8rem;
    color: white;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: bold;
}

input[type="checkbox"]:checked::after {
    content: '✔';
    font-size: 0.8rem;
    color: white;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: bold;
}

/* Fix label spacing next to checkbox */
input[type="checkbox"]+label {
    vertical-align: middle;
    margin-left: 0.5rem;
    cursor: pointer;
}

/* ==========================================================================
   TABS & SEGMENTED CONTROLS
   ========================================================================== */
.tabs-nav {
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tab-button {
    background: transparent;
    color: var(--text-secondary);
    font-weight: 600;
    padding: 0.75rem 1.25rem;
    border-radius: 12px;
    border: 1px solid transparent;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tab-button:hover {
    color: white;
    background: rgba(255, 255, 255, 0.05);
}

.tab-button.active {
    background: rgba(139, 92, 246, 0.15);
    color: var(--neon-primary);
    border: 1px solid rgba(139, 92, 246, 0.3);
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.1);
}

/* Tab Content Visibility */
.tab-content .tab-pane {
    display: none;
    animation: fadeIn 0.4s ease;
}

.tab-content .tab-pane.active {
    display: block;
}

.segmented-control-apple {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--glass-border);
    padding: 4px;
    border-radius: 14px;
    display: inline-flex;
    position: relative;
}

.segmented-control-apple .control-button {
    flex: 1;
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-weight: 600;
    border-radius: 10px;
    z-index: 2;
    cursor: pointer;
    transition: color 0.3s ease;
}

.segmented-control-apple .control-button.active {
    color: white;
}

.active-pill {
    position: absolute;
    top: 4px;
    left: 4px;
    bottom: 4px;
    background: linear-gradient(90deg, var(--neon-primary), var(--neon-accent));
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    z-index: 1;
    transition: transform 0.3s ease, width 0.3s ease;
}

/* ==========================================================================
   SLIDERS & RANGES
   ========================================================================== */
.slider-wrapper {
    position: relative;
    margin-top: 1.5rem;
}

.slider-output {
    position: absolute;
    top: -2.75rem;
    left: 0;
    transform: translateX(-50%);
    background: var(--neon-accent);
    color: #000;
    font-weight: bold;
    border-radius: 8px;
    padding: 4px 8px;
    font-family: var(--font-data);
    box-shadow: 0 0 10px var(--neon-accent);
    pointer-events: none;
    z-index: 10;
}

.slider-output::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid var(--neon-accent);
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 24px;
    width: 24px;
    border-radius: 50%;
    background: var(--bg-void);
    border: 2px solid var(--neon-accent);
    box-shadow: 0 0 15px var(--neon-accent);
    margin-top: -9px;
    transition: transform 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.slider-labels {
    position: relative;
    height: 2rem;
    margin-top: 0.5rem;
    font-size: 0.75rem;
}

.slider-labels span {
    position: absolute;
    top: 0.5rem;
    transform: translateX(-50%);
    color: var(--text-muted);
}

.slider-labels span::before {
    content: '';
    position: absolute;
    top: -0.5rem;
    left: 50%;
    transform: translateX(-50%);
    width: 1px;
    height: 6px;
    background-color: var(--glass-border);
}

/* ==========================================================================
   MODALS, OVERLAYS & TOASTS
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999;
    background: rgba(3, 0, 20, 0.8);
    backdrop-filter: blur(10px);
}

/* Updated selector to include #donate-modal-container and generalized .modal-container */
#signup-modal-container,
#edit-miner-modal-container,
#upgrade-miner-modal-container,
#confirmation-modal-container,
#pioneer-modal-container .bg-slate-800,
#recap-modal-content,
#donate-modal-container,
.modal-container {
    background: rgba(10, 10, 18, 0.85);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1), 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border-radius: 24px;

    /* Center positioning logic */
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(10, 10, 18, 0.9);
    backdrop-filter: blur(12px);
    border: 1px solid var(--success-color);
    color: white;
    padding: 1rem 2rem;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    transition: bottom 0.5s ease-in-out;
    font-weight: 600;
}

.toast.show {
    bottom: 30px;
}

.toast.error {
    border-color: var(--danger-color);
}

/* ==========================================================================
   WIDGET COMPONENTS (Lists, Tables, Stats)
   ========================================================================== */

/* Tables */
.comparison-table th,
.daily-history-table th,
#scenario-results-table th {
    color: var(--neon-accent);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    padding: 1rem;
    border-bottom: 1px solid var(--glass-border);
}

.comparison-table td,
.daily-history-table td,
#scenario-results-table td {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

/* Miner List Items (Cards) - FIXED LAYOUT */
.miner-fleet-item,
.miner-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    border-left: 4px solid var(--neon-primary);
    border-radius: 16px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    transition: transform 0.2s ease, border-color 0.2s ease;
    position: relative;
}

.miner-fleet-item:hover,
.miner-card:hover {
    transform: translateX(4px);
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.2);
}

/* --- Add Miner Form Transitions --- */
/* Ensure the form is hidden by default with zero height */
.add-miner-form {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.3s ease, max-height 0.4s ease, visibility 0.4s, transform 0.3s ease;
    margin-top: 0;
    padding: 0;
}

/* When the class 'is-open' is added via JS, expand it */
.add-miner-form.is-open {
    max-height: 1000px;
    /* Large enough value to fit content */
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--glass-border);
}

/* Internal Layout of Miner Card */
.miner-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.miner-name {
    font-weight: 600;
    color: white;
    font-size: 1rem;
}

.miner-sub-info {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.miner-stats {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
    font-family: var(--font-data);
}

.miner-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.miner-actions button {
    padding: 0.5rem;
    border-radius: 50%;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.miner-actions button:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-color: var(--glass-border);
}

/* Miner Avatar Colors & Styling */
.miner-avatar {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.85rem;
    color: white;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
    text-transform: uppercase;
}

/* Collection Colors */
.miner-avatar[data-collection^="The M"] {
    background-color: #be185d;
}

/* Pink */
.miner-avatar[data-collection^="The T"] {
    background-color: #059669;
}

/* Emerald */
.miner-avatar[data-collection^="The G"] {
    background-color: #d97706;
}

/* Amber */
.miner-avatar[data-collection^="The S"] {
    background-color: #4f46e5;
}

/* Indigo */
.miner-avatar[data-collection^="The N"] {
    background-color: #2563eb;
}

/* Blue */
.miner-avatar[data-collection^="The E"] {
    background-color: #7c3aed;
}

/* Violet */
.miner-avatar[data-collection^="The W"] {
    background-color: #db2777;
}

/* Fuchsia */
.miner-avatar[data-collection^="The K"] {
    background-color: #dc2626;
}

/* Red */
.miner-avatar[data-collection="The Solana Collection"] {
    background-color: #9945FF;
}

.miner-avatar[data-collection="The Duck Collection"] {
    background-color: #FFD700;
    color: black;
}

/* Empty States */
.empty-state-container {
    padding: 3rem;
    text-align: center;
    border: 2px dashed var(--glass-border);
    border-radius: 20px;
    background: rgba(0, 0, 0, 0.2);
}

.empty-state-icon {
    width: 4rem;
    height: 4rem;
    margin: 0 auto 1rem;
    color: var(--text-muted);
    opacity: 0.5;
}

/* Skeleton Loaders (Shimmer) */
.skeleton-card,
.skeleton-line {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    position: relative;
    overflow: hidden;
}

.skeleton-card::after,
.skeleton-line::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

/* Insight Items */
.insight-item {
    display: flex;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-left: 4px solid var(--neon-accent);
    padding: 1rem;
    border-radius: 12px;
}

.insight-item.warning {
    border-left-color: var(--warning-color);
    background: rgba(245, 158, 11, 0.05);
}

/* KPI Grid */
.kpi-grid-card,
.hero-stat-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}

.kpi-grid-card:hover {
    transform: translateY(-4px);
    border-color: var(--neon-primary);
    box-shadow: 0 10px 30px -10px rgba(139, 92, 246, 0.2);
}

/* Live Dot Animation */
.live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--success-color);
    box-shadow: 0 0 10px var(--success-color);
    animation: pulse-glow 2s infinite;
    display: inline-block;
    margin-right: 8px;
}

@keyframes pulse-glow {
    0% {
        box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.4);
    }

    70% {
        box-shadow: 0 0 0 6px rgba(52, 211, 153, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(52, 211, 153, 0);
    }
}

/* Checkbox Toggle */
.checkbox-wrapper-36 label {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--glass-border);
}

.checkbox-wrapper-36 input[type="checkbox"]:checked+label {
    background: var(--neon-primary);
    border-color: var(--neon-primary);
}

/* ==========================================================================
   ANIMATIONS
   ========================================================================== */
.fade-in-up {
    animation: fadeInUp 0.5s ease forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Text Gradients */
.text-gradient {
    background: linear-gradient(135deg, #fff 0%, #a5b4fc 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.text-gradient-primary {
    background: linear-gradient(135deg, var(--neon-accent) 0%, var(--neon-primary) 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* --- Specific Dashboard Overrides for Polish --- */
/* Ensure the chart area doesn't feel cramped */
#performance-chart {
    max-height: 400px;
    padding: 10px;
}

/* Fix for the "naked" checkmark look - ensure they are visible on dark bg */
input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--glass-border);
}

/* Invert the calendar icon in date inputs so it's visible on dark backgrounds */
.date-picker-input::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
    opacity: 0.6;
}

.date-picker-input::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

/* Refine spacing in the new dashboard controls wrapper */
.dashboard-controls-wrapper {
    padding: 0.5rem 0.75rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
}

/* ==========================================================================
   DONATION MODAL STYLING
   ========================================================================== */
/* Header polish */
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* Pushes title to left, button to right */
    padding: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    background: linear-gradient(to right, rgba(255, 255, 255, 0.02), transparent);
    position: relative;
    width: 100%;
    /* Ensure full width */
}

.modal-header h2 {
    font-size: 1.5rem;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
    margin: 0;
    /* Remove default margins */
    line-height: 1.2;
}

.modal-body {
    padding: 1.5rem;
}

/* Crypto Tabs (Icons) */
#crypto-nav {
    background: rgba(0, 0, 0, 0.3) !important;
    /* Force darker bg for the strip */
    border: 1px solid var(--glass-border);
}

.crypto-select-btn {
    width: 3.5rem;
    height: 3.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.5;
    filter: grayscale(100%);
    background: transparent;
    border: 1px solid transparent;
}

.crypto-select-btn:hover {
    opacity: 0.8;
    background: rgba(255, 255, 255, 0.05);
    transform: translateY(-2px);
}

.crypto-select-btn.active {
    opacity: 1;
    filter: grayscale(0%);
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid var(--neon-primary);
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.2);
    transform: scale(1.1);
}

.crypto-select-btn img {
    width: 28px;
    height: 28px;
    filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.2));
}

/* QR Code Area */
#donate-content-crypto div.bg-white {
    background-color: white !important;
    /* Keep white for QR readability */
    border-radius: 16px;
    padding: 1rem;
    box-shadow: 0 0 25px rgba(255, 255, 255, 0.1);
    border: 4px solid rgba(255, 255, 255, 0.1);
    /* Glass border around white */
    max-width: 200px;
    margin: 0 auto;
}

/* Network Label */
#crypto-network {
    font-family: var(--font-data);
    color: var(--neon-accent);
    letter-spacing: 0.05em;
}

/* Address Box */
#wallet-address {
    background: rgba(0, 0, 0, 0.6) !important;
    border: 1px solid var(--glass-border);
    font-family: 'Space Mono', monospace;
    font-size: 0.85rem;
    color: #cbd5e1;
    text-align: center;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.5);
}

#copy-address-btn {
    white-space: nowrap;
}

/* Tab Switcher (Crypto vs PayPal) */
.donate-tab-btn {
    padding: 0.5rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

/* Force active state styling for the tabs if they use btn-primary */
.donate-tab-btn.btn-primary {
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.3);
}

/* Close button positioning fix */
#donate-modal-close-btn {
    /* Override PHP 'absolute' class to make it sit naturally in the flex header */
    position: static !important;
    font-size: 2rem;
    line-height: 1rem;
    padding: 0.5rem;
    margin-right: -0.5rem;
    /* Compensate for padding to align with edge */
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    width: 32px;
    border-radius: 50%;
}

#donate-modal-close-btn:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

#performance-chart {
    min-height: 400px;
    /* Force a height so Chart.js has space to draw */
    width: 100% !important;
}

/* ==========================================================================
   MODAL ANIMATION STATES
   ========================================================================== */
.modal-overlay,
.modal-container {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
}

.modal-overlay.active,
.modal-container.active {
    opacity: 1;
    visibility: visible;
}

/* Add a smooth pop-in effect for the container */
.modal-container {
    transform: translate(-50%, -45%); /* Start slightly lower */
}

.modal-container.active {
    transform: translate(-50%, -50%); /* Pop into exact center */
}