﻿/* ============================================================
   BASE — tokens, resets, typography, layout primitives
   ============================================================ */

/* ── Design tokens ── */
:root {
    /* Text */
    --color-dark-text: #1c2420;
    --color-light-text: #FFFFFF;
    --color-muted: #5b6a63;
    /* Brand — Royal Copenhagen Navy (mirrors app's actionPrimary / brandGreen) */
    --color-brand: #1a2849;
    --color-brand-dark: #10182b;
    --color-brand-soft: #e8ecf6;
    /* Backgrounds */
    --color-primary-bg: #f7f9f8;
    --color-secondary-bg: #f4f6f5;
    --color-tertiary-bg: #e8ecf6;
    --color-card-bg: #FFFFFF;
    /* Buttons */
    --color-primary-button: #1a2849;
    --color-primary-button-hover: #10182b;
    --color-secondary-button: #e8ecf6;
    --color-secondary-button-hover: #d5dce8;
    --color-secondary-button-active: #1a2849;
    --color-tertiary-button: #f4f6f5;
    --color-tertiary-button-hover: #e8ecf6;
    --color-tertiary-button-active: #1a2849;
    /* Typography — Inter for UI, Cormorant Garamond for editorial display.
       Use these vars everywhere instead of hard-coded font-family names. */
    --font-body: 'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    --font-display: 'Cormorant Garamond', 'Playfair Display', Georgia, serif;
}

/* ── Reset / globals ── */
html, body {
    background-color: var(--color-primary-bg);
    font-family: var(--font-body);
    font-feature-settings: 'ss01', 'cv11';
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

main {
    width: 100%;
    background-color: var(--color-primary-bg);
}

a, .btn-link {
    color: #006bb7;
}

h1:focus {
    outline: none;
}

/* ── Utility ── */
.muted {
    opacity: 0.55;
}

.small {
    font-size: 0.83rem;
}

.italic {
    font-style: italic;
}

/* ── Page shell ── */
.page {
    display: flex;
    flex-direction: column;
    background-color: var(--color-primary-bg);
}

.content {
    padding-top: 0.5rem;
    padding-bottom: 1.5rem;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
    background-color: var(--color-primary-bg);
    width: 100%;
}

/* ── Page header (shared across pages) ── */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.page-title-section {
    flex-grow: 1;
    min-width: 200px;
}

.page-title {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 400;
    letter-spacing: -0.01em;
    margin: 0;
    color: var(--color-dark-text);
}

.page-description,
.page-subtitle {
    font-size: 0.88rem;
    color: var(--color-muted);
    margin: 0.25rem 0 0;
    line-height: 1.5;
}

/* ── Flex helpers ── */
.flex-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.actions-container {
    display: flex;
    gap: 0.5rem;
}

/* ── Section label ── */
.section-label {
    font-size: 0.78rem;
    font-weight: 650;
    opacity: 0.55;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.inline-section-label {
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.45;
    margin-bottom: 0.25rem;
}

.section-eyebrow {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--color-brand, #1a2849);
    opacity: 0.55;
    margin-bottom: 0.75rem;
}

.section-divider,
.rule-divider {
    border: none;
    border-top: 1px solid rgba(0,0,0,0.08);
    margin: 0.25rem 0;
}

/* ── Empty states ── */
.empty-state {
    text-align: center;
    padding: 4rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

    .empty-state.centered {
        padding: 4rem 1rem;
    }

.empty-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.empty-title {
    font-weight: 700;
    font-size: 1.05rem;
}

/* ── Avatar ── */
.avatar-sm {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 0.78rem;
    background: var(--color-primary-bg);
    border: 1px solid rgba(0,0,0,0.12);
    flex-shrink: 0;
}

.avatar-lg {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 1.1rem;
    background: var(--color-primary-bg);
    border: 1px solid rgba(0,0,0,0.12);
    flex-shrink: 0;
}

/* ── Count badge ── */
.count-badge {
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    background: var(--color-primary-bg);
    border: 1px solid rgba(0,0,0,0.1);
}

/* ── Dialog / modal ── */
.dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    z-index: 999;
}

.dialog {
    background: var(--color-primary-bg);
    padding: 1.5rem 1.75rem;
    border-radius: 16px;
    width: 80%;
    max-height: 90vh;
    box-shadow: 0 8px 40px rgba(0,0,0,0.16), 0 2px 8px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.06);
}

/* Width modifiers so dialogs don't hand-roll inline widths. */
.dialog--narrow { width: min(560px, 95vw); }
.dialog--wide { width: min(920px, 95vw); }

.dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--color-primary-bg);
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(0,0,0,0.08);
    flex-shrink: 0;
}

/* Editorial dialog title + supporting line. */
.dialog-title {
    margin: 0;
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.15;
    color: var(--color-dark-text);
}

.dialog-subtitle {
    margin: 0.15rem 0 0;
    font-size: 0.82rem;
    color: var(--color-muted);
}

.dialog-content {
    overflow-y: auto;
    max-height: calc(90vh - 70px);
    padding-right: 0.5rem;
}

/* Padded, scrollable body for simple dialogs (DrinkOne, AddWine, …). */
.dialog-body {
    padding: 1rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow-y: auto;
}

/* Shared sticky-ish footer for dialog actions (was undefined — dialogs relied on it). */
.dialog-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.6rem;
    padding-top: 1rem;
    margin-top: 0.5rem;
    border-top: 1px solid rgba(0,0,0,0.06);
    flex-shrink: 0;
}

.dialog-footer .dialog-footer-spacer { margin-right: auto; }

/* ── Table ── */
.table {
    width: 100%;
    border-collapse: collapse;
    border-radius: 12px;
    overflow: hidden;
    background: var(--color-card-bg);
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

    .table th,
    .table td {
        padding: 12px;
        text-align: center;
        border-bottom: 1px solid #eee;
    }

    .table thead {
        background-color: var(--color-card-bg);
        border-radius: 12px;
        font-weight: bold;
    }

    .table td.winecolor {
        border-left: 6px solid transparent;
        padding-left: 0.5rem;
        border-radius: 12px;
    }

        .table td.winecolor.red {
            border-left-color: #8B0000;
        }

        .table td.winecolor.white {
            border-left-color: #F5F5DC;
        }

        .table td.winecolor.rose {
            border-left-color: #F2A1B3;
        }

        .table td.winecolor.sparkling {
            border-left-color: #D4AF37;
        }

        .table td.winecolor.orange {
            border-left-color: #E67E22;
        }
        .table td.winecolor.sweet {
            border-left-color: #CD853F;
        }
