/* ============================================
   VaporNexus Kiosk Demo - styles.css
   Dark modern kiosk UI: deep navy, vapor blue accents,
   large touch targets, clean ecommerce polish.
   Prioritizes tablet/kiosk landscape but works on desktop too.
   ============================================ */

:root {
  --bg: #0a0f1c;
  --bg-elev: #0f1626;
  --surface: #121a2b;
  --surface-2: #18223a;
  --surface-3: #1f2a45;
  --text: #e8ecf5;
  --text-muted: #8f9ab3;
  --text-subtle: #5f6b85;
  --accent: #00d1ff;
  --accent-dark: #0099cc;
  --accent-glow: rgba(0, 209, 255, 0.25);
  --neon: #7c5cff;
  --success: #22c55e;
  --success-bg: rgba(34, 197, 94, 0.12);
  --warning: #f59e0b;
  --danger: #ef4444;
  --border: #24314f;
  --border-light: #33446a;

  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 24px;

  --shadow: 0 10px 30px -15px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 20px 60px -15px rgba(0, 0, 0, 0.75);

  font-size: 16px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Kiosk container - centered with subtle frame feel */
.kiosk {
  max-width: 1280px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-elev);
  box-shadow: var(--shadow-lg);
  position: relative;
}

/* Top status / header bar (shown after verification) */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  min-height: 78px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.brand-dot {
  width: 10px;
  height: 10px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 4px var(--accent-glow);
}

.status-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.status-pill.verified {
  background: var(--success-bg);
  border-color: var(--success);
  color: var(--success);
}

.status-pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

/* Cart button in header */
.cart-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 52px;
}

.cart-btn:hover,
.cart-btn:focus-visible {
  border-color: var(--accent);
  background: var(--surface-3);
}

.cart-btn .count {
  background: var(--accent);
  color: #001018;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.85rem;
  min-width: 22px;
  text-align: center;
}

/* Main content area */
.main {
  flex: 1;
  padding: 28px;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Reusable view container */
.view {
  display: none;
  flex: 1;
  flex-direction: column;
}

.view.active {
  display: flex;
}

/* Landing screen */
.landing {
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 32px;
  max-width: 720px;
  margin: 0 auto;
}

.landing h1 {
  font-size: clamp(2.6rem, 6vw, 4.2rem);
  margin: 0;
  letter-spacing: -0.04em;
}

.tagline {
  font-size: 1.35rem;
  color: var(--text-muted);
  max-width: 520px;
  margin: 0 auto;
}

.notice {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: var(--warning);
  padding: 14px 24px;
  border-radius: var(--radius);
  font-size: 0.95rem;
  max-width: 560px;
}

.cta-btn {
  background: var(--accent);
  color: #001018;
  border: none;
  font-size: 1.25rem;
  font-weight: 700;
  padding: 22px 64px;
  border-radius: var(--radius-lg);
  cursor: pointer;
  box-shadow: 0 0 0 1px rgba(0, 209, 255, 0.4),
              0 10px 30px -10px var(--accent-glow);
  transition: transform 0.1s ease, box-shadow 0.2s ease;
  min-width: 320px;
  min-height: 78px;
}

.cta-btn:hover,
.cta-btn:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 0 0 1px rgba(0, 209, 255, 0.6),
              0 20px 40px -10px var(--accent-glow);
}

.cta-btn:active {
  transform: scale(0.985);
}

/* Verification / Scan screens */
.scan-container {
  max-width: 620px;
  margin: 40px auto 0;
  text-align: center;
  width: 100%;
}

.scan-title {
  font-size: 1.85rem;
  margin-bottom: 12px;
}

.scan-subtitle {
  color: var(--text-muted);
  margin-bottom: 32px;
}

.scan-frame {
  background: var(--surface);
  border: 3px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  margin: 0 auto 32px;
  max-width: 460px;
  position: relative;
  overflow: hidden;
}

.scan-frame.scanning::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  height: 4px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--accent),
    transparent
  );
  box-shadow: 0 0 20px var(--accent);
  animation: scanline 1.6s linear infinite;
  top: 35%;
}

@keyframes scanline {
  0% { top: 20%; }
  100% { top: 80%; }
}

.scan-icon {
  font-size: 4.5rem;
  margin-bottom: 16px;
  display: block;
}

.progress {
  height: 6px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
  margin: 24px 0;
}

.progress-bar {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.3s ease;
}

.result-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin: 24px 0;
  text-align: left;
}

.result-box.success {
  border-color: var(--success);
  background: rgba(16, 185, 129, 0.06);
}

.result-title {
  font-size: 1.35rem;
  color: var(--success);
  margin: 0 0 14px;
}

.meta-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}

.meta-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.meta-list li::before {
  content: "✓";
  color: var(--success);
  font-weight: 700;
}

