/* ═══════════════════════════════════════════════════════
   Guest QR Card — MoveAthens
   Banner on welcome page + bottom-sheet modal that renders
   a printable "visitor card" with the hotel's scannable QR.
   Visible to hotel staff only (not guests).
   ═══════════════════════════════════════════════════════ */

/* ========== Banner on home (frosted, matches other panels) ========== */
.ma-guest-qr-banner {
  --qrb-bg:        rgba(255, 255, 255, 0.06);
  --qrb-bg-hover:  rgba(255, 255, 255, 0.09);
  --qrb-border:    rgba(70, 211, 255, 0.28);
  --qrb-border-hv: rgba(70, 211, 255, 0.5);
  --qrb-title:     #ffffff;
  --qrb-sub:       rgba(255, 255, 255, 0.6);
  --qrb-icon-bg:   rgba(70, 211, 255, 0.14);
  --qrb-icon-fg:   #46d3ff;
  --qrb-icon-brd:  rgba(70, 211, 255, 0.35);

  all: unset;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  padding: 14px 16px;
  margin-top: 16px;
  border-radius: 16px;
  background: var(--qrb-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--qrb-border);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
/* Light-mode banner: dark text on subtle white‑tinted frosted panel */
html.ma-force-light .ma-guest-qr-banner {
  --qrb-bg:        rgba(15, 37, 72, 0.04);
  --qrb-bg-hover:  rgba(15, 37, 72, 0.07);
  --qrb-border:    rgba(15, 37, 72, 0.18);
  --qrb-border-hv: rgba(15, 37, 72, 0.32);
  --qrb-title:     #0f2548;
  --qrb-sub:       rgba(15, 37, 72, 0.62);
  --qrb-icon-bg:   rgba(15, 37, 72, 0.08);
  --qrb-icon-fg:   #0f2548;
  --qrb-icon-brd:  rgba(15, 37, 72, 0.2);
}
@media (prefers-color-scheme: light) {
  html:not(.ma-force-dark) .ma-guest-qr-banner {
    --qrb-bg:        rgba(15, 37, 72, 0.04);
    --qrb-bg-hover:  rgba(15, 37, 72, 0.07);
    --qrb-border:    rgba(15, 37, 72, 0.18);
    --qrb-border-hv: rgba(15, 37, 72, 0.32);
    --qrb-title:     #0f2548;
    --qrb-sub:       rgba(15, 37, 72, 0.62);
    --qrb-icon-bg:   rgba(15, 37, 72, 0.08);
    --qrb-icon-fg:   #0f2548;
    --qrb-icon-brd:  rgba(15, 37, 72, 0.2);
  }
}
.ma-guest-qr-banner:hover,
.ma-guest-qr-banner:focus-visible {
  background: var(--qrb-bg-hover);
  border-color: var(--qrb-border-hv);
}
.ma-guest-qr-banner:active { transform: scale(0.985); }
.ma-guest-qr-banner[hidden] { display: none !important; }

.ma-guest-qr-banner__text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  text-align: left;
}
.ma-guest-qr-banner__title {
  font-size: 16px;
  font-weight: 700;
  color: var(--qrb-title);
  letter-spacing: 0.3px;
  line-height: 1.2;
}
.ma-guest-qr-banner__sub {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--qrb-sub);
  line-height: 1.3;
  letter-spacing: 0.2px;
}
.ma-guest-qr-banner__icon {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--qrb-icon-bg);
  color: var(--qrb-icon-fg);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--qrb-icon-brd);
}

/* ========== Bottom-sheet modal — theme-aware surface ==========
   Scoped CSS vars so ONLY the sheet chrome reacts to theme,
   not the visitor card (which must always be white for print). */
.ma-qr-sheet {
  --qrs-bg:        #ffffff;
  --qrs-text:      #0f2548;
  --qrs-muted:     #4a5568;
  --qrs-grabber:   rgba(0, 0, 0, 0.18);
  --qrs-divider:   rgba(0, 0, 0, 0.08);
  --qrs-btn-bg:    #ffffff;
  --qrs-btn-text:  #0f2548;
  --qrs-btn-border: rgba(15, 37, 72, 0.18);
  --qrs-primary-bg:    #0f2548;
  --qrs-primary-text:  #ffffff;
  --qrs-primary-border: #0f2548;
}

