/* ===== TERMINAL DASHBOARD — Design System ===== */
/* MiroFish-inspired: black bg, monospace, orange/green/red accents */

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

/* === CSS Variables === */
:root {
    --bg-primary: #060610;
    --bg-secondary: rgba(14, 14, 28, 0.85);
    --bg-widget: rgba(12, 12, 26, 0.55);
    --bg-widget-header: rgba(18, 18, 36, 0.7);
    --bg-hover: rgba(30, 30, 60, 0.5);
    --bg-input: rgba(8, 8, 20, 0.6);

    --border-primary: rgba(60, 60, 120, 0.25);
    --border-accent: rgba(100, 100, 180, 0.3);
    --border-widget: rgba(50, 50, 100, 0.2);
    --border-focus: #f59e0b;

    --text-primary: #f0f0f8;
    --text-secondary: #a0a0b8;
    --text-muted: #606078;
    --text-dim: #38384a;

    --accent-orange: #ff9f1c;
    --accent-green: #2ecc71;
    --accent-red: #ff4757;
    --accent-cyan: #00d2ff;
    --accent-blue: #4f8cff;
    --accent-purple: #b24dff;
    --accent-yellow: #ffe066;
    --accent-pink: #ff6b9d;

    --font-mono: 'JetBrains Mono', 'Share Tech Mono', 'Courier New', monospace;
    --font-size-xs: 10px;
    --font-size-sm: 11px;
    --font-size-base: 12.5px;
    --font-size-md: 13.5px;
    --font-size-lg: 16px;
    --font-size-xl: 20px;
    --font-size-xxl: 28px;
    --font-size-huge: 36px;

    --widget-radius: 2px;
    --widget-gap: 6px;
    --header-height: 36px;
    --ticker-height: 28px;

    --shadow-widget: 0 2px 8px rgba(0, 0, 0, 0.5), 0 8px 32px rgba(0, 0, 0, 0.35), 0 0 1px rgba(100, 100, 200, 0.15);
    --shadow-glow-green: 0 0 12px rgba(46, 204, 113, 0.25);
    --shadow-glow-red: 0 0 12px rgba(255, 71, 87, 0.25);
    --shadow-glow-orange: 0 0 12px rgba(255, 159, 28, 0.25);

    --glass-blur: blur(16px);
    --glass-border: 1px solid rgba(255, 255, 255, 0.06);
}

/* === Reset & Base === */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    overflow: hidden;
    background: var(--bg-primary);
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(30, 30, 80, 0.15) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(40, 20, 80, 0.1) 0%, transparent 50%);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: var(--font-size-base);
    line-height: 1.4;
    -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-primary); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-accent); }

/* === Top Header Bar === */
.top-bar {
    display: flex;
    align-items: center;
    height: var(--header-height);
    background: var(--bg-secondary);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-bottom: var(--glass-border);
    padding: 0 12px;
    gap: 16px;
    z-index: 100;
    position: relative;
}

.top-bar__brand {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--accent-orange);
    font-weight: 700;
    font-size: var(--font-size-md);
    letter-spacing: 1px;
    text-transform: uppercase;
    white-space: nowrap;
}

.top-bar__brand .dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-green);
    animation: pulse-dot 2s ease-in-out infinite;
    margin-right: 4px;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; box-shadow: 0 0 4px var(--accent-green); }
    50% { opacity: 0.4; box-shadow: none; }
}

.top-bar__nav {
    display: flex;
    gap: 2px;
}

.top-bar__nav a {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 4px 10px;
    font-size: var(--font-size-sm);
    border-radius: var(--widget-radius);
    transition: all 0.15s;
}

.top-bar__nav a:hover { color: var(--text-primary); background: var(--bg-hover); }
.top-bar__nav a.active { color: var(--accent-orange); background: rgba(245, 158, 11, 0.1); }

.top-bar__spacer { flex: 1; }