.action-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 24px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 1.05rem;
  font-weight: 600;
  padding: 16px 32px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  min-height: 60px;
  min-width: 160px;
  transition: all 0.1s ease;
  text-decoration: none;
}

.btn:hover,
.btn:focus-visible {
  border-color: var(--accent);
  background: var(--surface-3);
}

.btn-primary {
  background: var(--accent);
  color: #001018;
  border-color: var(--accent);
  font-weight: 700;
}

.btn-primary:hover,
.btn-primary:focus-visible {
  background: #00b8e6;
  border-color: #00b8e6;
}

.btn-large {
  font-size: 1.15rem;
  padding: 20px 48px;
  min-height: 72px;
}

.btn-danger {
  border-color: rgba(239, 68, 68, 0.4);
  color: var(--danger);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
}

.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--text);
}

/* Storefront */
.store-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.store-header h2 {
  margin: 0;
  font-size: 1.7rem;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 20px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filter-group label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-subtle);
  font-weight: 600;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.1s ease;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
}

.chip.active,
.chip:hover {
  background: var(--accent);
  color: #001018;
  border-color: var(--accent);
}

.search-input {
  width: 260px;
  min-width: 200px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

select.filter-select {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  min-width: 170px;
  cursor: pointer;
}

.price-range {
  display: flex;
  gap: 8px;
  align-items: center;
}

.price-range input {
  width: 92px;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
}

/* Product grid */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(228px, 1fr));
  gap: 20px;
  flex: 1;
  align-content: start;
}

.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.1s ease, border-color 0.1s ease;
}

.product-card:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
}

.product-image {
  width: 100%;
  height: 168px;
  object-fit: cover;
  background: var(--bg);
  display: block;
}

.product-info {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.product-brand {
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.product-name {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.2;
}

.product-meta {
  font-size: 0.9rem;
  color: var(--text-muted);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.product-meta span {
  background: var(--surface-2);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.8rem;
}

.product-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  flex: 1;
  margin: 4px 0 0;
}

.product-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  gap: 12px;
}

.product-price {
  font-size: 1.25rem;
  font-weight: 700;
}

.add-btn {
  background: var(--accent);
  color: #001018;
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  min-height: 44px;
  transition: filter 0.1s ease;
}

.add-btn:hover {
  filter: brightness(0.95);
}

/* Featured badge */
.badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: var(--neon);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 6px;
  z-index: 2;
  letter-spacing: 0.03em;
}

.product-image-wrap {
  position: relative;
}

/* Cart drawer */
.cart-drawer {
  position: fixed;
  top: 0;
  right: -420px;
  width: 400px;
  max-width: 92vw;
  height: 100%;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  display: flex;
  flex-direction: column;
  transition: right 0.28s ease;
}

.cart-drawer.open {
  right: 0;
}

.cart-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  font-size: 1.15rem;
}

.cart-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.6rem;
  cursor: pointer;
  line-height: 1;
}

.cart-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}

.cart-item {
  display: flex;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.cart-item:last-child {
  border-bottom: none;
}

.cart-item-info {
  flex: 1;
  min-width: 0;
}

.cart-item-name {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 2px;
}

.cart-item-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.cart-qty {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.qty-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
}

.qty-btn:hover {
  background: var(--surface-3);
}

.cart-item-price {
  font-weight: 700;
  white-space: nowrap;
  text-align: right;
}

.remove-btn {
  background: none;
  border: none;
  color: var(--danger);
  font-size: 0.75rem;
  cursor: pointer;
  padding: 4px;
  margin-top: 4px;
}

.cart-footer {
  padding: 20px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg-elev);
}

.cart-subtotal {
  display: flex;
  justify-content: space-between;
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.cart-tax {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.cart-total {
  display: flex;
  justify-content: space-between;
  font-size: 1.15rem;
  font-weight: 700;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.cart-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Checkout view */
.checkout-container {
  max-width: 620px;
  margin: 0 auto;
  width: 100%;
}

.checkout-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.form-group {
  margin-bottom: 18px;
}

.form-group.full {
  grid-column: 1 / -1;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-subtle);
  margin-bottom: 6px;
  font-weight: 600;
}

.form-group input {
  width: 100%;
  padding: 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 1.05rem;
}

.form-group input:focus {
  outline: none;
  border-color: var(--accent);
}

.warning-box {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.5);
  color: var(--warning);
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  margin: 20px 0;
}

.order-summary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.order-summary h4 {
  margin: 0 0 12px;
}

.summary-line {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}

.summary-line:last-child {
  border-bottom: none;
  font-weight: 700;
  font-size: 1.1rem;
  padding-top: 10px;
}

/* Success / Receipt screen */
.success-screen {
  text-align: center;
  max-width: 560px;
  margin: 60px auto 0;
}

.success-icon {
  font-size: 5rem;
  color: var(--success);
  margin-bottom: 16px;
}

.success-title {
  font-size: 2rem;
  margin: 0 0 8px;
}

.receipt-options {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 32px 0;
}

.receipt-option {
  padding: 16px 28px;
  border: 2px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 600;
  min-width: 120px;
  transition: all 0.1s ease;
  color: white;
}

.receipt-option:hover,
.receipt-option:focus-visible {
  border-color: var(--accent);
}

.receipt-option.selected {
  border-color: var(--accent);
  background: rgba(0, 209, 255, 0.1);
}

.final-message {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-bottom: 32px;
}

/* Modal (for idle timeout, confirmations) */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 300;
  padding: 20px;
}

