/* --- 1. CORE ARCHITECTURE ARCHETYPES & THEMES --- */
:root {
    --bg-main: #f4f7fa;
    --bg-surface: #ffffff;
    --bg-surface-sub: #fdfdfd;
    --bg-input: #eef2f6;
    --border-ui: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --brand-primary: #f7931a; 
    --ui-green: #10b981;
    --ui-red: #ef4444;
    --accent-orange-light: rgba(247, 147, 26, 0.1);
    --transition-speed: 0.25s;
}

[data-theme="dark"] {
    --bg-main: #060f1e;
    --bg-surface: #0b1729;
    --bg-surface-sub: #040c16;
    --bg-input: #13243d;
    --border-ui: #1a2e47;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --ui-green: #34d399;
    --ui-red: #f87171;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-main);
    display: flex;
    justify-content: center;
    min-height: 100vh;
    color: var(--text-primary);
}

/* Modal for T&C */
.tc-modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85); backdrop-filter: blur(8px);
    z-index: 9999; display: flex; justify-content: center; align-items: center;
    padding: 20px;
}
.tc-modal-content {
    background: var(--bg-surface); width: 100%; max-width: 500px;
    border-radius: 16px; padding: 24px; border: 1px solid var(--border-ui);
    display: flex; flex-direction: column; gap: 16px;
}
.tc-modal-content h2 { font-size: 1.2rem; font-weight: 700; color: var(--text-primary); }
.tc-scroll-box {
    height: 300px; overflow-y: auto; background: var(--bg-input);
    padding: 16px; border-radius: 8px; font-size: 0.85rem; color: var(--text-secondary); line-height: 1.6;
}
.tc-scroll-box p { margin-bottom: 12px; }
.tc-accept-btn {
    padding: 14px; border: none; border-radius: 8px; font-weight: 700; font-size: 1rem;
    background: var(--ui-green); color: white; cursor: pointer; transition: opacity var(--transition-speed);
}
.tc-accept-btn:disabled { background: var(--text-secondary); cursor: not-allowed; opacity: 0.5; }

/* Responsive Shell Context */
.app-shell {
    width: 100%;
    max-width: 600px; /* Expanded for better desktop viewing */
    background-color: var(--bg-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    padding-bottom: 72px;
    overflow-x: hidden;
    box-shadow: 0 0 40px rgba(0,0,0,0.1);
    transition: filter var(--transition-speed);
}

/* --- 2. LAYOUT HEADER & INFRASTRUCTURE --- */
.site-header {
    background-color: var(--bg-surface); padding: 16px; display: flex;
    justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border-ui);
    position: sticky; top: 0; z-index: 100;
}

.brand-logo { font-weight: 900; font-size: 1.2rem; letter-spacing: -0.5px; display: flex; align-items: center; gap: 6px; }
.brand-logo span { color: var(--brand-primary); }
.text-orange { color: var(--brand-primary); }

.header-right { display: flex; align-items: center; gap: 12px; }

.mode-toggle-container { background-color: var(--bg-input); padding: 3px; border-radius: 8px; display: flex; }
.mode-btn {
    background: none; border: none; font-size: 0.75rem; font-weight: 700;
    padding: 8px 12px; border-radius: 6px; cursor: pointer; color: var(--text-secondary);
    transition: all var(--transition-speed);
}
.mode-btn.active { background-color: var(--bg-surface); color: var(--text-primary); box-shadow: 0 2px 4px rgba(0,0,0,0.05); }

.theme-toggle-btn { background: none; border: none; color: var(--text-secondary); font-size: 1.1rem; cursor: pointer; transition: color var(--transition-speed); }
.theme-toggle-btn:hover { color: var(--brand-primary); }

/* Ticker Information Layer */
.ticker-ribbon { background-color: var(--bg-surface-sub); padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border-ui); }
.ticker-left { display: flex; align-items: center; gap: 8px; }
.coin-icon { width: 20px; height: 20px; }
.asset-pair { font-weight: 800; font-size: 0.9rem; display: flex; flex-direction: column;}
.live-badge { font-size: 0.55rem; color: var(--ui-green); font-weight: 900; letter-spacing: 0.5px; margin-top: 2px;}
.ticker-right { display: flex; align-items: flex-end; flex-direction: column; position: relative; padding: 4px 8px; border-radius: 6px;}
.live-price { font-weight: 700; font-size: 1.05rem; transition: color 0.1s;}
.price-delta { font-size: 0.75rem; font-weight: 600; }

