/* ==========================================================================
   Haircut Tracker - shared styles (entry kiosk + admin)

   Dark shop theme: near-black surfaces, gold brand accent for identity and
   selection, green reserved for the money action. Dark-only on purpose - the
   entry page lives on a shop tablet and should look the same on every device.
   ========================================================================== */

:root {
    color-scheme: dark;

    --paper:       #0a0a0a;   /* page */
    --card:        #151515;   /* panels, cards */
    --card-2:      #1c1c1c;   /* inputs, keys, raised bits */
    --card-3:      #232323;   /* hover */
    --line:        #292927;   /* hairlines */
    --line-strong: #3a3a37;   /* button borders */

    --ink:        #f4f2ee;
    --ink-soft:   #bab6ae;
    --ink-faint:  #8b8782;

    --gold:       #d9ab55;
    --gold-lift:  #e6bf72;
    --gold-deep:  #8a6a2c;
    --gold-tint:  rgba(217, 171, 85, .12);

    --go:         #10a172;   /* submit / confirm */
    --go-lift:    #15b782;
    --go-tint:    rgba(16, 161, 114, .14);

    --danger:      #e05a6b;
    --danger-tint: rgba(224, 90, 107, .13);

    --radius: 14px;
    --shadow: 0 18px 40px rgba(0, 0, 0, .45);

    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-display: "Didot", "Playfair Display", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }

/* Must win over the display rules further down this file. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    color: var(--ink);
    background: var(--paper);
    line-height: 1.45;
}

h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.01em; }

a { color: var(--gold); }

::selection { background: var(--gold); color: #0a0a0a; }

/* --------------------------------------------------------------------------
   Brand lockup (logo image, or a text fallback)
   -------------------------------------------------------------------------- */

.brand { display: flex; align-items: center; min-width: 0; }

.brand__logo {
    display: block;
    height: var(--logo-h, 46px);   /* set from LOGO_HEIGHT in config.php */
    width: auto;
    max-width: min(320px, 46vw);
    object-fit: contain;
}

.brand__text { display: block; line-height: 1; }

.brand__name {
    display: block;
    font-family: var(--font-display);
    font-size: 1.65rem;
    font-weight: 700;
    letter-spacing: .04em;
    color: var(--gold);
}

.brand__sub {
    display: block;
    margin-top: .25rem;
    font-size: .6rem;
    font-weight: 600;
    letter-spacing: .34em;
    color: var(--ink-soft);
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    min-height: 48px;
    padding: 0 1.25rem;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    background: var(--card-2);
    color: var(--ink);
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background .12s ease, border-color .12s ease, transform .06s ease;
    -webkit-tap-highlight-color: transparent;
}

.btn:hover { background: var(--card-3); border-color: #4a4a45; }
.btn:active { transform: translateY(1px); }

.btn:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}

/* Gold: brand-level actions (admin save/update, log in). */
.btn--primary {
    background: linear-gradient(180deg, var(--gold-lift), var(--gold));
    border-color: var(--gold);
    color: #14100a;
}
.btn--primary:hover {
    background: linear-gradient(180deg, #f0cd85, var(--gold-lift));
    border-color: var(--gold-lift);
}

/* Green: the money action, as on the mockup's Charge button. */
.btn--go {
    background: var(--go);
    border-color: var(--go);
    color: #fff;
}
.btn--go:hover { background: var(--go-lift); border-color: var(--go-lift); }

.btn--ghost { background: transparent; color: var(--ink-soft); }
.btn--ghost:hover { background: var(--card-2); color: var(--ink); }

.btn--danger {
    color: var(--danger);
    border-color: rgba(224, 90, 107, .38);
    background: var(--danger-tint);
}
.btn--danger:hover { background: rgba(224, 90, 107, .2); border-color: var(--danger); }

/* Selected state for a group of choices (e.g. the report date presets). */
.btn--on {
    background: var(--gold-tint);
    border-color: var(--gold);
    color: var(--gold-lift);
}
.btn--on:hover { background: rgba(217, 171, 85, .2); border-color: var(--gold-lift); }

.btn--tiny { min-height: 32px; padding: 0 .7rem; font-size: .8rem; border-radius: 8px; }

.btn[disabled] { opacity: .5; cursor: default; }

/* --------------------------------------------------------------------------
   Toasts (top right)
   -------------------------------------------------------------------------- */

.toast-stack {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 60;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    max-width: min(24rem, calc(100vw - 2rem));
}

.toast {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .85rem 1rem;
    border-radius: 12px;
    background: var(--card-2);
    border: 1px solid var(--line-strong);
    box-shadow: var(--shadow);
    font-weight: 600;
    animation: toast-in .22s ease-out;
}

.toast.is-leaving { animation: toast-out .25s ease-in forwards; }

.toast__icon {
    flex: none;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: .95rem;
    color: #fff;
    background: var(--ink-faint);
}

.toast--success { border-color: rgba(16, 161, 114, .5); }
.toast--success .toast__icon { background: var(--go); }
.toast--error { border-color: rgba(224, 90, 107, .5); }
.toast--error .toast__icon { background: var(--danger); }

.toast__text { flex: 1; }

.toast__close {
    flex: none;
    border: 0;
    background: none;
    color: var(--ink-faint);
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 .1rem;
}
.toast__close:hover { color: var(--ink); }

@keyframes toast-in {
    from { opacity: 0; transform: translateX(16px) scale(.98); }
    to   { opacity: 1; transform: none; }
}
@keyframes toast-out {
    to { opacity: 0; transform: translateX(16px); }
}

/* --------------------------------------------------------------------------
   Entry page
   -------------------------------------------------------------------------- */

.entry-page main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.25rem 1.25rem 2rem;
}

