@import url('https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700&family=Geist+Mono:wght@400;500&display=swap');

:root {
    /* Bookshop tokens — quiet, warm minimal. */
    --bk-ink: #171513;
    --bk-ink-soft: #3D3934;
    --bk-muted: #7C7670;
    --bk-line: #EAE6DD;
    --bk-line-strong: #D9D3C7;
    --bk-canvas: #FAFAF7;
    --bk-surface: #FFFFFF;
    --bk-surface-warm: #F4F1EA;
    --bk-accent: #C2553F;
    --bk-accent-ink: #8E3A29;
    --bk-accent-tint: #FBEFEC;

    /* Bootstrap variable overrides — let Bootstrap components inherit our palette. */
    --bs-body-color: var(--bk-ink);
    --bs-body-bg: var(--bk-canvas);
    --bs-body-font-family: 'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --bs-body-font-weight: 400;
    --bs-body-line-height: 1.55;
    --bs-border-color: var(--bk-line);
    --bs-border-radius: 0.5rem;
    --bs-border-radius-sm: 0.375rem;
    --bs-border-radius-lg: 0.75rem;
    --bs-primary: var(--bk-accent);
    --bs-primary-rgb: 194, 85, 63;
    --bs-secondary-color: var(--bk-muted);
    --bs-link-color: var(--bk-accent-ink);
    --bs-link-hover-color: var(--bk-ink);
    --bs-emphasis-color: var(--bk-ink);
    --bs-heading-color: var(--bk-ink);

    /* Legacy aliases that the rest of this file still references. */
    --bookshop-page: var(--bk-canvas);
}

html, body {
    font-family: 'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif;
    font-feature-settings: 'ss01', 'cv11';
    letter-spacing: -0.005em;
}

body.admin-body,
body.storefront-body {
    min-height: 100vh;
    background:
        radial-gradient(120% 80% at 50% -20%, rgba(194, 85, 63, 0.04) 0%, transparent 60%),
        var(--bk-canvas);
    color: var(--bs-body-color);
    font-family: var(--bs-body-font-family);
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    letter-spacing: -0.015em;
    color: var(--bk-ink);
}

h1 { font-weight: 700; letter-spacing: -0.022em; }

.bk-display {
    font-weight: 700;
    letter-spacing: -0.028em;
    line-height: 1.04;
    font-feature-settings: 'ss01';
}

.bk-eyebrow {
    font-family: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--bk-muted);
    font-weight: 500;
}

.bk-rule {
    display: inline-block;
    width: 1.5rem;
    height: 1px;
    background: var(--bk-line-strong);
    vertical-align: middle;
    margin-right: 0.5rem;
}

.bk-mark {
    display: inline-block;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: var(--bk-accent);
    box-shadow: 0 0 0 4px var(--bk-accent-tint);
}

.bk-card {
    background: var(--bk-surface);
    border: 1px solid var(--bk-line);
    border-radius: 0.75rem;
    padding: 1.5rem;
    transition: border-color 200ms ease, transform 200ms ease;
}

.bk-card:hover {
    border-color: var(--bk-line-strong);
}

.bk-card--link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.bk-card--link:hover {
    color: inherit;
    transform: translateY(-1px);
}

.bk-divider {
    height: 1px;
    background: var(--bk-line);
    border: 0;
    margin: 2rem 0;
}

.bk-subheading-host > h2 {
    font-size: 1rem;
    font-weight: 500;
    margin: 0 0 1rem;
    color: var(--bk-ink-soft);
    letter-spacing: -0.005em;
}

.bk-item-meta > h2 {
    font-size: 0.95rem;
    font-weight: 500;
    margin: 0;
    color: var(--bk-ink);
    line-height: 1.3;
    letter-spacing: -0.005em;
}

