/*
 * CoachCentral base styles. Notion-inspired warm-neutral palette; see
 * CoachCentralTheme.cs for the canonical token values. This file harmonizes
 * the Bootstrap CSS (still loaded for form controls and the .btn family)
 * with the MudBlazor theme so the two don't fight each other visually.
 */

:root {
    --cc-bg: #F7F6F3;
    --cc-surface: #FFFFFF;
    --cc-surface-2: #F1F1EF;
    --cc-border: #E9E9E7;
    --cc-border-strong: #D9D8D5;
    --cc-text: #37352F;
    --cc-text-muted: #787774;
    --cc-text-faint: #B5B3AE;
    --cc-accent: #2383E2;
    --cc-accent-soft: #E7F2FC;
    /* On-brand text color (computed for the default --cc-accent;
       the BrandedSurface wrapper overrides on public surfaces with
       a luminance-correct value for the chosen brand color). */
    --cc-accent-on: #FFFFFF;
    --cc-accent-tint: #E7F2FC;
    /* Default button radius — public surfaces can override via the
       BrandedSurface wrapper based on Tenant.ButtonStyle. */
    --cc-button-radius: 0.5rem;
    /* Brand: warm rust / terracotta. Used sparingly — wordmark, hero callouts,
       and small accents. Distinct enough from --cc-warning that they don't
       confuse each other in context. */
    --cc-brand: #D97757;
    --cc-brand-soft: #F7E5DC;
    --cc-success: #448361;
    --cc-warning: #C67B5C;
    --cc-error: #B4524A;
}

html, body {
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    color: var(--cc-text);
    background-color: var(--cc-bg);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--cc-text);
    font-weight: 600;
    letter-spacing: -0.005em;
}

h1 { font-size: 2rem;     line-height: 1.25; }
h2 { font-size: 1.625rem; line-height: 1.3; }
h3 { font-size: 1.35rem;  line-height: 1.35; }
h4 { font-size: 1.175rem; line-height: 1.4; }

a, .btn-link {
    color: var(--cc-accent);
    text-decoration: none;
}

a:hover, .btn-link:hover {
    text-decoration: underline;
}

/* Bootstrap button overrides — warm palette, soft borders, no harsh
   gradient. We aim for "subtle but tactile." */
