/*
 * BestWine24 Dashboard — Design System
 * Light theme, reusable across all dashboard pages.
 *
 * Usage: <link rel="stylesheet" href="/assets/dashboard.css">
 *
 * Color classes: .c-green, .c-red, .c-amber, .c-blue, .c-muted
 * Layout: .dashboard, .header, .kpi-main, .cards, .card, .section
 * Components: .progress-*, .breakdown, .legend-*, .spinner
 */

/* --- Variables --- */
:root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --border: #e2e5ea;
    --text: #1a1d24;
    --text-secondary: #5f6672;
    --text-muted: #9ca1ab;
    --green: #16a34a;
    --red: #dc2626;
    --amber: #d97706;
    --blue: #4f46e5;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,.06);
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    margin: 0;
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* --- Layout --- */
.dashboard {
    max-width: 1100px;
    margin: 0 auto;
    padding: 32px 24px;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.header h1 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0;
}
.header .updated {
    font-size: 12px;
    color: var(--text-muted);
}

/* --- Main KPI --- */
.kpi-main {
    text-align: center;
    padding: 48px 24px 40px;
}
.kpi-main .label {
    font-size: 13px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 12px;
    font-weight: 500;
}
.kpi-main .value {
    font-size: 88px;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 12px;
    color: var(--text);
}
.kpi-main .sub {
    font-size: 15px;
    color: var(--text-secondary);
}
.kpi-main .sub b {
    color: var(--text);
    font-weight: 600;
}

/* --- Progress bar --- */
.progress-wrap {
    max-width: 560px;
    margin: 24px auto 0;
}
.progress-track {
    height: 14px;
    background: var(--border);
    border-radius: 7px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    border-radius: 7px;
    background: linear-gradient(90deg, var(--blue), var(--green));
    transition: width .8s ease;
}
.progress-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

/* --- Metric cards --- */
.cards {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}
.card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}
.card .val {
    font-size: 30px;
    font-weight: 800;
    line-height: 1.2;
    color: var(--text);
}
.card .lbl {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 6px;
}
.card .hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 3px;
}

/* --- Section --- */
.section {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    margin-bottom: 16px;
}
.section h2 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0 0 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* --- Breakdown bar --- */
.breakdown {
    display: flex;
    height: 28px;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 14px;
}
.breakdown div {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    transition: width .8s;
}

/* --- Legend --- */
.legend {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}
.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex-shrink: 0;
}

/* --- Color classes --- */
.c-green { color: var(--green) !important }
.c-red { color: var(--red) !important }
.c-amber { color: var(--amber) !important }
.c-blue { color: var(--blue) !important }
.c-muted { color: var(--text-muted) !important }

/* --- Spinner --- */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--border);
    border-top-color: var(--blue);
    border-radius: 50%;
    animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg) } }
