/* ============================================================
   Cosmos Smart Parking — Guest Portal Styles
   ============================================================ */

:root {
  --bg-dark:    #0a0f1e;
  --bg-card:    #ffffff;
  --bg-soft:    #f4f7fc;
  --line:       #e2eaf5;
  --text:       #0a1628;
  --muted:      #64748b;
  --accent:     #1741c4;
  --accent-h:   #1234a8;
  --accent-2:   #f59e0b;
  --danger:     #dc2626;
  --success:    #0d6e63;
  --radius-lg:  22px;
  --radius-md:  14px;
  --radius-sm:  10px;
  --shadow:     0 24px 64px rgba(10, 15, 30, 0.13);
  --font-head:  'Unbounded', sans-serif;
  --font-body:  'DM Sans', sans-serif;
}

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

html, body {
  width: 100%;
  overflow-x: hidden;
}

body {
  font-family: var(--font-body);
  background: linear-gradient(170deg, var(--bg-dark) 0, var(--bg-dark) 220px, #e8f0fb 220px 100%);
  color: var(--text);
  min-height: 100vh;
}

img { max-width: 100%; height: auto; display: block; }

/* ── TOPBAR ── */
.topbar {
  padding: 22px 28px;
}

.brand-wrap {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: #fff;
}

.brand-mark {
  width: 46px; height: 46px;
  border-radius: 13px;
  background: linear-gradient(135deg, #2855d8, var(--accent-2));
  display: grid; place-items: center;
  font-size: 22px; font-weight: 900;
  box-shadow: 0 8px 24px rgba(40,85,216,.35);
  color: #fff;
}

.brand {
  font-family: var(--font-head);
  font-size: 18px;
  font-weight: 900;
  letter-spacing: -.02em;
  line-height: 1.1;
}

.brand-sub {
  font-size: 11px;
  color: #90aad4;
  text-transform: uppercase;
  letter-spacing: .16em;
}

/* ── MAIN CONTAINER ── */
.container {
  width: min(100% - 32px, 960px);
  margin: 0 auto 56px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  box-shadow: var(--shadow);
}

/* ── HERO ── */
.hero { margin-bottom: 32px; }

.hero h1 {
  font-family: var(--font-head);
  font-size: clamp(32px, 5vw, 52px);
  font-weight: 900;
  letter-spacing: -.03em;
  line-height: 1.05;
  color: var(--text);
}

.subtitle {
  margin-top: 12px;
  font-size: 16px;
  color: var(--muted);
  font-weight: 500;
  line-height: 1.5;
}

/* ── SECTIONS ── */
.plate-box,
.keyboard-box,
.photo-search-box {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 16px;
  position: relative;
}

.plate-label,
.keyboard-title {
  font-family: var(--font-head);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 16px;
  display: block;
}

/* ── PLATE INPUT ── */
.plate-input-wrap {
  background: #fff;
  border: 2px solid #c7d9f5;
  border-radius: var(--radius-md);
  padding: 12px 18px;
  transition: border-color .2s;
}

.plate-input-wrap:focus-within {
  border-color: var(--accent);
}

#plateInput {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--font-head);
  font-size: 32px;
  font-weight: 900;
  letter-spacing: .06em;
  text-align: center;
  color: var(--text);
}

#plateInput::placeholder {
  font-size: 16px;
  font-family: var(--font-body);
  font-weight: 500;
  letter-spacing: 0;
  color: #b0bdd0;
}

/* ── AUTOCOMPLETE ── */
.autocomplete-dropdown {
  position: absolute;
  top: calc(100% - 8px);
  left: 24px;
  right: 24px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 32px rgba(10,15,30,.12);
  z-index: 100;
  overflow: hidden;
}

.autocomplete-item {
  padding: 14px 18px;
  font-family: var(--font-head);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .05em;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
  transition: background .15s;
}