.bk-status-dot {
    display: inline-block;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    margin-right: 0.5rem;
    vertical-align: middle;
}
.bk-status-dot--open    { background: #4F8A4C; box-shadow: 0 0 0 4px #E7F0E6; }
.bk-status-dot--scheduled { background: #B8884B; box-shadow: 0 0 0 4px #F6EEDC; }

/* Page-load reveal — staggered, restrained. */
.bk-reveal {
    opacity: 0;
    transform: translateY(8px);
    animation: bk-rise 480ms ease forwards;
}
.bk-reveal-1 { animation-delay: 60ms; }
.bk-reveal-2 { animation-delay: 140ms; }
.bk-reveal-3 { animation-delay: 220ms; }
.bk-reveal-4 { animation-delay: 300ms; }
.bk-reveal-5 { animation-delay: 380ms; }

@keyframes bk-rise {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
    .bk-reveal,
    .bk-reveal-1, .bk-reveal-2, .bk-reveal-3, .bk-reveal-4, .bk-reveal-5 {
        animation: none;
        opacity: 1;
        transform: none;
    }
}

/* Bootstrap primary button override — solid terracotta with a confident hover. */
.btn-primary {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--bk-accent);
    --bs-btn-border-color: var(--bk-accent);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--bk-accent-ink);
    --bs-btn-hover-border-color: var(--bk-accent-ink);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--bk-accent-ink);
    --bs-btn-active-border-color: var(--bk-accent-ink);
    --bs-btn-focus-shadow-rgb: 194, 85, 63;
    font-weight: 500;
    letter-spacing: -0.005em;
}

.btn-outline-secondary {
    --bs-btn-color: var(--bk-ink);
    --bs-btn-border-color: var(--bk-line-strong);
    --bs-btn-hover-color: var(--bk-ink);
    --bs-btn-hover-bg: var(--bk-surface-warm);
    --bs-btn-hover-border-color: var(--bk-line-strong);
    --bs-btn-active-bg: var(--bk-surface-warm);
    --bs-btn-active-border-color: var(--bk-line-strong);
    font-weight: 500;
}

.btn-outline-danger {
    --bs-btn-color: #8E3A29;
    --bs-btn-border-color: #D9C0BA;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--bk-accent);
    --bs-btn-hover-border-color: var(--bk-accent);
    font-weight: 500;
}

/* Cards — flatten the default Bootstrap card so it matches our hairline aesthetic. */
.card {
    border-color: var(--bk-line);
    border-radius: 0.75rem;
    background: var(--bk-surface);
    box-shadow: none;
}

.card-header,
.card-footer {
    background: var(--bk-surface);
    border-color: var(--bk-line);
}

/* Tables — quieter borders, more breathing space. */
.table {
    --bs-table-bg: transparent;
    --bs-table-border-color: var(--bk-line);
    --bs-table-color: var(--bk-ink);
    --bs-table-hover-color: var(--bk-ink);
    --bs-table-hover-bg: var(--bk-surface-warm);
}
.table > :not(caption) > * > * {
    padding: 0.85rem 0.75rem;
}
.table-light, .table-light > th, .table-light > td {
    --bs-table-bg: var(--bk-surface-warm);
    --bs-table-color: var(--bk-ink-soft);
    color: var(--bk-ink-soft);
    font-weight: 500;
    border-bottom-color: var(--bk-line-strong);
}
.table thead th {
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.72rem;
    color: var(--bk-muted);
    font-weight: 500;
}

/* Form controls — flatter, calmer focus. */
.form-control, .form-select {
    border-color: var(--bk-line);
    background-color: var(--bk-surface);
    color: var(--bk-ink);
}
.form-control:focus, .form-select:focus {
    border-color: var(--bk-accent);
    box-shadow: 0 0 0 3px var(--bk-accent-tint);
}
.form-label {
    font-weight: 500;
    color: var(--bk-ink-soft);
    font-size: 0.875rem;
}

.text-secondary { color: var(--bk-muted) !important; }
.bg-light { background-color: var(--bk-surface-warm) !important; }
.text-danger { color: var(--bk-accent-ink) !important; }

/* Nav tabs — flatter, with a confident underline on the active tab. */
.nav-tabs {
    --bs-nav-tabs-border-color: var(--bk-line);
    --bs-nav-tabs-link-active-color: var(--bk-ink);
    --bs-nav-tabs-link-active-bg: transparent;
    --bs-nav-tabs-link-active-border-color: transparent transparent var(--bk-accent);
    border-bottom-width: 1px;
}
.nav-tabs .nav-link {
    color: var(--bk-muted);
    border: 0;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    padding: 0.5rem 0.85rem;
    font-weight: 500;
}
.nav-tabs .nav-link:hover {
    color: var(--bk-ink);
    border-bottom-color: var(--bk-line-strong);
}
.nav-tabs .nav-link.active {
    color: var(--bk-ink);
    border-bottom-color: var(--bk-accent);
}