.entry-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .9rem 1.25rem;
    background: #000;
    border-bottom: 1px solid var(--line);
}

.admin-link {
    color: var(--ink-soft);
    text-decoration: none;
    font-size: .85rem;
    font-weight: 600;
    letter-spacing: .02em;
    padding: .45rem .85rem;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
}
.admin-link:hover { color: var(--gold); border-color: var(--gold-deep); }

.panel {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-top: 1.25rem;
}

.panel__title {
    font-size: 1.1rem;
    font-weight: 650;
    color: var(--ink);
    margin-bottom: 1rem;
}

/* Barber tiles ------------------------------------------------------------ */

.barber-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
}

.barber-card {
    position: relative;
    display: block;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.barber-card__input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    pointer-events: none;
}

/* The border wraps photo + name, as one tile. */
.barber-card__body {
    display: block;
    border: 2px solid var(--line);
    border-radius: 12px;
    background: var(--card-2);
    overflow: hidden;
    transition: border-color .12s ease, transform .1s ease, background .12s ease;
}

.barber-card__media {
    position: relative;
    display: block;
    aspect-ratio: 1 / 1;
    background: #101010;
    overflow: hidden;
}

/* Fallback for browsers without aspect-ratio */
@supports not (aspect-ratio: 1 / 1) {
    .barber-card__media { height: 150px; }
}

.barber-card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.barber-card__initials {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-family: var(--font-display);
    font-size: 2.4rem;
    font-weight: 700;
    letter-spacing: .03em;
    color: #4d4a44;
}

.barber-card__check {
    position: absolute;
    top: .5rem;
    right: .5rem;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--gold);
    color: #14100a;
    display: grid;
    place-items: center;
    font-size: .95rem;
    font-weight: 700;
    opacity: 0;
    transform: scale(.6);
    transition: opacity .12s ease, transform .12s ease;
}

