/* DonutTrade — Apple Dark Glass & Ambient Mesh Styling */

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

:root {
    --bg-obsidian: #0B0E17;
    --card-gradient: linear-gradient(180deg, rgba(25, 30, 44, 0.92) 0%, rgba(17, 21, 32, 0.94) 100%);
    --card-gradient-hover: linear-gradient(180deg, rgba(32, 38, 56, 0.94) 0%, rgba(20, 25, 38, 0.96) 100%);
    --card-border: rgba(255, 255, 255, 0.09);
    --card-border-hover: rgba(255, 255, 255, 0.18);
    --glass-panel: rgba(14, 18, 28, 0.75);
    --accent-blue: #38bdf8;
    --accent-indigo: #6366f1;
    --accent-green: #34d399;
    --accent-red: #f87171;
    --accent-amber: #fbbf24;
}

html, body {
    max-width: 100vw;
    overflow-x: clip;
    overscroll-behavior-x: none;
    -webkit-overflow-scrolling: touch;
}

body {
    background-color: var(--bg-obsidian);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
    color: #f8fafc;
}

/* Tabular numbers for clean prices and metrics */
.tabular-nums, .num, input[type="number"], .num-tabular {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}

/* Ambient Fixed Mesh Blobs - Soft and non-distracting */
.ambient-glow-wrapper {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100dvh;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.ambient-blob-1 {
    position: absolute;
    top: -140px;
    left: -80px;
    width: 680px;
    height: 680px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.22) 0%, rgba(139, 92, 246, 0.10) 45%, transparent 70%);
    filter: blur(130px);
    border-radius: 50%;
}

.ambient-blob-2 {
    position: absolute;
    top: -60px;
    right: -100px;
    width: 640px;
    height: 640px;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.18) 0%, rgba(14, 165, 233, 0.08) 45%, transparent 70%);
    filter: blur(130px);
    border-radius: 50%;
}

.ambient-blob-3 {
    position: absolute;
    bottom: -140px;
    left: 28%;
    width: 720px;
    height: 720px;
    background: radial-gradient(circle, rgba(245, 158, 11, 0.12) 0%, rgba(217, 119, 6, 0.06) 50%, transparent 70%);
    filter: blur(140px);
    border-radius: 50%;
}

/* Stable Apple Dark Glass Cards - NO backdrop-filter or hover-transform flicker */
.glass-card {
    background: var(--card-gradient);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.50);
    transition: border-color 0.15s ease;
}

.glass-card:hover {
    border-color: var(--card-border-hover);
}

.glass-card-interactive {
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.glass-card-interactive:hover {
    background: var(--card-gradient-hover);
    border-color: rgba(255, 255, 255, 0.20);
}

.glass-panel {
    background: var(--glass-panel);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
}

/* Glass Pill Buttons & Badges */
.glass-pill {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.11);
    border-radius: 9999px;
    transition: all 0.15s ease-out;
}

.glass-pill:hover {
    background: rgba(255, 255, 255, 0.11);
    border-color: rgba(255, 255, 255, 0.22);
}

.btn-glass {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 9999px;
    transition: all 0.15s ease-out;
}

.btn-glass:hover {
    background: rgba(255, 255, 255, 0.13);
    border-color: rgba(255, 255, 255, 0.25);
    color: #ffffff;
}

/* Primary Gradient Action Button */
.btn-primary, .btn-primary-gradient {
    background: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%);
    color: #ffffff;
    box-shadow: 0 4px 18px rgba(79, 70, 229, 0.35);
    border-radius: 9999px;
    transition: all 0.15s ease;
}

.btn-primary:hover:not(:disabled), .btn-primary-gradient:hover:not(:disabled) {
    background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.45);
}

.btn-primary:active:not(:disabled), .btn-primary-gradient:active:not(:disabled) {
    transform: scale(0.98);
}

.btn-primary:disabled, .btn-primary-gradient:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    box-shadow: none;
    filter: grayscale(0.5);
}

/* Smooth dark scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.16);
    border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.30);
}

/* iOS Safe Area & Fixed PWA Panels */
.pwa-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 40;
    padding-top: env(safe-area-inset-top, 0px);
    background: rgba(11, 14, 23, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.pwa-main {
    padding-top: calc(4.25rem + env(safe-area-inset-top, 0px));
    padding-bottom: calc(5.75rem + env(safe-area-inset-bottom, 0px));
}

@media (min-width: 768px) {
    .pwa-main {
        padding-top: 5rem;
        padding-bottom: 2rem;
    }
}

.safe-area-bottom {
    padding-bottom: max(0.65rem, env(safe-area-inset-bottom, 0px));
    padding-top: 0.45rem;
}

#toastContainer {
    bottom: calc(5rem + env(safe-area-inset-bottom, 0px));
}

@media (min-width: 768px) {
    #toastContainer {
        bottom: 1.5rem;
    }
}

/* Form inputs */
input[type=number]::-webkit-inner-spin-button, 
input[type=number]::-webkit-outer-spin-button { 
    -webkit-appearance: none; 
    margin: 0; 
}
input[type=number] {
    -moz-appearance: textfield;
}

/* Segmented Control styling */
.segmented-control {
    background: rgba(14, 18, 28, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.11);
    border-radius: 9999px;
    padding: 3px;
}
.segmented-item {
    border-radius: 9999px;
    padding: 5px 14px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s ease;
}
.segmented-item.active {
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}