/* Alerts — quieter than Bootstrap defaults. */
.alert {
    border-radius: 0.5rem;
    border: 1px solid transparent;
}
.alert-info {
    background: var(--bk-surface-warm);
    border-color: var(--bk-line);
    color: var(--bk-ink-soft);
}
.alert-success {
    background: #ECF3EC;
    border-color: #CFE2CE;
    color: #345632;
}
.alert-danger {
    background: var(--bk-accent-tint);
    border-color: #E9CFCA;
    color: var(--bk-accent-ink);
}

/* Shared legacy button aliases mapped onto Bootstrap's component model. */
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.375rem;
    padding: .5rem 1rem;
    border-radius: var(--bs-border-radius);
    border: 1px solid transparent;
    font-weight: 600;
    line-height: 1.5;
    text-decoration: none;
    cursor: pointer;
}

.button--primary,
.storefront-nav__cta {
    color: #fff;
    background: var(--bs-primary);
    border-color: var(--bs-primary);
}

.button--primary:hover,
.storefront-nav__cta:hover {
    color: #fff;
    background: #1d4ed8;
    border-color: #1d4ed8;
}

.button--secondary,
.button--ghost {
    color: var(--bs-body-color);
    background: #fff;
    border-color: var(--bs-border-color);
}

.button--secondary:hover,
.button--ghost:hover {
    color: var(--bs-primary);
    background: #f8f9fa;
    border-color: #b6c2d2;
}

/* Admin shell */
.admin-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 15.5rem minmax(0, 1fr);
}

.admin-header,
.admin-topbar,
.admin-sidebar {
    position: sticky;
    top: 0;
    z-index: 1020;
    align-self: start;
    height: 100vh;
    padding: 1.25rem 0.75rem 0;
    border-right: 1px solid var(--bk-line);
    background: var(--bk-surface);
}

.admin-nav-scroller {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}

.admin-nav {
    display: flex;
    flex-direction: column;
    gap: .125rem;
}

.admin-nav__link {
    display: flex;
    align-items: center;
    padding: .42rem .75rem;
    border-radius: var(--bs-border-radius-sm);
    color: var(--bk-muted);
    font-size: .88rem;
    font-weight: 500;
    line-height: 1.3;
    text-decoration: none;
    letter-spacing: -0.005em;
    transition: color 160ms ease, background-color 160ms ease;
}

.admin-nav__link:hover {
    color: var(--bk-ink);
    background: var(--bk-surface-warm);
}

.admin-nav__link--active {
    color: var(--bk-ink);
    background: var(--bk-surface-warm);
    position: relative;
}

.admin-nav__link--active::before {
    content: "";
    position: absolute;
    left: -0.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 0.25rem;
    height: 0.25rem;
    border-radius: 50%;
    background: var(--bk-accent);
}

.admin-sign-out {
    flex: 0 0 auto;
    border-top: 1px solid var(--bk-line) !important;
    background: var(--bk-surface);
}

.admin-main,
.admin-content {
    width: min(100%, 1440px);
    padding: 2rem;
}

.admin-section,
.admin-page-header,
.admin-hero,
.admin-table-card {
    margin-top: 1rem;
    padding: 1rem;
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius-lg);
    background: #fff;
}

.admin-page-header:first-child,
.admin-hero:first-child,
.admin-table-card:first-child,
.admin-section:first-child {
    margin-top: 0;
}

.admin-workspace-header,
.admin-page-header,
.admin-hero {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
}

.admin-workspace-header h1,
.admin-page-header h1,
.admin-hero h1,
.admin-toolbar h1 {
    margin: 0;
    font-size: 1.75rem;
    line-height: 1.2;
    font-weight: 700;
}

.admin-summary-card__title {
    display: block;
    margin: 0 0 .25rem;
    color: var(--bs-primary);
    text-transform: uppercase;
    letter-spacing: .08em;
    font-size: .75rem;
    font-weight: 700;
}

.admin-hero__copy,
.admin-muted,
.admin-table small,
.admin-current-image span {
    color: var(--bs-secondary-color);
}

