:root {
  --primary: #1d63ed;
  --primary-dark: #1550c7;
  --navy: #0f2a5c;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e5e9f0;
  --bg: #f3f6fb;
  --card: #ffffff;
  --green: #16a34a;
  --green-bg: #eafaf0;
  --green-border: #bbf0cd;
  --blue-bg: #eaf1ff;
  --error: #dc2626;
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.hidden { display: none !important; }

/* Topbar — hidden on mobile, full width on desktop */
.topbar {
  display: none;
  width: 100%;
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(15, 42, 92, 0.04);
}

.topbar-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* =========================================================
   MOBILE (default) — one screen at a time
   ========================================================= */

.layout {
  flex: 1 0 auto;
  max-width: 440px;
  margin: 0 auto;
  padding: 20px 16px 40px;
  width: 100%;
}

/* Screen switching via body class */
#detailsView, #emptyView { display: none; }
body.has-case #searchView { display: none; }
body.has-case #detailsView { display: block; }

/* ---------- Brand ---------- */
.brand { text-align: center; padding: 14px 0 20px; }
.brand-logo-img {
  max-width: 190px;
  height: auto;
  margin: 0 auto 12px;
  display: block;
}
.brand-name { font-size: 1.55rem; font-weight: 800; color: var(--navy); margin-top: 4px; letter-spacing: -0.02em; }
.brand-sub { color: var(--muted); font-size: 0.9rem; }

/* ---------- Card ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(15, 42, 92, 0.05);
}

.card-heading { text-align: center; font-size: 1.3rem; font-weight: 700; color: var(--navy); }
.card-desc { text-align: center; color: var(--muted); font-size: 0.85rem; margin: 4px 8px 18px; }

/* ---------- Form ---------- */
label { display: block; font-size: 0.82rem; font-weight: 500; margin-bottom: 6px; }

.field { position: relative; margin-bottom: 14px; }
.field-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; color: var(--muted); pointer-events: none;
}
.field input {
  width: 100%; height: 46px;
  padding: 0 44px 0 40px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit; font-size: 0.92rem;
  background: #fff;
}
.field input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(29, 99, 237, 0.15); }

.eye-btn {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: none; border: none; padding: 6px; cursor: pointer; color: var(--muted);
}
.eye-btn svg { width: 18px; height: 18px; display: block; }

.btn {
  width: 100%; height: 48px; margin-top: 4px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: 10px;
  background: var(--primary); color: #fff;
  font: inherit; font-weight: 600; font-size: 0.95rem;
  cursor: pointer; transition: background 0.15s;
}
.btn svg { width: 18px; height: 18px; }
.btn:hover { background: var(--primary-dark); }
.btn:disabled { opacity: 0.7; cursor: wait; }

.turnstile-wrap {
  margin: 14px 0 8px;
  display: flex;
  justify-content: flex-start;
  min-height: 65px;
}

.error { color: var(--error); font-size: 0.85rem; margin: -4px 0 12px; }

.note {
  display: flex; align-items: center; gap: 10px;
  margin-top: 16px; padding: 0 6px;
  font-size: 0.8rem; color: var(--muted);
}
.note svg { width: 18px; height: 18px; flex-shrink: 0; }


.secure-box {
  display: flex; align-items: center; gap: 12px;
  background: var(--blue-bg);
  border-radius: 14px; padding: 14px 16px;
}
.secure-icon {
  width: 36px; height: 36px; border-radius: 50%;
  background: #fff; color: var(--primary);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.secure-icon svg { width: 20px; height: 20px; }
.secure-box strong { display: block; font-size: 0.88rem; color: var(--navy); }
.secure-box span { font-size: 0.78rem; color: var(--muted); }

/* ---------- Details ---------- */
.details-mobile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 0 14px;
}
.details-mobile-logo {
  height: 28px;
  width: auto;
  object-fit: contain;
  display: block;
}
.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: none; cursor: pointer;
  color: var(--primary); font: inherit; font-size: 0.88rem; font-weight: 600;
  padding: 4px 0;
}
.back-link svg { width: 16px; height: 16px; }

.small-label { font-size: 0.8rem; color: var(--muted); }
.file-row { display: flex; align-items: center; gap: 8px; }
.file-number { font-size: 1.5rem; font-weight: 800; color: var(--navy); letter-spacing: 0.01em; }
.copy-btn { background: none; border: none; cursor: pointer; color: var(--primary); padding: 4px; }
.copy-btn svg { width: 18px; height: 18px; display: block; }
.copy-btn.copied { color: var(--green); }
.updated { font-size: 0.78rem; color: var(--muted); margin-bottom: 14px; }