.top-bar__stats {
    display: flex;
    gap: 16px;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.top-bar__stats .stat-label { color: var(--text-muted); margin-right: 4px; }
.top-bar__stats .stat-value { color: var(--text-primary); }
.top-bar__stats .stat-up { color: var(--accent-green); }
.top-bar__stats .stat-down { color: var(--accent-red); }

.top-bar__clock {
    font-size: var(--font-size-md);
    color: var(--accent-orange);
    font-weight: 700;
    letter-spacing: 2px;
    min-width: 70px;
    text-align: right;
}

.top-bar__actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.top-bar__btn {
    background: var(--bg-hover);
    border: 1px solid var(--border-primary);
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: var(--font-size-xs);
    padding: 3px 8px;
    cursor: pointer;
    border-radius: var(--widget-radius);
    transition: all 0.15s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.top-bar__btn:hover {
    color: var(--text-primary);
    border-color: var(--accent-orange);
}

.top-bar__btn--primary {
    background: linear-gradient(135deg, rgba(0,229,204,0.2), rgba(0,229,204,0.1));
    border: 1px solid rgba(0,229,204,0.5);
    color: #00e5cc;
    font-weight: 700;
    box-shadow: 0 0 12px rgba(0,229,204,0.15);
}
.top-bar__btn--primary:hover {
    background: linear-gradient(135deg, rgba(0,229,204,0.35), rgba(0,229,204,0.2));
    border-color: #00e5cc;
    color: #fff;
    box-shadow: 0 0 20px rgba(0,229,204,0.3);
}

/* === Widget Add Dropdown === */
.widget-add-dropdown {
    position: relative;
}

.widget-add-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-accent);
    min-width: 220px;
    z-index: 200;
    box-shadow: var(--shadow-widget);
}

.widget-add-menu.open { display: block; }

.widget-add-menu__item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    font-family: var(--font-mono);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    transition: all 0.1s;
}

.widget-add-menu__item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.widget-add-menu__item .icon { font-size: 14px; }
.widget-add-menu__item.active { color: var(--accent-orange); }

/* === Main Grid Area === */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(24, 1fr);
    grid-auto-rows: 40px;
    gap: var(--widget-gap);
    padding: var(--widget-gap);
    height: calc(100vh - var(--header-height) - var(--ticker-height));
    height: calc(100dvh - var(--header-height) - var(--ticker-height));
    overflow-y: auto;
    overflow-x: hidden;
}

/* === Widget Frame === */
.widget {
    background: var(--bg-widget);
    backdrop-filter: blur(16px) saturate(1.3);
    -webkit-backdrop-filter: blur(16px) saturate(1.3);
    border: var(--glass-border);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
    position: relative;
    box-shadow: var(--shadow-widget), inset 0 1px 0 rgba(255,255,255,0.04);
}

.widget:hover {
    border-color: rgba(100, 100, 200, 0.3);
    box-shadow: var(--shadow-widget), 0 0 20px rgba(100, 100, 200, 0.05);
}

/* Smooth reflow during drag reorder */
.dashboard-grid .widget {
    transition: transform 0.25s cubic-bezier(0.2, 0, 0, 1), 
                border-color 0.2s, box-shadow 0.2s, opacity 0.2s;
}

.widget.dragging {
    opacity: 0.5;
    transform: scale(0.97);
    border-color: var(--accent-orange);
    box-shadow: var(--shadow-glow-orange);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.widget.touch-drag-active {
    border-color: var(--accent-orange);
    box-shadow: 0 0 0 2px var(--accent-orange), 0 0 24px rgba(255, 159, 28, 0.4);
    opacity: 0.85;
    transform: scale(0.98);
    transition: all 0.15s ease;
    z-index: 100 !important;
}

.widget.drag-over {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 20px rgba(0, 210, 255, 0.15);
    transform: scale(1.01);
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
}

.widget.drag-over::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 6px;
    background: rgba(0, 210, 255, 0.03);
    pointer-events: none;
    animation: drag-pulse 1s ease-in-out infinite;
}

@keyframes drag-pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* Widget Header */
.widget__header {
    display: flex;
    align-items: center;
    height: 28px;
    min-height: 28px;
    padding: 0 10px;
    background: var(--bg-widget-header);
    border-bottom: var(--glass-border);
    cursor: grab;
    user-select: none;
    gap: 6px;
}

