/* public/assets/css/main.css
   B&B Voucher — Design System
   Stile: hospitality minimalista, carta e oro antico
   Font: DM Serif Display (titoli) + DM Sans (corpo)
*/

/* ── Reset & Variables ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --cream:      #faf7f2;
  --parchment:  #f0ebe0;
  --gold:       #c9a96e;
  --gold-dark:  #a8854a;
  --charcoal:   #2a2a2a;
  --text:       #3d3530;
  --muted:      #8a7f75;
  --white:      #ffffff;
  --border:     #ddd6c8;
  --success:    #2d6a4f;
  --success-bg: #d8f3dc;
  --error:      #c62828;
  --error-bg:   #ffebee;
  --warn:       #e65100;
  --warn-bg:    #fff3e0;
  --shadow:     0 2px 12px rgba(42,42,42,.10);
  --shadow-lg:  0 8px 32px rgba(42,42,42,.15);
  --radius:     12px;
  --radius-sm:  6px;
  --font-serif: 'DM Serif Display', Georgia, serif;
  --font-sans:  'DM Sans', system-ui, sans-serif;
  --transition: 180ms ease;
}

/* ── Base ────────────────────────────────────────────────────────────────────── */
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--cream);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

/* ── Typography ──────────────────────────────────────────────────────────────── */
h1, h2, h3 { font-family: var(--font-serif); font-weight: 400; color: var(--charcoal); }
h1 { font-size: clamp(1.6rem, 5vw, 2.4rem); }
h2 { font-size: clamp(1.2rem, 4vw, 1.8rem); }
h3 { font-size: 1.1rem; }
p  { color: var(--text); }
a  { color: var(--gold-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
small { color: var(--muted); font-size: .85rem; }

/* ── Lang Switcher ───────────────────────────────────────────────────────────── */
.lang-switcher {
  position: fixed;
  top: 14px; right: 16px;
  display: flex; gap: 4px;
  z-index: 999;
}
.lang-switcher a {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--border);
  background: var(--white);
  transition: var(--transition);
  text-decoration: none;
}
.lang-switcher a.active,
.lang-switcher a:hover {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--white);
}

/* ── Container / Card ────────────────────────────────────────────────────────── */
.container { max-width: 1100px; margin: 0 auto; padding: 0 1.5rem; }
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
  border: 1px solid var(--border);
}
.card-sm { padding: 1.25rem; }

/* ── Centered Auth Layout ────────────────────────────────────────────────────── */
.auth-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 2rem 1rem;
  background: linear-gradient(135deg, var(--cream) 60%, var(--parchment) 100%);
}
.auth-card {
  width: 100%; max-width: 400px;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem 2rem;
  border: 1px solid var(--border);
  position: relative;
}
.auth-logo {
  text-align: center; margin-bottom: 1.75rem;
}
.auth-logo .emoji { font-size: 2.8rem; display: block; margin-bottom: .5rem; }
.auth-logo h1 { font-size: 1.5rem; }
.auth-logo p  { color: var(--muted); font-size: .9rem; margin-top: .25rem; }

/* ── Forms ───────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }
label {
  display: block;
  font-weight: 500; font-size: .85rem;
  margin-bottom: .4rem;
  color: var(--muted);
  letter-spacing: .03em;
  text-transform: uppercase;
}
input, select, textarea {
  width: 100%;
  padding: .75rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 1rem;
  color: var(--text);
  background: var(--cream);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,169,110,.15);
  background: var(--white);
}
input[type="tel"].pin-input {
  font-size: 2rem; letter-spacing: .4em;
  text-align: center; font-weight: 600;
  height: 64px;
}

/* ── Buttons ─────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .75rem 1.5rem;
  border: none; border-radius: var(--radius-sm);
  font-family: var(--font-sans); font-size: 1rem; font-weight: 600;
  cursor: pointer; transition: var(--transition);
  text-decoration: none; white-space: nowrap;
}
.btn-primary {
  background: var(--gold); color: var(--white);
  box-shadow: 0 2px 8px rgba(201,169,110,.35);
}
.btn-primary:hover { background: var(--gold-dark); transform: translateY(-1px); text-decoration: none; color: var(--white); }
.btn-secondary {
  background: transparent; color: var(--gold-dark);
  border: 1.5px solid var(--gold);
}
.btn-secondary:hover { background: var(--parchment); text-decoration: none; }
.btn-danger  { background: var(--error); color: var(--white); }
.btn-danger:hover  { background: #b71c1c; }
.btn-success { background: var(--success); color: var(--white); }
.btn-success:hover { background: #1b4332; }
.btn-sm  { padding: .45rem 1rem; font-size: .875rem; }
.btn-lg  { padding: 1rem 2rem; font-size: 1.1rem; width: 100%; }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn-full { width: 100%; }

/* ── Alerts ──────────────────────────────────────────────────────────────────── */
.alert {
  padding: .85rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: .9rem; margin-bottom: 1rem;
  border-left: 4px solid;
}
.alert-error   { background: var(--error-bg);   color: var(--error);   border-color: var(--error); }
.alert-success { background: var(--success-bg); color: var(--success); border-color: var(--success); }
.alert-warn    { background: var(--warn-bg);    color: var(--warn);    border-color: var(--warn); }
.alert-hidden  { display: none; }

