/* Root Theme Variables */
:root {
    --bg-dark: #0a0d14;
    --card-bg: rgba(18, 24, 38, 0.7);
    --card-border: rgba(255, 255, 255, 0.08);
    --text-main: #f0f4f8;
    --text-muted: #8a99ad;
    --text-dim: #505e73;
    --accent-blue: #3b82f6;
    --accent-green: #00e699;
    --accent-red: #ff4d66;
    --border-color: rgba(255, 255, 255, 0.08);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: rgba(10, 13, 20, 0.95);
    border-bottom: 1px solid var(--border-color);
    z-index: 100;
}

.brand {
    display: flex;
    align-items: center;
    gap: 8px;
}

.brand-icon {
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, var(--accent-blue), #1d4ed8);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 14px;
    color: #fff;
}

.brand-title {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.badge-live {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 230, 153, 0.1);
    color: var(--accent-green);
    border: 1px solid rgba(0, 230, 153, 0.2);
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.pulse-dot {
    width: 6px;
    height: 6px;
    background-color: var(--accent-green);
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(0, 230, 153, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(0, 230, 153, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(0, 230, 153, 0); }
}

/* Navigation Tabs */
.nav-tabs {
    display: flex;
    background: rgba(14, 19, 31, 0.95);
    border-bottom: 1px solid var(--border-color);
    padding: 4px 12px;
    gap: 8px;
}

.nav-tab {
    flex: 1;
    padding: 10px 0;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.nav-tab.active {
    color: var(--accent-blue);
    border-bottom-color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.08);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

/* App Main Container & Tab Views */
.app-container {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tab-content {
    display: none;
    flex-direction: column;
    gap: 12px;
}

.tab-content.active {
    display: flex;
}

/* Live Signal Tiles Grid */
.signal-tiles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.signal-tile {
    background: rgba(18, 24, 38, 0.85);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.signal-tile.buy {
    border-left: 4px solid var(--accent-green);
    background: linear-gradient(135deg, rgba(0, 230, 153, 0.05), rgba(18, 24, 38, 0.95));
}

.signal-tile.sell {
    border-left: 4px solid var(--accent-red);
    background: linear-gradient(135deg, rgba(255, 77, 102, 0.05), rgba(18, 24, 38, 0.95));
}

.signal-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}

.tile-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tile-asset-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tile-asset-name {
    font-size: 15px;
    font-weight: 800;
    color: var(--text-main);
}

.tile-tf-badge {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
}

.tile-signal-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.tile-signal-badge.buy {
    background: rgba(0, 230, 153, 0.15);
    color: var(--accent-green);
    border: 1px solid var(--accent-green);
}

.tile-signal-badge.sell {
    background: rgba(255, 77, 102, 0.15);
    color: var(--accent-red);
    border: 1px solid var(--accent-red);
}

.tile-price-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    background: rgba(0, 0, 0, 0.2);
    padding: 8px 10px;
    border-radius: var(--radius-sm);
}

.tile-price-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tile-price-label {
    font-size: 9px;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
}

.tile-price-val {
    font-size: 13px;
    font-weight: 700;
}

.tile-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 10px;
    color: var(--text-dim);
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    padding-top: 6px;
}

/* Controls Bar & Form Controls Overhaul */
.controls-bar {
    display: flex;
    gap: 6px;
    align-items: center;
    overflow-x: auto;
    padding-bottom: 4px;
}

.select-pill, select, .form-control, input[type="text"], input[type="number"], input[type="password"] {
    background: #0e131f !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    color: #f0f4f8 !important;
    padding: 10px 14px !important;
    border-radius: var(--radius-sm) !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    outline: none !important;
    cursor: pointer;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.4);
    transition: all 0.2s ease-in-out;
}

.select-pill:focus, select:focus, .form-control:focus, input[type="text"]:focus, input[type="number"]:focus, input[type="password"]:focus {
    border-color: var(--accent-blue) !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25), inset 0 1px 3px rgba(0, 0, 0, 0.4) !important;
}

/* FIX ALL DROPDOWN SELECT OPTIONS COLOR CONTRAST GLITCH */
select option, .select-pill option, .form-control option {
    background-color: #0e131f !important;
    color: #f0f4f8 !important;
    padding: 10px !important;
}

