/* R.E.T.A.R.D. v2.0 Dashboard Styles */
/* Supports both Crypto (dark) and Stocks (Financial Times) modes */

:root {
    /* Crypto Mode (default) */
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #1a1a24;
    --border-color: #2a2a3a;
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --text-muted: #6a6a7a;
    --color-long: #00d084;
    --color-short: #ff4757;
    --color-neutral: #6a6a7a;
    --accent-color: #00d084;
    --font-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', monospace;
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Stock Mode (Financial Times aesthetic) */
body.stock-mode {
    --bg-primary: #fff1e5;  /* FT paper color */
    --bg-secondary: #f2dfce;
    --bg-card: #ffffff;
    --border-color: #d1c7b9;
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-muted: #999999;
    --color-long: #0d7377;  /* FT teal */
    --color-short: #9e2f50; /* FT burgundy */
    --color-neutral: #666666;
    --accent-color: #9e2f50;
    --font-mono: 'Courier New', monospace;
    --font-sans: Georgia, 'Times New Roman', serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
    transition: background 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header */
.header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Mode Toggle */
.mode-toggle {
    display: flex;
    gap: 0.25rem;
    background: var(--bg-secondary);
    padding: 0.25rem;
    border-radius: 8px;
}

.mode-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.05em;
}

.mode-btn:hover {
    color: var(--text-primary);
    background: var(--bg-card);
}

.mode-btn.active {
    background: var(--accent-color);
    color: #ffffff;
}

/* Timeframe Selector */
.timeframe-selector {
    display: flex;
    gap: 0.25rem;
    background: var(--bg-secondary);
    padding: 0.25rem;
    border-radius: 8px;
}

.tf-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tf-btn:hover {
    color: var(--text-primary);
    background: var(--bg-card);
}

.tf-btn.active {
    background: var(--color-long);
    color: #ffffff;
}

body.stock-mode .tf-btn.active {
    background: var(--accent-color);
}

.title {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

body.stock-mode .title {
    font-family: Georgia, serif;
    font-weight: 400;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    background: none;
    -webkit-background-clip: initial;
    -webkit-text-fill-color: var(--text-primary);
    color: var(--text-primary);
}

.status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
}

.status-indicator {
    width: 8px;
    height: 8px;
    background: var(--color-long);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

body.stock-mode .status-indicator {
    background: #0d7377;
}

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

.status-text {
    color: var(--color-long);
    font-family: var(--font-mono);
}

body.stock-mode .status-text {
    color: #0d7377;
}

.timestamp {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

#last-updated {
    color: var(--text-primary);
}

/* Assets Grid */
.assets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

body.stock-mode .assets-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

/* Asset Card */
.asset-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    cursor: pointer;
}

body.stock-mode .asset-card {
    border-radius: 0;
    border: 1px solid var(--border-color);
    box-shadow: 2px 2px 0 rgba(0,0,0,0.1);
}

.asset-card:hover {
    border-color: #3a3a4a;
    transform: translateY(-2px);
}

body.stock-mode .asset-card:hover {
    border-color: #9e2f50;
    box-shadow: 3px 3px 0 #9e2f50;
}

.asset-card.signal-long {
    border-left: 4px solid var(--color-long);
}

body.stock-mode .asset-card.signal-long {
    border-left: 4px solid #0d7377;
}

.asset-card.signal-short {
    border-left: 4px solid var(--color-short);
}

body.stock-mode .asset-card.signal-short {
    border-left: 4px solid #9e2f50;
}

.asset-card.signal-neutral {
    border-left: 4px solid var(--color-neutral);
}

.asset-header {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.asset-symbol {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: var(--font-mono);
}

body.stock-mode .asset-symbol {
    font-family: Georgia, serif;
    font-weight: 700;
}

.asset-name {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.asset-price {
    font-family: var(--font-mono);
    font-size: 2.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1.25rem;
}

body.stock-mode .asset-price {
    font-family: Georgia, serif;
}

/* Signal Section */
.signal-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.signal-badge {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.875rem;
    letter-spacing: 0.05em;
    font-family: var(--font-mono);
}

body.stock-mode .signal-badge {
    border-radius: 0;
    font-family: Georgia, serif;
}

.signal-badge.long {
    background: rgba(0, 208, 132, 0.15);
    color: var(--color-long);
}

body.stock-mode .signal-badge.long {
    background: rgba(13, 115, 119, 0.15);
    color: #0d7377;
}

.signal-badge.short {
    background: rgba(255, 71, 87, 0.15);
    color: var(--color-short);
}

body.stock-mode .signal-badge.short {
    background: rgba(158, 47, 80, 0.15);
    color: #9e2f50;
}

.signal-badge.neutral {
    background: rgba(106, 106, 122, 0.15);
    color: var(--text-muted);
}

.confidence {
    text-align: right;
}

.confidence-value {
    font-family: var(--font-mono);
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

body.stock-mode .confidence-value {
    font-family: Georgia, serif;
}

.confidence-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-left: 0.25rem;
    font-family: var(--font-mono);
}

/* Price Levels */
.price-levels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.price-level {
    background: var(--bg-secondary);
    padding: 0.875rem;
    border-radius: 8px;
}

body.stock-mode .price-level {
    border-radius: 0;
    border: 1px solid var(--border-color);
}

.level-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
    font-family: var(--font-mono);
}

.level-value {
    font-family: var(--font-mono);
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

body.stock-mode .level-value {
    font-family: Georgia, serif;
}

/* Secondary levels (additional support/resistance) */
.level-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.level-secondary {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--bg-primary);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

body.stock-mode .level-secondary {
    font-family: Georgia, serif;
    background: #f9f5f0;
    border-color: #d1c7b9;
}

.price-level.support .level-secondary {
    color: rgba(0, 208, 132, 0.8);
    border-color: rgba(0, 208, 132, 0.3);
}

.price-level.resistance .level-secondary {
    color: rgba(255, 71, 87, 0.8);
    border-color: rgba(255, 71, 87, 0.3);
}

body.stock-mode .price-level.support .level-secondary {
    color: #0d7377;
    border-color: rgba(13, 115, 119, 0.3);
}

body.stock-mode .price-level.resistance .level-secondary {
    color: #9e2f50;
    border-color: rgba(158, 47, 80, 0.3);
}

/* Distant level styling (far from current price) */
.level-value.distant {
    opacity: 0.6;
    font-size: 0.9rem;
}

.no-levels {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Signal Breakdown */
.signal-breakdown h4 {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
    font-family: var(--font-mono);
}

.breakdown-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.breakdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.check {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
}

.check.active {
    background: rgba(0, 208, 132, 0.15);
    color: var(--color-long);
}

body.stock-mode .check.active {
    background: rgba(13, 115, 119, 0.15);
    color: #0d7377;
}

.check.inactive {
    background: var(--bg-secondary);
    color: var(--text-muted);
}

.check::before {
    content: "✓";
}

.check.inactive::before {
    content: "—";
}

/* Strategy Tags */
.strategies-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.strategy-tag {
    background: rgba(100, 100, 255, 0.15);
    color: #8888ff;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-family: var(--font-mono);
}

body.stock-mode .strategy-tag {
    background: rgba(158, 47, 80, 0.1);
    color: #9e2f50;
    border-radius: 0;
    font-family: Georgia, serif;
    font-size: 0.7rem;
}

/* Detail Box */
.detail-box {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 1.5rem;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    z-index: 100;
    max-height: 50vh;
    overflow-y: auto;
}

.detail-box.active {
    transform: translateY(0);
}

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

.detail-header h3 {
    font-size: 1.25rem;
    color: var(--text-primary);
    margin: 0;
    font-family: var(--font-mono);
}

body.stock-mode .detail-header h3 {
    font-family: Georgia, serif;
}

.detail-close {
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
}

.detail-close:hover {
    color: var(--text-primary);
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.detail-label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.detail-value {
    color: var(--text-primary);
    font-weight: 600;
    font-family: var(--font-mono);
}

body.stock-mode .detail-value {
    font-family: Georgia, serif;
}

.detail-value.long {
    color: var(--color-long);
}

body.stock-mode .detail-value.long {
    color: #0d7377;
}

.detail-value.short {
    color: var(--color-short);
}

body.stock-mode .detail-value.short {
    color: #9e2f50;
}

.detail-strategies {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.detail-strategies h4 {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

/* Support/Resistance styling */
.price-level.support .level-value {
    color: #ff6b6b;
}

.price-level.resistance .level-value {
    color: #51cf66;
}

body.stock-mode .price-level.support .level-value {
    color: #9e2f50;
}

body.stock-mode .price-level.resistance .level-value {
    color: #0d7377;
}

/* Flipped levels (role reversal) */
.level-value.flipped {
    color: #ffd43b !important;
    text-shadow: 0 0 10px rgba(255, 212, 59, 0.3);
}

body.stock-mode .level-value.flipped {
    color: #9e2f50 !important;
    text-shadow: none;
    font-weight: 700;
}

.price-level .level-value.flipped::after {
    content: " ↜";
    font-size: 0.875rem;
    color: #ffd43b;
}

body.stock-mode .price-level .level-value.flipped::after {
    content: " [FLIP]";
    color: #9e2f50;
    font-size: 0.7rem;
}

/* Tooltip for flipped levels */
.level-value.flipped:hover {
    cursor: help;
}

/* Footer */
.footer {
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.footer p {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

body.stock-mode .footer p {
    font-family: Georgia, serif;
}

/* Signal Quality Guide */
.signal-guide {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

body.stock-mode .signal-guide {
    border-radius: 0;
    border: 1px solid var(--border-color);
}

.signal-guide h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-family: var(--font-mono);
    letter-spacing: 0.1em;
}

body.stock-mode .signal-guide h3 {
    font-family: Georgia, serif;
    text-transform: uppercase;
    border-bottom: 2px solid #9e2f50;
    padding-bottom: 0.5rem;
    display: inline-block;
}

.tier-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.tier {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    border-left: 3px solid var(--color-neutral);
}

body.stock-mode .tier {
    border-radius: 0;
}

.tier-excellent {
    border-left-color: var(--color-long);
}

body.stock-mode .tier-excellent {
    border-left-color: #0d7377;
}

.tier-medium {
    border-left-color: #f39c12;
}

body.stock-mode .tier-medium {
    border-left-color: #e9a319;
}

.tier-low {
    border-left-color: var(--color-short);
}

body.stock-mode .tier-low {
    border-left-color: #9e2f50;
}

.tier-badge {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    font-weight: 700;
    padding: 0.25rem 0.5rem;
    background: var(--bg-card);
    border-radius: 4px;
    min-width: 50px;
    text-align: center;
}

body.stock-mode .tier-badge {
    border-radius: 0;
    font-family: Georgia, serif;
}

.tier-excellent .tier-badge {
    color: var(--color-long);
}

body.stock-mode .tier-excellent .tier-badge {
    color: #0d7377;
}

.tier-medium .tier-badge {
    color: #f39c12;
}

body.stock-mode .tier-medium .tier-badge {
    color: #b8810f;
}

.tier-low .tier-badge {
    color: var(--color-short);
}

body.stock-mode .tier-low .tier-badge {
    color: #9e2f50;
}

.tier-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.tier-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.tier-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.timeframe-note {
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

body.stock-mode .timeframe-note {
    border-radius: 0;
    font-family: Georgia, serif;
}

.timeframe-note .highlight {
    color: var(--text-primary);
    font-weight: 600;
}

/* Strategy Info Panel */
.strategy-info-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

body.stock-mode .strategy-info-panel {
    border-radius: 0;
    border: 1px solid var(--border-color);
}

.strategy-info-panel h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-family: var(--font-mono);
    letter-spacing: 0.1em;
}

body.stock-mode .strategy-info-panel h3 {
    font-family: Georgia, serif;
    text-transform: uppercase;
    border-bottom: 2px solid #9e2f50;
    padding-bottom: 0.5rem;
    display: inline-block;
}

.strategy-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 0.75rem;
}

.strategy-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: 8px;
}

body.stock-mode .strategy-item {
    border-radius: 0;
    border: 1px solid var(--border-color);
}

.strategy-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
}

body.stock-mode .strategy-name {
    font-family: Georgia, serif;
}

.strategy-timeframe {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: #8888ff;
}

body.stock-mode .strategy-timeframe {
    color: #0d7377;
}

.strategy-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .tier-grid {
        grid-template-columns: 1fr;
    }
    
    .strategy-grid {
        grid-template-columns: 1fr;
    }
    
    .header-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .mode-toggle,
    .timeframe-selector {
        justify-content: center;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .title {
        font-size: 1.5rem;
    }
    
    .assets-grid {
        grid-template-columns: 1fr;
    }
    
    body.stock-mode .assets-grid {
        grid-template-columns: 1fr;
    }
    
    .asset-price {
        font-size: 2rem;
    }
    
    .confidence-value {
        font-size: 1.5rem;
    }
}