.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover { background: #f0f6ff; color: var(--accent); }

/* ── BUTTONS ── */
.plate-actions,
.guest-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

button {
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 15px;
  transition: all .18s ease;
  min-height: 48px;
}

.btn-primary {
  flex: 1 1 200px;
  padding: 14px 20px;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .02em;
  box-shadow: 0 8px 24px rgba(23,65,196,.28);
}

.btn-primary:hover {
  background: var(--accent-h);
  transform: translateY(-1px);
  box-shadow: 0 12px 32px rgba(23,65,196,.35);
}

.btn-primary:disabled {
  opacity: .6;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  flex: 1 1 140px;
  padding: 12px 16px;
  background: #fff;
  color: var(--muted);
  border: 1px solid var(--line);
}

.btn-secondary:hover {
  background: var(--bg-soft);
  color: var(--text);
}

.btn-ghost {
  flex: 1 1 200px;
  padding: 14px 20px;
  background: transparent;
  color: var(--accent);
  border: 2px solid #c7d9f5;
  font-family: var(--font-head);
  font-size: 13px;
  letter-spacing: .02em;
}

.btn-ghost:hover {
  background: #f0f6ff;
  border-color: var(--accent);
}

.btn-pay {
  width: 100%;
  margin-top: 20px;
  padding: 18px;
  background: linear-gradient(135deg, var(--accent), #2855d8);
  color: #fff;
  font-family: var(--font-head);
  font-size: 15px;
  letter-spacing: .02em;
  box-shadow: 0 10px 30px rgba(23,65,196,.3);
}

.btn-pay:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 40px rgba(23,65,196,.38);
}

.btn-pay:disabled {
  opacity: .6;
  cursor: not-allowed;
  transform: none;
}

.btn-not-my-car {
  width: 100%;
  margin-top: 10px;
  padding: 12px;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  font-size: 14px;
}

.btn-not-my-car:hover {
  background: var(--bg-soft);
  color: var(--text);
}

.btn-select {
  width: 100%;
  margin-top: 12px;
  padding: 13px;
  background: var(--success);
  color: #fff;
  font-family: var(--font-head);
  font-size: 13px;
  letter-spacing: .02em;
}

.btn-select:hover { background: #0b5c52; }

/* ── KEYBOARD ── */
.keyboard-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-bottom: 8px;
}

.keyboard-row.digits {
  grid-template-columns: repeat(10, 1fr);
}

.keyboard-row button {
  padding: 14px 0;
  background: #fff;
  border: 1px solid var(--line);
  font-family: var(--font-head);
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  min-height: 50px;
  border-radius: var(--radius-sm);
}

.keyboard-row button:hover {
  background: #f0f6ff;
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

.keyboard-row button:active {
  transform: translateY(0);
  background: #e5eeff;
}

/* ── PHOTO SEARCH ── */
.photo-search-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.photo-search-head h2 {
  font-family: var(--font-head);
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -.02em;
  margin-bottom: 4px;
}

.photo-search-head p {
  font-size: 14px;
  color: var(--muted);
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.photo-loading {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px;
  color: var(--muted);
  font-weight: 500;
}

.car-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(10,15,30,.06);
  transition: transform .2s, box-shadow .2s;
}

.car-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(10,15,30,.1);
}

.car-card img {
  width: 100%;
  height: 160px;
  object-fit: cover;
}

.car-card-body { padding: 14px; }

.car-card-time {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 6px;
}

.car-card-amount {
  font-family: var(--font-head);
  font-size: 18px;
  font-weight: 900;
  color: var(--text);
  margin-bottom: 2px;
}

.car-card-status {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}

/* ── RESULT CARD ── */
#resultSection { margin-top: 20px; }

.result-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: 0 8px 32px rgba(10,15,30,.07);
}

.result-title {
  font-family: var(--font-head);
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -.02em;
  margin-bottom: 20px;
  color: var(--text);
}

.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
}

.result-row:last-of-type { border-bottom: none; }
.result-row .lbl { color: var(--muted); font-weight: 500; }
.result-row .val { font-weight: 700; color: var(--text); }

.result-photo {
  width: 100%;
  border-radius: var(--radius-md);
  margin: 16px 0;
  max-height: 260px;
  object-fit: cover;
}

.result-amount {
  font-family: var(--font-head);
  font-size: 36px;
  font-weight: 900;
  color: var(--accent);
  letter-spacing: -.02em;
  text-align: center;
  padding: 20px 0 8px;
}

.result-amount-label {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 4px;
}

/* Phone input for receipt */
.phone-wrap {
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--bg-soft);
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
}

.phone-wrap label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 8px;
}

.phone-wrap input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-family: var(--font-body);
  font-size: 16px;
  outline: none;
  background: #fff;
  transition: border-color .2s;
}

.phone-wrap input:focus {
  border-color: var(--accent);
}

.phone-hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

/* ── MESSAGES ── */
.msg-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius-md);
  padding: 14px 18px;
  color: var(--danger);
  font-weight: 600;
  font-size: 14px;
  margin-top: 16px;
}

.msg-info {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-md);
  padding: 14px 18px;
  color: var(--accent);
  font-weight: 600;
  font-size: 14px;
  margin-top: 16px;
}

/* ── UTILITY ── */
.hidden { display: none !important; }

/* ── RESPONSIVE ── */
@media (max-width: 640px) {
  body {
    background: linear-gradient(170deg, var(--bg-dark) 0, var(--bg-dark) 160px, #e8f0fb 160px 100%);
  }

  .topbar { padding: 16px; }

  .container {
    width: calc(100% - 20px);
    padding: 22px 18px;
    border-radius: 18px;
  }

  .hero h1 { font-size: 30px; }

  .plate-box,
  .keyboard-box,
  .photo-search-box { padding: 18px 16px; }

  #plateInput { font-size: 26px; }

  .keyboard-row { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .keyboard-row.digits { grid-template-columns: repeat(5, 1fr); }

  .keyboard-row button { font-size: 14px; min-height: 46px; padding: 12px 0; }

  .plate-actions,
  .guest-actions { flex-direction: column; }

  .btn-primary,
  .btn-ghost,
  .btn-secondary { flex: none; width: 100%; }

  .photo-grid { grid-template-columns: 1fr; }

  .result-card { padding: 20px 18px; }
  .result-amount { font-size: 30px; }
}

@media (max-width: 400px) {
  .keyboard-row { grid-template-columns: repeat(3, 1fr); }
  .keyboard-row.digits { grid-template-columns: repeat(5, 1fr); }
}