/* Remove default browser number spinner arrows */
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;
}

.btn-pill {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-pill.active, .btn-pill:hover {
    background: var(--accent-blue);
    color: #fff;
    border-color: var(--accent-blue);
}

/* Cards & Panels */
.chart-card, .panel-card, .metric-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 14px;
    backdrop-filter: blur(12px);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.asset-price {
    font-size: 20px;
    font-weight: 800;
}

.asset-change {
    font-size: 12px;
    font-weight: 600;
    margin-left: 6px;
}

.asset-change.positive { color: var(--accent-green); }
.asset-change.negative { color: var(--accent-red); }

/* Chart Wrapper */
.chart-wrapper {
    width: 100%;
    height: 320px;
    position: relative;
}

canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.metric-card {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.metric-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
}

.metric-value {
    font-size: 18px;
    font-weight: 800;
}

.metric-sub {
    font-size: 10px;
    color: var(--text-dim);
}

/* Form Controls */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 10px;
}

.form-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
}

.form-control {
    width: 100%;
}

.panel-title {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-main);
}

/* Watchlist & Trigger Config Pills */
.watchlist-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 8px;
    margin-top: 6px;
}

.check-pill {
    background: rgba(14, 19, 31, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    color: var(--text-main);
}

.check-pill:hover {
    border-color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.08);
}

.check-pill input[type="checkbox"] {
    accent-color: var(--accent-blue);
    width: 16px;
    height: 16px;
    border-radius: 4px;
}

/* Profile Cards & Master UI */
.profile-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px;
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: all 0.2s ease;
}

.profile-card:hover {
    border-color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.05);
}

.profile-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.profile-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.btn-icon {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background: var(--accent-blue);
    color: #fff;
    border-color: var(--accent-blue);
}

.btn-icon.delete:hover {
    background: var(--accent-red);
    border-color: var(--accent-red);
}

.pair-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(59, 130, 246, 0.12);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.25);
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 700;
    margin-right: 4px;
    margin-bottom: 4px;
}

.pair-badge .remove-pair {
    cursor: pointer;
    color: var(--accent-red);
    font-weight: 800;
    margin-left: 2px;
}

/* Modal Overlay & Form Sheet */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(10, 13, 20, 0.85);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal-overlay.active {
    display: flex;
}

.modal-sheet {
    background: #0e131f;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.modal-title {
    font-size: 16px;
    font-weight: 800;
    color: var(--text-main);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
}

.modal-close:hover {
    color: var(--accent-red);
}

/* Signal Log Dashboard Table */
.dashboard-table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: rgba(14, 19, 31, 0.8);
}

.log-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
    text-align: left;
}

.log-table th {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    padding: 8px 10px;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.log-table td {
    padding: 8px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: var(--text-main);
    white-space: nowrap;
}

/* Outcome Status Badges */
.badge-outcome {
    padding: 3px 6px;
    border-radius: 10px;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-outcome.tp { background: rgba(0, 230, 153, 0.15); color: var(--accent-green); border: 1px solid var(--accent-green); }
.badge-outcome.sl { background: rgba(255, 77, 102, 0.15); color: var(--accent-red); border: 1px solid var(--accent-red); }
.badge-outcome.pending { background: rgba(245, 158, 11, 0.15); color: #f59e0b; border: 1px solid #f59e0b; }

/* Lock Screen Security Overlay */
.lock-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #0a0d14;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.lock-card {
    background: rgba(18, 24, 38, 0.95);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 360px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
}

.lock-icon {
    width: 54px;
    height: 54px;
    background: linear-gradient(135deg, var(--accent-blue), #1d4ed8);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.lock-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-main);
}

.lock-subtitle {
    font-size: 12px;
    color: var(--text-muted);
}
#toastContainer {
    position: fixed;
    top: 60px;
    right: 16px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: rgba(18, 24, 38, 0.95);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    color: #fff;
    font-size: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: toastIn 0.3s ease;
}

.toast.buy { border-left: 4px solid var(--accent-green); }
.toast.sell { border-left: 4px solid var(--accent-red); }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(50px); }
    to { opacity: 1; transform: translateX(0); }
}
