/* ================================================================
   GeoLens Design System
   Premium BI / analytical platform aesthetic.
   Reused across landing page, report page, and all future pages.
   ================================================================ */

/* ---- FONTS ---- */
/* Instrument Serif: hero headlines (editorial authority)
   Space Grotesk: section titles, data labels, numbers (precision)
   DM Sans: body copy, UI text (readability) */

/* ---- CSS VARIABLES ---- */
:root {
    /* Backgrounds */
    --bg-page: #F8F9FB;
    --bg-card: #FFFFFF;
    --bg-card-hover: #FAFBFC;
    --bg-elevated: #F1F3F6;
    --bg-dark: #1B1F27;

    /* Accent — restrained teal, used ONLY for CTAs, scores, active states */
    --accent: #0F766E;
    --accent-light: #14B8A6;
    --accent-bg: rgba(15, 118, 110, 0.06);
    --accent-bg-strong: rgba(15, 118, 110, 0.10);
    --accent-border: rgba(15, 118, 110, 0.18);

    /* Text */
    --text-primary: #1B1F27;
    --text-secondary: #4B5563;
    --text-muted: #6B7280;
    --text-on-accent: #FFFFFF;

    /* Borders & Shadows */
    --border: #E5E7EB;
    --border-light: #F0F1F3;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.08);
    --shadow-xl: 0 8px 32px rgba(0,0,0,0.10);

    /* Score colors */
    --score-red: #DC2626;
    --score-red-bg: rgba(220, 38, 38, 0.08);
    --score-red-border: rgba(220, 38, 38, 0.20);
    --score-amber: #D97706;
    --score-amber-bg: rgba(217, 119, 6, 0.08);
    --score-amber-border: rgba(217, 119, 6, 0.20);
    --score-green: #16A34A;
    --score-green-bg: rgba(22, 163, 74, 0.08);
    --score-green-border: rgba(22, 163, 74, 0.20);

    /* Spacing scale */
    --space-xs: 8px;
    --space-sm: 16px;
    --space-md: 32px;
    --space-lg: 64px;
    --space-xl: 96px;
    --space-2xl: 128px;

    /* Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    /* Typography sizes */
    --text-xs: 0.75rem;   /* 12px */
    --text-sm: 0.875rem;  /* 14px */
    --text-base: 1rem;    /* 16px */
    --text-lg: 1.125rem;  /* 18px */
    --text-xl: 1.25rem;   /* 20px */
    --text-2xl: 1.5rem;   /* 24px */
    --text-3xl: 2rem;     /* 32px */
    --text-4xl: 3rem;     /* 48px */
    --text-5xl: 4rem;     /* 64px */
}

/* ---- RESET ---- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg-page);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* ---- TYPOGRAPHY ---- */
h1, h2, h3, h4 {
    font-family: 'Space Grotesk', sans-serif;
    line-height: 1.2;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}
.headline-serif {
    font-family: 'Instrument Serif', serif;
    letter-spacing: -0.01em;
    line-height: 1.1;
}

/* ---- LAYOUT ---- */
.container {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 var(--space-md);
}
.container-narrow {
    max-width: 820px;
    margin: 0 auto;
    padding: 0 var(--space-md);
}
.section-padding {
    padding-top: var(--space-xl);
    padding-bottom: var(--space-xl);
}

/* ---- CARDS ---- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--accent-border);
}
.card-sm {
    padding: var(--space-sm) var(--space-md);
}
.card-md {
    padding: var(--space-md);
}
.card-lg {
    padding: var(--space-md) calc(var(--space-md) + 8px);
}

/* ---- BUTTONS ---- */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    background: var(--accent);
    color: var(--text-on-accent);
    border: none;
    border-radius: var(--radius-sm);
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: var(--text-base);
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
    text-decoration: none;
    white-space: nowrap;
}
.btn-primary:hover { background: #0D6B63; }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    font-size: var(--text-sm);
    cursor: pointer;
    transition: border-color 0.2s ease, color 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
}
.btn-secondary:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* ---- LABELS & TAGS ---- */
.label {
    display: inline-block;
    padding: 4px 12px;
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-radius: 100px;
    font-family: 'Space Grotesk', sans-serif;
}
.label-accent {
    background: var(--accent-bg);
    color: var(--accent);
}
.label-muted {
    background: var(--bg-elevated);
    color: var(--text-muted);
}
.label-success {
    background: var(--score-green-bg);
    color: var(--score-green);
}
.label-warning {
    background: var(--score-amber-bg);
    color: var(--score-amber);
}
.label-danger {
    background: var(--score-red-bg);
    color: var(--score-red);
}

/* ---- INPUTS ---- */
.input-field {
    padding: 14px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: 'DM Sans', sans-serif;
    font-size: var(--text-base);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    width: 100%;
}
.input-field::placeholder { color: var(--text-muted); }
.input-field:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-bg);
}

.select-field {
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: 'DM Sans', sans-serif;
    font-size: var(--text-sm);
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%239CA3AF' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}
.select-field:focus { border-color: var(--accent); }

/* ---- SCORE INDICATORS ---- */
.score-num {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    line-height: 1;
}
.s-red { color: var(--score-red); }
.s-amber { color: var(--score-amber); }
.s-green { color: var(--score-green); }

/* ---- SECTION TAG ---- */
.section-tag {
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--accent);
    font-weight: 700;
    font-family: 'Space Grotesk', sans-serif;
    margin-bottom: var(--space-sm);
}

/* ---- TABLES ---- */
.data-table {
    width: 100%;
    border-collapse: collapse;
}
.data-table th {
    font-family: 'Space Grotesk', sans-serif;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-muted);
    text-align: left;
    padding: 12px 16px;
    border-bottom: 2px solid var(--border);
}
.data-table td {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg-elevated); }

/* ---- DONUT GAUGE ---- */
.gauge-wrap {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.gauge-label {
    font-size: var(--text-xs);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    font-family: 'Space Grotesk', sans-serif;
}
.gauge {
    position: relative;
    width: 72px;
    height: 72px;
}
.gauge svg {
    width: 72px;
    height: 72px;
    transform: rotate(-90deg);
}
.gauge-num {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 1.05rem;
    line-height: 1;
}

/* ---- TABS ---- */
.tab-group {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
}
.tab-item {
    padding: 8px 16px;
    font-size: var(--text-sm);
    font-weight: 600;
    font-family: 'Space Grotesk', sans-serif;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease;
}
.tab-item:hover { color: var(--text-secondary); }
.tab-item.active {
    color: var(--text-primary);
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
}

/* ---- UTILITY ---- */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-accent { color: var(--accent); }
.font-mono { font-family: 'Space Grotesk', monospace; }
.font-serif { font-family: 'Instrument Serif', serif; }

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    border: 0;
}

/* ---- SPINNER ---- */
.btn-spinner {
    width: 18px; height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- RESPONSIVE HELPERS ---- */
@media (max-width: 768px) {
    .container, .container-narrow { padding: 0 var(--space-sm); }
    .section-padding {
        padding-top: var(--space-lg);
        padding-bottom: var(--space-lg);
    }
}