.modal.open {
  display: flex;
}

.modal-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 100%;
  max-width: 420px;
  text-align: center;
}

.modal-content h3 {
  margin-top: 0;
}

.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  justify-content: center;
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-3);
  color: var(--text);
  border: 1px solid var(--border-light);
  padding: 14px 26px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-weight: 600;
  z-index: 400;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
}

/* Processing animation */
.processing {
  text-align: center;
  padding: 60px 20px;
}

.spinner {
  width: 64px;
  height: 64px;
  border: 5px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto 24px;
  animation: spin 0.9s linear infinite;
}

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

/* Utility */
.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-24 { margin-top: 24px; }

.compliance {
  font-size: 0.75rem;
  color: var(--text-subtle);
  text-align: center;
  margin-top: auto;
  padding-top: 20px;
}

/* Responsive tweaks for smaller screens */
@media (max-width: 768px) {
  .kiosk {
    box-shadow: none;
  }
  .main {
    padding: 18px;
  }
  .product-grid {
    grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  }
  .cart-drawer {
    width: 100%;
    max-width: 100%;
  }
  .checkout-grid {
    grid-template-columns: 1fr;
  }
}

/* Targeted mobile fixes for narrow phones (under 600px) */
@media (max-width: 600px) {
  /* Header: vertical mobile layout - no absolute, no edge touch, no horiz scroll */
  .header {
    display: grid;
    grid-template-areas:
      "brand cart"
      "status status";
    grid-template-columns: 1fr auto;
    align-items: center;
    padding: 8px 14px; /* 14px side padding, nothing touches edges */
    min-height: auto;
    gap: 6px;
    position: sticky; /* keep, but no abs */
    top: 0;
    z-index: 50;
  }

  .brand {
    grid-area: brand;
    font-size: 1.1rem;
    gap: 8px;
    /* logo left in its cell */
  }

  .status-bar {
    grid-area: status;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: nowrap;
    justify-content: space-between;
    width: 100%;
    margin-top: 0;
  }

  .cart-btn {
    grid-area: cart;
    padding: 6px 10px;
    font-size: 0.85rem;
    min-height: 36px;
    /* keep tappable, away from edge via header padding */
  }

  .status-pill {
    font-size: 0.65rem;
    padding: 3px 6px;
    flex: 1 1 0;
    min-width: 0;
    justify-content: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .status-pill .dot {
    width: 6px;
    height: 6px;
  }

  /* Storefront mobile polish: one column cards, stacked filters, full width inputs, side padding */
  .main {
    padding: 14px; /* consistent 14px side padding */
  }

  .product-grid {
    grid-template-columns: 1fr; /* stay one column on narrow phones */
    gap: 12px;
  }

  .filters {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 16px;
  }

  .filter-group {
    width: 100%;
  }

  .search-input {
    width: 100%;
    min-width: 0;
  }

  select.filter-select {
    width: 100%;
    min-width: 0;
  }

  .price-range {
    width: 100%;
    gap: 6px;
  }

  .price-range input {
    flex: 1;
    min-width: 60px;
    width: auto;
  }

  .filter-chips {
    gap: 6px;
  }

  .chip {
    padding: 6px 12px;
    font-size: 0.8rem;
    min-height: 36px;
  }

  /* Ensure no horizontal scrolling on page */
  body,
  .kiosk {
    overflow-x: hidden;
  }

  /* Store header and other polish */
  .store-header h2 {
    font-size: 1.4rem;
  }
}

/* Even tighter for 360px and below - stack price if needed */
@media (max-width: 360px) {
  .price-range {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }

  .price-range input {
    width: 100%;
    min-width: 0;
  }

  .price-range span {
    display: none; /* hide the – on very narrow to save space; labels imply range */
  }
}

/* High contrast focus for accessibility */
button:focus-visible,
input:focus-visible,
select:focus-visible,
.chip:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* Per-field inline validation errors (shown on blur for checkout) */
.field-error {
  color: var(--danger);
  font-size: 0.75rem;
  margin-top: 4px;
  min-height: 1em;
  display: none;
}