/* --- 3. TAB CONTROLS PANEL ROUTING --- */
.workspace-viewport { flex: 1; padding: 16px; overflow-y: auto; }
.tab-panel { display: none; animation: fadeIn var(--transition-speed) ease-out; }
.tab-panel.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* --- 4. TRADING TOOLING & CANVAS INTERFACES --- */
.chart-container { background-color: var(--bg-surface); border: 1px solid var(--border-ui); border-radius: 12px; padding: 12px; position: relative; margin-bottom: 16px; }
#tradingChart { width: 100%; height: 220px; display: block; }
.chart-crosshair-val { position: absolute; right: 16px; top: 16px; background-color: var(--brand-primary); color: #000; font-size: 0.75rem; font-weight: 800; padding: 4px 8px; border-radius: 4px; box-shadow: 0 4px 10px rgba(247,147,26,0.2);}

.order-execution-card { background-color: var(--bg-surface); border: 1px solid var(--border-ui); border-radius: 12px; padding: 20px; }
.execution-meta-row { display: flex; justify-content: space-between; align-items: center; font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 16px; }
.payout-ratio strong { color: var(--ui-green); font-size: 1rem;}

.modern-select { background: var(--bg-input); color: var(--text-primary); border: 1px solid var(--border-ui); padding: 6px 10px; border-radius: 6px; font-weight: 600; font-family: 'Inter'; outline: none; margin-left: 6px; cursor: pointer;}

.input-group { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.input-group label { font-size: 0.8rem; font-weight: 700; color: var(--text-secondary); }
.amount-input-wrapper { display: flex; align-items: center; background-color: var(--bg-input); border-radius: 8px; border: 1px solid var(--border-ui); padding: 0 16px; transition: border var(--transition-speed);}
.amount-input-wrapper:focus-within { border-color: var(--brand-primary); }
.currency-symbol { font-weight: 700; color: var(--text-secondary); margin-right: 6px; }
.amount-input-wrapper input { background: none; border: none; width: 100%; padding: 14px 0; color: var(--text-primary); font-weight: 700; font-size: 1.1rem; outline: none; }

.execution-actions-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.trade-btn { border: none; padding: 16px; border-radius: 8px; font-weight: 800; font-size: 0.95rem; color: white; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; transition: transform 0.1s, filter 0.2s; }
.trade-btn:hover { filter: brightness(1.1); }
.trade-btn:active { transform: scale(0.96); }
.btn-up { background-color: var(--ui-green); box-shadow: 0 4px 15px rgba(16,185,129,0.2); }
.btn-down { background-color: var(--ui-red); box-shadow: 0 4px 15px rgba(239,68,68,0.2);}

/* Active Positions Layout */
.active-positions-tray { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.position-card { background-color: var(--bg-surface); border: 1px solid var(--border-ui); border-radius: 8px; padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; animation: fadeIn 0.3s ease-out;}
.pos-left { display: flex; flex-direction: column; gap: 4px; }
.pos-dir-badge { font-size: 0.7rem; font-weight: 800; text-transform: uppercase; padding: 3px 8px; border-radius: 4px; width: max-content; color: #fff;}
.pos-dir-badge.up { background-color: var(--ui-green); }
.pos-dir-badge.down { background-color: var(--ui-red); }
.pos-entry { font-size: 0.8rem; color: var(--text-secondary); margin-top: 2px; }
.pos-right { text-align: right; display: flex; flex-direction: column; gap: 4px;}
.pos-timer { font-size: 0.95rem; font-weight: 800; color: var(--brand-primary); font-variant-numeric: tabular-nums; }
.pos-amt { font-size: 0.8rem; font-weight: 600; }

/* --- 5. PROFILE & WALLET SYSTEMS --- */
.profile-header-card, .wallet-balance-hero { background-color: var(--bg-surface); border: 1px solid var(--border-ui); border-radius: 12px; padding: 24px; text-align: center; margin-bottom: 16px; }
.avatar-circle { width: 72px; height: 72px; background-color: var(--accent-orange-light); color: var(--brand-primary); font-size: 2rem; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 12px auto; }
.tier-badge { display: inline-block; background-color: var(--bg-input); font-size: 0.75rem; font-weight: 700; padding: 6px 12px; border-radius: 12px; margin-top: 8px; color: var(--text-secondary); }
.metrics-list-group { background-color: var(--bg-surface); border: 1px solid var(--border-ui); border-radius: 12px; overflow: hidden;}
.metric-item { display: flex; justify-content: space-between; padding: 16px; border-bottom: 1px solid var(--border-ui); font-size: 0.9rem; }
.metric-item:last-child { border-bottom: none; }
.m-label { color: var(--text-secondary); display: flex; align-items: center; gap: 8px; }
.m-val { font-weight: 700; }
.text-green { color: var(--ui-green); }

.hero-label { font-size: 0.8rem; color: var(--text-secondary); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;}
#wallet-crypto-bal { font-size: 1.8rem; font-weight: 900; margin: 8px 0; color: var(--text-primary); }
.fiat-conversion { font-size: 0.9rem; font-weight: 700; color: var(--ui-green); }

.wallet-action-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.w-action-tab { background-color: var(--bg-surface); border: 1px solid var(--border-ui); color: var(--text-secondary); padding: 12px; border-radius: 8px; font-weight: 700; font-size: 0.9rem; cursor: pointer; transition: all var(--transition-speed);}
.w-action-tab.active { background-color: var(--brand-primary); color: #000; border-color: var(--brand-primary); }

.wallet-sub-viewport { display: none; background-color: var(--bg-surface); border: 1px solid var(--border-ui); border-radius: 12px; padding: 20px; animation: fadeIn var(--transition-speed) ease-out; }
.wallet-sub-viewport.active { display: block; }

.deposit-notice { background-color: var(--accent-orange-light); border-radius: 8px; padding: 12px 16px; display: flex; gap: 12px; font-size: 0.8rem; line-height: 1.5; margin-bottom: 20px; }

.qr-code-frame { width: 160px; height: 160px; background-color: white; margin: 0 auto 20px auto; padding: 10px; border-radius: 12px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--border-ui);}

.swap-btn { background: var(--bg-input); border: 1px solid var(--border-ui); color: var(--text-primary); font-size: 0.75rem; padding: 4px 8px; border-radius: 4px; cursor: pointer; font-weight: 600; transition: background 0.2s;}
.swap-btn:hover { background: var(--border-ui); }

.crypto-address-container { display: flex; flex-direction: column; gap: 8px; }
.crypto-address-container label { font-size: 0.75rem; font-weight: 700; color: var(--text-secondary); }
.copy-input-row { display: flex; background-color: var(--bg-input); border-radius: 8px; border: 1px solid var(--border-ui); overflow: hidden; }
.address-string { flex: 1; padding: 12px 14px; font-family: monospace; font-size: 0.8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; align-self: center; }
.copy-action-btn { background-color: var(--border-ui); border: none; padding: 0 16px; color: var(--text-primary); cursor: pointer; transition: background var(--transition-speed);}
.copy-action-btn:hover { background-color: #cbd5e1; }

.wallet-sub-viewport input { background-color: var(--bg-input); border: 1px solid var(--border-ui); border-radius: 8px; padding: 14px; color: var(--text-primary); font-weight: 600; font-size: 0.95rem; outline: none; transition: border var(--transition-speed);}
.wallet-sub-viewport input:focus { border-color: var(--brand-primary); }

.execution-submit-btn { width: 100%; background-color: var(--brand-primary); color: #000; border: none; padding: 16px; border-radius: 8px; font-weight: 800; font-size: 0.95rem; cursor: pointer; margin-top: 12px; transition: filter var(--transition-speed); }
.execution-submit-btn:hover { filter: brightness(1.1); }

/* History Ledger */
.ledger-history-block { margin-top: 20px; }
.ledger-history-block h4 { font-size: 0.9rem; font-weight: 700; color: var(--text-secondary); margin-bottom: 12px; }
.ledger-list { display: flex; flex-direction: column; gap: 8px; }
.ledger-row { background-color: var(--bg-surface); padding: 12px 16px; border-radius: 8px; border: 1px solid var(--border-ui); display: flex; justify-content: space-between; align-items: center; font-size: 0.85rem; }
.ledger-left-info { display: flex; flex-direction: column; gap: 4px; }
.l-type { font-weight: 700; }
.l-date { color: var(--text-secondary); font-size: 0.75rem; }
.l-val { font-weight: 800; }

/* --- 7. HARDWARE FLASH ANIMATIONS --- */
@keyframes flashGreen { 0% { background-color: rgba(16, 185, 129, 0.4); } 100% { background-color: transparent; } }
@keyframes flashRed { 0% { background-color: rgba(239, 68, 68, 0.4); } 100% { background-color: transparent; } }
.feed-flash-up { animation: flashGreen 0.3s ease-out; }
.feed-flash-down { animation: flashRed 0.3s ease-out; }

/* --- 8. FLOATING STICKY NAVIGATION FOOTER --- */
.sticky-footer-menu {
    position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
    width: 100%; max-width: 600px; background-color: var(--bg-surface);
    border-top: 1px solid var(--border-ui); display: grid; grid-template-columns: repeat(3, 1fr);
    padding: 12px 0 8px 0; z-index: 100; box-shadow: 0 -4px 10px rgba(0,0,0,0.05);
}

.menu-nav-btn { background: none; border: none; color: var(--text-secondary); display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; font-size: 0.75rem; font-weight: 600; transition: color var(--transition-speed);}
.menu-nav-btn i { font-size: 1.3rem; }
.menu-nav-btn.active { color: var(--brand-primary); }

.zuri-toast-container {
    position: fixed; top: 20px; right: 20px; z-index: 9999;
    display: flex; flex-direction: column; gap: 10px; pointer-events: none;
}
.zuri-toast {
    background: var(--bg-surface); border-left: 4px solid var(--brand-primary);
    color: var(--text-primary); padding: 16px 24px; border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2); font-weight: 600; font-size: 0.9rem;
    animation: slideInRight 0.3s ease-out forwards; pointer-events: auto;
}
.zuri-toast.error { border-left-color: var(--ui-red); }
.zuri-toast.success { border-left-color: var(--ui-green); }

@keyframes slideInRight { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeOut { to { opacity: 0; } }