.status-box {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--green-bg); border: 1px solid var(--green-border);
  border-radius: 12px; padding: 14px;
}
.status-check {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--green); color: #fff;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.status-check svg { width: 18px; height: 18px; }
.status-title { font-weight: 700; font-size: 1.05rem; color: #14532d; }
.status-desc { font-size: 0.8rem; color: #3f6b50; }

.status-box.blue { background: var(--blue-bg); border-color: #c9dbff; }
.status-box.blue .status-check { background: var(--primary); }
.status-box.blue .status-title { color: var(--navy); }
.status-box.blue .status-desc { color: var(--muted); }

/* Stepper */
.stepper { display: flex; margin-top: 18px; }
.step { flex: 1; text-align: center; position: relative; }
.step::before {
  content: ""; position: absolute; top: 11px; left: -50%; width: 100%; height: 2px;
  background: var(--border); z-index: 0;
}
.step:first-child::before { display: none; }
.step.done::before { background: var(--primary); }
.step-dot {
  position: relative; z-index: 1;
  width: 24px; height: 24px; border-radius: 50%; margin: 0 auto 6px;
  background: #e2e8f0; color: #fff;
  display: flex; align-items: center; justify-content: center;
}
.step.done .step-dot { background: var(--primary); }
.step-dot svg { width: 13px; height: 13px; }
.step-label { font-size: 0.7rem; color: var(--muted); }
.step.done .step-label { color: var(--text); font-weight: 500; }

/* Sections */
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.section-head .section-title { margin-bottom: 0; }
.section-title { font-size: 0.95rem; font-weight: 700; color: var(--navy); margin-bottom: 8px; }

.badge { font-size: 0.72rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; }
.badge.done { background: var(--green-bg); color: var(--green); }
.badge.pending { background: var(--blue-bg); color: var(--primary); }

.info-row { display: flex; gap: 12px; align-items: flex-start; padding: 8px 0; }
.info-icon { width: 20px; height: 20px; color: #475569; flex-shrink: 0; margin-top: 2px; }
.info-icon.blue { color: var(--primary); }
.info-label { display: block; font-size: 0.75rem; color: var(--muted); }
.info-value { font-size: 0.92rem; font-weight: 600; }

/* Photos */
.photos-block { margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--border); }
.photos-title { font-size: 0.9rem; font-weight: 700; color: var(--navy); margin-bottom: 10px; }
.photos-title span { color: var(--muted); font-weight: 500; }

.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

.photo {
  position: relative; aspect-ratio: 1;
  border: 1px solid var(--border); border-radius: 10px;
  background: linear-gradient(135deg, #eef2f7, #e2e8f0);
  color: #94a3b8; cursor: pointer; overflow: hidden; padding: 0;
  display: flex; align-items: center; justify-content: center;
}
.photo:hover { border-color: var(--primary); }
.photo .ph-icon { width: 34px; height: 34px; }
.photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo .expand {
  position: absolute; right: 5px; bottom: 5px;
  width: 22px; height: 22px; border-radius: 6px;
  background: rgba(15, 23, 42, 0.55); color: #fff;
  display: flex; align-items: center; justify-content: center;
}
.photo .expand svg { width: 12px; height: 12px; }

.no-photos { grid-column: 1 / -1; font-size: 0.85rem; color: var(--muted); }

.info-note {
  display: flex; gap: 10px; align-items: flex-start;
  margin-top: 12px; padding: 12px;
  background: var(--blue-bg); border-radius: 10px;
  font-size: 0.8rem; color: #334155;
}
.info-note svg { width: 18px; height: 18px; color: var(--primary); flex-shrink: 0; }

/* Modal */
.modal {
  position: fixed; inset: 0; z-index: 10;
  background: rgba(15, 23, 42, 0.75);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal-box { position: relative; width: 100%; max-width: 640px; background: #fff; border-radius: 16px; padding: 14px; }
.modal-photo {
  aspect-ratio: 4 / 3; border-radius: 10px; overflow: hidden;
  background: linear-gradient(135deg, #eef2f7, #e2e8f0); color: #94a3b8;
  display: flex; align-items: center; justify-content: center;
}
.modal-photo svg { width: 64px; height: 64px; }
.modal-photo img { width: 100%; height: 100%; object-fit: contain; background: #000; }
.modal-caption { text-align: center; font-size: 0.85rem; color: var(--muted); margin-top: 10px; }
.modal-close {
  position: absolute; top: -12px; right: -8px;
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--border); background: #fff;
  font-size: 1.4rem; line-height: 1; cursor: pointer;
}

/* ---------- Footer ---------- */
.site-footer {
  margin-top: auto;
  background: #ffffff;
  border-top: 1px solid var(--border);
  padding: 22px 0;
  color: var(--muted);
  font-size: 0.85rem;
  width: 100%;
}

.footer-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.footer-logo {
  height: 26px;
  width: auto;
  object-fit: contain;
}

.footer-tagline {
  font-weight: 700;
  color: var(--navy);
  font-size: 0.9rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.footer-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
  background: var(--blue-bg);
  padding: 7px 18px;
  border-radius: 999px;
  border: 1px solid rgba(29, 99, 237, 0.2);
  transition: all 0.2s ease;
}

.footer-link:hover {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(29, 99, 237, 0.2);
  transform: translateY(-1px);
}

.footer-link .footer-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.footer-link .external-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.footer-copy {
  font-size: 0.8rem;
  color: var(--muted);
}

@media (min-width: 768px) {
  .footer-inner {
    flex-direction: row;
    justify-content: space-between;
    text-align: left;
  }
}

/* =========================================================
   TABLET — wider single column, 2-col pickup/drop
   ========================================================= */
@media (min-width: 720px) {
  .layout { max-width: 720px; }
  #searchView { max-width: 440px; margin: 0 auto; }
  .two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .two-col .card { margin-bottom: 12px; }
  .info-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
  .case-top { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: stretch; }
  .case-top .updated { margin-bottom: 0; }
}

/* =========================================================
   DESKTOP — top bar + centered search (default) + 2-col details
   ========================================================= */
@media (min-width: 1024px) {
  .topbar {
    display: block;
  }
  .topbar-brand { display: flex; align-items: center; gap: 16px; }
  .topbar-logo-img { height: 40px; width: auto; object-fit: contain; display: block; }
  .topbar-divider { width: 1px; height: 32px; background: var(--border); }
  .topbar-name { font-size: 1.12rem; font-weight: 800; color: var(--navy); line-height: 1.2; }
  .topbar-sub { font-size: 0.8rem; color: var(--muted); line-height: 1.2; margin-top: 2px; }
  .topbar-right { display: flex; align-items: center; }
  .topbar-item {
    display: flex; align-items: center; gap: 10px;
    padding: 0 20px; color: inherit; text-decoration: none;
  }
  .topbar-item + .topbar-item { border-left: 1px solid var(--border); }
  .topbar-item small { display: block; font-size: 0.72rem; color: var(--muted); }
  .topbar-item strong { display: block; font-size: 0.88rem; color: var(--navy); }
  .topbar-item strong.sm { font-size: 0.85rem; }
  .topbar-icon {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--blue-bg); color: var(--primary);
    display: flex; align-items: center; justify-content: center;
  }
  .topbar-icon svg { width: 18px; height: 18px; }

  /* Default (no case loaded): Track Your Case form is CENTER ALIGNED on desktop */
  body:not(.has-case) .layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    max-width: 480px;
    margin: 36px auto 60px;
    padding: 10px 16px 40px;
  }
  body:not(.has-case) #searchView {
    display: block;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    position: static;
  }
  body:not(.has-case) #emptyView,
  body:not(.has-case) #detailsView {
    display: none !important;
  }
  body:not(.has-case) .search-panel .secure-box {
    display: flex;
    margin-top: 14px;
  }

  /* When viewing case details: hide Track Your Case and make detailsView 100% */
  body.has-case .layout {
    max-width: 1140px;
    width: 100%;
    display: block;
    padding: 24px 20px 48px;
    margin: 0 auto;
  }
  body.has-case #searchView {
    display: none !important;
  }
  body.has-case #detailsView {
    display: flex;
    width: 100%;
  }
  body.has-case #emptyView {
    display: none !important;
  }
  body.has-case .search-panel .secure-box {
    display: none;
  }

  .brand { display: none; }
  #emptyView { display: none !important; }

  .details-mobile-logo { display: none; }
  .details-mobile-header {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    padding: 0 0 10px;
  }
  .back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 10px;
    background: #fff;
    border: 1px solid var(--border);
    color: var(--primary);
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: 0 1px 3px rgba(15, 42, 92, 0.05);
    transition: all 0.15s ease;
  }
  .back-link:hover {
    background: var(--blue-bg);
    border-color: var(--primary);
  }

  .search-card { padding: 24px 22px; margin-bottom: 0; }

  .details-panel {
    background: transparent; border: none; border-radius: 0;
    padding: 0; box-shadow: none;
    display: flex; flex-direction: column; gap: 16px;
  }
  .details-panel .card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px 22px;
    box-shadow: 0 1px 3px rgba(15, 42, 92, 0.04);
    margin-bottom: 0;
  }

  .case-top { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: center; }
  .file-box { background: transparent; padding: 0; }
  .file-number { font-size: 1.7rem; }
  .status-box { padding: 14px 18px; }
  .status-title { font-size: 1.15rem; }
  .stepper { margin: 24px 0 6px; }
  .step-dot { width: 28px; height: 28px; }
  .step::before { top: 13px; }
  .step-label { font-size: 0.8rem; }

  .info-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
  .info-cols .info-row { border-top: none; padding: 0; }

  .two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
  .two-col .card { margin-bottom: 0; }
}

@media (min-width: 1024px) and (max-width: 1280px) {
  .topbar-inner, body.has-case .layout, .site-footer .footer-inner {
    padding-left: 16px;
    padding-right: 16px;
  }
}