.widget__header:active { cursor: grabbing; }

.widget__header-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    flex-shrink: 0;
}

.widget__header-dot.live { background: var(--accent-green); animation: pulse-dot 2s ease-in-out infinite; }
.widget__header-dot.idle { background: var(--text-muted); }

.widget__title {
    font-size: var(--font-size-xs);
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.widget__controls {
    display: flex;
    gap: 2px;
    position: relative;
    z-index: 10;
}

.widget__ctrl-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 11px;
    cursor: pointer;
    padding: 2px 4px;
    line-height: 1;
    font-family: var(--font-mono);
    transition: color 0.15s;
}

.widget__ctrl-btn:hover { color: var(--text-primary); }
.widget__ctrl-btn.close:hover { color: var(--accent-red); }

/* Widget Body */
.widget__body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 6px 8px;
    font-size: var(--font-size-sm);
}

/* Widget collapsed — shrink to header-only */
.widget.collapsed {
    height: auto !important;
    min-height: 0 !important;
    grid-row: span 1 !important;
    overflow: hidden;
}
.widget.collapsed .widget__body { display: none; }
.widget.collapsed .widget__resize { display: none; }

/* Widget resize handle */
.widget__resize {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 20px;
    height: 20px;
    cursor: nwse-resize;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.2s;
    touch-action: none;
}

.widget:hover .widget__resize { opacity: 1; }

.widget__resize::before {
    content: '';
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--accent-orange);
    border-bottom: 2px solid var(--accent-orange);
    opacity: 0.6;
}

/* Touch devices: bigger resize handle, always visible */
@media (pointer: coarse) {
    .widget__resize {
        width: 36px;
        height: 36px;
        opacity: 0.7;
    }
    .widget__resize::before {
        bottom: 6px;
        right: 6px;
        width: 14px;
        height: 14px;
        border-width: 3px;
    }
}

.widget.resizing {
    opacity: 0.8;
    border-color: var(--accent-orange);
    box-shadow: var(--shadow-glow-orange);
    z-index: 50;
}

/* === Widget Sizes (grid spans on 24-col grid) === */
/* Width: 6=small, 8=med-small, 12=medium, 16=med-large, 18=large, 20=xl, 24=full */
/* Height: 4=short, 6=med, 8=tall, 10=xtall, 12=xxl */
.widget--1x1 { grid-column: span 6; grid-row: span 4; }
.widget--1x2 { grid-column: span 6; grid-row: span 8; }
.widget--1x3 { grid-column: span 6; grid-row: span 12; }
.widget--2x1 { grid-column: span 12; grid-row: span 4; }
.widget--2x2 { grid-column: span 12; grid-row: span 8; }
.widget--2x3 { grid-column: span 12; grid-row: span 12; }
.widget--3x1 { grid-column: span 8; grid-row: span 4; }
.widget--3x2 { grid-column: span 18; grid-row: span 8; }
.widget--3x3 { grid-column: span 18; grid-row: span 12; }
.widget--4x1 { grid-column: span 16; grid-row: span 4; }
.widget--4x2 { grid-column: span 16; grid-row: span 8; }
.widget--4x3 { grid-column: span 16; grid-row: span 12; }
.widget--5x3 { grid-column: span 20; grid-row: span 12; }
.widget--full { grid-column: span 24; grid-row: span 8; }
.widget--full-tall { grid-column: span 24; grid-row: span 12; }

/* === Bottom Ticker Bar === */
.ticker-bar {
    height: var(--ticker-height);
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-primary);
    display: flex;
    align-items: center;
    overflow: hidden;
    position: relative;
}

.ticker-bar__track {
    display: flex;
    gap: 24px;
    animation: ticker-scroll 60s linear infinite;
    white-space: nowrap;
    padding: 0 12px;
}

@keyframes ticker-scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

.ticker-bar__item {
    display: flex;
    gap: 6px;
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    align-items: center;
}

