/* KeikenV Status Dashboard - Unified Styles */
/* Dark theme with modern Inter font and consistent design */

:root {
    --bg: #0f1634;
    --panel: #1c2552;
    --panel-muted: #1b2144;
    --panel-hover: #232b5a;
    --success: #3be1a1;
    --warning: #f5c451;
    --error: #f2686b;
    --info: #4c5bd4;
    --accent: #8b6ef9;
    --text: #f2f4ff;
    --text-muted: #9aa1c9;
    --border: rgba(154, 161, 201, 0.2);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Header */
.dashboard-header {
    background: linear-gradient(135deg, #2b2f6d 0%, #4c5bd4 100%);
    color: white;
    padding: 2rem 0;
    margin-bottom: 0;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}

.dashboard-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.dashboard-header p {
    opacity: 0.9;
    font-size: 0.95rem;
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Navigation Tabs */
.nav-tabs {
    display: flex;
    gap: 0.5rem;
    padding: 1rem 0;
    border-bottom: 2px solid var(--panel);
    margin-bottom: 1.5rem;
    list-style: none;
    flex-wrap: wrap;
}

.nav-tabs .nav-item {
    list-style: none;
}

.nav-tabs .nav-link {
    display: block;
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.625rem 1rem;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
    border: none;
    background: transparent;
}

.nav-tabs .nav-link:hover {
    color: var(--text);
    background: var(--panel);
    text-decoration: none;
}

.nav-tabs .nav-link.active {
    color: var(--text);
    background: var(--info);
    border-color: var(--info);
}

/* Cards */
.card {
    background: var(--panel);
    border: none;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    color: inherit;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.card h4, .card h5 {
    color: var(--text);
    font-weight: 600;
    margin-bottom: 1rem;
}

/* Stat Cards */
.stat-card {
    background: var(--panel);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
    line-height: 1.2;
}

.stat-label {
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

.text-muted {
    color: var(--text-muted) !important;
}

.text-success {
    color: var(--success) !important;
}

.text-danger {
    color: var(--error) !important;
}

.text-warning {
    color: var(--warning) !important;
}

.text-primary {
    color: var(--info) !important;
}

/* Status Pills */
.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.85rem;
}

.status-ok {
    background: rgba(59, 225, 161, 0.15);
    color: var(--success);
}

.status-error {
    background: rgba(242, 104, 107, 0.15);
    color: var(--error);
}

.status-warning {
    background: rgba(245, 196, 81, 0.15);
    color: var(--warning);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-success {
    background: rgba(59, 225, 161, 0.15);
    color: var(--success);
}

.badge-warning {
    background: rgba(245, 196, 81, 0.15);
    color: var(--warning);
}

.badge-danger {
    background: rgba(242, 104, 107, 0.15);
    color: var(--error);
}

.badge-info {
    background: rgba(76, 91, 212, 0.15);
    color: var(--info);
}

.badge-secondary {
    background: rgba(154, 161, 201, 0.15);
    color: var(--text-muted);
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    color: var(--text);
}

.table thead th {
    background: var(--panel-muted);
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    padding: 0.875rem 1rem;
    border: none;
    text-align: left;
}

.table tbody td {
    padding: 0.875rem 1rem;
    border-top: 1px solid var(--border);
    vertical-align: middle;
}

.table-hover tbody tr {
    transition: background-color 0.15s ease;
}

.table-hover tbody tr:hover {
    background-color: var(--panel-hover);
}

.table-dark {
    background: transparent;
}

.table-responsive {
    overflow-x: auto;
}

/* Forms */
.form-control {
    background: var(--panel-muted);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    padding: 0.625rem 1rem;
    font-size: 0.95rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus {
    background: var(--panel-muted);
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(139, 110, 249, 0.15);
    color: var(--text);
    outline: none;
}

.form-control option {
    background: var(--panel);
    color: var(--text);
}

label {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    display: block;
}

/* Alerts */
.alert {
    padding: 1rem 1.25rem;
    border-radius: 12px;
    margin-bottom: 1rem;
}

.alert-info {
    background: rgba(76, 91, 212, 0.15);
    color: var(--text);
    border: 1px solid rgba(76, 91, 212, 0.3);
}

.alert-info strong {
    color: var(--info);
}

.alert ol {
    margin: 0.75rem 0 0 1.25rem;
    padding: 0;
}

.alert li {
    margin-bottom: 0.25rem;
}

/* Refresh indicator */
.refresh-indicator {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Section titles */
.section-title {
    color: var(--accent);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

/* Empty state */
.empty-state {
    color: var(--text-muted);
    padding: 2rem;
    text-align: center;
}

/* Row utilities - Bootstrap overrides */
.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -0.75rem;
}

.col-md-3, .col-md-4, .col-md-6, .col-md-12 {
    padding: 0 0.75rem;
}

@media (min-width: 768px) {
    .col-md-3 { flex: 0 0 25%; max-width: 25%; }
    .col-md-4 { flex: 0 0 33.333%; max-width: 33.333%; }
    .col-md-6 { flex: 0 0 50%; max-width: 50%; }
    .col-md-12 { flex: 0 0 100%; max-width: 100%; }
}

@media (max-width: 767px) {
    .col-md-3, .col-md-4, .col-md-6, .col-md-12 {
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 1rem;
    }
}

/* Spacing utilities */
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.mt-4 { margin-top: 1.5rem !important; }
.p-3 { padding: 1rem !important; }
.p-4 { padding: 1.5rem !important; }

.d-flex { display: flex !important; }
.justify-content-between { justify-content: space-between !important; }
.align-items-center { align-items: center !important; }
.text-center { text-align: center !important; }
.text-right { text-align: right !important; }
.h-100 { height: 100% !important; }

/* Page-specific accent colors (optional overrides) */
.page-arena .stat-value { color: #667eea; }
.page-arena .section-title { color: #667eea; }
.page-arena .nav-tabs .nav-link.active { background: #667eea; }

.page-discovery .stat-value { color: #f5576c; }
.page-discovery .section-title { color: #f5576c; }
.page-discovery .nav-tabs .nav-link.active { background: #f5576c; }

.page-queues .stat-value { color: var(--accent); }
.page-ab-testing .stat-value { color: #2a5298; }

/* Footer */
.footer-text {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 1.5rem 0;
}

/* Loading spinner */
.spinner {
    border: 3px solid var(--panel-muted);
    border-top: 3px solid var(--accent);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

/* Progress bar */
.progress-bar-container {
    width: 100%;
    height: 8px;
    background: var(--panel-muted);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--info), var(--accent));
    transition: width 0.3s ease;
}

/* Metrics Guide (Arena) */
.metrics-guide {
    background: var(--panel-muted);
    border-radius: 12px;
    padding: 1.25rem;
}

.metrics-guide h5 {
    color: var(--text);
    margin-bottom: 1rem;
}

.metrics-guide ul {
    margin: 0;
    padding-left: 1.25rem;
}

.metrics-guide li {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 0.375rem;
}

.metrics-guide strong {
    color: var(--text);
}

/* Rank styling for leaderboard */
.rank {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--accent);
}

.rank-1 { color: #ffd700; } /* Gold */
.rank-2 { color: #c0c0c0; } /* Silver */
.rank-3 { color: #cd7f32; } /* Bronze */

/* Management link styling */
.management-link a {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.management-link a:hover {
    color: var(--accent);
}

/* Updated label */
.updated-label {
    color: var(--text-muted);
}

/* Win rate visualization (A/B Testing) */
.win-rate-viz {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0.75rem 0;
}

.win-rate-bar {
    flex: 1;
    height: 20px;
    background: var(--panel-muted);
    border-radius: 10px;
    overflow: hidden;
    display: flex;
}

.win-rate-baseline {
    background: var(--text-muted);
    height: 100%;
}

.win-rate-challenger {
    background: var(--accent);
    height: 100%;
}

/* Test card (A/B Testing) */
.test-card {
    background: var(--panel-muted);
    border-left: 4px solid var(--accent);
    padding: 1.25rem;
    margin-bottom: 1rem;
    border-radius: 12px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.test-card:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.test-card h3 {
    color: var(--text);
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
}

.test-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.test-meta-item {
    display: flex;
    flex-direction: column;
}

.test-meta-item label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.test-meta-item value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .dashboard-header {
        padding: 1.5rem 0;
    }
    
    .dashboard-header h1 {
        font-size: 1.5rem;
    }
    
    .stat-value {
        font-size: 1.75rem;
    }
    
    .container {
        padding: 0 1rem;
    }
}