.admin-toolbar,
.admin-filters,
.admin-table-card__header,
.admin-actions,
.admin-page-actions,
.admin-form-actions,
.admin-status-row,
.admin-segmented-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    align-items: center;
    justify-content: space-between;
}

.admin-form,
.admin-stack {
    display: grid;
    gap: .85rem;
}

.admin-form--inline {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: .6rem;
}

.admin-form--inline label {
    max-width: 14rem;
}

.admin-form label,
.admin-filters label {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    font-size: .875rem;
    font-weight: 600;
}

.admin-form input:not([type="checkbox"]):not([type="hidden"]),
.admin-form textarea,
.admin-form select,
.admin-filters input,
.admin-filters select {
    display: block;
    width: 100%;
    min-width: 10.5rem;
    min-height: calc(1.5em + .75rem + 2px);
    padding: .375rem .75rem;
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
    background: #fff;
    color: var(--bs-body-color);
    font: inherit;
}

.admin-form--inline input,
.admin-form--inline select,
.admin-form--inline .button {
    box-sizing: border-box;
    height: calc(1.5em + .75rem + 2px);
    min-height: calc(1.5em + .75rem + 2px);
}

.admin-form--inline .button {
    padding-top: 0;
    padding-bottom: 0;
}

.admin-checkbox,
.admin-checkbox-option {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: .5rem;
    width: fit-content;
}

/* .admin-form sets `display: flex; flex-direction: column` on every <label>
   so labels stack above their inputs. A .admin-checkbox label needs to
   stay on one line — same-specificity selector that overrides the column
   layout for the checkbox case. */
.admin-form .admin-checkbox,
.admin-form .admin-checkbox-option {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: .5rem;
    width: fit-content;
    font-weight: 500;
}

.admin-checkbox input[type="checkbox"],
.admin-checkbox-option input[type="checkbox"],
.admin-table input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    min-width: 0;
    min-height: 0;
    padding: 0;
    accent-color: var(--bs-primary);
    flex-shrink: 0;
}

.admin-form__section {
    margin: 0;
    padding: 1rem;
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
}

.admin-table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
    background: #fff;
}

.admin-table {
    width: 100%;
    min-width: 48rem;
    margin-bottom: 0;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    padding: .65rem .75rem;
    border-bottom: 1px solid var(--bs-border-color);
    text-align: left;
    vertical-align: middle;
}

.admin-table th {
    color: var(--bs-secondary-color);
    background: var(--bs-light);
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.admin-table tr:last-child td {
    border-bottom: 0;
}

.admin-table__actions {
    white-space: nowrap;
}

.admin-table__actions .button {
    min-height: 2.25rem;
    padding-block: .35rem;
}

.admin-empty-state,
.admin-status-message,
.validation-summary-errors {
    margin: 0 0 1rem;
    padding: .75rem 1rem;
    border-radius: var(--bs-border-radius);
}

.admin-empty-state {
    margin-bottom: 0;
    color: var(--bs-secondary-color);
}

.admin-status-message {
    color: #084298;
    background: #cfe2ff;
    border: 1px solid #9ec5fe;
    font-weight: 600;
}

.validation-summary-errors {
    color: #842029;
    background: #f8d7da;
    border: 1px solid #f1aeb5;
}

/* The asp-validation-summary tag helper adds validation-summary-valid to its
   wrapper when there are no errors. Collapse the empty wrapper so it stops
   showing up as an empty red alert. */
.validation-summary-valid {
    display: none;
}

.admin-thumbnail {
    width: 3.5rem;
    height: 3.5rem;
    object-fit: cover;
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
    background: #fff;
}

.admin-thumbnail--large {
    width: 8rem;
    height: 8rem;
}

.admin-current-image {
    display: grid;
    gap: .35rem;
    justify-items: start;
}

.admin-summary-grid,
.admin-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    gap: .8rem;
}

.admin-summary-card {
    padding: 1rem;
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
    background: #fff;
}

.admin-checklist-row {
    display: grid;
    grid-template-columns: minmax(10rem, 1fr) auto;
    gap: .5rem .75rem;
    align-items: center;
    padding: .65rem 0;
    border-bottom: 1px solid var(--bs-border-color);
}

.admin-checklist-row:last-child {
    border-bottom: 0;
}