.ticker-bar__item .sym { color: var(--text-primary); font-weight: 500; }
.ticker-bar__item .price { color: var(--text-primary); }
.ticker-bar__item .pct.up { color: var(--accent-green); }
.ticker-bar__item .pct.down { color: var(--accent-red); }

/* === Live Feed / Scrolling List === */
.live-feed {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.live-feed__row {
    display: flex;
    align-items: center;
    padding: 3px 0;
    gap: 8px;
    font-size: var(--font-size-sm);
    border-bottom: 1px solid rgba(42, 42, 42, 0.3);
    animation: fadeInRow 0.3s ease;
}

@keyframes fadeInRow {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.live-feed__row .time { color: var(--text-muted); font-size: var(--font-size-xs); min-width: 45px; }
.live-feed__row .exchange { color: var(--text-muted); font-size: var(--font-size-xs); min-width: 30px; }
.live-feed__row .symbol { color: var(--accent-yellow); min-width: 70px; }
.live-feed__row .side.long { color: var(--accent-green); }
.live-feed__row .side.short { color: var(--accent-red); }
.live-feed__row .value { color: var(--text-primary); min-width: 60px; text-align: right; }
.live-feed__row .value.big { color: var(--accent-orange); font-weight: 700; }

/* === Data Table === */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 6px;
    text-align: left;
    border-bottom: 1px solid var(--border-widget);
    font-weight: 400;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.data-table th:hover { color: var(--text-secondary); }

.data-table td {
    padding: 3px 6px;
    border-bottom: 1px solid rgba(42, 42, 42, 0.2);
    white-space: nowrap;
    font-size: var(--font-size-sm);
}

.data-table tr:hover td { background: var(--bg-hover); }

.data-table .sym { color: var(--accent-yellow); font-weight: 500; }
.data-table .up { color: var(--accent-green); }
.data-table .down { color: var(--accent-red); }
.data-table .muted { color: var(--text-muted); }
.data-table .accent { color: var(--accent-orange); }

/* === Mini Chart Container === */
.mini-chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 8px;
    padding: 4px;
    overflow-y: auto;
}

.mini-chart-card {
    background: linear-gradient(135deg, rgba(20,25,40,0.95), rgba(15,18,30,0.95));
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 10px;
    padding: 6px 10px 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.mini-chart-card:hover {
    border-color: rgba(99,102,241,0.4);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.mini-chart-card__row1 {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    line-height: 1.2;
}

.mini-chart-card__row2 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2px;
    line-height: 1.2;
}

.mini-chart-card__sym {
    font-size: 13px;
    color: #e0e0e0;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.mini-chart-card__badge {
    font-size: 8px;
    color: #6b7280;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 3px;
    padding: 0px 4px;
    font-family: var(--font-mono);
    letter-spacing: 0.3px;
}

.mini-chart-card__price {
    font-size: 12px;
    font-weight: 600;
    color: #f0f0f0;
    font-family: var(--font-mono);
}

.mini-chart-card__pct {
    font-size: 10px;
    font-weight: 600;
    font-family: var(--font-mono);
}

.mini-chart-card__canvas {
    width: 100%;
    margin-top: 2px;
    min-height: 30px;
}

/* Mini Charts Toolbar */
.mc-toolbar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 3px 6px; border-bottom: 1px solid rgba(60,60,120,0.2);
}
.mc-toolbar__left, .mc-toolbar__right { display: flex; gap: 2px; align-items: center; }
.mc-sep { color: rgba(255,255,255,0.12); font-size: 10px; margin: 0 2px; }
.mc-tf {
    background: none; border: 1px solid transparent; color: var(--text-muted);
    font-size: 10px; font-weight: 600; padding: 1px 5px; border-radius: 3px;
    cursor: pointer; font-family: inherit; transition: 0.15s;
}
.mc-tf:hover { color: var(--text-primary); border-color: rgba(255,255,255,0.1); }
.mc-tf.active { color: var(--accent-orange); border-color: var(--accent-orange); background: rgba(255,160,0,0.08); }
.mc-icon-btn {
    background: none; border: 1px solid rgba(255,255,255,0.08); color: var(--text-muted);
    font-size: 12px; width: 20px; height: 20px; border-radius: 3px;
    cursor: pointer; display: flex; align-items: center; justify-content: center; transition: 0.15s;
}
.mc-icon-btn:hover { color: var(--text-primary); border-color: rgba(255,255,255,0.2); }
.mc-gear { font-size: 11px; }
.mc-settings {
    display: flex; flex-direction: column; gap: 6px;
    padding: 6px 8px; background: rgba(15,20,35,0.9);
    border-bottom: 1px solid rgba(60,60,120,0.2);
}
.mc-settings__row {
    display: flex; align-items: center; gap: 6px; font-size: 10px; color: var(--text-muted);
}
.mc-settings__row select, .mc-settings__row input[type="range"] {
    background: rgba(30,35,55,0.8); border: 1px solid rgba(60,60,120,0.3);
    color: var(--text-primary); font-size: 10px; border-radius: 3px; padding: 1px 4px;
}
.mc-settings__btns { display: flex; gap: 2px; }

/* Mini Charts: Hover Preview */
.mc-preview {
    position: fixed;
    z-index: 9999;
    background: rgba(12, 16, 28, 0.96);
    border: 1px solid rgba(100, 120, 200, 0.25);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.6), 0 0 0 1px rgba(100,120,200,0.1);
    backdrop-filter: blur(12px);
    overflow: hidden;
    opacity: 0;
    transform: scale(0.92) translateY(6px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}
.mc-preview.visible {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: auto;
}
.mc-preview__head {
    padding: 6px 10px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(60,60,120,0.2);
    background: rgba(20,25,45,0.5);
}
.mc-preview__chart {
    width: 100%;
    height: calc(100% - 30px);
}

/* === Spread Bar (Arbi) === */
.spread-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 0;
    font-size: var(--font-size-sm);
    border-bottom: 1px solid rgba(42, 42, 42, 0.2);
}