.barber-card__caption {
    display: block;
    padding: .6rem .5rem .7rem;
    text-align: center;
    font-weight: 600;
    font-size: 1rem;
    color: var(--ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.barber-card:hover .barber-card__body { border-color: #45443f; transform: translateY(-2px); }

.barber-card__input:checked ~ .barber-card__body {
    border-color: var(--gold);
    background: var(--gold-tint);
}
.barber-card__input:checked ~ .barber-card__body .barber-card__check {
    opacity: 1;
    transform: none;
}
.barber-card__input:checked ~ .barber-card__body .barber-card__caption { color: var(--gold-lift); }

.barber-card__input:focus-visible ~ .barber-card__body {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}

/* Amount + keypad --------------------------------------------------------- */

.amount-row { max-width: 380px; }

.amount-field {
    display: flex;
    align-items: center;
    gap: .5rem;
    border: 2px solid var(--line);
    border-radius: 12px;
    padding: .6rem 1rem;
    background: #101010;
}

.amount-field:focus-within {
    border-color: var(--gold);
    box-shadow: 0 0 0 4px var(--gold-tint);
}

.amount-field__symbol {
    font-size: 2rem;
    font-weight: 600;
    color: var(--gold);
}

.amount-field__input {
    flex: 1;
    min-width: 0;
    border: 0;
    background: none;
    font-family: var(--font);
    font-size: 2.6rem;
    font-weight: 650;
    letter-spacing: -.02em;
    color: var(--ink);
    padding: 0;
    width: 100%;
}
.amount-field__input:focus { outline: none; }
.amount-field__input::placeholder { color: #4a4842; }

.keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .6rem;
    margin-top: 1rem;
}

/* Shown only when JS detects a touch device (see entry.js) */
.keypad[aria-hidden="true"] { display: none; }

.keypad__key {
    min-height: 60px;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    background: var(--card-2);
    font: inherit;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--ink);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    transition: background .1s ease, border-color .1s ease;
}
.keypad__key:hover { background: var(--card-3); }
.keypad__key:active {
    background: var(--gold-tint);
    border-color: var(--gold);
    transform: translateY(1px);
}
.keypad__key--action { font-size: 1.25rem; color: var(--ink-soft); }

/* Actions ---------------------------------------------------------------- */

.entry-actions {
    display: flex;
    gap: .75rem;
    justify-content: flex-end;
    margin-top: 1.25rem;
}

.btn--submit {
    min-height: 62px;
    padding: 0 2.5rem;
    font-size: 1.15rem;
    border-radius: 12px;
    letter-spacing: .01em;
}

@media (max-width: 520px) {
    .entry-actions { flex-direction: column-reverse; }
    .entry-actions .btn { width: 100%; }
}

/* Footer tagline --------------------------------------------------------- */

.entry-footer {
    padding: 1.5rem 1.25rem 2.5rem;
    text-align: center;
}

.tagline {
    display: inline-flex;
    align-items: center;
    gap: 1rem;
    font-size: .7rem;
    font-weight: 600;
    letter-spacing: .3em;
    color: var(--gold);
    text-transform: uppercase;
}
.tagline::before,
.tagline::after {
    content: "";
    width: 40px;
    height: 1px;
    background: var(--gold-deep);
}

.idle-warning {
    position: fixed;
    left: 50%;
    bottom: 1.25rem;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .7rem 1rem;
    border-radius: 999px;
    background: var(--card-2);
    border: 1px solid var(--gold-deep);
    color: var(--ink);
    font-weight: 600;
    font-size: .9rem;
    box-shadow: var(--shadow);
    z-index: 50;
    white-space: nowrap;
}

.empty-state {
    max-width: 34rem;
    margin: 4rem auto;
    padding: 2rem;
    text-align: center;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.empty-state h2 { font-size: 1.3rem; margin-bottom: .5rem; }
.empty-state p { color: var(--ink-soft); margin: 0 0 1.25rem; }

/* --------------------------------------------------------------------------
   Admin
   -------------------------------------------------------------------------- */

.admin-topbar {
    background: #000;
    border-bottom: 1px solid var(--line);
}

.admin-topbar__inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: .8rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex-wrap: wrap;
}

.admin-topbar__brand {
    display: flex;
    align-items: center;
    text-decoration: none;
    margin-right: auto;
}
.admin-topbar__brand .brand__logo { height: calc(var(--logo-h, 46px) * .75); max-width: min(240px, 40vw); }
.admin-topbar__brand .brand__name { font-size: 1.2rem; }
.admin-topbar__brand .brand__sub { font-size: .5rem; letter-spacing: .3em; }

.admin-nav { display: flex; gap: .35rem; flex-wrap: wrap; }

.admin-nav a {
    color: var(--ink-soft);
    text-decoration: none;
    font-weight: 600;
    font-size: .9rem;
    padding: .45rem .8rem;
    border-radius: 8px;
    border: 1px solid transparent;
}
.admin-nav a:hover { background: var(--card-2); color: var(--ink); }
.admin-nav a.is-active {
    background: var(--gold-tint);
    border-color: var(--gold-deep);
    color: var(--gold-lift);
}

.admin-main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem 1.25rem 3rem;
}

.page-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}
.page-head h1 { font-size: 1.5rem; }
.page-head p { margin: .3rem 0 0; color: var(--ink-soft); font-size: .92rem; }

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

.card__title { font-size: 1.05rem; margin-bottom: 1rem; }

