/**
 * POS Valet Page Styles - "La Rosa" red theme
 * Compact ticket-stub aesthetic matching the restaurant's lotería card vibe.
 */

.page-pos-valet {
  position: relative;
  padding: 16px 16px 40px;
  color: var(--color-text);
  font-family: var(--font-body, 'Atrament', sans-serif);
  z-index: 1;
}

/* ==========================================================================
   SECTION SCAFFOLDING
   ========================================================================== */

.pv-section {
  margin-bottom: 20px;
  position: relative;
  z-index: 1;
}

.pv-section-title {
  font-family: var(--font-display, 'Atrament', sans-serif);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--color-chulas-red);
  margin: 0 0 10px 2px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.pv-section-title::before,
.pv-section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(240, 89, 96, 0.35),
    transparent
  );
}

.pv-section-title::before { max-width: 14px; }

/* ==========================================================================
   SCAN CARD - lotería ticket stub (compact)
   ========================================================================== */

.pv-scan-card {
  position: relative;
  background: var(--color-secondary-background, #1c1c1e);
  border: 2px solid var(--color-chulas-red);
  border-radius: 4px;
  padding: 22px 18px 16px;
  box-shadow:
    0 6px 24px rgba(0, 0, 0, 0.4),
    0 0 28px rgba(0,0,0,0);
}

/* Inner thin border, classic ticket stub */
.pv-scan-card::before {
  content: '';
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(240, 89, 96, 0.35);
  border-radius: 2px;
  pointer-events: none;
}

/* Banner label at top, like lotería card title */
.pv-scan-label {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, var(--color-chulas-red) 0%, #D84850 100%);
  color: #fff;
  font-family: var(--font-display, sans-serif);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  padding: 4px 14px;
  border-radius: 2px;
  white-space: nowrap;
  box-shadow: 0 3px 10px rgba(0,0,0,0);
}

.pv-scan-body {
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
  z-index: 1;
}

.pv-scan-qr {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border: 1.5px solid rgba(240, 89, 96, 0.6);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-chulas-red);
  background: rgba(240, 89, 96, 0.06);
}

.pv-scan-qr svg {
  width: 26px;
  height: 26px;
}

.pv-scan-copy {
  flex: 1;
  min-width: 0;
}

.pv-scan-title {
  font-family: var(--font-display, sans-serif);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text);
  margin: 0 0 2px;
}

.pv-scan-subtitle {
  font-size: 12px;
  line-height: 1.4;
  color: var(--color-text-secondary);
  margin: 0;
}

.pv-scan-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 14px;
  padding: 11px 16px;
  background: linear-gradient(135deg, var(--color-chulas-red) 0%, #D84850 100%);
  color: #fff;
  border: 2px solid var(--color-chulas-black);
  border-radius: 4px;
  font-family: var(--font-display, sans-serif);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  cursor: pointer;
  box-shadow:
    0 4px 14px rgba(0,0,0,0),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
  transition: transform 120ms ease, box-shadow 120ms ease;
  position: relative;
  z-index: 1;
}