.spread-row .pair { color: var(--accent-yellow); min-width: 70px; }
.spread-row .exchanges { color: var(--text-muted); font-size: var(--font-size-xs); }

.spread-bar {
    flex: 1;
    height: 12px;
    background: var(--bg-input);
    border-radius: 1px;
    position: relative;
    overflow: hidden;
}

.spread-bar__fill {
    height: 100%;
    border-radius: 1px;
    transition: width 0.3s;
}

.spread-bar__fill.positive { background: linear-gradient(90deg, transparent, var(--accent-green)); }
.spread-bar__fill.negative { background: linear-gradient(90deg, transparent, var(--accent-red)); }

.spread-row .pct { min-width: 50px; text-align: right; font-weight: 500; }

/* === Heatmap Summary === */
.heatmap-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(32px, 1fr));
    gap: 2px;
}

.heatmap-cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    font-weight: 500;
    border-radius: 1px;
    cursor: pointer;
    transition: transform 0.1s;
}

.heatmap-cell:hover { transform: scale(1.2); z-index: 1; }

/* === Utility Classes === */
.text-green { color: var(--accent-green); }
.text-red { color: var(--accent-red); }
.text-orange { color: var(--accent-orange); }
.text-cyan { color: var(--accent-cyan); }
.text-yellow { color: var(--accent-yellow); }
.text-muted { color: var(--text-muted); }
.text-dim { color: var(--text-dim); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-bold { font-weight: 700; }
.text-lg { font-size: var(--font-size-lg); }
.text-xl { font-size: var(--font-size-xl); }
.text-xxl { font-size: var(--font-size-xxl); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-1 { flex: 1; }
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* === Number Formatting === */
.big-number {
    font-size: var(--font-size-xxl);
    font-weight: 700;
    letter-spacing: -1px;
    line-height: 1;
}

.big-number.green { color: var(--accent-green); text-shadow: var(--shadow-glow-green); }
.big-number.red { color: var(--accent-red); text-shadow: var(--shadow-glow-red); }

/* === Loading Skeleton === */
.skeleton {
    background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-hover) 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: 2px;
}

@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* === Market Overview Specific === */
.market-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-widget);
    padding: 8px 10px;
    border-radius: var(--widget-radius);
}