.btn {
    font-weight: 500;
    border-radius: 6px;
    padding: 0.4rem 0.85rem;
    transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.btn-primary {
    color: #fff;
    background-color: var(--cc-accent);
    border-color: var(--cc-accent);
}

.btn-primary:hover, .btn-primary:focus {
    background-color: #1A6FC1;
    border-color: #1A6FC1;
    color: #fff;
}

.btn-outline-primary {
    color: var(--cc-accent);
    border-color: var(--cc-border-strong);
    background-color: var(--cc-surface);
}

.btn-outline-primary:hover, .btn-outline-primary:focus {
    background-color: var(--cc-accent-soft);
    border-color: var(--cc-accent);
    color: var(--cc-accent);
}

.btn-outline-secondary {
    color: var(--cc-text);
    border-color: var(--cc-border-strong);
    background-color: var(--cc-surface);
}

.btn-outline-secondary:hover, .btn-outline-secondary:focus {
    background-color: var(--cc-surface-2);
    border-color: var(--cc-border-strong);
    color: var(--cc-text);
}

.btn-outline-danger {
    color: var(--cc-error);
    border-color: var(--cc-border-strong);
    background-color: var(--cc-surface);
}

.btn-outline-danger:hover, .btn-outline-danger:focus {
    background-color: #FBEEEC;
    border-color: var(--cc-error);
    color: var(--cc-error);
}

.btn-link {
    text-decoration: none;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus,
.form-control:focus, .form-check-input:focus, .form-select:focus {
    box-shadow: 0 0 0 3px rgba(35, 131, 226, 0.18);
    outline: none;
}

/* Form controls — Notion's input style is flat and quiet, no heavy chrome. */
.form-control, .form-select {
    background-color: var(--cc-surface);
    border-color: var(--cc-border-strong);
    color: var(--cc-text);
    border-radius: 6px;
    padding: 0.45rem 0.65rem;
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--cc-accent);
    background-color: var(--cc-surface);
    color: var(--cc-text);
}

.form-control::placeholder {
    color: var(--cc-text-faint);
}

.form-label {
    color: var(--cc-text);
    font-weight: 500;
    margin-bottom: 0.35rem;
}

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

.form-check-input {
    border-color: var(--cc-border-strong);
}

.form-check-input:checked {
    background-color: var(--cc-accent);
    border-color: var(--cc-accent);
}

/* MudBlazor Outlined papers default to a darker rgba border. Soften to our
   token so cards don't feel walled-off from the page. */
.mud-paper-outlined {
    border-color: var(--cc-border) !important;
}

.mud-table thead th {
    color: var(--cc-text-muted);
    font-weight: 500;
    background-color: var(--cc-surface);
    border-bottom: 1px solid var(--cc-border) !important;
}

.mud-table-cell {
    border-bottom-color: var(--cc-border) !important;
}

.mud-table-row:hover {
    background-color: var(--cc-bg) !important;
}

/* MudAlert: tone the backgrounds down so they're informational rather than
   shouty. Material's defaults are saturated; we want Notion-like callouts. */
.mud-alert-filled-success { background-color: #E8F1EC !important; color: var(--cc-success) !important; }
.mud-alert-filled-warning { background-color: #F7EBE3 !important; color: var(--cc-warning) !important; }
.mud-alert-filled-error   { background-color: #F7E5E2 !important; color: var(--cc-error) !important; }
.mud-alert-filled-info    { background-color: var(--cc-accent-soft) !important; color: var(--cc-accent) !important; }

.mud-alert-filled-success .mud-alert-icon,
.mud-alert-filled-warning .mud-alert-icon,
.mud-alert-filled-error .mud-alert-icon,
.mud-alert-filled-info .mud-alert-icon {
    color: inherit !important;
}

.content {
    padding-top: 1.5rem;
    padding-bottom: 3rem;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid var(--cc-success);
}

.invalid {
    outline: 1px solid var(--cc-error);
}

.validation-message {
    color: var(--cc-error);
}

.blazor-error-boundary {
    background-color: var(--cc-error);
    color: #fff;
    padding: 1rem 1rem 1rem 3.7rem;
}

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

.darker-border-checkbox.form-check-input {
    border-color: var(--cc-border-strong);
}

/* Booking slot button. Plain anchor that looks like a button — used in
   both the public booking flow and the client portal slot picker so the
   two surfaces stay visually consistent. Stacks a small "coach: X" line
   under the primary time when the visitor's TZ differs from the coach's. */
.bk-slot-btn {
    display: inline-flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 0.3rem 0.8rem; min-width: 5rem;
    border: 1px solid var(--cc-accent); border-radius: 4px;
    color: var(--cc-accent); background: transparent;
    font-size: 0.9rem; font-weight: 500; line-height: 1.2;
    text-decoration: none; cursor: pointer;
    font-variant-numeric: tabular-nums;
}
.bk-slot-btn:hover { background: var(--cc-accent-soft); }
.bk-slot-time { font-weight: 600; }
.bk-slot-coach-time {
    font-size: 0.7rem; font-weight: 400;
    opacity: 0.6; margin-top: 0.15rem;
    white-space: nowrap;
}

/* Subtle, warm scrollbars to match the canvas. */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--cc-border); border-radius: 6px; }
*::-webkit-scrollbar-thumb:hover { background: var(--cc-border-strong); }

/* Course-authored content (Lesson.ContentHtml + Course.DescriptionHtml).
   Apply `.course-content` to any container that renders the
   sanitizer-cleaned TipTap output — the editor + the client player
   stay visually consistent. See docs/COURSES.md. */
.course-content :where(h2, h3) { margin-top: 1.25rem; }
.course-content img { max-width: 100%; height: auto; }
.course-content hr {
    border: 0; border-top: 2px solid var(--cc-border);
    margin: 1.5rem 0;
}
.course-content mark {
    background-color: #fff3a3;
    padding: 0.05rem 0.1rem;
    border-radius: 2px;
}
/* Task lists — pointer-events: none on the checkbox label so the
   v3 player renders them as static markers. v2 will wire interactive
   completion via a separate rendering path. */
.course-content ul[data-type="taskList"] {
    list-style: none; padding-left: 0;
}
.course-content ul[data-type="taskList"] li {
    display: flex; align-items: flex-start; gap: 0.5rem;
}
.course-content ul[data-type="taskList"] li > label {
    flex-shrink: 0; margin-top: 0.3rem; pointer-events: none;
}
.course-content ul[data-type="taskList"] li > div { flex-grow: 1; }
.course-content ul[data-type="taskList"] li > div > p { margin: 0; }
/* Tables — match the editor styling. */
.course-content table {
    border-collapse: collapse; margin: 0.75rem 0;
    width: 100%; table-layout: fixed;
}
.course-content table td, .course-content table th {
    border: 1px solid var(--cc-border);
    padding: 0.4rem 0.5rem; vertical-align: top;
}
.course-content table th {
    background: var(--cc-bg);
    font-weight: 600;
}

/* Centered narrow card for the anonymous auth pages (login, forgot /
   reset password). These render inside MainLayout (anon visitors on
   subdomains get the thin Sign-in header bar above); the card keeps the
   form at a readable width instead of letting the inputs stretch the
   full viewport. Shared here so all the auth screens match. */
.auth-shell {
    display: flex;
    justify-content: center;
    padding: 3rem 1rem;
}
.auth-card {
    width: 100%;
    max-width: 24rem;
    background: var(--cc-surface);
    border: 1px solid var(--cc-border);
    border-radius: 8px;
    padding: 1.75rem 1.75rem 1.5rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.auth-title {
    margin: 0 0 1.25rem;
    font-size: 1.5rem;
}
.auth-aux a { color: var(--cc-text-muted); }
.auth-aux a:hover { color: var(--cc-text); }

/* ============================================================================
 * Responsive data patterns — shared mobile primitives for the client portal
 * (and anywhere a wide table has to survive a phone). app.css was previously
 * breakpoint-free; this is the foundation. Two shapes:
 *   .cc-cardlist / .cc-datacard  — a list that IS cards at every width
 *                                  (auto columns on desktop, one-up on phones)
 *   table.cc-rtable              — a real table on desktop that collapses to
 *                                  labeled cards under 640px; cells carry
 *                                  data-label="Column".
 * Both are opt-in (new class names), so existing pages are untouched.
 * ==========================================================================*/

/* ---- Card list ---- */
.cc-cardlist {
    display: grid;
    gap: 0.7rem;
    /* min(100%, 20rem) keeps a track from ever exceeding the container, so a
       narrow phone never gets a horizontal scrollbar. */
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr));
}
.cc-datacard {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.8rem 0.9rem;
    background: var(--cc-surface);
    border: 1px solid var(--cc-border);
    border-radius: 8px;
}
.cc-datacard-title { font-weight: 600; font-size: 1rem; color: var(--cc-text); }
.cc-datacard-meta { color: var(--cc-text-muted); font-size: 0.87rem; }
.cc-datacard-meta strong { color: var(--cc-text); font-weight: 600; }
.cc-datacard-when { font-weight: 600; font-variant-numeric: tabular-nums; }
.cc-datacard-when .sub {
    display: block; font-weight: 400; color: var(--cc-text-muted);
    font-size: 0.82rem; margin-top: 0.1rem;
}
.cc-datacard-statrow {
    display: flex; align-items: center; justify-content: space-between;
    gap: 0.5rem; flex-wrap: wrap;
}
.cc-datacard-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
/* Actions grow to comfortable tap targets and wrap rather than cram; a lone
   button (e.g. Book) fills the row. min-width keeps 2–3 from getting tiny. */
.cc-datacard-actions .btn { flex: 1 1 auto; min-width: 6rem; padding: 0.5rem 0.85rem; }
/* A cancel/confirm form styled to sit in the action row like a button. */
.cc-datacard-actions form { display: contents; }

/* ---- Status pill ---- */
.cc-pill {
    display: inline-flex; align-items: center; gap: 0.35rem;
    font-size: 0.82rem; font-weight: 600; white-space: nowrap;
    padding: 0.2rem 0.55rem; border-radius: 999px;
    background: var(--cc-accent-soft); color: #1A6FC1;
}
.cc-pill-muted { background: var(--cc-surface-2); color: var(--cc-text-muted); }
.cc-pill-success { background: #E4F1EA; color: var(--cc-success); }
.cc-pill-warning { background: #F7E9E1; color: var(--cc-warning); }

/* ---- Responsive table: table on desktop, labeled cards under 640px ---- */
@media (max-width: 640px) {
    table.cc-rtable, table.cc-rtable thead, table.cc-rtable tbody,
    table.cc-rtable tr, table.cc-rtable th, table.cc-rtable td { display: block; }
    /* Keep the header row for screen readers but hide it visually. */
    table.cc-rtable thead {
        position: absolute; width: 1px; height: 1px;
        padding: 0; margin: -1px; overflow: hidden;
        clip: rect(0 0 0 0); white-space: nowrap; border: 0;
    }
    table.cc-rtable tr {
        border: 1px solid var(--cc-border); border-radius: 8px;
        margin-bottom: 0.7rem; padding: 0.15rem 0.1rem;
        background: var(--cc-surface);
    }
    table.cc-rtable td {
        display: flex; align-items: baseline; gap: 1rem;
        padding: 0.4rem 0.85rem; border: 0; text-align: right;
        white-space: normal;
    }
    /* Label pulled from the cell's data-label attribute, pinned left; the
       value flows to the right edge. */
    table.cc-rtable td[data-label]::before {
        content: attr(data-label);
        font-weight: 600; color: var(--cc-text-muted);
        text-align: left; margin-right: auto;
    }
    /* Label-less cells (e.g. a lone action button) just right-align. */
    table.cc-rtable td:not([data-label]) { justify-content: flex-end; }
    table.cc-rtable td:empty { display: none; }
}

/* ============================================================================
 * HeroBlock — the composed landing-page hero (background photo or gradient +
 * scrim + live title/badge). CSS lives here rather than inline in the component
 * so a LIST of heroes (e.g. shop cards) doesn't duplicate a <style> per card.
 * Markup: Components/Shared/HeroBlock.razor.
 * ==========================================================================*/
.hb {
    position: relative; overflow: hidden;
    border-radius: 12px; margin-bottom: 1.5rem;
    display: flex; align-items: center; justify-content: center; text-align: center;
    min-height: clamp(210px, 32vw, 340px);
    /* Solid brand-tinted band as a base so the hero never looks broken with no
       photo; the photo (when set) paints over it. */
    background-color: var(--cc-accent, #2f5062);
    background-size: cover; background-position: center; background-repeat: no-repeat;
}
/* Scrim between the photo and the text so words stay legible on a busy image. */
.hb::before { content: ''; position: absolute; inset: 0; pointer-events: none; }
.hb-scrim-dark::before { background: linear-gradient(180deg, rgba(8,15,22,.28) 0%, rgba(8,15,22,.58) 100%); }
.hb-scrim-light::before { background: rgba(255,255,255,.55); }

/* Curated gradient backgrounds — a coach can pick one instead of a photo. */
.hb-bg-dawn   { background-image: linear-gradient(160deg,#f4b183 0%,#e07a5f 34%,#b4526a 66%,#5f4b8b 100%); }
.hb-bg-forest { background-image: linear-gradient(160deg,#3a6b4c 0%,#2f5d43 40%,#24493a 70%,#15302a 100%); }
.hb-bg-ocean  { background-image: linear-gradient(168deg,#3c5f70 0%,#4d818d 34%,#2f5062 60%,#1d3547 100%); }
.hb-bg-sand   { background-image: linear-gradient(160deg,#e6d2ad 0%,#d3ab7c 38%,#b1815a 70%,#856048 100%); }
.hb-bg-slate  { background-image: linear-gradient(160deg,#6b7a8a 0%,#4a5766 42%,#333d49 72%,#1f262e 100%); }
.hb-bg-brand  { background-image: linear-gradient(160deg, var(--cc-accent) 0%, color-mix(in srgb, var(--cc-accent) 55%, #10151b) 100%); }

.hb-inner { position: relative; padding: 2rem 1.4rem; width: 100%; }
.hb-avatar {
    width: 84px; height: 84px; border-radius: 50%; object-fit: cover;
    border: 3px solid rgba(255,255,255,.85); box-shadow: 0 2px 12px rgba(0,0,0,.3);
    margin: 0 auto .8rem; display: block;
}
.hb-subtitle { margin: .6rem auto 0; max-width: 36rem; font-size: 1.02rem; line-height: 1.45; }
.hb-scrim-dark  .hb-eyebrow, .hb-scrim-dark  .hb-title { color: #fff; }
.hb-scrim-light .hb-eyebrow, .hb-scrim-light .hb-title { color: var(--cc-text, #37352F); }
.hb-scrim-dark  .hb-subtitle { color: rgba(255,255,255,.92); }
.hb-scrim-light .hb-subtitle { color: var(--cc-text, #37352F); }
.hb-eyebrow { text-transform: uppercase; letter-spacing: .09em; font-size: .8rem; font-weight: 600; opacity: .9; margin-bottom: .5rem; }
.hb-title {
    font-weight: 800; text-transform: uppercase; letter-spacing: .01em; line-height: 1.05; margin: 0;
    font-size: clamp(1.7rem, 5vw, 2.9rem); text-shadow: 0 2px 16px rgba(0,0,0,.28);
}
.hb-scrim-light .hb-title { text-shadow: none; }
.hb-badge {
    display: inline-block; margin-top: 1rem; padding: .5rem 1.15rem;
    /* Always a fully-rounded pill so the badge reads as a tag, not a button. */
    border-radius: 999px; background: var(--cc-accent); color: var(--cc-accent-on);
    font-weight: 700; text-transform: uppercase; letter-spacing: .06em; font-size: .85rem;
    box-shadow: 0 2px 14px rgba(0,0,0,.22);
}

/* Compact variant for shop/listing card thumbnails: fills a fixed-aspect
   container and scales the title to the CARD width via container queries — the
   card gives the hero its own `container-type: inline-size` ancestor. */
.hb.hb-compact { min-height: 0; height: 100%; margin-bottom: 0; border-radius: 0; }
.hb-compact .hb-inner { padding: .85rem .8rem; }
.hb-compact .hb-eyebrow { font-size: .58rem; margin-bottom: .2rem; }
.hb-compact .hb-title { font-size: clamp(.9rem, 7.5cqi, 1.5rem); }
.hb-compact .hb-subtitle { display: none; }
.hb-compact .hb-avatar { width: 46px; height: 46px; margin-bottom: .4rem; border-width: 2px; }
.hb-compact .hb-badge { margin-top: .45rem; padding: .24rem .65rem; font-size: .6rem; }