.admin-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-top: .9rem;
    color: var(--bs-secondary-color);
    font-size: .9rem;
}

.admin-pagination__links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
}

.admin-pagination__current {
    color: var(--bs-body-color);
    font-weight: 600;
}

/* Storefront compatibility on top of Bootstrap. */
.storefront-header {
    position: sticky;
    top: 0;
    z-index: 1020;
    background: #fff;
    border-bottom: 1px solid var(--bs-border-color);
}

.storefront-header__inner {
    width: min(100% - 2rem, 1240px);
    min-height: 4.25rem;
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(12rem, 1fr) auto minmax(12rem, 1fr);
    gap: 1rem;
    align-items: center;
}

.storefront-brand,
.storefront-nav,
.storefront-actions,
.hero__actions {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.storefront-brand {
    color: var(--bs-body-color);
    font-weight: 700;
    text-decoration: none;
}

.storefront-brand__mark {
    width: 1.15rem;
    height: 1.45rem;
    border: 3px solid var(--bs-primary);
    border-radius: .25rem;
}

.storefront-nav {
    flex-wrap: wrap;
    justify-content: center;
}

.storefront-nav a,
.storefront-action-link,
.storefront-account-button {
    color: var(--bs-secondary-color);
    font-size: .875rem;
    font-weight: 600;
    text-decoration: none;
}

.storefront-actions {
    justify-content: flex-end;
}

.storefront-account-button {
    max-width: 14rem;
    border: 0;
    background: transparent;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hero {
    width: min(100% - 2rem, 1240px);
    min-height: calc(100svh - 5rem);
    margin: 0 auto;
    padding: 4rem 0;
    display: grid;
    grid-template-columns: minmax(0, .95fr) minmax(18rem, 1.05fr);
    gap: clamp(2rem, 5vw, 4rem);
    align-items: center;
}

.hero h1 {
    margin: .35rem 0 1rem;
    font-size: clamp(2.5rem, 6vw, 5.5rem);
    line-height: .95;
    font-weight: 700;
}

.hero__eyebrow {
    color: var(--bs-primary);
    text-transform: uppercase;
    letter-spacing: .08em;
    font-size: .8rem;
    font-weight: 700;
}

.hero__message {
    color: var(--bs-secondary-color);
    font-size: 1.125rem;
    line-height: 1.55;
}

.hero__visual img {
    width: 100%;
    max-height: 70vh;
    object-fit: cover;
    border-radius: var(--bs-border-radius-lg);
}

.details-grid,
.storefront-grid,
.order-grid {
    width: min(100% - 2rem, 1240px);
    margin: 2rem auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
    gap: 1rem;
}

.detail-card,
.storefront-card,
.order-card,
.auth-panel {
    padding: 1rem;
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius-lg);
    background: #fff;
}

.status {
    display: inline-flex;
    align-items: center;
    padding: .25rem .6rem;
    border-radius: 999px;
    font-size: .85rem;
    font-weight: 600;
}

.status--open {
    color: #0f5132;
    background: #d1e7dd;
}

.status--scheduled {
    color: #664d03;
    background: #fff3cd;
}

body a:focus-visible,
.admin-body a:focus-visible,
body button:focus-visible,
body input:focus-visible,
body select:focus-visible,
body textarea:focus-visible {
    outline: 3px solid rgba(var(--bs-primary-rgb), .25);
    outline-offset: 2px;
}

@media (max-width: 900px) {
    .admin-shell {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }

    .admin-header,
    .admin-topbar,
    .admin-sidebar {
        position: static;
        height: auto;
        padding: .75rem;
        border-right: 0;
        border-bottom: 1px solid var(--bs-border-color);
    }

    .admin-nav-scroller {
        overflow-x: auto;
        overflow-y: hidden;
    }

    .admin-nav {
        flex-direction: row;
        width: max-content;
        min-width: 100%;
    }

    .admin-main,
    .admin-content {
        padding: 1rem;
    }

    .storefront-header__inner {
        grid-template-columns: 1fr;
        padding: .75rem 0;
    }

    .storefront-nav,
    .storefront-actions {
        justify-content: flex-start;
    }

    .hero {
        grid-template-columns: 1fr;
        min-height: auto;
        padding: 2rem 0;
    }
}