.pv-scan-btn:active {
  transform: translateY(1px) scale(0.99);
  box-shadow:
    0 2px 8px rgba(0,0,0,0),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.pv-scan-btn svg {
  width: 15px;
  height: 15px;
}

.pv-scan-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* ==========================================================================
   MANUAL ENTRY (collapsed by default)
   ========================================================================== */

.pv-manual {
  margin-top: 10px;
  text-align: center;
  position: relative;
  z-index: 1;
}

.pv-manual-toggle {
  background: none;
  border: none;
  color: var(--color-text-secondary);
  font-family: var(--font-body, sans-serif);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 3px;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(240, 89, 96, 0.4);
}

.pv-manual-toggle:hover {
  color: var(--color-text);
}

.pv-manual-form {
  display: none;
  margin-top: 10px;
  gap: 8px;
  align-items: stretch;
}

.pv-manual-form.open {
  display: flex;
}

.pv-manual-form input {
  flex: 1;
  padding: 10px 12px;
  border-radius: 4px;
  border: 1.5px solid rgba(240, 89, 96, 0.35);
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 14px;
  letter-spacing: 2px;
  text-align: center;
  text-transform: uppercase;
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.pv-manual-form input:focus {
  border-color: var(--color-chulas-red);
  box-shadow: 0 0 0 2px rgba(0,0,0,0);
}

.pv-manual-submit {
  padding: 0 14px;
  background: linear-gradient(135deg, var(--color-chulas-red) 0%, #D84850 100%);
  color: #fff;
  border: 1.5px solid var(--color-chulas-black);
  border-radius: 4px;
  font-family: var(--font-display, sans-serif);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(0,0,0,0);
}

.pv-manual-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.pv-error {
  margin: 10px 0 0;
  padding: 8px 12px;
  background: rgba(240, 89, 96, 0.1);
  border: 1px solid rgba(240, 89, 96, 0.35);
  border-radius: 3px;
  color: #ffb0b5;
  font-size: 12px;
  text-align: center;
}

/* ==========================================================================
   SESSIONS LIST
   ========================================================================== */

.pv-sessions {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pv-session {
  position: relative;
  background: var(--color-secondary-background, #1c1c1e);
  border: 1.5px solid rgba(240, 89, 96, 0.3);
  border-radius: 4px;
  padding: 12px 14px 11px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.pv-session--active {
  border-color: var(--color-chulas-red);
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.35),
    0 0 20px rgba(0,0,0,0);
}

.pv-session-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
}

.pv-session-vehicle {
  font-family: var(--font-display, sans-serif);
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: 0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pv-ticket {
  color: rgba(255, 255, 255, 0.5);
  font-size: 11px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  flex-shrink: 0;
}

.pv-status-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 6px;
}

.pv-status {
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.1em;
  background: #3a3a3c;
  color: #fff;
}

.pv-status--parked     { background: #1a5490; }
.pv-status--requested,
.pv-status--in_transit { background: #c07a00; }
.pv-status--delivered,
.pv-status--closed     { background: #2e7d32; }
.pv-status--canceled   { background: #5a5a5c; }

.pv-payment {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.55);
  letter-spacing: 0.02em;
}

.pv-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 10px;
}

.pv-codes {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

.pv-code-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.pv-code-label {
  flex: 0 0 auto;
  width: 64px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
}

.pv-code-value {
  flex: 1 1 auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

/* Primary row: the actual POS ticket number — large, lime so it stands out
   as the thing the valet needs to redeem. */
.pv-code-row--primary .pv-code-value--ticket {
  font-size: 18px;
  letter-spacing: 0.06em;
  color: var(--color-chulas-lime, #D6DE23);
}

/* Secondary row: the V-XXXXXX claim/bearer code, kept smaller. */
.pv-code-row--secondary .pv-code-value--claim,
.pv-claim-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 1.5px;
  color: var(--color-chulas-red);
  font-weight: 600;
  font-size: 12px;
}

.pv-copy-btn {
  flex: 0 0 auto;
  background: rgba(255, 255, 255, 0.10);
  color: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 4px 10px;
  border-radius: 6px;
  font-family: var(--font-display, sans-serif);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease, color 120ms ease, border-color 120ms ease;
}

.pv-copy-btn:active {
  transform: translateY(1px);
}

.pv-copy-btn--ghost {
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
}

.pv-copy-btn--copied,
.pv-copy-btn--copied.pv-copy-btn--ghost {
  background: var(--color-chulas-lime, #D6DE23);
  color: #1c1c1e;
  border-color: transparent;
}

.pv-session-actions {
  display: flex;
  gap: 6px;
}

.pv-btn {
  flex: 1;
  padding: 8px 10px;
  border-radius: 4px;
  font-family: var(--font-display, sans-serif);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 120ms ease;
}

.pv-btn:active { transform: translateY(1px); }

.pv-btn--primary {
  background: linear-gradient(135deg, var(--color-chulas-red) 0%, #D84850 100%);
  color: #fff;
  border: 1.5px solid var(--color-chulas-black);
  box-shadow: 0 3px 10px rgba(0,0,0,0);
}

.pv-btn--primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.pv-btn--secondary {
  background: transparent;
  color: var(--color-chulas-red);
  border: 1.5px solid rgba(240, 89, 96, 0.45);
}

.pv-empty {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.45);
  font-style: italic;
  padding: 4px 2px 0;
  margin: 0;
}

/* Loading state */
.pv-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px 16px;
  color: rgba(255, 255, 255, 0.55);
  font-size: 12px;
  letter-spacing: 0.04em;
}

.pv-loading::before {
  content: '';
  width: 14px;
  height: 14px;
  border: 2px solid rgba(240, 89, 96, 0.18);
  border-top-color: var(--color-chulas-red);
  border-radius: 50%;
  animation: pvSpin 0.8s linear infinite;
}

@keyframes pvSpin {
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   SCANNER OVERLAY - sleek, compact reticle
   ========================================================================== */

.pv-scanner {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 2000;
  display: none;
  flex-direction: column;
}

.pv-scanner.open {
  display: flex;
}

.pv-scanner-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}

.pv-scanner-dim {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(
      circle at 50% 48%,
      transparent 0,
      transparent 110px,
      rgba(0, 0, 0, 0.7) 160px,
      rgba(0, 0, 0, 0.88) 100%
    );
  pointer-events: none;
}

.pv-scanner-frame {
  position: absolute;
  top: 48%;
  left: 50%;
  width: 220px;
  height: 220px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.pv-scanner-frame::before,
.pv-scanner-frame::after,
.pv-scanner-frame > span::before,
.pv-scanner-frame > span::after {
  content: '';
  position: absolute;
  width: 26px;
  height: 26px;
  border: 2.5px solid var(--color-chulas-red);
  filter: drop-shadow(0 0 6px rgba(0,0,0,0));
}

.pv-scanner-frame::before {
  top: 0; left: 0;
  border-right: none; border-bottom: none;
  border-top-left-radius: 3px;
}

.pv-scanner-frame::after {
  top: 0; right: 0;
  border-left: none; border-bottom: none;
  border-top-right-radius: 3px;
}

.pv-scanner-frame > span { position: absolute; inset: 0; }

.pv-scanner-frame > span::before {
  bottom: 0; left: 0;
  top: auto;
  border-right: none; border-top: none;
  border-bottom-left-radius: 3px;
}

.pv-scanner-frame > span::after {
  bottom: 0; right: 0;
  top: auto;
  border-left: none; border-top: none;
  border-bottom-right-radius: 3px;
}

/* Laser line sweeping inside reticle */
.pv-scanner-laser {
  position: absolute;
  top: 48%;
  left: calc(50% - 100px);
  width: 200px;
  height: 1.5px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--color-chulas-red),
    transparent
  );
  box-shadow: 0 0 10px var(--color-chulas-red);
  pointer-events: none;
  animation: pvLaser 2.4s ease-in-out infinite;
  transform: translateY(-100px);
}

@keyframes pvLaser {
  0%, 100% { transform: translateY(-100px); opacity: 0.15; }
  50%      { transform: translateY(100px);  opacity: 1; }
}

.pv-scanner-top {
  position: relative;
  z-index: 2;
  padding: max(env(safe-area-inset-top), 14px) 14px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.55), transparent);
}

.pv-scanner-title {
  font-family: var(--font-display, sans-serif);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
}

.pv-scanner-close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.pv-scanner-bottom {
  position: relative;
  z-index: 2;
  margin-top: auto;
  padding: 14px 14px max(env(safe-area-inset-bottom), 16px);
  text-align: center;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.65), transparent);
}

.pv-scanner-hint {
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  margin: 0 0 10px;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7);
  letter-spacing: 0.02em;
}

.pv-scanner-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.85);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.pv-scanner-status--error {
  border-color: rgba(240, 89, 96, 0.55);
  color: #ffb0b5;
}

.pv-scanner-status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-chulas-red);
  box-shadow: 0 0 6px var(--color-chulas-red);
  animation: pvScanDot 1.2s ease-in-out infinite;
}

.pv-scanner-status--error::before {
  animation: none;
  background: #ffb0b5;
  box-shadow: none;
}

@keyframes pvScanDot {
  0%, 100% { opacity: 0.4; }
  50%      { opacity: 1; }
}

/* ── Navigation loading overlay (scan → payment page) ───────────────────── */
#pv-nav-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(35, 31, 32, 0.92);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 9999;
  animation: pvNavFadeIn 180ms ease-out both;
}

.pv-nav-overlay__card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 28px 36px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  min-width: 220px;
}

.pv-nav-overlay__spinner {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.18);
  border-top-color: #fff;
  animation: pvNavSpin 0.8s linear infinite;
}

.pv-nav-overlay__msg {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.2px;
  text-align: center;
}

@keyframes pvNavFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes pvNavSpin {
  to { transform: rotate(360deg); }
}
