/*
 * Nordic Clarity — admin adaptation.
 * Tokens mirror Web.Booking/src/app.css (default tenant). Keep values in sync with that file;
 * components must only consume semantic tokens, never raw colors.
 */
:root {
    color-scheme: light;

    --primary: 214 52% 25%;
    --primary-hover: 214 52% 19%;
    --primary-foreground: 0 0% 100%;

    --accent: 186 47% 53%;
    --accent-soft: 186 30% 92%;

    --focus-ring: 186 47% 53%;

    --background: 210 20% 98%;
    --foreground: 222 47% 11%;

    --surface: 0 0% 100%;
    --surface-muted: 210 20% 96%;
    --surface-raised: 0 0% 100%;

    --border: 214 16% 90%;
    --text-muted: 215 16% 42%;

    --success: 142 76% 28%;
    --success-surface: 142 76% 95%;
    --warning: 35 92% 45%;
    --warning-surface: 48 96% 89%;
    --danger: 0 72% 45%;
    --danger-surface: 0 72% 95%;

    --font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    font-family: var(--font-family);
    font-size: 16px;
    line-height: 1.5;
    background-color: hsl(var(--background));
    color: hsl(var(--foreground));
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, p {
    margin: 0;
}

a {
    color: inherit;
}

h1:focus {
    outline: none;
}

:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px hsl(var(--focus-ring));
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.icon {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}

.text-muted {
    color: hsl(var(--text-muted));
}

/* App shell — applied once in MainLayout. Pages must not add their own outer wrapper. */
.shell {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
}

.page {
    padding-top: 2rem;
    padding-bottom: 6rem;
}

/* Breadcrumb */
.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem;
    margin: 0 0 2.5rem;
    padding: 0;
    list-style: none;
    font-size: 0.875rem;
    color: hsl(var(--text-muted));
}

    .breadcrumb a {
        text-decoration: none;
        border-radius: 0.25rem;
        transition: color 150ms;
    }

        .breadcrumb a:hover {
            color: hsl(var(--foreground));
        }

    .breadcrumb .separator {
        color: hsl(var(--border));
        user-select: none;
    }

    .breadcrumb [aria-current="page"] {
        color: hsl(var(--foreground));
        font-weight: 500;
    }

/* Typography */
.eyebrow {
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: hsl(var(--text-muted));
}

.page-header {
    padding-bottom: 2.5rem;
    margin-bottom: 3rem;
    border-bottom: 1px solid hsl(var(--border));
}

    .page-header .eyebrow {
        margin-bottom: 0.75rem;
    }

.page-title {
    font-size: 3rem;
    line-height: 1.05;
    font-weight: 800;
    letter-spacing: -0.025em;
}

.page-lead {
    max-width: 36rem;
    margin-top: 1rem;
    font-size: 1.125rem;
    line-height: 1.625;
    color: hsl(var(--text-muted));
}

.section-title {
    font-size: 1.125rem;
    line-height: 1.75rem;
    font-weight: 600;
}

@media (max-width: 640px) {
    .page-title {
        font-size: 2.25rem;
    }
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 2.75rem;
    padding: 0.625rem 1.5rem;
    border: 1px solid transparent;
    border-radius: 9999px;
    font: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.25rem;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 150ms, color 150ms, border-color 150ms;
}

    .btn:active {
        transform: scale(0.98);
    }

.btn-primary {
    background-color: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
}

    .btn-primary:hover {
        background-color: hsl(var(--primary-hover));
    }

.btn-secondary {
    background-color: hsl(var(--surface));
    border-color: hsl(var(--border));
    color: hsl(var(--foreground));
}

    .btn-secondary:hover {
        background-color: hsl(var(--surface-muted));
    }

.btn-ghost {
    background: none;
    color: hsl(var(--text-muted));
    padding-left: 1rem;
    padding-right: 1rem;
}

    .btn-ghost:hover {
        color: hsl(var(--foreground));
        background-color: hsl(var(--surface-muted));
    }

/* Segmented toggle (view mode toggle pattern) */
.segmented {
    display: inline-flex;
    gap: 0.25rem;
    padding: 0.25rem;
    border-radius: 9999px;
    background-color: hsl(var(--surface-muted));
}

    .segmented button {
        padding: 0.5rem 1rem;
        border: 0;
        border-radius: 9999px;
        background: none;
        font: inherit;
        font-size: 0.875rem;
        font-weight: 500;
        color: hsl(var(--text-muted));
        cursor: pointer;
        transition: background-color 150ms, color 150ms;
    }

        .segmented button:hover {
            color: hsl(var(--foreground));
        }

        .segmented button[aria-pressed="true"] {
            background-color: hsl(var(--primary));
            color: hsl(var(--primary-foreground));
            box-shadow: var(--shadow-sm);
        }

/* Grouped filter surface */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 1rem;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    border: 1px solid hsl(var(--border));
    border-radius: 2rem;
    background-color: hsl(var(--surface));
    box-shadow: var(--shadow-sm);
}