/* Dark mode — explicit user choice OR system preference (unless forced light) */
html.ma-force-dark .ma-qr-sheet,
html:not(.ma-force-light) .ma-qr-sheet {
  --qrs-bg:        #151c2e;
  --qrs-text:      #f4f6fb;
  --qrs-muted:     #b2b8c7;
  --qrs-grabber:   rgba(255, 255, 255, 0.28);
  --qrs-divider:   rgba(255, 255, 255, 0.08);
  --qrs-btn-bg:    rgba(255, 255, 255, 0.06);
  --qrs-btn-text:  #f4f6fb;
  --qrs-btn-border: rgba(255, 255, 255, 0.15);
  --qrs-primary-bg:    #46d3ff;
  --qrs-primary-text:  #0b0f1a;
  --qrs-primary-border: #46d3ff;
}
/* But respect forced light even in an otherwise dark system */
@media (prefers-color-scheme: light) {
  html:not(.ma-force-dark) .ma-qr-sheet {
    --qrs-bg:        #ffffff;
    --qrs-text:      #0f2548;
    --qrs-muted:     #4a5568;
    --qrs-grabber:   rgba(0, 0, 0, 0.18);
    --qrs-divider:   rgba(0, 0, 0, 0.08);
    --qrs-btn-bg:    #ffffff;
    --qrs-btn-text:  #0f2548;
    --qrs-btn-border: rgba(15, 37, 72, 0.18);
    --qrs-primary-bg:    #0f2548;
    --qrs-primary-text:  #ffffff;
    --qrs-primary-border: #0f2548;
  }
}
html.ma-force-light .ma-qr-sheet {
  --qrs-bg:        #ffffff;
  --qrs-text:      #0f2548;
  --qrs-muted:     #4a5568;
  --qrs-grabber:   rgba(0, 0, 0, 0.18);
  --qrs-divider:   rgba(0, 0, 0, 0.08);
  --qrs-btn-bg:    #ffffff;
  --qrs-btn-text:  #0f2548;
  --qrs-btn-border: rgba(15, 37, 72, 0.18);
  --qrs-primary-bg:    #0f2548;
  --qrs-primary-text:  #ffffff;
  --qrs-primary-border: #0f2548;
}

/* Scrim — a touch darker in dark mode so the home fades out more */
.ma-qr-sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 9000;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
html.ma-force-dark .ma-qr-sheet-backdrop,
html:not(.ma-force-light) .ma-qr-sheet-backdrop {
  background: rgba(0, 0, 0, 0.72);
}
@media (prefers-color-scheme: light) {
  html:not(.ma-force-dark) .ma-qr-sheet-backdrop {
    background: rgba(0, 0, 0, 0.55);
  }
}
.ma-qr-sheet-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.ma-qr-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 92vh;
  background: var(--qrs-bg);
  color: var(--qrs-text);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.35);
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
  z-index: 9001;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.ma-qr-sheet.is-open { transform: translateY(0); }

.ma-qr-sheet__grabber {
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: var(--qrs-grabber);
  margin: 10px auto 0;
  flex-shrink: 0;
}

.ma-qr-sheet__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px 6px;
  flex-shrink: 0;
}
.ma-qr-sheet__title {
  font-size: 16px;
  font-weight: 700;
  color: var(--qrs-text);
  margin: 0;
}
.ma-qr-sheet__close {
  all: unset;
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--qrs-muted);
  font-size: 22px;
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
}
.ma-qr-sheet__close:hover,
.ma-qr-sheet__close:focus-visible {
  background: var(--qrs-divider);
  color: var(--qrs-text);
}

.ma-qr-sheet__body {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 6px 18px 18px;
}

