/**
 * Volatility Monitor - Main Stylesheet
 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* Header */
.header {
    background: white;
    border-radius: 16px;
    padding: 24px 32px;
    margin-bottom: 24px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    color: #333;
    font-size: 28px;
    font-weight: 700;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.last-update {
    color: #666;
    font-size: 14px;
    margin-top: 4px;
}

/* Auth Styles */
.auth-login {
    text-align: right;
}

.auth-hint {
    font-size: 12px;
    color: #999;
    margin-top: 8px;
}

.auth-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.auth-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.auth-avatar-placeholder {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
}

.auth-username {
    font-size: 14px;
    color: #333;
    font-weight: 500;
}

.auth-logout-btn {
    background: #f5f5f5;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
}

.auth-logout-btn:hover {
    background: #eee;
    color: #333;
}

/* Refresh Button */
.refresh-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: transform 0.2s, box-shadow 0.2s;
}

.refresh-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.refresh-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Strategy Tabs */
.strategy-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.strategy-tab {
    flex: 1;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 14px 20px;
    cursor: pointer;
    transition: all 0.25s;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.strategy-tab .tab-label {
    font-size: 18px;
    font-weight: 700;
    color: #333;
}

.strategy-tab .tab-desc {
    font-size: 11px;
    color: #999;
    font-weight: 400;
}

.strategy-tab:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.strategy-tab.active {
    border-color: #667eea;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.strategy-tab.active .tab-label {
    color: white;
}

.strategy-tab.active .tab-desc {
    color: rgba(255,255,255,0.8);
}

/* Strategy Badge */
.strategy-badge {
    display: inline-block;
    background: #f0f0f0;
    color: #666;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 12px;
}

/* Table Container */
.table-container {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    border-bottom: 2px solid #e0e0e0;
}

th {
    text-align: left;
    padding: 16px 12px;
    color: #666;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

th.sortable {
    cursor: pointer;
    user-select: none;
}

th.sortable:hover {
    color: #667eea;
}

tbody tr {
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
}

tbody tr:hover {
    background: #f8f9fa;
}

td {
    padding: 16px 12px;
    font-size: 15px;
    color: #333;
}

.symbol {
    font-weight: 700;
    color: #333;
}

.horizon {
    color: #666;
}

.vol-value {
    font-family: 'Courier New', monospace;
    font-weight: 600;
}

/* Risk Level Styles */
.risk-very-low {
    background: #e8f5e9;
    color: #388e3c;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
    min-width: 60px;
    text-align: center;
}

.risk-low {
    background: #e3f2fd;
    color: #1976d2;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
    min-width: 60px;
    text-align: center;
}

.risk-normal {
    background: #fff3e0;
    color: #f57c00;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
    min-width: 60px;
    text-align: center;
}

.risk-high {
    background: #ffebee;
    color: #d32f2f;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
    min-width: 60px;
    text-align: center;
}

.risk-very-high {
    background: #fce4ec;
    color: #c2185b;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
    min-width: 60px;
    text-align: center;
}

/* Loading & Error States */
.loading {
    text-align: center;
    padding: 60px;
    color: #666;
}

.error {
    background: #ffebee;
    color: #d32f2f;
    padding: 16px;
    border-radius: 8px;
    margin: 20px 0;
}

/* Model Info Footer */
.model-info {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e0e0e0;
    font-size: 12px;
    color: #999;
    text-align: center;
}

/* ---- LP Signal View ---- */

.lp-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.lp-card {
    background: white;
    border-radius: 16px;
    padding: 20px 24px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.lp-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}

.lp-symbol {
    font-size: 20px;
    font-weight: 700;
    color: #333;
}

.lp-regime {
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.regime-calm { background: #e8f5e9; color: #2e7d32; }
.regime-normal { background: #e3f2fd; color: #1565c0; }
.regime-elevated { background: #fff3e0; color: #ef6c00; }
.regime-high { background: #ffebee; color: #c62828; }
.regime-extreme { background: #f3e5f5; color: #7b1fa2; }

.lp-trend {
    font-size: 13px;
    color: #666;
    font-weight: 500;
}

.lp-action {
    font-size: 14px;
    font-weight: 700;
    color: #333;
    background: #f5f5f5;
    padding: 4px 14px;
    border-radius: 8px;
}

/* 两个 LP 策略：Signal 与 Regime Only，放在卡片顶部醒目位置 */
.lp-strategies-banner {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    padding: 12px 16px;
    margin: 0 0 16px 0;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    border-left: 4px solid #667eea;
}

.lp-strategy-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.lp-strategy-name {
    font-size: 13px;
    font-weight: 700;
    color: #495057;
}

.lp-strategy-value {
    font-size: 15px;
    font-weight: 700;
    color: #333;
    background: white;
    padding: 6px 16px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.lp-regime-only-value {
    color: #1565c0;
    background: #e3f2fd;
}

.lp-card-body {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 20px;
}

.lp-section-title {
    font-size: 11px;
    font-weight: 700;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.lp-rv-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    font-size: 13px;
}

.lp-rv-label {
    width: 56px;
    flex-shrink: 0;
    color: #666;
    font-weight: 500;
}

.lp-rv-bar-bg {
    flex: 1;
    height: 6px;
    background: #eee;
    border-radius: 3px;
    overflow: hidden;
}

.lp-rv-bar {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 3px;
    transition: width 0.4s ease;
}

.lp-rv-value {
    width: 56px;
    flex-shrink: 0;
    text-align: right;
    font-family: 'Courier New', monospace;
    font-weight: 600;
    color: #333;
}

.spike-badge {
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.spike-low {
    background: #e8f5e9;
    color: #2e7d32;
}

.spike-med {
    background: #fff3e0;
    color: #ef6c00;
}

.spike-high {
    background: #ffebee;
    color: #c62828;
    animation: spike-pulse 1.5s ease-in-out infinite;
}

@keyframes spike-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.lp-section-meta {
    font-size: 13px;
    color: #666;
    display: flex;
    flex-direction: column;
    gap: 6px;
    justify-content: center;
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }

    .header-right {
        flex-direction: column;
        width: 100%;
    }

    #auth-container {
        order: -1;
    }

    .strategy-tabs {
        flex-wrap: wrap;
    }

    .strategy-tab {
        padding: 10px 14px;
    }

    .strategy-tab .tab-label {
        font-size: 15px;
    }

    table {
        font-size: 13px;
    }

    th, td {
        padding: 12px 8px;
    }

    .auth-user {
        justify-content: center;
    }

    .lp-card-body {
        grid-template-columns: 1fr;
    }

    .lp-card-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .lp-action {
        margin-left: 0;
    }
}