.field {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.field-label {
    font-size: 0.875rem;
    font-weight: 500;
}

.input {
    min-height: 2.75rem;
    padding: 0.5rem 1rem;
    border: 1px solid hsl(var(--border));
    border-radius: 0.5rem;
    background-color: hsl(var(--background));
    color: hsl(var(--foreground));
    font: inherit;
    font-size: 0.875rem;
}

/* Pill toggles for multi-select filters */
.pill-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    border: 0;
}

    .pill-group legend {
        margin-bottom: 0.75rem;
        padding: 0;
    }

.pill-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    min-height: 2.25rem;
    padding: 0.375rem 1rem;
    border: 1px solid hsl(var(--border));
    border-radius: 9999px;
    background-color: hsl(var(--surface));
    font-size: 0.875rem;
    font-weight: 500;
    color: hsl(var(--text-muted));
    cursor: pointer;
    transition: background-color 150ms, color 150ms, border-color 150ms;
}

    .pill-toggle:hover {
        color: hsl(var(--foreground));
        background-color: hsl(var(--surface-muted));
    }

    .pill-toggle:focus-within {
        box-shadow: 0 0 0 2px hsl(var(--focus-ring));
    }

    .pill-toggle .icon {
        display: none;
        width: 0.875rem;
        height: 0.875rem;
    }

    .pill-toggle:has(input:checked) {
        background-color: hsl(var(--accent-soft));
        border-color: transparent;
        color: hsl(var(--primary));
        font-weight: 600;
    }

        .pill-toggle:has(input:checked) .icon {
            display: block;
        }

/* Cards and stats */
.card {
    border: 1px solid hsl(var(--border));
    border-radius: 1rem;
    background-color: hsl(var(--surface));
}

.card-body {
    padding: 1.5rem;
}

a.card {
    display: block;
    text-decoration: none;
    transition: box-shadow 150ms;
}

    a.card:hover {
        box-shadow: var(--shadow-md);
    }

.icon-tile {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    margin-bottom: 1.25rem;
    border-radius: 0.75rem;
    background-color: hsl(var(--accent-soft));
    color: hsl(var(--primary));
}

    .icon-tile .icon {
        width: 1.25rem;
        height: 1.25rem;
    }

.card-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
}

.stat-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    margin: 2.5rem 0;
    padding: 0;
}

.stat {
    margin: 0;
    padding: 1.25rem 1.5rem;
    border: 1px solid hsl(var(--border));
    border-radius: 1rem;
    background-color: hsl(var(--surface));
}

    .stat dd {
        margin: 0.5rem 0 0;
        font-size: 1.875rem;
        line-height: 2.25rem;
        font-weight: 700;
        letter-spacing: -0.025em;
        font-variant-numeric: tabular-nums;
    }

.chart-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.chart-container {
    position: relative;
    height: 22rem;
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

    .data-table th,
    .data-table td {
        padding: 0.75rem 0.5rem;
        border-bottom: 1px solid hsl(var(--border));
        text-align: left;
    }

    .data-table th {
        font-weight: 600;
        color: hsl(var(--text-muted));
    }

    .data-table tbody tr:last-child td {
        border-bottom: none;
    }

    .data-table .numeric {
        text-align: right;
        font-variant-numeric: tabular-nums;
    }

    .data-table .url-cell {
        word-break: break-all;
    }

/* Banners */
.banner {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border: 1px solid;
    border-radius: 1rem;
    font-size: 0.875rem;
    font-weight: 500;
}

    .banner .icon {
        margin-top: 0.125rem;
    }

.banner-danger {
    background-color: hsl(var(--danger-surface));
    border-color: hsl(var(--danger) / 0.25);
    color: hsl(var(--danger));
}

.banner-info {
    background-color: hsl(var(--surface-muted));
    border-color: hsl(var(--border));
    color: hsl(var(--text-muted));
}

.loading-text {
    font-size: 0.875rem;
    color: hsl(var(--text-muted));
}

/* Framework UI */
#blazor-error-ui {
    color-scheme: light only;
    background: hsl(var(--warning-surface));
    color: hsl(var(--foreground));
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.75rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    font-size: 0.875rem;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    padding: 1rem 1.25rem;
    border-radius: 1rem;
    background: hsl(var(--danger-surface));
    color: hsl(var(--danger));
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.loading-progress {
    position: absolute;
    display: block;
    width: 6rem;
    height: 6rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto;
}

    .loading-progress circle {
        fill: none;
        stroke: hsl(var(--border));
        stroke-width: 0.5rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: hsl(var(--primary));
            stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
            transition: stroke-dasharray 0.05s ease-in-out;
        }

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-size: 0.875rem;
    font-weight: 500;
    color: hsl(var(--text-muted));
    inset: calc(20vh + 2.5rem) 0 auto 0;
}

    .loading-progress-text:after {
        content: var(--blazor-load-percentage-text, "Loading");
    }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition-duration: 0.01ms !important;
    }
}