.market-card__label {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.market-card__value {
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--text-primary);
}

/* === Responsive === */
@media (max-width: 1400px) {
    .widget--3x2 { grid-column: span 24; }
    .widget--5x3 { grid-column: span 24; }
    .widget--4x3 { grid-column: span 24; }
}

@media (max-width: 1000px) {
    .widget--2x2 { grid-column: span 24; }
    .widget--4x2 { grid-column: span 24; }
    .widget--2x1 { grid-column: span 24; }
    .widget--4x1 { grid-column: span 24; }
    .top-bar__stats { display: none; }
    .top-bar__nav { display: none; }
}

@media (max-width: 768px) {
    #dashboard-grid .widget {
        grid-column: 1 / -1 !important;
    }
    .top-bar__brand { font-size: var(--font-size-sm); }
    .top-bar__clock { display: none; }

    /* Fix mobile viewport clipping (URL bar, notch, bottom bar) */
    .dashboard-grid {
        height: calc(100vh - var(--header-height) - var(--ticker-height));
        height: calc(100dvh - var(--header-height) - var(--ticker-height));
        padding-bottom: calc(var(--widget-gap) + env(safe-area-inset-bottom, 0px));
    }
    .top-bar {
        padding-top: env(safe-area-inset-top, 0px);
    }
    body {
        overflow: hidden;
        position: fixed;
        width: 100%;
        height: 100vh;
        height: 100dvh;
    }
}

/* === Coin Search Overlay === */
.coin-search-overlay {
    position: fixed; inset: 0; z-index: 10000;
    background: rgba(5, 8, 18, 0.7);
    backdrop-filter: blur(8px);
    display: flex; justify-content: center; align-items: flex-start;
    padding-top: 15vh;
    opacity: 0; pointer-events: none;
    transition: opacity 0.2s ease;
}
.coin-search-overlay.visible {
    opacity: 1; pointer-events: auto;
}
.coin-search-box {
    width: 420px; max-width: 90vw;
    background: rgba(15, 20, 38, 0.95);
    border: 1px solid rgba(100, 120, 220, 0.25);
    border-radius: 12px;
    box-shadow: 0 16px 64px rgba(0,0,0,0.6), 0 0 0 1px rgba(100,120,200,0.08), 0 0 40px rgba(100,120,200,0.08);
    overflow: hidden;
    transform: translateY(-20px) scale(0.96);
    transition: transform 0.25s cubic-bezier(0.2, 0, 0, 1);
}
.coin-search-overlay.visible .coin-search-box {
    transform: translateY(0) scale(1);
}
.coin-search-input-row {
    display: flex; align-items: center; gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(60, 60, 120, 0.25);
}
.coin-search-icon { font-size: 16px; opacity: 0.5; }
.coin-search-input {
    flex: 1; background: none; border: none; outline: none;
    font-size: 16px; font-weight: 600; color: var(--text-primary);
    font-family: inherit; letter-spacing: 0.5px;
}
.coin-search-input::placeholder { color: rgba(255,255,255,0.2); }
.coin-search-hint {
    font-size: 9px; color: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.1); border-radius: 3px;
    padding: 2px 5px;
}
.coin-search-results {
    max-height: 400px; overflow-y: auto;
}
.coin-search-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 16px; cursor: pointer;
    transition: background 0.12s;
}
.coin-search-item:hover, .coin-search-item.selected {
    background: rgba(100, 120, 220, 0.1);
}
.coin-search-item.selected {
    border-left: 2px solid var(--accent-orange);
}
.coin-search-item__sym {
    font-size: 13px; font-weight: 700; color: var(--text-primary);
    min-width: 80px;
}
.coin-search-item__pair {
    font-weight: 400; color: var(--text-muted); font-size: 11px;
}

/* Active Chart TF Button */
.chart-tf.active {
    background: rgba(245, 158, 11, 0.25) !important;
    color: #f59e0b !important;
    border: 1px solid rgba(245, 158, 11, 0.5) !important;
    font-weight: 700 !important;
}
