/* =====================================================================
   Visitor System - shared styles
   Import into Bootstrap Studio: Design panel > right-click Styles >
   Import > choose this file. Leave it linked to every page.
   ===================================================================== */

:root {
  /* Pass geometry. Change these two if you ever move to a different
     badge size - everything else follows. */
  --pass-width: 105mm;
  --pass-height: 70mm;

  --brand-dark: #101827;
  --brand-muted: #64748b;
  --brand-border: #d6dce5;
  --brand-accent: #135b65;
  --brand-accent-dark: #0f4951;
}

body {
  min-height: 100vh;
  background: #f4f7fb;
  color: var(--brand-dark);
  font-family: Arial, Helvetica, sans-serif;
}

/* ---------- Page shell ---------------------------------------------- */
.visitor-app {
  max-width: 1080px;
  margin: 0 auto;
  padding: 32px 16px;
}

.visitor-app.is-narrow {
  max-width: 980px;
}

.app-card {
  background: #fff;
  border: 1px solid #e5eaf1;
  border-radius: 22px;
  box-shadow: 0 18px 45px rgba(15, 23, 42, .08);
  overflow: hidden;
}

.app-header {
  padding: 24px;
  background: linear-gradient(135deg, #101827, #135b65);
  color: #fff;
}

.app-header h1 {
  margin: 0;
  font-size: clamp(1.45rem, 2.5vw, 2.1rem);
  font-weight: 800;
  letter-spacing: -.03em;
}

.app-header p {
  margin: 8px 0 0;
  color: rgba(255, 255, 255, .82);
}

.app-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.app-nav a {
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: .95rem;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .35);
}

.app-nav a:hover,
.app-nav a:focus-visible {
  background: rgba(255, 255, 255, .16);
  color: #fff;
}

.app-nav a[aria-current="page"] {
  background: #fff;
  color: var(--brand-accent);
  border-color: #fff;
}

/* ---------- Controls ------------------------------------------------- */
.form-label {
  font-weight: 700;
  color: #1f2937;
}

.form-control,
.form-select {
  border-radius: 14px;
  padding: 12px 14px;
  border-color: #cdd6e1;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--brand-accent);
  box-shadow: 0 0 0 .2rem rgba(19, 91, 101, .14);
}

.btn-pass {
  border: 0;
  border-radius: 14px;
  padding: 12px 18px;
  font-weight: 800;
  background: var(--brand-accent);
  color: #fff;
}

.btn-pass:hover,
.btn-pass:focus {
  background: var(--brand-accent-dark);
  color: #fff;
}

.btn-outline-pass {
  border-radius: 14px;
  padding: 12px 18px;
  font-weight: 800;
  border: 1px solid #cdd6e1;
  color: #1f2937;
  background: #fff;
}

.btn-outline-pass:hover,
.btn-outline-pass:focus {
  border-color: var(--brand-accent);
  color: var(--brand-accent);
  background: #f8fbfc;
}

:focus-visible {
  outline: 3px solid rgba(19, 91, 101, .45);
  outline-offset: 2px;
}

/* ---------- Small pieces --------------------------------------------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #dbe3ee;
  background: #f8fbff;
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 700;
  color: #0f172a;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #94a3b8;
  display: inline-block;
}

.status-dot.ok { background: #22c55e; }
.status-dot.warn { background: #f59e0b; }
.status-dot.err { background: #ef4444; }

.small-muted { color: var(--brand-muted); }
.is-hidden { display: none !important; }

.badge-pending {
  background: #fef3c7;
  color: #92400e;
  border-radius: 999px;
  padding: 4px 10px;
  font-weight: 800;
  font-size: .78rem;
}

.badge-printed {
  background: #dcfce7;
  color: #166534;
  border-radius: 999px;
  padding: 4px 10px;
  font-weight: 800;
  font-size: .78rem;
}

.badge-cancelled {
  background: #f1f5f9;
  color: #475569;
  border-radius: 999px;
  padding: 4px 10px;
  font-weight: 800;
  font-size: .78rem;
}

/* ---------- Preview panes -------------------------------------------- */
.preview-wrap {
  background: #e9eef5;
  border-radius: 18px;
  padding: 20px;
  overflow: auto;
}

.preview-wrap.is-centred {
  display: grid;
  place-items: center;
}

.preview-card {
  background: #fff;
  border: 1px solid #e5eaf1;
  border-radius: 18px;
  box-shadow: 0 14px 35px rgba(15, 23, 42, .06);
  padding: 18px;
}

.preview-title {
  font-weight: 900;
  letter-spacing: -.02em;
  margin-bottom: 6px;
}

.preview-sub {
  color: var(--brand-muted);
  margin: 0;
}

.preview-note {
  color: var(--brand-muted);
  font-size: .92rem;
  margin-top: 12px;
  text-align: center;
}

.pass-preview-scale {
  transform-origin: top center;
  max-width: 100%;
}

/* ---------- Employee picker ------------------------------------------ */
.picker-wrap { position: relative; }

.picker-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 1000;
  background: #fff;
  border: 1px solid #e5eaf1;
  border-radius: 14px;
  box-shadow: 0 18px 45px rgba(15, 23, 42, .12);
  overflow: hidden;
  max-height: 260px;
  overflow-y: auto;
}

