/* ============================================
   QUANTUM TRADE - Premium Trading Calculator
   Modern Glassmorphism Design System
   ============================================ */

:root {
    /* Core Colors */
    --bg-deep: #070b14;
    --bg-surface: #0d1321;
    --bg-card: rgba(15, 23, 42, 0.75);

    /* Primary Gradient */
    --primary-start: #6366f1;
    --primary-end: #8b5cf6;
    --primary: linear-gradient(135deg, var(--primary-start), var(--primary-end));

    /* Accent Colors */
    --accent-cyan: #22d3ee;
    --accent-pink: #f472b6;

    /* Semantic Colors */
    --profit: #10b981;
    --profit-glow: rgba(16, 185, 129, 0.4);
    --loss: #ef4444;
    --loss-glow: rgba(239, 68, 68, 0.4);
    --warning: #f59e0b;

    /* Text Colors */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    /* Border & Shadow */
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(99, 102, 241, 0.3);
    --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.15);

    /* Spacing */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 28px;
}

/* ============================================
   Reset & Base
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-deep);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

/* ============================================
   Background Effects
   ============================================ */
.bg-effects {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
}

.gradient-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
    animation: float 20s ease-in-out infinite;
}

.orb-1 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.4) 0%, transparent 70%);
    top: -200px;
    left: -200px;
    animation-delay: 0s;
}

.orb-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.35) 0%, transparent 70%);
    top: 50%;
    right: -150px;
    animation-delay: -7s;
}

.orb-3 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(34, 211, 238, 0.25) 0%, transparent 70%);
    bottom: -100px;
    left: 30%;
    animation-delay: -14s;
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    25% {
        transform: translate(30px, -30px) scale(1.05);
    }

    50% {
        transform: translate(-20px, 20px) scale(0.95);
    }

    75% {
        transform: translate(20px, 10px) scale(1.02);
    }
}

.grid-overlay {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(99, 102, 241, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(99, 102, 241, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    mask-image: radial-gradient(ellipse at center, black 0%, transparent 70%);
}

/* ============================================
   App Container
   ============================================ */
.app-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ============================================
   Header
   ============================================ */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-subtle);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 40px;
    height: 40px;
}

