/* AlPhi Cuts -- brand: charcoal + warm gold, the classic barbershop palette without leaning on the
   red/white/blue pole cliche. No build step: plain CSS, custom properties for theming. */
:root {
  --ink: #171512;
  --panel: #221f1b;
  --panel-2: #2b2722;
  --line: #3a352d;
  --gold: #d4af37;
  --gold-soft: #e8c866;
  --text: #f3efe6;
  --muted: #b8ad9a;
  --good: #4caf7d;
  --warn: #e0a541;
  --bad: #e0605a;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--ink);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--gold-soft); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.2; }
p { margin: 0 0 .8em; }
.container { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(23, 21, 18, .92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.site-header .row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 20px; color: var(--text); }
.brand .mark { width: 34px; height: 34px; border-radius: 8px; background: linear-gradient(135deg, var(--gold), #a9791f); display: flex; align-items: center; justify-content: center; font-size: 18px; color: #171512; font-weight: 900; }
.brand-logo { width: 34px; height: 34px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.brand-logo-lg { width: 56px; height: 56px; border-radius: 12px; object-fit: cover; display: block; margin: 0 auto 10px; }

/* ---------- sitewide logo watermark ---------- */
.bg-watermark {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: url('/icons/logo.webp') center 12vh no-repeat;
  background-size: min(520px, 70vw);
  opacity: .05;
}
.nav-links { display: flex; gap: 18px; }
.nav-links a { color: var(--muted); font-size: 14px; font-weight: 600; }
.nav-links a:hover { color: var(--gold-soft); text-decoration: none; }

.nav-toggle { display: none; flex-direction: column; justify-content: center; gap: 5px; width: 34px; height: 34px; background: none; border: none; cursor: pointer; padding: 0; flex-shrink: 0; }
.nav-toggle span { display: block; width: 22px; height: 2px; background: var(--text); border-radius: 2px; transition: transform .2s, opacity .2s; }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 640px) {
  .nav-toggle { display: flex; }
  .nav-links {
    display: flex; flex-direction: column; gap: 0;
    position: fixed; top: 61px; left: 0; right: 0; z-index: 39;
    background: var(--panel); border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow);
    max-height: 0; overflow: hidden;
    transition: max-height .25s ease;
  }
  .nav-links.open { max-height: 420px; }
  .nav-links a { padding: 14px 20px; border-bottom: 1px solid var(--line); font-size: 15px; }
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  padding: 11px 18px; border-radius: 10px; font-weight: 700; font-size: 14px; cursor: pointer;
  transition: transform .08s ease, background .15s ease; text-decoration: none;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-gold { background: linear-gradient(135deg, var(--gold-soft), var(--gold)); color: #171512; border-color: transparent; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }

/* ---------- hero ---------- */
.hero { padding: 56px 0 40px; text-align: center; }
.hero .rating-badge {
  display: inline-flex; align-items: center; gap: 6px; background: var(--panel);
  border: 1px solid var(--line); padding: 6px 14px; border-radius: 999px; font-size: 13px; margin-bottom: 18px;
}
.hero h1 { font-size: 40px; letter-spacing: -.02em; }
.hero .tagline { font-size: 18px; color: var(--muted); max-width: 560px; margin: 0 auto 22px; }
.hero .price-pill {
  display: inline-block; background: var(--panel); border: 1px solid var(--gold); color: var(--gold-soft);
  padding: 6px 16px; border-radius: 999px; font-weight: 800; margin-bottom: 24px;
}
.hero-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.stars { color: var(--gold-soft); letter-spacing: 2px; }

/* ---------- cards / sections ---------- */
section { padding: 40px 0; border-top: 1px solid var(--line); }
.section-head { margin-bottom: 22px; }
.section-head h2 { font-size: 26px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 760px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------- queue ---------- */
.queue-summary { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.queue-summary .big { font-size: 30px; font-weight: 800; color: var(--gold-soft); }
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.slot {
  border: 1px solid var(--line); border-radius: 9px; padding: 8px 6px; text-align: center; font-size: 12px; font-weight: 700;
  background: var(--panel-2); color: var(--muted);
}
.slot.free { background: rgba(76, 175, 125, .12); border-color: var(--good); color: var(--good); }
.slot.taken { background: rgba(216, 173, 84, .08); }
.slot.now { background: rgba(224, 165, 65, .18); border-color: var(--warn); color: var(--warn); animation: pulse 1.6s infinite; }
.slot.past { opacity: .35; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(224,165,65,.4); } 50% { box-shadow: 0 0 0 6px rgba(224,165,65,0); } }

/* ---------- forms ---------- */
label { display: block; font-size: 13px; font-weight: 700; color: var(--muted); margin: 12px 0 5px; }
label:first-child { margin-top: 0; }
input, select, textarea {
  width: 100%; background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 9px; padding: 10px 12px; font-size: 14px; font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); }
textarea { resize: vertical; min-height: 80px; }
.field-row { display: flex; gap: 10px; }
.field-row > * { flex: 1; }
.form-msg { margin-top: 12px; padding: 10px 12px; border-radius: 9px; font-size: 13px; }
.form-msg.error { background: rgba(224, 96, 90, .12); color: var(--bad); border: 1px solid var(--bad); }
.form-msg.ok { background: rgba(76, 175, 125, .12); color: var(--good); border: 1px solid var(--good); }

/* ---------- my booking ---------- */
.ticket { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.status-pill { padding: 5px 12px; border-radius: 999px; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.status-booked { background: rgba(184,173,154,.15); color: var(--muted); }
.status-on_deck { background: rgba(224,165,65,.1); color: var(--warn); }
.status-called { background: rgba(224,165,65,.18); color: var(--warn); }
.status-checked_in { background: rgba(212,175,55,.18); color: var(--gold-soft); }
.status-in_chair { background: rgba(76,175,125,.18); color: var(--good); }
.status-done { background: rgba(76,175,125,.1); color: var(--good); }
.status-no_show, .status-cancelled { background: rgba(224,96,90,.15); color: var(--bad); }

/* ---------- feedback ---------- */
.review { border-bottom: 1px solid var(--line); padding: 14px 0; }
.review:last-child { border-bottom: none; }
.review .stars-sm { font-size: 13px; }
.review .reply { margin-top: 8px; padding: 10px 12px; background: var(--panel-2); border-radius: 9px; font-size: 13px; }
.review .reply b { color: var(--gold-soft); }

/* ---------- chat ---------- */
.chat-box { display: flex; flex-direction: column; gap: 8px; max-height: 320px; overflow-y: auto; padding: 4px; margin-bottom: 12px; }
.msg { max-width: 78%; padding: 9px 12px; border-radius: 12px; font-size: 14px; }
.msg.client { align-self: flex-end; background: var(--gold-soft); color: #171512; border-bottom-right-radius: 3px; }
.msg.owner { align-self: flex-start; background: var(--panel-2); border: 1px solid var(--line); border-bottom-left-radius: 3px; }
.chat-send { display: flex; gap: 8px; }
.chat-send textarea { min-height: 42px; }

/* ---------- footer / contact ---------- */
footer { padding: 40px 0 60px; }
.contact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-top: 16px; }
.contact-grid a, .contact-grid .item { color: var(--text); font-size: 14px; }

/* ---------- get the app ---------- */
.qr-box { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.qr-box img { background: #fff; padding: 10px; border-radius: 10px; width: 160px; height: 160px; }

/* ---------- modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); max-width: 440px; width: 100%; padding: 22px; box-shadow: var(--shadow); }
.modal h3 { margin-bottom: 14px; }
.modal-close { float: right; background: none; border: none; color: var(--muted); font-size: 20px; cursor: pointer; }

/* ---------- admin ---------- */
.admin-shell { display: flex; min-height: 100vh; }
.admin-side { width: 220px; background: var(--panel); border-right: 1px solid var(--line); padding: 20px 14px; flex-shrink: 0; }
.admin-side a { display: block; padding: 10px 12px; border-radius: 8px; color: var(--muted); font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.admin-side a.active, .admin-side a:hover { background: var(--panel-2); color: var(--gold-soft); text-decoration: none; }
.admin-main { flex: 1; padding: 28px; max-width: 900px; }
.admin-topbar { display: none; }
.admin-side-backdrop { display: none; }

@media (max-width: 720px) {
  .admin-shell { flex-direction: column; }
  .admin-topbar {
    display: flex; align-items: center; gap: 14px;
    position: sticky; top: 0; z-index: 45;
    background: rgba(23, 21, 18, .96); backdrop-filter: blur(6px);
    border-bottom: 1px solid var(--line); padding: 12px 16px;
  }
  .admin-topbar .nav-toggle { display: flex; }
  .admin-main { padding: 20px 16px; max-width: 100%; }

  .admin-side {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 60;
    width: 260px; max-width: 80vw;
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: var(--shadow);
  }
  .admin-side.open { transform: translateX(0); }
  .admin-side-backdrop.open {
    display: block; position: fixed; inset: 0; z-index: 50;
    background: rgba(0, 0, 0, .55);
  }
}
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
.stat-row { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; min-width: 130px; }
.stat .n { font-size: 24px; font-weight: 800; color: var(--gold-soft); }
.stat .l { font-size: 12px; color: var(--muted); }

/* ---------- photo grids (styles tab, style requests) ---------- */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 8px; margin: 10px 0; }
.photo-thumb { position: relative; }
.photo-thumb img { width: 100%; aspect-ratio: 1/1; object-fit: cover; border-radius: 8px; display: block; }
.photo-thumb .photo-del { position: absolute; top: 3px; right: 3px; background: rgba(23,21,18,.85); color: var(--bad); border: none; border-radius: 999px; width: 22px; height: 22px; line-height: 1; cursor: pointer; font-size: 14px; }

/* ---------- printable QR / receipt ---------- */
#receipt-print { display: none; }
@media print {
  body * { visibility: hidden; }
  #get-app, #get-app * { visibility: visible; }
  #get-app { position: absolute; inset: 0; padding: 60px 20px; text-align: center; }
  #get-app .qr-box { justify-content: center; }
  #get-app .qr-box img { width: 320px; height: 320px; }
  #get-app-btn, #qr-print-btn { display: none; }

  body.printing-receipt #get-app { display: none; }
  body.printing-receipt #receipt-print,
  body.printing-receipt #receipt-print * { visibility: visible; }
  body.printing-receipt #receipt-print {
    display: block; position: absolute; inset: 0; padding: 40px; color: #171512; background: #fff;
  }
}

/* ---------- receipt ---------- */
.receipt-doc { max-width: 420px; margin: 0 auto; font-family: 'Segoe UI', system-ui, sans-serif; }
.receipt-doc .r-logo { width: 90px; height: 90px; display: block; margin: 0 auto 10px; border-radius: 16px; }
.receipt-doc h2 { text-align: center; margin: 0 0 2px; }
.receipt-doc .r-sub { text-align: center; color: #6b6255; font-size: 13px; margin-bottom: 18px; }
.receipt-doc .r-stamp { text-align: center; font-weight: 900; letter-spacing: .08em; color: #4caf7d; border: 2px solid #4caf7d; border-radius: 8px; padding: 6px; margin-bottom: 18px; }
.receipt-doc table { width: 100%; border-collapse: collapse; font-size: 14px; }
.receipt-doc td { padding: 7px 0; border-bottom: 1px dashed #ccc; }
.receipt-doc td:last-child { text-align: right; font-weight: 700; }
.receipt-doc .r-total td { border-bottom: none; border-top: 2px solid #171512; font-size: 17px; font-weight: 900; padding-top: 12px; }
.receipt-doc .r-foot { text-align: center; font-size: 12px; color: #6b6255; margin-top: 22px; }

/* ---------- barber-free banner ---------- */
.free-banner { background: linear-gradient(135deg, var(--gold), var(--gold-soft)); color: #171512; border-radius: var(--radius); padding: 14px 18px; margin-bottom: 18px; font-weight: 800; display: flex; align-items: center; gap: 10px; }

/* ---------- payments ---------- */
.payment-disclaimer { background: rgba(224,96,90,.1); border: 1px solid var(--bad); color: var(--text); border-radius: 10px; padding: 12px 14px; font-size: 13px; margin-bottom: 12px; }
.payment-box { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin-top: 10px; }
.payment-box pre { white-space: pre-wrap; word-break: break-word; font-family: inherit; background: var(--ink); border-radius: 8px; padding: 10px; margin: 8px 0; font-size: 14px; }