.notice {
    padding: .85rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--card);
    margin-bottom: 1.25rem;
    font-size: .92rem;
}
.notice--warn { background: var(--gold-tint); border-color: var(--gold-deep); color: #e8cf9a; }
.notice--error { background: var(--danger-tint); border-color: rgba(224, 90, 107, .45); color: #f0a3ad; }
.notice--ok { background: var(--go-tint); border-color: rgba(16, 161, 114, .45); color: #6fdcb4; }
.notice code {
    background: rgba(255, 255, 255, .08);
    padding: .1rem .3rem;
    border-radius: 4px;
    font-size: .95em;
}

/* Forms ------------------------------------------------------------------ */

.form-narrow { max-width: 620px; }

.field { margin-bottom: 1rem; }

.field label {
    display: block;
    font-weight: 600;
    font-size: .85rem;
    margin-bottom: .35rem;
}

.field__hint { color: var(--ink-faint); font-weight: 500; font-size: .8rem; }

.input,
input[type="text"].input,
input[type="password"].input,
input[type="number"].input,
input[type="date"].input,
input[type="file"].input,
textarea.input {
    width: 100%;
    min-height: 46px;
    padding: .55rem .75rem;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    background: #101010;
    font: inherit;
    color: var(--ink);
}
.input:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px var(--gold-tint);
}
.input::placeholder { color: #55524c; }
input[type="file"].input { padding: .5rem; cursor: pointer; }
input[type="file"].input::file-selector-button {
    margin-right: .75rem;
    padding: .45rem .85rem;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: var(--card-2);
    color: var(--ink);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
input[type="file"].input::file-selector-button:hover { background: var(--card-3); }

.form-row {
    display: flex;
    gap: .75rem;
    align-items: flex-end;
    flex-wrap: wrap;
}
.form-row .field { margin-bottom: 0; }

.checkbox {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-weight: 600;
    font-size: .9rem;
}
.checkbox input { width: 20px; height: 20px; accent-color: var(--gold); }

.form-actions { display: flex; gap: .6rem; margin-top: 1.25rem; flex-wrap: wrap; }

/* Tables ----------------------------------------------------------------- */

.table-wrap { overflow-x: auto; }

table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: .93rem;
}

table.data th, table.data td {
    text-align: left;
    padding: .7rem .6rem;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
    white-space: nowrap;
}

table.data th {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--ink-faint);
}

table.data tbody tr:hover td { background: rgba(255, 255, 255, .02); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tfoot td {
    font-weight: 700;
    border-top: 2px solid var(--line-strong);
    border-bottom: 0;
    color: var(--ink);
}
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
table.data .wrap { white-space: normal; }

.thumb {
    width: 46px;
    height: 46px;
    border-radius: 8px;
    object-fit: cover;
    display: block;
    background: #101010;
    border: 1px solid var(--line);
}
.thumb--initials {
    display: grid;
    place-items: center;
    font-family: var(--font-display);
    font-weight: 700;
    color: #55524c;
    font-size: .95rem;
}

.pill {
    display: inline-block;
    padding: .2rem .55rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .02em;
}
.pill--on { background: var(--go-tint); color: #6fdcb4; }
.pill--off { background: rgba(255, 255, 255, .07); color: var(--ink-faint); }

.row-actions { display: flex; gap: .4rem; justify-content: flex-end; }

.muted { color: var(--ink-faint); }

/* Reports ---------------------------------------------------------------- */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.stat {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1rem 1.1rem;
}
.stat__label {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--ink-faint);
    font-weight: 700;
}
.stat__value {
    font-size: 1.9rem;
    font-weight: 700;
    letter-spacing: -.02em;
    margin-top: .2rem;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}
.stat--money .stat__value { color: var(--gold-lift); }

.chart-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
}
@media (min-width: 900px) {
    .chart-grid { grid-template-columns: 1fr 1fr; }
}

.chart-box { position: relative; height: 320px; }

.range-presets { display: flex; gap: .4rem; flex-wrap: wrap; }

/* Login ------------------------------------------------------------------ */

.login-page {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 1.5rem;
}

.login-card {
    width: 100%;
    max-width: 22rem;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.75rem;
}
.login-card .brand { justify-content: center; margin-bottom: 1.5rem; }
.login-card h1 { font-size: 1.25rem; margin-bottom: .35rem; }
.login-card > p { margin: 0 0 1.25rem; color: var(--ink-soft); font-size: .9rem; }
.login-card .btn { width: 100%; }
.login-back { display: block; text-align: center; margin-top: 1rem; font-size: .85rem; color: var(--ink-faint); }
.login-back:hover { color: var(--gold); }