/* ── Spinner ──────────────────────────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2.5px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.spinner-dark {
  border-color: rgba(42,42,42,.2);
  border-top-color: var(--charcoal);
}

/* ── Admin Layout ────────────────────────────────────────────────────────────── */
.admin-layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; flex-shrink: 0;
  background: var(--charcoal);
  color: #ddd; padding: 0;
  display: flex; flex-direction: column;
}
.sidebar-brand {
  padding: 1.5rem 1.25rem 1rem;
  font-family: var(--font-serif);
  font-size: 1.1rem; color: var(--gold);
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-nav { padding: .75rem 0; flex: 1; }
.sidebar-nav a {
  display: flex; align-items: center; gap: .6rem;
  padding: .6rem 1.25rem;
  color: #bbb; font-size: .9rem;
  transition: var(--transition);
  text-decoration: none;
}
.sidebar-nav a:hover, .sidebar-nav a.active {
  background: rgba(201,169,110,.15);
  color: var(--gold);
}
.sidebar-nav .icon { font-size: 1rem; width: 20px; text-align: center; }
.sidebar-footer { padding: 1rem 1.25rem; border-top: 1px solid rgba(255,255,255,.08); }
.main-content { flex: 1; overflow: hidden; }
.topbar {
  background: var(--white); border-bottom: 1px solid var(--border);
  padding: 1rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 10;
}
.topbar h2 { font-size: 1.1rem; font-family: var(--font-sans); font-weight: 600; }
.page-body { padding: 1.5rem; }

/* ── Tables ──────────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { 
  text-align: left; padding: .7rem 1rem;
  background: var(--parchment); color: var(--muted);
  font-weight: 600; font-size: .8rem; letter-spacing: .05em; text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}
td { padding: .65rem 1rem; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--cream); }
.badge {
  display: inline-block;
  padding: .2rem .6rem; border-radius: 20px;
  font-size: .75rem; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase;
}
.badge-issued   { background: #e3f2fd; color: #1565c0; }
.badge-redeemed { background: var(--success-bg); color: var(--success); }
.badge-void     { background: #f3e5f5; color: #6a1b9a; }
.badge-expired  { background: #eceff1; color: #546e7a; }
.badge-active   { background: var(--success-bg); color: var(--success); }
.badge-cancelled{ background: var(--error-bg); color: var(--error); }

/* ── KPI Cards ───────────────────────────────────────────────────────────────── */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(200px,1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.kpi-card {
  background: var(--white); border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--border); box-shadow: var(--shadow);
  text-align: center;
}
.kpi-card .kpi-val { font-family: var(--font-serif); font-size: 2.5rem; color: var(--gold-dark); line-height: 1; }
.kpi-card .kpi-label { color: var(--muted); font-size: .8rem; margin-top: .35rem; text-transform: uppercase; letter-spacing: .05em; }

/* ── Guest / Merchant pages ──────────────────────────────────────────────────── */
.page-wrap {
  max-width: 520px; margin: 0 auto;
  padding: 1.5rem 1rem 4rem;
}
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.25rem;
}
.page-header h1 { font-size: 1.4rem; }
.booking-info {
  background: var(--parchment); border-radius: var(--radius-sm);
  padding: .85rem 1rem; margin-bottom: 1rem;
  font-size: .9rem; border-left: 3px solid var(--gold);
}
.voucher-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: .75rem;
  box-shadow: var(--shadow);
  transition: var(--transition);
}
.voucher-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.voucher-card .vc-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .35rem; }
.voucher-card .vc-title { font-weight: 600; }
.voucher-card .vc-meta { font-size: .8rem; color: var(--muted); }
.voucher-card .vc-footer { margin-top: .75rem; display: flex; gap: .5rem; }

