/* --- BASE PWA STYLES --- */
:root {
  --tk-text: #223126;
  --tk-muted: #4b5f5b;
  --tk-line: rgba(34, 28, 20, 0.2);
  --tk-primary: #f6c232;
  --color-yellow-local: #f6c232;
}

body {
  background-color: #a8afad !important;
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif !important;
  color: #1a2e1a !important;
  margin: 0;
  padding-bottom: 60px;
  /* Space for bottom nav */
}

.clay-btn {
  --clay-border-radius: 1rem;
  --clay-shadow-outset: 4px 4px 8px 0 rgba(0, 0, 0, .25);
  --clay-shadow-inset-primary: -8px -8px 12px 0 rgba(0, 0, 0, .2);
  --clay-shadow-inset-secondary: 8px 8px 12px 0 hsla(0, 0%, 100%, .3);
  --clay-background: var(--color-yellow-local);
}

.pwa-header {
  background-color: #f4ebce;
  padding: 15px 20px;
  text-align: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pwa-header h1 {
  font-family: "Cormorant Garamond", serif !important;
  margin: 0;
  font-size: 1.4rem;
  font-weight: 700;
  color: #223126;
}

.pwa-content {
  padding: 10px;
}

/* Bottom Navigation */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background-color: #f4ebce;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
  display: flex;
  justify-content: space-around;
  padding: 8px 0;
  padding-bottom: env(safe-area-inset-bottom, 8px);
  z-index: 1000;
  border-top: 1px solid rgba(139, 125, 101, 0.2);
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: #889f98;
  font-size: 0.75rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.bottom-nav-item i {
  font-size: 1.25rem;
  margin-bottom: 4px;
}

.bottom-nav-item.active {
  color: #f6c232;
}

.gate-myt-container {
  position: relative;
  z-index: 1;
  width: 100%;
  margin: 0 auto;
  border: 4px solid transparent;
  border-radius: 22px;
  corner-shape: scoop;
  box-shadow: inset 4px 4px 8px #6d5e4678, inset -4px -4px 8px #8b7d654d, 0 5px 15px rgba(0, 0, 0, 0.05);
  background:
    linear-gradient(rgba(248, 240, 214, 0.98), rgba(232, 208, 155, 0.98)) padding-box,
    linear-gradient(#c1b59b, #c1b59b) border-box,
    radial-gradient(circle at 50% 18%, rgba(255, 249, 233, 0.94), rgba(242, 228, 188, 0.98) 48%, rgba(228, 208, 155, 0.98) 100%);
  overflow: hidden;
}

/* Custom PWA Install Banner */
.pwa-install-banner {
  position: fixed;
  top: -100px;
  left: 0;
  right: 0;
  margin: 14px;
  background: #0f172a;
  color: white;
  border-radius: 16px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  z-index: 10000;
  transition: top 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.pwa-install-banner.show {
  top: env(safe-area-inset-top, 10px);
}

.pwa-install-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pwa-install-logo {
  width: 44px;
  height: 44px;
  background: transparent;
  border-radius: 12px;
  padding: 2px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.pwa-install-logo img {
  max-width: 100%;
  max-height: 100%;
}

.pwa-install-text {
  display: flex;
  flex-direction: column;
}

.pwa-install-title {
  font-weight: 700;
  font-size: 0.95rem;
}

.pwa-install-subtitle {
  font-size: 0.75rem;
  color: #94a3b8;
}

.pwa-install-btn {
  background: #2563eb;
  color: white;
  border: none;
  padding: 8px 18px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
}

.pwa-install-close {
  color: #64748b;
  background: none;
  border: none;
  font-size: 1.4rem;
  padding: 0 6px 0 0;
  cursor: pointer;
}

/* --- CAMERA PAGE (SCANNER) STYLES --- */
body.page-camera {
  padding-bottom: 0 !important;
  /* Hide padding so video takes full screen */
}

.page-camera .pwa-header {
  display: none !important;
}

.page-camera .pwa-content {
  padding: 0;
  height: calc(100vh - 65px);
  /* height minus bottom nav */
  overflow: hidden;
  position: relative;
  background: #05070b;
}

.camera-shell {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.preview-frame {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.camera-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

.camera-overlay::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to right, rgba(5, 7, 11, .65) 0, rgba(5, 7, 11, .65) 15%, transparent 15%, transparent 85%, rgba(5, 7, 11, .65) 85%, rgba(5, 7, 11, .65) 100%),
    linear-gradient(to bottom, rgba(5, 7, 11, .65) 0, rgba(5, 7, 11, .65) 20%, transparent 20%, transparent 80%, rgba(5, 7, 11, .65) 80%, rgba(5, 7, 11, .65) 100%);
}

.scan-guide {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(72vw, 280px);
  aspect-ratio: 1/1;
  transform: translate(-50%, -50%);
  border: 2px solid rgba(255, 255, 255, .92);
  border-radius: 22px;
  box-shadow: 0 0 0 999px rgba(0, 0, 0, 0);
  transition: border-color .18s ease, transform .18s ease;
}

.scan-guide::before,
.scan-guide::after {
  content: "";
  position: absolute;
  left: 12%;
  right: 12%;
  height: 2px;
  background: rgba(34, 197, 94, .92);
  box-shadow: 0 0 14px rgba(34, 197, 94, .55);
}

.scan-guide::before {
  top: 28%;
}

.scan-guide::after {
  bottom: 28%;
}

.scan-line {
  position: absolute;
  left: 10%;
  right: 10%;
  top: 18%;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(34, 197, 94, 0), rgba(34, 197, 94, .95), rgba(34, 197, 94, 0));
  box-shadow: 0 0 18px rgba(34, 197, 94, .65);
  animation: scanSweep 2.1s linear infinite;
}

.scan-corners {
  position: absolute;
  inset: 0;
}

.scan-corners span {
  position: absolute;
  width: 32px;
  height: 32px;
  border-color: #60a5fa;
  border-style: solid;
}

.scan-corners span:nth-child(1) {
  top: -2px;
  left: -2px;
  border-width: 5px 0 0 5px;
  border-top-left-radius: 22px;
}

.scan-corners span:nth-child(2) {
  top: -2px;
  right: -2px;
  border-width: 5px 5px 0 0;
  border-top-right-radius: 22px;
}

.scan-corners span:nth-child(3) {
  bottom: -2px;
  left: -2px;
  border-width: 0 0 5px 5px;
  border-bottom-left-radius: 22px;
}

.scan-corners span:nth-child(4) {
  bottom: -2px;
  right: -2px;
  border-width: 0 5px 5px 0;
  border-bottom-right-radius: 22px;
}

.scan-guide-label {
  position: absolute;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%);
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(15, 23, 42, .72);
  color: #fff;
  font-size: .8rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  backdrop-filter: blur(4px);
  z-index: 20;
  white-space: nowrap;
}

.camera-status {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: .8rem;
  font-weight: 700;
  z-index: 20;
  white-space: nowrap;
}

.camera-shell.detected .scan-guide {
  border-color: rgba(250, 204, 21, .98);
  transform: translate(-50%, -50%) scale(1.02);
}

.camera-shell.detected .scan-line {
  animation-duration: .55s;
}

#splash-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #05070b;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  transition: opacity 0.6s ease-out, visibility 0.6s ease-out;
}

.splash-logo {
  width: 140px;
  margin-bottom: 30px;
  animation: pulseLogo 2s infinite;
}

.splash-title {
  color: #f6c232;
  font-size: 1.8rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  text-transform: uppercase;
  text-align: center;
}

.splash-subtitle {
  color: #94a3b8;
  font-size: 0.95rem;
  font-weight: 500;
  text-align: center;
  max-width: 80%;
}

.dcf-accents {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 8px;
  background: linear-gradient(90deg, #efbc18, #f6c232, #f59e0b);
}

@keyframes pulseLogo {
  0% {
    transform: scale(0.95);
    opacity: 0.9;
  }

  50% {
    transform: scale(1.05);
    opacity: 1;
    filter: drop-shadow(0 0 12px rgba(246, 194, 50, 0.4));
  }

  100% {
    transform: scale(0.95);
    opacity: 0.9;
  }
}

@keyframes scanSweep {
  0% {
    top: 18%;
    opacity: .45
  }

  50% {
    top: 78%;
    opacity: 1
  }

  100% {
    top: 18%;
    opacity: .45
  }
}

/* --- DATA/FORM PAGE STYLES --- */
.section-card {
  padding: 16px;
  margin-bottom: 12px;
  background: #f8fafc;
  border-radius: 14px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.form-label {
  font-weight: 700;
  font-size: .78rem;
  letter-spacing: .02em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.form-control {
  width: 92%;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--tk-line);
  margin-bottom: 12px;
  font-size: .9rem;
}

.output-box {
  margin-top: 12px;
  padding: 16px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  color: #334155;
  font-size: .85rem;
  max-height: 350px;
  overflow: auto;
}

.btn-corp {
  display: inline-block;
  padding: 12px 24px;
  font-weight: 700;
  font-size: .95rem;
  border-radius: 12px;
  background: #0f172a;
  color: #fff;
  text-align: center;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15);
  transition: all .2s ease;
  --clay-border-radius: 1rem;
  --clay-shadow-outset: 4px 4px 8px 0 rgba(0, 0, 0, .25);
  --clay-shadow-inset-primary: -8px -8px 12px 0 rgba(0, 0, 0, .2);
  --clay-shadow-inset-secondary: 8px 8px 12px 0 hsla(0, 0%, 100%, .3);
  --clay-background: #ffd014;
  border-radius: var(--clay-border-radius, 32px);
  border: none;
  box-shadow: var(--clay-shadow-outset, 8px 8px 16px 0 rgba(0, 0, 0, .25)), inset var(--clay-shadow-inset-primary, -8px -8px 16px 0 rgba(0, 0, 0, .25)), inset var(--clay-shadow-inset-secondary, 8px 8px 16px 0 hsla(0, 0%, 100%, .2));
}

.btn-corp:hover {
  background: #1e293b;
  transform: translateY(-1px);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.9rem;
  margin-top: 10px;
}

.status-badge.valid {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.status-badge.invalid {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.result-success {
  background: #ecfdf5;
  border-color: #10b981;
  color: #065f46;
}

.result-error {
  background: #fef2f2;
  border-color: #ef4444;
  color: #991b1b;
}

.status-badge.success {
  background: #10b981;
  color: white;
}

.status-badge.error {
  background: #ef4444;
  color: white;
}