/* ========== Visitor card — ALWAYS WHITE (printable) ========== */
.ma-visitor-card {
  max-width: 360px;
  margin: 0 auto;
  background: #ffffff;
  color: #0b1220;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}
/* In light-mode sheet the card bg matches the sheet bg → give it a stronger
   frame so it clearly stands out. */
html.ma-force-light .ma-qr-sheet .ma-visitor-card {
  border: 1px solid rgba(0, 0, 0, 0.14);
  box-shadow: 0 6px 22px rgba(15, 37, 72, 0.18);
}
@media (prefers-color-scheme: light) {
  html:not(.ma-force-dark) .ma-qr-sheet .ma-visitor-card {
    border: 1px solid rgba(0, 0, 0, 0.14);
    box-shadow: 0 6px 22px rgba(15, 37, 72, 0.18);
  }
}
.ma-visitor-card__top {
  padding: 24px 22px 18px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
}
.ma-visitor-card__hotel {
  font-size: 12px;
  font-weight: 700;
  color: #7a8698;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  line-height: 1.2;
}
.ma-visitor-card__heading {
  font-size: 22px;
  font-weight: 800;
  color: #0b1220;
  line-height: 1.2;
  margin: 0;
}
.ma-visitor-card__qr {
  width: 220px;
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  padding: 6px;
  border-radius: 8px;
}
.ma-visitor-card__qr svg { width: 100%; height: 100%; display: block; }
.ma-visitor-card__qr--loading { color: #7a8698; font-size: 13px; }

.ma-visitor-card__badge {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 800;
  color: #0f2548;
  background: #ffd84d;
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}
.ma-visitor-card__footer {
  background: linear-gradient(135deg, #1a3a6e 0%, #0f2548 100%);
  /* Reduced vertical padding so bigger logo doesn't push the blue strip */
  padding: 8px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 86px;
}
/* Logo is dark-blue on transparent → invert to white for the dark footer */
.ma-visitor-card__footer img {
  height: 72px;
  width: auto;
  display: block;
  filter: brightness(0) invert(1);
}

/* ========== Actions row (theme-aware) ========== */
.ma-qr-sheet__actions {
  max-width: 360px;
  margin: 14px auto 6px;
  display: flex;
  gap: 10px;
}
.ma-qr-sheet__actions button {
  flex: 1 1 auto;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--qrs-btn-border);
  background: var(--qrs-btn-bg);
  color: var(--qrs-btn-text);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: filter 0.15s ease;
}
.ma-qr-sheet__actions button.ma-qr-sheet__btn-primary {
  background: var(--qrs-primary-bg);
  color: var(--qrs-primary-text);
  border-color: var(--qrs-primary-border);
}
.ma-qr-sheet__actions button:hover  { filter: brightness(1.06); }
.ma-qr-sheet__actions button:active { filter: brightness(0.94); }

.ma-qr-sheet__error {
  max-width: 360px;
  margin: 8px auto 0;
  font-size: 12.5px;
  color: #ef4444;
  text-align: center;
}

/* Demo-mode note (not an error, just informational) */
.ma-qr-sheet__error.ma-qr-demo-note {
  color: rgba(255, 255, 255, 0.85);
}
.ma-qr-demo-link {
  color: #4fc3f7;
  font-weight: 600;
  text-decoration: underline;
}
html.ma-force-light .ma-qr-sheet__error.ma-qr-demo-note {
  color: rgba(11, 18, 32, 0.82);
}
html.ma-force-light .ma-qr-demo-link { color: #2563eb; }
@media (prefers-color-scheme: light) {
  html:not(.ma-force-dark) .ma-qr-sheet__error.ma-qr-demo-note {
    color: rgba(11, 18, 32, 0.82);
  }
  html:not(.ma-force-dark) .ma-qr-demo-link { color: #2563eb; }
}

/* ========== Small screens ========== */
@media (max-width: 360px) {
  .ma-guest-qr-banner { padding: 12px 14px; }
  .ma-guest-qr-banner__title { font-size: 15px; }
  .ma-guest-qr-banner__sub { font-size: 11px; }
  .ma-guest-qr-banner__icon { width: 40px; height: 40px; }
  .ma-visitor-card__qr { width: 190px; height: 190px; }
  .ma-visitor-card__heading { font-size: 20px; }
}

/* ========== Print ========== */
@media print {
  @page { margin: 10mm; }
  html, body { background: #ffffff !important; height: auto !important; }
  body > *:not(.ma-qr-sheet-backdrop):not(.ma-qr-sheet) { display: none !important; }
  .ma-qr-sheet-backdrop { display: none !important; }
  .ma-qr-sheet {
    position: static !important;
    transform: none !important;
    max-height: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    background: #ffffff !important;
    color: #0f2548 !important;
  }
  .ma-qr-sheet__grabber,
  .ma-qr-sheet__header,
  .ma-qr-sheet__actions,
  .ma-qr-sheet__error { display: none !important; }
  .ma-qr-sheet__body { overflow: visible !important; padding: 0 !important; }
  .ma-visitor-card {
    box-shadow: none !important;
    border: 1px solid #d0d5dd !important;
    max-width: 100% !important;
    page-break-inside: avoid;
  }
  .ma-visitor-card__qr { width: 60mm; height: 60mm; }
}