.logo-icon svg {
    width: 100%;
    height: 100%;
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.brand-name {
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 1px;
    color: var(--text-primary);
}

.brand-name .accent {
    background: var(--primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.brand-tag {
    font-size: 0.65rem;
    color: var(--text-muted);
    letter-spacing: 2px;
    text-transform: uppercase;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.market-ticker {
    display: none;
    gap: 12px;
}

@media (min-width: 600px) {
    .market-ticker {
        display: flex;
    }
}

.ticker-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
}

.ticker-symbol {
    color: var(--text-muted);
    font-weight: 500;
}

.ticker-price {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
}

.ticker-price.up {
    color: var(--profit);
}

.ticker-price.down {
    color: var(--loss);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 20px;
}

.pulse {
    width: 8px;
    height: 8px;
    background: var(--profit);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        box-shadow: 0 0 0 0 var(--profit-glow);
    }

    50% {
        opacity: 0.8;
        box-shadow: 0 0 0 8px transparent;
    }
}

.status-text {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--profit);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Coin Search & Custom Ticker */
.ticker-add {
    width: 24px;
    height: 24px;
    background: rgba(99, 102, 241, 0.2);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 50%;
    color: var(--primary-start);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ticker-add:hover {
    background: rgba(99, 102, 241, 0.4);
    transform: scale(1.1);
}

.custom-ticker {
    position: relative;
}

.ticker-remove {
    width: 16px;
    height: 16px;
    background: rgba(239, 68, 68, 0.2);
    border: none;
    border-radius: 50%;
    color: var(--loss);
    font-size: 0.8rem;
    cursor: pointer;
    margin-left: 4px;
    transition: all 0.2s;
}

.ticker-remove:hover {
    background: var(--loss);
    color: white;
}

.coin-search {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    width: 280px;
    background: var(--bg-card);
    border: 1px solid var(--border-glow);
    border-radius: var(--radius-md);
    padding: 12px;
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow-card);
    z-index: 100;
}

.coin-search input {
    width: 100%;
    padding: 10px 12px;
    font-size: 0.85rem;
    margin-bottom: 8px;
}

.coin-results {
    max-height: 200px;
    overflow-y: auto;
}

.coin-results::-webkit-scrollbar {
    width: 4px;
}

.coin-results::-webkit-scrollbar-thumb {
    background: var(--border-glow);
    border-radius: 2px;
}

.coin-result-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.coin-result-item:hover {
    background: rgba(99, 102, 241, 0.15);
}

.coin-result-item img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

.coin-result-info {
    flex: 1;
}

.coin-result-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.coin-result-symbol {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.coin-loading {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.header-right {
    position: relative;
}

/* ============================================
   Navigation Tabs
   ============================================ */
.main-nav {
    display: flex;
    gap: 6px;
    padding: 6px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    margin-bottom: 24px;
    overflow-x: auto;
    scrollbar-width: none;
}

.main-nav::-webkit-scrollbar {
    display: none;
}

.nav-tab {
    flex: 1;
    min-width: max-content;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.nav-tab .tab-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.nav-tab:hover {
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
}

.nav-tab.active {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-glow);
    box-shadow: var(--shadow-glow), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.nav-tab.active .tab-icon {
    color: var(--primary-start);
}

/* ============================================
   Screen & Cards
   ============================================ */
.main-content {
    flex: 1;
}

.screen {
    display: none;
    animation: fadeSlideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.screen.active {
    display: block;
}

@keyframes fadeSlideUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.screen-grid {
    display: grid;
    gap: 20px;
}

@media (min-width: 768px) {
    .screen-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.glass-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 24px;
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow-card);
    transition: all 0.3s ease;
}

.glass-card:hover {
    border-color: var(--border-glow);
    box-shadow: var(--shadow-card), var(--shadow-glow);
}

.card-header {
    margin-bottom: 20px;
}

.card-header h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.card-header .icon {
    font-size: 1.1rem;
}

.divider {
    height: 1px;
    background: var(--border-subtle);
    margin: 24px 0;
}

/* ============================================
   Side Toggle (Long/Short)
   ============================================ */
.side-toggle {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.side-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.side-btn svg {
    width: 18px;
    height: 18px;
}

.side-btn.long.active {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.4);
    color: var(--profit);
    box-shadow: 0 0 20px var(--profit-glow);
}

.side-btn.short.active {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.4);
    color: var(--loss);
    box-shadow: 0 0 20px var(--loss-glow);
}

/* ============================================
   Input Groups
   ============================================ */
.input-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group.full {
    grid-column: span 2;
}

.input-group label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.toggle-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 4px;
    color: var(--primary-start);
    font-size: 0.65rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.toggle-btn svg {
    width: 12px;
    height: 12px;
}

.toggle-btn:hover {
    background: rgba(99, 102, 241, 0.2);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-prefix,
.input-suffix {
    position: absolute;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    pointer-events: none;
}

.input-prefix {
    left: 14px;
}

.input-suffix {
    right: 14px;
}

input {
    width: 100%;
    padding: 14px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.2s;
}

input:has(~ .input-suffix) {
    padding-right: 40px;
}

.input-wrapper:has(.input-prefix) input {
    padding-left: 30px;
}

input:focus {
    outline: none;
    border-color: var(--primary-start);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

input::placeholder {
    color: rgba(255, 255, 255, 0.15);
}

/* Hide number input spinners */
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;
}

/* ============================================
   Result Display
   ============================================ */
.hero-result {
    text-align: center;
    padding: 24px;
    margin-bottom: 20px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.05));
    border: 1px solid var(--border-glow);
    border-radius: var(--radius-md);
}

.hero-result.accent {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.1));
}

.hero-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.hero-value {
    display: block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 2.2rem;
    font-weight: 700;
    line-height: 1.2;
    transition: color 0.3s;
}

.hero-value.profit {
    color: var(--profit);
    text-shadow: 0 0 30px var(--profit-glow);
}

.hero-value.loss {
    color: var(--loss);
    text-shadow: 0 0 30px var(--loss-glow);
}

.hero-value.neutral {
    color: var(--text-primary);
}

.hero-sub {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.result-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.result-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    transition: all 0.2s;
}

.result-item:hover {
    border-color: var(--border-subtle);
}

.result-item.warning {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.2);
}

.result-label {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.result-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.result-value.profit {
    color: var(--profit);
}

.result-value.loss {
    color: var(--loss);
}

.result-value.neutral {
    color: var(--text-primary);
}

.result-value.highlight {
    color: var(--accent-cyan);
}

/* ============================================
   Compare Grid
   ============================================ */
.compare-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.compare-item {
    padding: 16px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    transition: all 0.3s;
}

.compare-item:hover {
    border-color: var(--border-glow);
    transform: translateY(-2px);
}

.compare-item.highlight {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.1));
    border-color: var(--border-glow);
}

.compare-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.compare-icon {
    font-size: 1.2rem;
}

.compare-title {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.compare-value {
    display: block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* ============================================
   Footer
   ============================================ */
.main-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    margin-top: 24px;
    border-top: 1px solid var(--border-subtle);
}

.reset-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: transparent;
    border: 1px dashed var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.reset-btn svg {
    width: 16px;
    height: 16px;
}

.reset-btn:hover {
    border-color: var(--loss);
    color: var(--loss);
    background: rgba(239, 68, 68, 0.1);
}

.footer-info {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 480px) {
    .app-container {
        padding: 16px;
    }

    .glass-card {
        padding: 20px;
    }

    .hero-value {
        font-size: 1.8rem;
    }

    .input-grid {
        grid-template-columns: 1fr;
    }

    .input-group.full {
        grid-column: span 1;
    }

    .result-grid {
        grid-template-columns: 1fr;
    }

    .compare-grid {
        grid-template-columns: 1fr;
    }

    .nav-tab span {
        display: none;
    }

    .nav-tab {
        padding: 12px;
    }

    .nav-tab .tab-icon {
        width: 22px;
        height: 22px;
    }
}