.picker-item {
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: 0;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.picker-item:hover,
.picker-item.is-active {
  background: #f3f7fb;
}

.picker-name {
  font-weight: 800;
  color: #0f172a;
  line-height: 1.1;
}

.picker-meta {
  font-size: .86rem;
  color: var(--brand-muted);
  line-height: 1.1;
}

/* ---------- Pending table -------------------------------------------- */
.table-wrap {
  border: 1px solid #e5eaf1;
  border-radius: 18px;
  overflow: hidden;
  background: #fff;
}

.table-wrap .table {
  margin: 0;
}

.table-wrap thead th {
  background: #f8fafc;
  font-weight: 800;
  color: #334155;
  white-space: nowrap;
  border-bottom: 1px solid #e5eaf1;
}

.table-wrap td {
  vertical-align: middle;
}

.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.row-actions .btn {
  border-radius: 10px;
  font-weight: 700;
  padding: 6px 12px;
  font-size: .875rem;
}

/* ---------- The pass itself ------------------------------------------- */
.visitor-pass {
  width: var(--pass-width);
  height: var(--pass-height);
  background: #fff;
  border: 1.2mm solid var(--brand-dark);
  border-radius: 5mm;
  box-sizing: border-box;
  padding: 6mm;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: var(--brand-dark);
  position: relative;
  overflow: hidden;
}

.visitor-pass::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(19, 91, 101, .08), transparent 45%);
  pointer-events: none;
}

.pass-top {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8mm;
  border-bottom: .45mm solid var(--brand-border);
  padding-bottom: 3.5mm;
}

.pass-title {
  font-size: 8mm;
  line-height: 1;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--brand-accent);
}

.pass-date {
  font-size: 3.2mm;
  line-height: 1.25;
  text-align: right;
  color: #475569;
  white-space: nowrap;
  font-weight: 700;
}

.pass-main {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  padding: 3mm 0;
}

.visitor-name {
  font-size: 10mm;
  line-height: 1.04;
  font-weight: 900;
  letter-spacing: -.03em;
  word-break: break-word;
}

.business-name {
  margin-top: 3mm;
  font-size: 5.7mm;
  line-height: 1.1;
  font-weight: 700;
  color: #334155;
  word-break: break-word;
}

.company-logo-wrap {
  margin-top: 3mm;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 14mm;
  max-height: 18mm;
}

.company-logo {
  display: block;
  max-width: 58mm;
  max-height: 18mm;
  object-fit: contain;
}

.logo-helper {
  color: var(--brand-muted);
  font-size: .88rem;
  margin-top: 6px;
}

.pass-bottom {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6mm;
  border-top: .45mm solid var(--brand-border);
  padding-top: 3mm;
  color: #475569;
  font-size: 3mm;
  font-weight: 700;
}

.pass-footer-right { text-align: right; }

/* ---------- UniFi reminder modal -------------------------------------- */
.unifi-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(15, 23, 42, .68);
  backdrop-filter: blur(4px);
}

.unifi-modal-backdrop.is-active { display: flex; }

.unifi-modal-box {
  width: min(100%, 520px);
  background: #fff;
  border-radius: 22px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .24);
  overflow: hidden;
}

.unifi-modal-header {
  padding: 20px 22px;
  background: linear-gradient(135deg, #101827, #135b65);
  color: #fff;
}

.unifi-modal-header h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: -.02em;
}

.unifi-modal-body { padding: 22px; }

.unifi-modal-body p {
  margin: 0 0 14px;
  color: #334155;
  line-height: 1.45;
}

.unifi-modal-actions {
  display: grid;
  gap: 10px;
}

@media (min-width: 576px) {
  .unifi-modal-actions { grid-template-columns: 1fr 1fr; }
  .unifi-modal-actions .full-width { grid-column: 1 / -1; }
}

/* ---------- Print ------------------------------------------------------
   Paper is a 70mm x 210mm strip. The pass is rotated onto the first
   105mm, the return instructions onto the second 105mm.
   ---------------------------------------------------------------------- */
.print-area { display: none; }

@media print {
  @page { size: 70mm 210mm; margin: 0; }

  html, body {
    width: 70mm !important;
    height: 210mm !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
    overflow: hidden !important;
  }

  .visitor-app,
  .unifi-modal-backdrop { display: none !important; }

  .print-area {
    display: block !important;
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 70mm !important;
    height: 210mm !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    background: #fff !important;
  }

  .print-rotator {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 105mm !important;
    height: 70mm !important;
    transform-origin: top left !important;
    transform: rotate(-90deg) translateX(-105mm) !important;
  }

  .print-area .visitor-pass {
    width: 105mm !important;
    height: 70mm !important;
    margin: 0 !important;
    border-radius: 0 !important;
    border-width: 1mm !important;
    box-shadow: none !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .print-instructions-area {
    position: absolute !important;
    left: 0 !important;
    top: 105mm !important;
    width: 70mm !important;
    height: 105mm !important;
    overflow: hidden !important;
    background: #fff !important;
  }

  .print-instructions-rotator {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 105mm !important;
    height: 70mm !important;
    transform-origin: top left !important;
    transform: rotate(-90deg) translateX(-105mm) !important;
  }

  .print-instructions-pass {
    width: 105mm !important;
    height: 70mm !important;
    position: relative !important;
    background: #fff !important;
  }

  .print-instructions-frame {
    position: absolute !important;
    left: 4mm !important;
    top: 4mm !important;
    right: 4mm !important;
    bottom: 4mm !important;
    border: 1.2mm solid #101827 !important;
    border-radius: 2mm !important;
    box-sizing: border-box !important;
    background: #fff !important;
    display: flex !important;
    justify-content: center !important;
    align-items: flex-start !important;
  }

  .print-instructions-text {
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 8mm 6mm 0 6mm !important;
    text-align: center !important;
    color: #101827 !important;
    font-size: 3.6mm !important;
    line-height: 1.25 !important;
    font-weight: 900 !important;
  }

  .print-instructions-phone {
    display: inline-block !important;
    margin-top: 2mm !important;
    font-size: 4.0mm !important;
    font-weight: 900 !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