/* ── Wizard Steps ────────────────────────────────────────────────────────────── */
.step-indicator {
  display: flex; gap: 4px; margin-bottom: 1.5rem;
}
.step-indicator .step {
  height: 4px; flex: 1; border-radius: 2px;
  background: var(--border); transition: var(--transition);
}
.step-indicator .step.done { background: var(--gold); }
.step-indicator .step.active { background: var(--gold-dark); }
.service-cards { display: grid; grid-template-columns: repeat(3,1fr); gap: .75rem; margin-bottom: 1rem; }
.service-card {
  background: var(--white); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); padding: 1rem .75rem;
  text-align: center; cursor: pointer; transition: var(--transition);
}
.service-card:hover { border-color: var(--gold); }
.service-card.selected { border-color: var(--gold-dark); background: #fdf6ec; }
.service-card .sc-emoji { font-size: 1.8rem; }
.service-card .sc-label { font-size: .85rem; font-weight: 600; margin-top: .35rem; }
.service-card .sc-time  { font-size: .7rem; color: var(--muted); }
.date-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: .5rem; margin-bottom: 1rem; }
.date-chip {
  background: var(--white); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); padding: .5rem; text-align: center;
  cursor: pointer; font-size: .8rem; transition: var(--transition);
}
.date-chip:hover { border-color: var(--gold); }
.date-chip.selected { background: var(--gold); border-color: var(--gold); color: var(--white); }
.date-chip.disabled { opacity: .4; pointer-events: none; }
.merchant-list .ml-item {
  background: var(--white); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); padding: .85rem 1rem;
  margin-bottom: .5rem; cursor: pointer; transition: var(--transition);
}
.merchant-list .ml-item:hover { border-color: var(--gold); }
.merchant-list .ml-item.selected { border-color: var(--gold-dark); background: #fdf6ec; }
.merchant-list .ml-name { font-weight: 600; }
.merchant-list .ml-addr { font-size: .8rem; color: var(--muted); }

/* ── QR Page ─────────────────────────────────────────────────────────────────── */
.qr-wrap {
  min-height: 100vh;
  background: var(--cream);
  display: flex; flex-direction: column; align-items: center;
  padding: 1.5rem 1rem;
}
.qr-box {
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 2rem;
  width: 100%; max-width: 360px;
  text-align: center;
}
.qr-box h2 { font-size: 1.1rem; margin-bottom: .25rem; }
.qr-box .qr-merchant { color: var(--muted); font-size: .85rem; margin-bottom: 1rem; }
#qrcode-canvas { margin: 1rem auto; display: block; }
.qr-status { margin: 1rem 0; padding: .75rem; border-radius: var(--radius-sm); font-weight: 600; }
.qr-token-fallback { font-size: .7rem; color: var(--muted); word-break: break-all; margin-top: .5rem; }
.qr-warn { margin-top: 1rem; font-size: .8rem; color: var(--muted); padding: .6rem; background: var(--parchment); border-radius: var(--radius-sm); }

/* ── Scanner ──────────────────────────────────────────────────────────────────── */
.scanner-wrap { position: relative; width: 100%; max-width: 400px; margin: 0 auto; aspect-ratio: 1; overflow: hidden; border-radius: var(--radius); background: #000; }
.scanner-wrap video { width: 100%; height: 100%; object-fit: cover; }
.scanner-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
}
.scanner-crosshair {
  width: 200px; height: 200px;
  border: 2px solid var(--gold);
  border-radius: 12px;
  box-shadow: 0 0 0 9999px rgba(0,0,0,.4);
  position: relative;
}
.scanner-crosshair::before, .scanner-crosshair::after {
  content: '';
  position: absolute;
  background: var(--gold);
  border-radius: 2px;
}
.scanner-crosshair::before { width: 30px; height: 3px; top: -1px; left: 50%; transform: translateX(-50%); }
.scanner-crosshair::after  { width: 3px; height: 30px; left: -1px; top: 50%; transform: translateY(-50%); }

/* ── Modal ───────────────────────────────────────────────────────────────────── */
.modal-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 1000;
  align-items: center; justify-content: center;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--white); border-radius: var(--radius);
  padding: 2rem; width: 90%; max-width: 520px;
  box-shadow: var(--shadow-lg); max-height: 90vh; overflow-y: auto;
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.25rem; }
.modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--muted); }

/* ── Pagination ──────────────────────────────────────────────────────────────── */
.pagination { display: flex; gap: .5rem; margin-top: 1rem; align-items: center; }
.pagination .page-info { color: var(--muted); font-size: .85rem; flex: 1; text-align: center; }

/* ── Summary Box ─────────────────────────────────────────────────────────────── */
.summary-box { background: var(--parchment); border-radius: var(--radius-sm); padding: 1rem; margin-bottom: 1rem; }
.summary-row { display: flex; justify-content: space-between; padding: .3rem 0; font-size: .9rem; border-bottom: 1px solid var(--border); }
.summary-row:last-child { border-bottom: none; }
.summary-row .sr-label { color: var(--muted); }
.summary-row .sr-value { font-weight: 600; }

/* ── Utilities ───────────────────────────────────────────────────────────────── */
.mt-1 { margin-top: .5rem; }  .mt-2 { margin-top: 1rem; }   .mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; }.mb-2 { margin-bottom: 1rem; }.mb-3 { margin-bottom: 1.5rem; }
.text-center { text-align: center; } .text-muted { color: var(--muted); }
.text-success { color: var(--success); } .text-error { color: var(--error); }
.flex { display: flex; } .gap-1 { gap: .5rem; } .gap-2 { gap: 1rem; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.hidden { display: none !important; }

/* ── Responsive ──────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .admin-layout { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; overflow-x: auto; }
  .sidebar-nav { display: flex; padding: 0; }
  .sidebar-nav a { padding: .75rem 1rem; flex-direction: column; font-size: .75rem; gap: 2px; }
  .sidebar-footer { display: none; }
  .service-cards { grid-template-columns: repeat(3,1fr); }
  .date-grid { grid-template-columns: repeat(3,1fr); }
  .kpi-grid { grid-template-columns: repeat(2,1fr); }
  .table-wrap { margin: 0 -1rem; }
}
