/* SinghaSport — component styles (plain CSS; works with the Tailwind CDN).
   Palette: slate neutrals + emerald brand + sky accent. No purple / orange. */

:root {
    --brand:       #c39f5c;
    --brand-dark:  #184a2e;
    --brand-light: #eef5ef;
    --ring:        #d3b276;
    --gold:        #d3b276;
    --gold-dark:   #c39f5c;
    --ink:         #12331f;

    /* Green text ramp (SPAZE mockup). Replaces the slate neutrals for body copy
       everywhere except the sidebar and the topbar — see the "Green text tone"
       section at the bottom of this file. Darkest → lightest. */
    --ink-900:     #0b2416;
    --ink-800:     #123922;
    --ink-700:     #184a2e;
    --ink-600:     #1e5b37;
    --ink-500:     #2f7449;
    --ink-400:     #5c8f74;
    --ink-300:     #94b5a2;
}

html { scroll-behavior: smooth; }

/* Warm taupe/sand page background — diagonal metallic gradient matching the SPAZE
   mockup. Fixed so it covers the viewport regardless of scroll; subtle enough that
   white cards stay legible on top. */
.bg-page {
    background: linear-gradient(155deg, #efe8d8 0%, #e5dac2 42%, #cfc09f 78%, #bfae8b 100%) fixed;
}
body { -webkit-tap-highlight-color: transparent; }

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: #cbd5e1 transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 9px; }

/* ---------------------------------------------------------------- Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    font-weight: 500; font-size: .875rem; line-height: 1.25rem;
    padding: .55rem .9rem; border-radius: .65rem; border: 1px solid transparent;
    cursor: pointer; transition: background .15s, color .15s, border-color .15s, box-shadow .15s;
    white-space: nowrap; text-decoration: none;
}
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.btn[disabled], .btn.is-loading { opacity: .55; cursor: not-allowed; }
.btn-sm { padding: .38rem .65rem; font-size: .8rem; border-radius: .55rem; }
.btn-primary { background: var(--gold); color: var(--ink); font-weight: 600; }
.btn-primary:hover { background: var(--gold-dark); }

/* Gold accent chrome — unifies the interactive/attention accent (count badges,
   avatar/initial circles, selected chips) with the gold primary buttons. Semantic
   status pills (success/warning/danger) are intentionally NOT part of this. */
.badge-count { background: var(--gold); color: var(--ink); }
.avatar-accent { background: #ecdcb8; color: #6e5124; }
.chip-selected { background: var(--gold); color: var(--ink); border-color: var(--gold-dark) !important; }
.bg-gold { background: var(--gold) !important; }
.btn-secondary { background: #fff; color: #334155; border-color: #e2e8f0; }
.btn-secondary:hover { background: #f8fafc; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-ghost { background: transparent; color: #475569; }
.btn-ghost:hover { background: #f1f5f9; }

/* ----------------------------------------------------------------- Inputs */
.input, .select, .textarea {
    width: 100%; padding: .55rem .75rem; font-size: .875rem;
    border-radius: .65rem; border: 1px solid #e2e8f0; background: #fff; color: #0f172a;
    transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus {
    outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring);
}
.input::placeholder { color: #94a3b8; }
.input[readonly], .input:disabled { background: #f1f5f9; color: #64748b; }
.label { display: block; font-size: .8rem; font-weight: 500; color: #475569; margin-bottom: .35rem; }
.form-hint { font-size: .75rem; color: #94a3b8; margin-top: .3rem; }
.form-error { font-size: .75rem; color: #dc2626; margin-top: .3rem; }

/* Filter-bar fields: readable width on desktop, full-width stack on mobile.
   Used inside `flex flex-wrap items-end gap-3` toolbars (reports + list filters). */
.field { flex: 1 1 12rem; min-width: 12rem; }
.field > .input, .field > .select, .field > .textarea { width: 100%; }
.field-actions { flex: 1 1 100%; display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: flex-end; gap: .5rem; }
@media (max-width: 640px) {
    .field { flex-basis: 100%; min-width: 0; }
    .field-actions { justify-content: stretch; }
    .field-actions > .btn { flex: 1 1 auto; justify-content: center; }
}

/* ------------------------------------------------------------------ Cards */
.card { background: #fff; border: 1px solid #e8edf2; border-radius: 1rem; box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.card-p { padding: 1.25rem; }

/* ------------------------------------------------------------------ Table */
.table-wrap { overflow-x: auto; border-radius: 1rem; }
.table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.table thead th {
    text-align: left; font-weight: 600; color: #64748b; background: #f8fafc;
    padding: .7rem .9rem; border-bottom: 1px solid #e2e8f0; white-space: nowrap;
}
.table tbody td { padding: .7rem .9rem; border-bottom: 1px solid #f1f5f9; color: #334155; vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #f8fafc; }
.table tfoot td { padding: .7rem .9rem; font-weight: 700; background: #f8fafc; border-top: 2px solid #e2e8f0; color: #0f172a; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.center { text-align: center !important; }

/* SweetAlert2 — recolor the default amber "warning" icon to neutral slate (no orange in the palette). */
.swal2-icon.swal2-warning { border-color: #cbd5e1; color: #475569; }

/* -------------------------------------------------------------- Select2 */
.select2-container { width: 100% !important; }
.select2-container--default .select2-selection--single {
    height: 2.5rem; border: 1px solid #cbd5e1; border-radius: .5rem; background: #fff;
    display: flex; align-items: center;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 2.5rem; padding-left: .75rem; padding-right: 1.8rem; color: #0f172a;
}
.select2-container--default .select2-selection--single .select2-selection__arrow { height: 2.4rem; right: .4rem; }
.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single {
    border-color: #1e5b37; box-shadow: 0 0 0 2px rgba(30,91,55,.2);
}
.select2-dropdown { border-color: #cbd5e1; }
.select2-container--default .select2-results__option--highlighted[aria-selected] { background: #1e5b37; }
.select2-container--default .select2-results__option[aria-selected=true] { background: #d6e7dc; color: #184a2e; }
.select2-search--dropdown .select2-search__field { border: 1px solid #cbd5e1; border-radius: .375rem; }

/* Plain tables (dashboard previews, empty states) — inset from the card edge too.
   DataTables tables sit inside .dataTables_wrapper, so this only hits non-DT tables. */
.table-wrap:has(> table.table) { padding: .3rem 1.25rem .9rem; }

/* ----------------------------------------------------------- DataTables */
/* Inset the whole block (search + table + pagination) so it isn't flush with the card. */
.dataTables_wrapper { padding: .6rem 1.25rem .9rem; }
.dataTables_wrapper .dataTables_filter { padding: .1rem 0 .8rem; }
.dataTables_wrapper .dataTables_filter input {
    border: 1px solid #cbd5e1; border-radius: .5rem; padding: .4rem .7rem; margin-left: .4rem; outline: none;
}
.dataTables_wrapper .dataTables_filter input:focus { border-color: #1e5b37; box-shadow: 0 0 0 2px rgba(30,91,55,.2); }
.dataTables_wrapper .dataTables_info { color: #64748b; padding: .8rem 0 0; }
.dataTables_wrapper .dataTables_paginate { padding: .7rem 0 0; }
.dataTables_wrapper .dataTables_paginate .paginate_button {
    border-radius: .4rem !important; padding: .3rem .7rem !important; border: 1px solid transparent !important; background: transparent !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: #1e5b37 !important; color: #fff !important; border-color: #1e5b37 !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: #f1f5f9 !important; color: #0f172a !important; border-color: #e2e8f0 !important;
}
.dataTables_wrapper .dataTables_filter, .dataTables_wrapper .dataTables_info { color: #64748b; }
/* DataTables sort icons shouldn't fight our header colours */
table.dataTable thead th { position: relative; }

/* -------------------------------------------------- Collapsible nav groups */
.nav-group-toggle { background: none; border: 0; cursor: pointer; }
.nav-group-toggle:hover .nav-group-chevron { color: #64748b; }
.nav-group-chevron { transition: transform .2s ease; }
.nav-group.is-collapsed .nav-group-chevron { transform: rotate(-90deg); }
/* Smooth height fold via animatable grid rows; collapses even without transition support. */
.nav-group-items { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .2s ease; }
.nav-group.is-collapsed .nav-group-items { grid-template-rows: 0fr; }
.nav-group-items-inner { overflow: hidden; min-height: 0; }

/* --------------------------------------------------------- Custom sidebar colour */
/* Enabled by data-sidebar-custom on <html>; the --sb-* vars are emitted per-request
   in header.php from the admin's chosen colour. #id selectors outrank the sidebar's
   Tailwind utilities so the custom colour always wins.
   Active links carry .bg-brand-50; everything else is an inactive link. */
html[data-sidebar-custom] #sidebar {
    background-color: var(--sb-bg);
    border-right-color: var(--sb-border);
    color: var(--sb-fg-muted);
}
html[data-sidebar-custom] #sidebar .border-b { border-bottom-color: var(--sb-border); }
html[data-sidebar-custom] #sidebar .leading-tight > div:first-child { color: var(--sb-fg); }
html[data-sidebar-custom] #sidebar .leading-tight > div:last-child,
html[data-sidebar-custom] #sidebar .nav-group-toggle span,
html[data-sidebar-custom] #sidebar .nav-group-chevron { color: var(--sb-fg-muted); }
html[data-sidebar-custom] #sidebar a { color: var(--sb-fg-muted); }
html[data-sidebar-custom] #sidebar a:not(.bg-brand-50):hover {
    background-color: var(--sb-hover-bg);
    color: var(--sb-fg);
}
html[data-sidebar-custom] #sidebar a.bg-brand-50 {
    background-color: var(--sb-active-bg);
    color: var(--sb-fg);
}

/* ------------------------------------ Topbar background (mobile = page bg) */
/* On mobile the topbar blends into the page gradient; on desktop it gets the
   frosted-glass treatment so content scrolling underneath stays readable. */
.app-topbar {
    background: linear-gradient(155deg, #efe8d8 0%, #e5dac2 42%, #cfc09f 78%, #bfae8b 100%) fixed;
}
@media (min-width: 1024px) {
    .app-topbar {
        background: rgb(255 255 255 / 0.9);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
    }
}

/* ------------------------------------------------ Desktop sidebar collapse */
/* PC only — hide the sidebar and widen the content. Mobile (< lg) is untouched:
   it keeps the slide-in overlay toggle, so this class has no effect there. */
.app-main { transition: padding-left .2s ease; }
@media (min-width: 1024px) {
    html.sidebar-collapsed #sidebar { transform: translateX(-100%); }
    html.sidebar-collapsed .app-main { padding-left: 0; }
}

/* --------------------------------------------------------- Page fade-in */
/* Content fades/slides in on every page load. Respects reduced-motion. */
@media (prefers-reduced-motion: no-preference) {
    .app-main > main { animation: page-fade .35s ease both; }
}
@keyframes page-fade {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: none; }
}

/* ------------------------------------------------------------------ Print */
@media print {
    .no-print, #sidebar, header.sticky, footer { display: none !important; }
    .dataTables_filter, .dataTables_info, .dataTables_paginate, .dataTables_length { display: none !important; }
    body { background: #fff !important; color: #000 !important; }
    .lg\:pl-64 { padding-left: 0 !important; }
    .print-area { box-shadow: none !important; border: none !important; }
    main { padding: 0 !important; }
}

/* ----------------------------------------------- Rendered markdown (.md-body)
   Blogger-style typography for portfolio post bodies. This is raw HTML output
   from Parsedown (sanitized server-side). */
.md-body { font-size: 1.05rem; line-height: 1.8; color: #1f2937; word-wrap: break-word; }
.md-body > :first-child { margin-top: 0; }
.md-body h1 { font-size: 1.75rem; font-weight: 700; margin: 2rem 0 .8rem; color: #0f172a; }
.md-body h2 { font-size: 1.5rem; font-weight: 700; margin: 2rem 0 .8rem; color: #0f172a; }
.md-body h3 { font-size: 1.2rem; font-weight: 700; margin: 1.6rem 0 .6rem; color: #0f172a; }
.md-body h4 { font-size: 1.05rem; font-weight: 700; margin: 1.2rem 0 .5rem; color: #0f172a; }
.md-body p  { margin: 0 0 1rem; }
.md-body ul, .md-body ol { margin: 0 0 1rem 1.4rem; }
.md-body ul { list-style: disc; }
.md-body ol { list-style: decimal; }
.md-body li { margin: .25rem 0; }
.md-body blockquote {
    border-left: 4px solid #1e5b37; background: #eef5ef; color: #184a2e;
    padding: .6rem 1rem; border-radius: .5rem; margin: 0 0 1rem;
}
.md-body a { color: #1e5b37; text-decoration: underline; }
.md-body a:hover { color: #184a2e; }
.md-body code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em;
    background: #f1f5f9; padding: .12rem .4rem; border-radius: .35rem;
}
.md-body pre { background: #0f172a; color: #e2e8f0; padding: 1rem; border-radius: .65rem; overflow-x: auto; margin: 0 0 1rem; }
.md-body pre code { background: none; padding: 0; color: inherit; font-size: .85rem; }
.md-body img { max-width: 100%; height: auto; border-radius: .65rem; margin: 0 0 1rem; }
/* Inline video players (YouTube/Vimeo iframe or direct <video>) — responsive 16:9 */
.md-body .md-embed { position: relative; width: 100%; aspect-ratio: 16 / 9; margin: 0 0 1.25rem; border-radius: .65rem; overflow: hidden; background: #000; }
.md-body .md-embed iframe, .md-body .md-embed video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.md-body .md-embed-video video { object-fit: contain; }
.md-body hr { border: 0; border-top: 1px solid #e2e8f0; margin: 1.5rem 0; }
.md-body table { width: 100%; border-collapse: collapse; margin: 0 0 1rem; }
.md-body th, .md-body td { border: 1px solid #e2e8f0; padding: .5rem .7rem; text-align: left; }
.md-body th { background: #f8fafc; font-weight: 600; }


/* ------------------------------------------- EasyMDE editor (pro post form)
   Fit the vendored editor into the app's input/card look. */
.EasyMDEContainer { max-width: 100%; }
.EasyMDEContainer .editor-toolbar { border-color: #e2e8f0; background: #f8fafc; border-radius: .65rem .65rem 0 0; }
.EasyMDEContainer .CodeMirror { border-color: #e2e8f0; border-radius: 0 0 .65rem .65rem; background: #fff; color: #0f172a; }
.EasyMDEContainer .editor-preview { background: #fff; padding: 1rem; }

/* ------------------------------------------------------- Corner status ribbon
   Folded-paper ribbon pinned to a card's top-right corner (bay picker: busy /
   inactive). The outer box clips to a small square so the rotated strip reads
   as "wrapping" the corner; the ::before/::after triangles are a darker shade
   of the same colour to fake the paper fold where the strip exits the square. */
.corner-ribbon { position: absolute; top: -2px; right: -2px; width: 90px; height: 90px; overflow: hidden; z-index: 10; pointer-events: none; }
.corner-ribbon::before, .corner-ribbon::after { position: absolute; z-index: -1; content: ""; display: block; border: 3px solid; }
.corner-ribbon::before { top: 0; left: 3px; }
.corner-ribbon::after  { bottom: 3px; right: 0; }
.corner-ribbon span {
    position: absolute; display: block; width: 130px; padding: 8px 0; left: -15px; top: 18px;
    transform: rotate(45deg); text-align: center; font-size: 11px; font-weight: 700; line-height: 1.2;
    color: #fff; box-shadow: 0 3px 6px rgba(15, 23, 42, .25); text-shadow: 0 1px 1px rgba(0, 0, 0, .15);
}
.corner-ribbon.is-inactive::before, .corner-ribbon.is-inactive::after { border-color: #475569; }
.corner-ribbon.is-inactive span { background: #64748b; }
.corner-ribbon.is-busy::before, .corner-ribbon.is-busy::after { border-color: #b45309; }
.corner-ribbon.is-busy span { background: #d97706; }
.corner-ribbon.is-free::before, .corner-ribbon.is-free::after { border-color: #047857; }
.corner-ribbon.is-free span { background: #059669; }

/* ------------------------------------------------ Icon picker (menu manager)
   A radio group rendered as selectable tiles. Written by hand because the
   pre-built tailwind.css ships only the utilities already used in the app —
   peer-checked/sr-only aren't in it. */
.icon-pick { display: inline-flex; cursor: pointer; }
.icon-pick input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.icon-pick > span {
    display: flex; align-items: center; justify-content: center;
    width: 2.75rem; height: 2.75rem; border-radius: .5rem;
    border: 1px solid #e2e8f0; color: #64748b; transition: all .15s ease;
}
.icon-pick > span svg { width: 1.25rem; height: 1.25rem; }
.icon-pick:hover > span { border-color: #cbd5e1; color: #334155; }
.icon-pick input:checked + span { border-color: #1e5b37; background: #eef5ef; color: #184a2e; }
.icon-pick input:focus-visible + span { outline: 2px solid #1e5b37; outline-offset: 2px; }

/* ------------------------------------- Helper link parked on a field's label row
   ("ลืมรหัสผ่าน?" next to the password label). The link is written *after* the
   input in the DOM so keyboard tab order runs field → field; this pins it back
   to the right end of the label line. Needs a positioned wrapper (.relative).
   line-height matches the .label line box so the smaller text sits centred. */
.label-link { position: absolute; right: 0; top: 0; line-height: 1.2rem; }

/* --------------------------------------------- Promo banner bounce (my_dashboard)
   The "คอร์สพิเศษ" strip nudges itself every few seconds so it reads as the one
   thing on the page asking to be clicked. Most of the cycle is idle — the hop
   only occupies the last ~25% — and hovering parks it so the link stays an easy
   target. Motion is dropped entirely under prefers-reduced-motion. */
.promo-bounce { will-change: transform; }
.promo-bounce:hover { animation-play-state: paused; }
.promo-bounce:hover .promo-arrow { animation-play-state: paused; }

@media (prefers-reduced-motion: no-preference) {
    .promo-bounce { animation: promo-bounce 2.8s cubic-bezier(.28, .84, .42, 1) infinite; }
    .promo-arrow  { display: inline-block; animation: promo-arrow 2.8s ease-in-out infinite; }
}

@keyframes promo-bounce {
    0%, 74%, 100% { transform: translateY(0)     scale(1); }
    80%           { transform: translateY(-6px)  scale(1.012); }
    86%           { transform: translateY(0)     scale(1); }
    91%           { transform: translateY(-2.5px) scale(1.004); }
    96%           { transform: translateY(0)     scale(1); }
}
@keyframes promo-arrow {
    0%, 74%, 100% { transform: translateX(0); }
    82%           { transform: translateX(4px); }
    92%           { transform: translateX(0); }
}

/* ------------------------------------------------- Segmented tab switcher
   Pill switch used to flip between content sets on one page (shop: private vs
   group courses). Hand-written for the same reason as .icon-pick above — the
   pre-built tailwind.css only ships utilities already used in the app. */
.seg {
    display: inline-flex; gap: .25rem; padding: .3rem;
    background: #fff; border: 1px solid #e8edf2; border-radius: 1rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}
.seg-btn {
    display: inline-flex; align-items: center; gap: .45rem;
    border: 0; background: transparent; cursor: pointer;
    padding: .55rem 1.5rem; border-radius: .8rem; white-space: nowrap;
    font-size: .875rem; font-weight: 700; letter-spacing: .04em;
    color: var(--ink-700); transition: background .15s, color .15s;
}
.seg-btn:hover { background: #f7f2e8; }
.seg-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.seg-btn[aria-selected="true"] { background: #e7d1a5; color: var(--ink-700); }
.seg-count { font-size: .75rem; font-weight: 600; opacity: .65; }
.seg-count.is-pop { display: inline-block; }
/* Narrow screens: scroll the switch instead of squeezing its tabs. Four Thai
   labels plus their counts (my_bookings) can't share 375px legibly. */
@media (max-width: 640px) {
    .seg {
        width: 100%; flex-wrap: nowrap; overflow-x: auto;
        scrollbar-width: none; -webkit-overflow-scrolling: touch;
    }
    .seg::-webkit-scrollbar { display: none; }
    .seg-btn { flex: 0 0 auto; justify-content: center; padding-left: .9rem; padding-right: .9rem; }
}

/* =============================================== Shop / buy page (customer)
   The buy page is the one screen that has to *sell* something, so it gets a
   slower, more deliberate motion language than the rest of the app: a
   staggered entrance, a gold hairline that draws itself across the top edge on
   hover, one sheen pass over the card, and a seat meter that fills itself.

   Rules of the block: every animation moves transform/opacity only (plus the
   one width keyframe on the seat meter, which is 6px tall), nothing loops fast
   enough to nag, and the whole thing is inert under prefers-reduced-motion —
   the final/resting state of every element is the plain non-animated CSS, so
   dropping the motion never hides content. Hand-written for the same reason as
   .seg above: the pre-built tailwind.css only ships utilities already in use. */

/* Sort chips under the type tabs. Toggle buttons, not a <select>: one tap, and
   the pressed one stays visible so the current order is never a mystery. */
.sortbar { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin: -.6rem 0 1.15rem; }
.sortbar-label {
    margin-right: .2rem; font-size: .7rem; font-weight: 600;
    letter-spacing: .07em; text-transform: uppercase; color: var(--ink-400);
}
.sort-chip, .sort-clear {
    display: inline-flex; align-items: center; gap: .35rem;
    padding: .35rem .75rem; border-radius: 999px; cursor: pointer;
    font-size: .76rem; font-weight: 600; white-space: nowrap;
    background: #fff; border: 1px solid #ece4d5; color: var(--ink-600);
    transition: transform .25s cubic-bezier(.22, .8, .28, 1), background .2s ease,
                border-color .2s ease, box-shadow .25s ease, color .2s ease;
}
.sort-chip:hover, .sort-clear:not([disabled]):hover {
    transform: translateY(-2px); border-color: #e7d1a5;
    box-shadow: 0 8px 16px -10px rgba(18, 51, 31, .45);
}
.sort-chip:focus-visible, .sort-clear:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.sort-chip[aria-pressed="true"] {
    background: linear-gradient(120deg, #f2e6cc, #dcbd7e);
    border-color: #c39f5c; color: #43310f;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5);
}
.sort-clear { border-style: dashed; color: var(--ink-500); }
.sort-clear[disabled] { opacity: .45; cursor: not-allowed; }

/* Section heading above a panel's grid. Earns its keep on the "ทั้งหมด" tab,
   where two panels stack and each has to say what it is. */
.shop-section {
    display: flex; align-items: center; gap: .55rem;
    margin: 0 0 .9rem; font-size: .78rem; font-weight: 700;
    letter-spacing: .09em; text-transform: uppercase; color: var(--ink-500);
}
.shop-section::after { content: ''; flex: 1 1 auto; height: 1px; background: linear-gradient(90deg, #dcbd7e, rgba(220, 189, 126, 0)); }
.shop-lead { margin: -.35rem 0 1rem; font-size: .85rem; color: var(--ink-500); }
.shop-panel + .shop-panel { margin-top: 1.9rem; }

/* Own grid so the entrance stagger reads left-to-right at every width. */
.shop-grid { display: grid; gap: 1.15rem; grid-template-columns: 1fr; align-items: stretch; }
@media (min-width: 768px)  { .shop-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1280px) { .shop-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* The wrapper carries the entrance animation and the card carries the hover
   motion — an animation's fill state would otherwise outrank :hover's
   transform and the card would refuse to lift. */
.shop-reveal { display: flex; }
.shop-reveal > .shop-card { flex: 1 1 auto; }
/* app.css loads after tailwind.css, so the utility's display:none would lose to
   the rule above on source order — restate it for the search filter. */
.shop-reveal.hidden { display: none; }

.shop-card {
    position: relative; overflow: hidden; display: flex; flex-direction: column;
    transition: transform .45s cubic-bezier(.22, .8, .28, 1),
                box-shadow .45s cubic-bezier(.22, .8, .28, 1),
                border-color .3s ease;
}
/* Lift on hover only — :focus-within would jog the card while the customer is
   tabbing through its own form fields. The hairline still answers focus. */
.shop-card:hover {
    transform: translateY(-5px); border-color: #e7d1a5;
    box-shadow: 0 22px 45px -22px rgba(18, 51, 31, .35), 0 2px 6px rgba(18, 51, 31, .06);
}
/* Gold hairline, drawn left → right on hover. */
.shop-card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; z-index: 1;
    background: linear-gradient(90deg, var(--gold-dark), #f3e3c1 45%, var(--gold));
    transform: scaleX(0); transform-origin: left center;
    transition: transform .55s cubic-bezier(.22, .8, .28, 1);
}
.shop-card:hover::before, .shop-card:focus-within::before { transform: scaleX(1); }
/* Sheen band — parked off-card and swept across once per hover. */
.shop-card::after, .btn-shine::after {
    content: ''; position: absolute; top: -25%; bottom: -25%; left: -45%; width: 35%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .7), transparent);
    transform: skewX(-16deg); opacity: 0; pointer-events: none;
}
.shop-card.is-special { border-color: #dcbd7e; box-shadow: 0 10px 30px -18px rgba(169, 126, 56, .5); }
.shop-card.is-group   { border-left: 3px solid #7db08e; }
.shop-card.is-next    { border-left: 3px solid var(--gold); }   /* booking still ahead */
.shop-card.is-off     { opacity: .72; }                          /* cancelled / no-show */
.shop-card.is-off:hover { opacity: 1; }

/* Cover image on a card that has no padding of its own (portfolios). */
.shop-cover {
    display: block; overflow: hidden; aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, #eef5ef, #f2e6cc);
}
.shop-cover img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .7s cubic-bezier(.22, .8, .28, 1); }
.shop-card:hover .shop-cover img { transform: scale(1.06); }
.shop-cover-empty { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; color: #aecdb9; }
.shop-cover-empty svg { width: 3rem; height: 3rem; }
.shop-body { padding: 1.15rem 1.25rem 1.25rem; display: flex; flex-direction: column; flex: 1 1 auto; }
.shop-excerpt { margin-top: .4rem; font-size: .85rem; color: var(--ink-500); flex: 1 1 auto; }
.shop-byline {
    margin-top: .9rem; padding-top: .8rem; border-top: 1px solid #f0e9db;
    display: flex; align-items: center; gap: .5rem; font-size: .8rem; color: var(--ink-500);
}
.shop-byline a { color: inherit; text-decoration: none; transition: color .2s ease; }
.shop-byline a:hover, .shop-title a:hover { color: var(--ink-800); }
.shop-title a { color: inherit; text-decoration: none; }

/* Card typography */
.shop-eyebrow { font-size: .7rem; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-400); }
.shop-title   { margin-top: .35rem; font-size: 1.0625rem; font-weight: 700; line-height: 1.35; color: var(--ink-900); }
.shop-when    { margin-top: .3rem; font-size: .8rem; color: var(--ink-600); }
.shop-price   { font-size: 1.75rem; font-weight: 800; line-height: 1.1; letter-spacing: -.02em; color: var(--ink-700); font-variant-numeric: tabular-nums; }
.shop-unit    { font-size: .8rem; color: var(--ink-400); }
.shop-meta    { margin-top: .15rem; font-size: .72rem; color: var(--ink-400); }

/* "คอร์สพิเศษ" pill — gold plate with a slow, occasional glint. */
.shop-badge {
    position: relative; overflow: hidden; flex: none;
    display: inline-flex; align-items: center; gap: .25rem;
    padding: .18rem .55rem; border-radius: 999px;
    font-size: .68rem; font-weight: 700; letter-spacing: .02em; color: #5c4318;
    background: linear-gradient(120deg, #f2e6cc, #dcbd7e);
    box-shadow: 0 1px 2px rgba(110, 81, 36, .3);
}
.shop-badge::after {
    content: ''; position: absolute; top: 0; bottom: 0; left: 0; width: 45%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .9), transparent);
    transform: translateX(-140%);
}

/* Social proof — "เรียนคอร์สนี้แล้ว N คน" as a gold ribbon.
   The negative left margin equals .card-p's padding, so the banner runs out to
   the card's own edge and the card's overflow:hidden trims it flush — that flush
   cut is what makes it read as a ribbon rather than a chip. The right end is
   notched with clip-path (which also clips any outer box-shadow, hence the inset
   highlight/shade doing the lift instead). Hidden at zero learners (shop.php). */
.shop-ribbon {
    position: relative; align-self: flex-start; overflow: hidden;
    margin: .7rem 0 .1rem -1.25rem;
    padding: .32rem 1.5rem .32rem 1.25rem;
    display: inline-flex; align-items: center; gap: .4rem;
    font-size: .74rem; font-weight: 700; color: #43310f; white-space: nowrap;
    background: linear-gradient(100deg, #a97e38 0%, #d3b276 30%, #f4e8cd 52%, #d3b276 74%, #c39f5c 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), inset 0 -1px 0 rgba(110, 81, 36, .35);
    clip-path: polygon(0 0, 100% 0, calc(100% - .6rem) 50%, 100% 100%, 0 100%);
}
.shop-ribbon b { font-weight: 800; font-size: .82rem; font-variant-numeric: tabular-nums; }
.shop-ribbon svg { flex: none; width: .9rem; height: .9rem; opacity: .8; }
/* Glint band, parked off-ribbon between passes. */
.shop-ribbon::after {
    content: ''; position: absolute; top: 0; bottom: 0; left: 0; width: 40%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .85), transparent);
    transform: translateX(-140%); pointer-events: none;
}

/* Payment-channel chips + their frame */
.shop-paybox { border-radius: .8rem; padding: .6rem .7rem; background: linear-gradient(135deg, #f7f2e8, #f0e9db); border: 1px solid #ece4d5; }
.shop-chipline { display: flex; flex-wrap: wrap; gap: .4rem; }
.pay-chip {
    display: inline-flex; align-items: center; gap: .35rem;
    padding: .3rem .55rem; border-radius: .6rem; background: #fff; border: 1px solid #f0e9db;
    font-size: .72rem; font-weight: 600; color: var(--ink-600);
    transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.pay-chip:hover { transform: translateY(-2px); border-color: #e7d1a5; box-shadow: 0 6px 14px -8px rgba(18, 51, 31, .4); }
.shop-note { margin-top: .45rem; font-size: .72rem; color: var(--ink-500); }
.shop-warn { border-radius: .8rem; padding: .6rem .7rem; background: #fdf6e7; border: 1px solid #f0dfba; font-size: .8rem; color: #87642c; }

/* Seat meter (group classes) */
.shop-seatrow { margin-top: .5rem; display: flex; align-items: center; gap: .6rem; }
.shop-seat { flex: 1 1 auto; height: 6px; border-radius: 999px; background: #efe8d8; overflow: hidden; }
.shop-seat > i { display: block; height: 100%; width: var(--w, 0%); border-radius: 999px; background: linear-gradient(90deg, #4d9066, #1e5b37); }
.shop-seat.is-low > i { background: linear-gradient(90deg, #dcbd7e, #c9974a); }
.shop-seatnum { flex: none; font-size: .72rem; font-weight: 600; color: var(--ink-500); font-variant-numeric: tabular-nums; }
.shop-seatnum.is-low { color: #a97e38; }

/* Status pills (my_courses). Palette-native replacements for the slate/violet
   tailwind pills these cards used to carry. */
.shop-pill {
    display: inline-flex; align-items: center; gap: .3rem; white-space: nowrap;
    padding: .18rem .6rem; border-radius: 999px; font-size: .68rem; font-weight: 700;
}
.shop-pill.is-done  { background: #d6e7dc; color: #123922; }
.shop-pill.is-live  { background: #eef5ef; color: #1e5b37; }
.shop-pill.is-wait  { background: #f2e6cc; color: #87642c; }
.shop-pill.is-group { background: #e4efe8; color: #2f7449; }

/* Secondary detail block inside a card (class date/time, notes). */
.shop-infobox {
    margin-top: .7rem; padding: .6rem .7rem; border-radius: .8rem;
    background: linear-gradient(135deg, #f7f2e8, #f0e9db); border: 1px solid #ece4d5;
    font-size: .8rem; color: var(--ink-600);
}
.shop-alert { margin-top: .35rem; font-weight: 600; color: #b91c1c; }

/* Buy form pinned to the bottom so cards of unequal height still line up. */
.shop-form { margin-top: auto; padding-top: .9rem; border-top: 1px solid #f0e9db; display: grid; gap: .5rem; }
/* Same idea for a row of action buttons instead of a form. */
.shop-actions {
    margin-top: auto; padding-top: .9rem; border-top: 1px solid #f0e9db;
    display: flex; flex-wrap: wrap; gap: .5rem;
}
.shop-consent { display: flex; align-items: flex-start; gap: .5rem; font-size: .72rem; color: var(--ink-500); }
.shop-consent input { margin-top: .15rem; flex: none; }

/* "โหลดเพิ่ม" footer under a folded grid. Same source-order caveat as
   .shop-reveal.hidden above — the display rule has to be undone explicitly. */
.shop-more { display: flex; justify-content: center; margin-top: 1.15rem; }
.shop-more.hidden { display: none; }
.shop-more > .btn { min-width: 13rem; border-color: #e7d1a5; }
.shop-more > .btn:hover { background: #faf5ea; }

/* Points banner — the one permanently animated element on the page. */
.shop-points {
    position: relative; overflow: hidden;
    background: linear-gradient(135deg, #faf5ea 0%, #f2e6cc 55%, #e7d1a5 100%);
    border-color: #e7d1a5;
}
.shop-points::after {
    content: ''; position: absolute; top: -30%; bottom: -30%; left: -30%; width: 30%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .75), transparent);
    transform: skewX(-14deg); opacity: 0; pointer-events: none;
}
.shop-points-icon { font-size: 1.6rem; line-height: 1; display: inline-block; }

/* Search field with a leading icon (no Tailwind icon utilities in the build). */
.input-icon { position: relative; }
.input-icon > svg { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); width: 1rem; height: 1rem; color: var(--ink-400); pointer-events: none; }
.input-icon > .input { padding-left: 2.1rem; }

/* Shine sweep for a CTA; pairs with .btn. */
.btn-shine { position: relative; overflow: hidden; }
.btn-shine:active { transform: translateY(1px); }

@media (prefers-reduced-motion: no-preference) {
    .shop-reveal        { animation: shop-rise .62s cubic-bezier(.22, .8, .28, 1) both; animation-delay: calc(var(--i, 0) * 60ms); }
    .shop-panel         { animation: shop-panel .34s ease both; }
    .shop-card:hover::after { animation: shop-sheen 1.05s cubic-bezier(.3, .6, .3, 1); }
    .btn-shine:hover::after { animation: shop-sheen .85s ease; }
    .shop-badge::after  { animation: shop-glint 4.2s ease-in-out infinite; }
    /* Offset from the badge's cycle so the two gold surfaces never glint together. */
    .shop-ribbon::after { animation: shop-glint 5.6s ease-in-out 1.4s infinite; }
    .shop-points::after { animation: shop-points-sheen 7s ease-in-out infinite; }
    .shop-points-icon   { animation: shop-float 4.2s ease-in-out infinite; }
    .shop-seat > i      { animation: shop-seat-fill 1s cubic-bezier(.22, .8, .28, 1) both; animation-delay: calc(var(--i, 0) * 60ms + .25s); }
    .seg-count.is-pop   { animation: shop-count-pop .3s cubic-bezier(.22, .8, .28, 1); }
}

@keyframes shop-rise      { from { opacity: 0; transform: translateY(16px) scale(.99); } to { opacity: 1; transform: none; } }
@keyframes shop-panel     { from { opacity: 0; transform: translateY(6px); }            to { opacity: 1; transform: none; } }
@keyframes shop-sheen     { from { opacity: .95; transform: skewX(-16deg) translateX(0); } to { opacity: 0; transform: skewX(-16deg) translateX(520%); } }
@keyframes shop-glint     { 0%, 62%, 100% { transform: translateX(-140%); } 80% { transform: translateX(160%); } }
/* Same sweep as shop-sheen, but idle for the first half of the cycle so the
   banner glints now and then instead of having a light permanently crawling. */
@keyframes shop-points-sheen {
    0%, 55%   { transform: skewX(-14deg) translateX(0);    opacity: 0; }
    58%       { opacity: .8; }
    90%, 100% { transform: skewX(-14deg) translateX(520%); opacity: 0; }
}
@keyframes shop-float     { 0%, 100% { transform: translateY(0) rotate(-5deg); } 50% { transform: translateY(-4px) rotate(5deg); } }
@keyframes shop-seat-fill { from { width: 0; } to { width: var(--w, 0%); } }
@keyframes shop-count-pop { from { transform: scale(.65); opacity: .35; } to { transform: none; opacity: .65; } }

/* ==================================================== Green text tone (SPAZE)
   Page copy reads in the brand green ramp (--ink-*) instead of slate, matching
   the SPAZE mockup. Deliberately NOT applied to the sidebar (#sidebar) or the
   topbar (.app-topbar) — those keep the slate chrome, so every rule here is
   undone for their subtrees at the end of the section.

   This block sits last on purpose: app.css loads after the pre-built
   tailwind.css, so these plain (non-!important) rules outrank the .text-slate-*
   utilities by source order, while the #sidebar / .app-topbar restores outrank
   these by specificity. Keep it at the bottom of the file. */

/* Base copy colour (body carries .text-slate-700 from header.php). */
body { color: var(--ink-700); }

/* Tailwind neutral text utilities → green ramp. */
.text-slate-900, .text-gray-900 { color: var(--ink-900); }
.text-slate-800, .text-gray-800 { color: var(--ink-800); }
.text-slate-700, .text-gray-700 { color: var(--ink-700); }
.text-slate-600, .text-gray-600 { color: var(--ink-600); }
.text-slate-500, .text-gray-500 { color: var(--ink-500); }
.text-slate-400, .text-gray-400 { color: var(--ink-400); }
.text-slate-300, .text-gray-300 { color: var(--ink-300); }
.hover\:text-slate-900:hover { color: var(--ink-900); }

/* Component text colours defined earlier in this file. */
.label                       { color: var(--ink-600); }
.form-hint                   { color: var(--ink-400); }
.input, .select, .textarea   { color: var(--ink-900); }
.input[readonly], .input:disabled { color: var(--ink-500); }
.input::placeholder          { color: var(--ink-400); }
.btn-secondary               { color: var(--ink-700); }
.btn-ghost                   { color: var(--ink-600); }
.table thead th              { color: var(--ink-500); }
.table tbody td              { color: var(--ink-700); }
.table tfoot td              { color: var(--ink-900); }
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_filter { color: var(--ink-500); }
.dataTables_wrapper .dataTables_paginate .paginate_button:hover { color: var(--ink-900) !important; }
.select2-container--default .select2-selection--single .select2-selection__rendered { color: var(--ink-900); }
.icon-pick > span            { color: var(--ink-500); }
.icon-pick:hover > span      { color: var(--ink-700); }
.md-body                     { color: var(--ink-700); }
.md-body h1, .md-body h2, .md-body h3, .md-body h4 { color: var(--ink-900); }
.EasyMDEContainer .CodeMirror { color: var(--ink-900); }

/* SweetAlert2 dialogs (rendered on <body>, i.e. page content, not chrome). */
.swal2-popup .swal2-title          { color: var(--ink-800); }
.swal2-popup .swal2-html-container { color: var(--ink-600); }

/* ---- Chrome exclusions: sidebar + topbar keep the original slate palette ---- */
#sidebar, .app-topbar { color: #334155; }
#sidebar .text-slate-900, .app-topbar .text-slate-900 { color: #0f172a; }
#sidebar .text-slate-800, .app-topbar .text-slate-800 { color: #1e293b; }
#sidebar .text-slate-700, .app-topbar .text-slate-700 { color: #334155; }
#sidebar .text-slate-600, .app-topbar .text-slate-600 { color: #475569; }
#sidebar .text-slate-500, .app-topbar .text-slate-500 { color: #64748b; }
#sidebar .text-slate-400, .app-topbar .text-slate-400 { color: #94a3b8; }
#sidebar .text-slate-300, .app-topbar .text-slate-300 { color: #cbd5e1; }
#sidebar .hover\:text-slate-900:hover,
.app-topbar .hover\:text-slate-900:hover { color: #0f172a; }
#sidebar .btn-secondary, .app-topbar .btn-secondary { color: #334155; }
#sidebar .btn-ghost, .app-topbar .btn-ghost { color: #475569; }
