/* Market Diff Visualizer - Finance Grade Dark Theme */
/* Design System Variables */
:root {
    --bg-primary: #0F172A;
    --surface-dark: #111827;
    --card-bg: #1F2937;
    --text-primary: #FFFFFF;
    --accent-cyan: #22D3EE;
    --success-green: #22C55E;
    --danger-red: #EF4444;
    --muted: #9CA3AF;
    --border-color: #374151;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: var(--surface-dark);
    border-bottom: 1px solid var(--border-color);
    padding: 20px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

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

.brand {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.brand-subtitle {
    font-size: 14px;
    color: var(--muted);
    font-weight: 400;
}

.date-indicator {
    background: var(--card-bg);
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.date-text {
    font-size: 14px;
    color: var(--muted);
}

/* Hero Section */
.hero {
    padding: 60px 0 40px;
    text-align: center;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--surface-dark) 100%);
}

.hero-title {
    font-size: clamp(32px, 5vw, 48px);
    font-weight: 700;
    margin-bottom: 16px;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-cyan) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 24px;
    font-weight: 500;
    color: var(--muted);
    margin-bottom: 8px;
}

.hero-support {
    font-size: 16px;
    color: var(--muted);
}

/* Market Selector */
.market-selector {
    padding: 40px 0;
    background: var(--surface-dark);
}

.selector-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 20px;
}

.market-btn {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    color: var(--text-primary);
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.market-btn:hover {
    border-color: var(--accent-cyan);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.market-btn.active {
    background: var(--accent-cyan);
    border-color: var(--accent-cyan);
    color: var(--bg-primary);
}

.market-btn:active {
    transform: translateY(0);
}

/* Loading Indicator */
.loading-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--muted);
    font-size: 14px;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top: 2px solid var(--accent-cyan);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Status Messages */
.status-section {
    padding: 20px 0;
}

.status-message {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    font-size: 14px;
}

.status-message.error {
    border-color: var(--danger-red);
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-red);
}

.status-message.warning {
    border-color: #F59E0B;
    background: rgba(245, 158, 11, 0.1);
    color: #F59E0B;
}

/* Section Titles */
.section-title {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 24px;
    color: var(--text-primary);
}

/* Asset Cards */
.assets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.asset-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.asset-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent-cyan);
}

.asset-card.unusual {
    border-left: 4px solid var(--danger-red);
}

.asset-card.normal {
    border-left: 4px solid var(--success-green);
}

.asset-card.flat {
    border-left: 4px solid var(--muted);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.asset-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.asset-symbol {
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 14px;
    color: var(--muted);
    margin-top: 4px;
}

.change-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.change-badge.unusual {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger-red);
}

.change-badge.normal {
    background: rgba(34, 197, 94, 0.2);
    color: var(--success-green);
}

.change-badge.flat {
    background: rgba(156, 163, 175, 0.2);
    color: var(--muted);
}

.change-display {
    margin-bottom: 16px;
}

.change-value {
    font-size: 36px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.change-value.positive {
    color: var(--success-green);
}

.change-value.negative {
    color: var(--danger-red);
}

.change-value.neutral {
    color: var(--muted);
}

.relative-change {
    font-size: 14px;
    color: var(--muted);
    margin-top: 4px;
}

.explanation {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.5;
}

/* Skeleton Loaders */
.asset-card.skeleton {
    pointer-events: none;
}

.asset-card.skeleton .asset-name-skeleton,
.asset-card.skeleton .change-badge-skeleton,
.asset-card.skeleton .change-value-skeleton,
.asset-card.skeleton .explanation-skeleton {
    background: linear-gradient(90deg, var(--card-bg) 25%, var(--border-color) 50%, var(--card-bg) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}

.asset-name-skeleton {
    height: 20px;
    width: 60%;
    margin-bottom: 8px;
}

.change-badge-skeleton {
    height: 24px;
    width: 80px;
}

.change-value-skeleton {
    height: 40px;
    width: 50%;
    margin-bottom: 8px;
}

.explanation-skeleton {
    height: 60px;
    width: 100%;
}

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

/* Summary Section */
.summary-section {
    padding: 40px 0;
    background: var(--surface-dark);
}

.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.summary-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
}

.summary-label {
    font-size: 14px;
    color: var(--muted);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.summary-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

/* Disclaimer */
.disclaimer {
    padding: 40px 0;
    background: var(--surface-dark);
    border-top: 1px solid var(--border-color);
}

.disclaimer-text {
    text-align: center;
    color: var(--muted);
    font-size: 14px;
}

/* Footer */
.footer {
    padding: 20px 0;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
}

.footer-text {
    text-align: center;
    color: var(--muted);
    font-size: 14px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }
    
    .header .container {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }
    
    .hero {
        padding: 40px 0 30px;
    }
    
    .hero-title {
        font-size: 32px;
    }
    
    .hero-subtitle {
        font-size: 20px;
    }
    
    .selector-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .market-btn {
        width: 100%;
        max-width: 200px;
    }
    
    .assets-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .asset-card {
        padding: 20px;
    }
    
    .change-value {
        font-size: 28px;
    }
    
    .summary-cards {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 28px;
    }
    
    .hero-subtitle {
        font-size: 18px;
    }
    
    .section-title {
        font-size: 24px;
    }
    
    .asset-card {
        padding: 16px;
    }
    
    .change-value {
        font-size: 24px;
    }
}

/* Animations */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-up {
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(10px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Tooltip Styles */
.tooltip {
    position: relative;
    cursor: help;
}

.tooltip:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--surface-dark);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    border: 1px solid var(--border-color);
}

.tooltip:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(1px);
    border: 4px solid transparent;
    border-top-color: var(--surface-dark);
    z-index: 1000;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--surface-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--muted);
}
