/* =========================================================
   SaveRx.ai — Global Styles
   Notes:
   - Lightweight, shared styles used by index.html
   - Drug card visuals emphasize savings & strong CTA
   ========================================================= */

/* ---------- Theme tokens ---------- */
:root{
  --bg: #f6f8fb;
  --card: #ffffff;
  --ink: #0b2a4e;
  --muted: #5b708b;
  --brand: #1d4ed8;
  --brand-2: #1f2f60;           /* primary button */
  --accent: #ef7d57;
  --success: #10b981;
  --danger: #dc2626;            /* red strike */
  --ring: 0 0 0 4px rgba(37,99,235,0.18);
  --shadow: 0 10px 30px rgba(10,36,80,0.06);
}

/* ---------- Reset-ish ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; max-width: 100%; overflow-x: hidden; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, 'Noto Sans', 'Liberation Sans', sans-serif;
  color: var(--ink);
  background: var(--bg);
}

/* ---------- Helpers ---------- */
.container { max-width: 1100px; margin: 0 auto; padding: 0 10px; }
.section-pad { padding: 1rem 1rem; }
.text-center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ---------- Header / Nav ---------- */
.site-header { padding: 16px 0; }
.site-nav { display: flex; align-items: center; gap: 18px; }
.site-nav .nav-fill { flex: 1; }
.brand { font-weight: 800; font-size: 22px; letter-spacing: -0.02em; color: rgb(17,65,137); text-decoration: none; }
.site-tagline { margin: 0; }
.nav-link { color: var(--muted); text-decoration: none; }
.nav-link:hover { color: var(--ink); }

/* ---------- Hero ---------- */
.hero { padding: 24px 0 10px; }
.hero-title { font-size: clamp(28px, 5vw, 44px); line-height: 1.15; letter-spacing: -0.02em; margin: 0; }
.hero-subtitle { color: #5e6a73; margin: .5rem 0 0; }

/* ---------- Search ---------- */
.search-wrap {
  display: flex; gap: 8px; align-items: center; justify-content: center; margin-top: 18px;
}
.search-wrap input {
  flex: 1; max-width: 720px; height: 56px; border-radius: 999px; padding: 0 18px;
  border: 1px solid rgba(0,0,0,.12); font-size: 16px;
}
.search-wrap button {
  height: 56px; border-radius: 999px; padding: 0 22px;
}

/* ---------- Buttons ---------- */
.btn {
  appearance: none; border: 0; cursor: pointer; font-weight: 700; letter-spacing: .2px;
  border-radius: 12px; padding: 14px 22px; box-shadow: 0 6px 20px rgba(37,99,235,.25);
}
.btn-primary { background: var(--brand-2); color: #fff; }
.btn-primary:hover { filter: brightness(0.98); }
.btn-primary:focus { outline: none; box-shadow: var(--ring); }

/* ---------- Cards Grid ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 18px;
}
@media (max-width: 980px){ .cards { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 520px){ .cards { grid-template-columns: 1fr; } }

/* ---------- Base card ---------- */
.drug-card {
  background: var(--card);
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 6px 18px rgba(0,0,0,.04);
}

/* =========================================================
   High-conversion card layout (deal-card)
   - Emphasizes savings with large “With savings” price
   - Strikethrough typical cash price (red line)
   - Strong full-width CTA
   ========================================================= */
.deal-card { position: relative; overflow: hidden; }
.deal-card .hdr { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.deal-card .title { margin: 0; font-size: 18px; font-weight: 800; letter-spacing: -.01em; }
.deal-card .sub { color: #6b7680; font-size: 13px; margin-bottom: 12px; }

/* “Official link” pill */
.badge-verified {
  display: inline-flex; align-items: center; gap: 6px;
  background: #e8fff4; color: #065f46; border: 1px solid #bbf7d0;
  padding: 6px 10px; border-radius: 999px; font-size: 12px; font-weight: 700;
}
.badge-verified svg { width: 14px; height: 14px; }

/* Price comparison panel */
.deal {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
  background: #f8fbff; border: 1px solid #e6efff; border-radius: 12px; padding: 12px;
  margin-bottom: 12px;
}
.deal .label { color: #6b7680; font-size: 12px; }

/* Left: Typical cash price (dark text, RED strike line) */
.deal .cash .price {
  font-weight: 700; color: #222; position: relative; display: inline-block;
}
.deal .cash .price s { text-decoration: none; color: inherit; position: relative; }
.deal .cash .price s::after {
  content: ""; position: absolute; left: 0; right: 0; top: 50%;
  height: 2px; background: var(--danger); /* red line */
  /* uncomment for a little flair: transform: rotate(-4deg); */
}

/* Right: With savings (big!) + Save % */
.deal .with .price { font-size: 28px; font-weight: 900; letter-spacing: -.02em; }
.deal .with .save { font-weight: 800; color: #0b8f4a; font-size: 13px; }

/* CTA block */
.deal-cta { display: flex; flex-direction: column; gap: 8px; }
.deal-cta .btn-lg {
  width: 100%; background: var(--brand-2); color: #fff; border: 0; border-radius: 12px;
  padding: 14px 16px; font-weight: 800; text-align: center; cursor: pointer;
  box-shadow: 0 8px 24px rgba(17,29,68,.18);
}
.deal-cta .btn-lg:hover { filter: brightness(0.98); }
.deal-cta .assure { display: flex; align-items: center; gap: 8px; color: #60708a; font-size: 12px; }
.deal-cta .assure svg { width: 14px; height: 14px; color: #0b8f4a; }

/* Stack deal columns on small screens */
@media (max-width: 520px){
  .deal { grid-template-columns: 1fr; }
}

/* ---------- Newsletter ---------- */
.newsletter {
  background: #f6f4ff;
  border-top: 1px solid rgba(0,0,0,.06);
  padding: 32px 0;
}
.newsletter h2 { margin: 0 0 6px; }
.newsletter .newsletter-form {
  display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 8px;
}
.newsletter input {
  height: 48px; border-radius: 10px; padding: 0 14px; border: 1px solid rgba(0,0,0,.12); min-width: 280px;
}

/* ---------- Footer ---------- */
.footer {
  background-color: var(--bg);
  border-top: 1px solid #d8dee9;
  color: var(--muted);
  font-size: 0.9rem;
  padding: 1.5rem 1rem;
  text-align: center;
}

.footer-container {
  max-width: 800px;
  margin: 0 auto;
}

.footer-brand {
  color: var(--ink);
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
}

.footer-disclaimer {
  line-height: 1.0;
  font-size: 0.9rem;
  margin: 0.5rem 0 1rem;
}

.footer-legal {
  font-size: 0.85rem;
  color: #6b7280;
}



/* ===========================
   Mobile-first optimization
   =========================== */

/* Small tablets and below */
@media (max-width: 768px) {
  /* Header */
  .site-header { padding: 12px 0; }
  .site-nav { gap: 12px; }
  .site-tagline { display: none; }               /* free up space */
  .nav-link { font-size: 15px; }

  /* Hero */
  .hero { padding: 18px 0 8px; }
  .hero-title { font-size: clamp(24px, 6.2vw, 34px); }
  .hero-subtitle { font-size: 15px; }

  /* Search row */
  .search-wrap { margin-top: 12px; gap: 8px; }
  .search-wrap input {
    height: 48px; max-width: 100%; font-size: 16px;
  }
  .search-wrap button {
    height: 48px; padding: 0 18px; font-size: 15px; border-radius: 12px;
  }

  /* Cards grid: go to 2 columns on small tablets */
  .cards { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
  .drug-card { padding: 14px; border-radius: 14px; }
}

/* Phones */
@media (max-width: 480px) {
  /* Header: keep it compact */
  .site-nav { gap: 10px; }
  .brand { font-size: 20px; }
  .nav-link { font-size: 14px; }

  /* Hero */
  .hero { padding: 16px 0 6px; }
  .hero-title { font-size: clamp(22px, 7vw, 30px); }
  .hero-subtitle { font-size: 14px; }

  /* Search: full width, stacked if necessary */
  .search-wrap { flex-wrap: nowrap; }
  .search-wrap input { flex: 1; height: 46px; }
  .search-wrap button { height: 46px; padding: 0 16px; }

  /* Cards grid: single column */
  .cards { grid-template-columns: 1fr; gap: 12px; }

  /* Card internals */
  .deal { grid-template-columns: 1fr; gap: 10px; padding: 10px; }
  .deal .with .price { font-size: 24px; }
  .deal .cash .price s::after { height: 2px; } /* keep the red strike visible */

  /* CTA: large and tappable */
  .deal-cta .btn-lg {
    padding: 14px 16px;
    font-size: 16px;
    border-radius: 12px;
  }
  .deal-cta .assure { font-size: 12px; }
}

/* Prevent brand wrapping and crowding on narrow headers */
@media (max-width: 360px) {
  .nav-link { display: none; }  /* hide About/Contact on very small screens */
}

/* --- Sticky Header --- */
.site-header {
  position: sticky;           /* stays at top during scroll */
  top: 0;
  z-index: 1000;
  background: #ffffff;
  padding: max(8px, env(safe-area-inset-top)) 16px 10px;
  border-bottom: 1px solid #EEF0F3;
  transition: box-shadow 180ms ease, backdrop-filter 180ms ease;
}

/* Subtle shadow when page scrolls a bit */
.site-header.is-scrolled {
  box-shadow: 0 4px 12px rgba(16,24,40,0.06);
  backdrop-filter: saturate(120%) blur(4px);
}

/* Top row */
.header-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Brand — prevent double brand text elsewhere */
.brand {
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.01em;
  color: #0B2440; /* your navy */
  text-decoration: none;
}

/* Desktop nav (hidden on mobile) */
.site-nav {
  margin-left: auto;
  display: none;
  gap: 18px;
}
.site-nav a { color: #243A57; text-decoration: none; font-weight: 500; }

/* Mobile menu button */
.menu-btn {
  margin-left: auto;
  font: inherit;
  background: transparent;
  border: none;
  padding: 6px 8px;
  line-height: 1;
  border-radius: 8px;
}

/* Search row */
.header-search {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: 10px;
}
.header-search input[type="search"] {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid #E4E7EC;
  border-radius: 12px;
  font-size: 16px;
  background: #F7F9FC;
}
.header-search .primary {
  height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  font-weight: 700;
  color: #fff;
  background: #14284B;
}

/* Mobile drawer */
.mobile-drawer[hidden] { display: none; }
.mobile-drawer {
  position: fixed;
  inset: 0 0 0 40%;
  background: #fff;
  box-shadow: -8px 0 20px rgba(0,0,0,0.08);
  padding: 20px;
  z-index: 1200;
}
.mobile-drawer nav {
  display: grid; gap: 14px;
}
.mobile-drawer a { color: #14284B; text-decoration: none; }

/* Responsive: show desktop nav ≥768px and hide menu button */
@media (min-width: 768px) {
  .menu-btn { display: none; }
  .site-nav { display: flex; }
  .header-search { grid-template-columns: 1fr 160px; gap: 12px; }
}

/* ===== SaveRx Mobile Card Tweaks (MVP) ===== */

/* 0) Never allow sideways scrolling on mobile */
html, body { overflow-x: hidden; }

/* 1) Containers: comfortable side padding on small screens */
@media (max-width: 640px) {
  .container { padding-left: 16px; padding-right: 16px; }
}

/* 2) Featured grid: responsive and compact gaps */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
@media (max-width: 480px) {
  .cards { grid-template-columns: 1fr; gap: 12px; }
}

/* 3) Card styling: soft border, subtle shadow, tight padding */
.card,
.drug-card { /* support either class */
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 14px;
  padding: 1em;
  background: var(--surface, #fff);
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.card .card-body,
.drug-card .card-body {
  padding: 14px;
}
.drug-title {
  margin: 0 0 6px 0;
  font-size: clamp(18px, 4vw, 20px);
  line-height: 1.25;
}
.drug-subtitle {
  margin: 0 0 10px 0;
  color: var(--muted, #6b7280);
  font-size: 14px;
}

/* 4) Buttons: sized to content by default */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;            /* ← was 100% */
  max-width: 100%;        /* prevents overflow in tight spaces */
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 12px;
  text-align: center;
}


/* 5) Loading text and list area: avoid layout jumpiness */
#featured-cards { min-height: 80px; }
#cards-loading {
  margin: 8px 0 0;
  color: var(--muted, #6b7280);
}

/* 6) Hero text sizes on small screens */
@media (max-width: 480px) {
  .hero-title   { font-size: clamp(22px, 7vw, 28px); line-height: 1.2; }
  .hero-subtitle{ font-size: 14px; }
}

/* 7) Safety: any images inside cards scale correctly */
.card img, .drug-card img { max-width: 100%; height: auto; display: block; }

/* 8) Reduce extra top/bottom space on sections for mobile */
@media (max-width: 640px) {
  .section-pad { padding-top: 18px; padding-bottom: 18px; }
}

/* Utility: block CTA on small screens only */
@media (max-width: 480px) {
  .btn-block-sm { display: block; width: 100%; }
}

/* --- SaveRx modal (homepage) --- */
.modal{position:fixed;inset:0;display:none;align-items:center;justify-content:center;z-index:1000}
.modal[aria-hidden="false"]{display:flex}
.modal-backdrop{position:absolute;inset:0;background:rgba(11,42,78,0.45)}
.modal-panel{
  position:relative;background:var(--card);color:var(--ink);box-shadow:var(--shadow);
  width:min(520px,92vw);border-radius:16px;padding:24px 20px 18px
}
.modal-title{margin:0 0 6px;font-size:1.375rem}
.modal-sub{margin:0 0 12px;color:var(--muted)}
.field{display:flex;flex-direction:column;gap:6px;margin:10px 0 14px}
.field input[type="email"]{padding:12px 14px;border:1px solid #e3e8ef;border-radius:10px;outline:none}
.field input[type="email"]:focus{box-shadow:var(--ring);border-color:#c7d2fe}
.modal-close{position:absolute;top:8px;right:10px;border:0;background:transparent;font-size:24px;line-height:1;cursor:pointer;color:var(--muted)}
.modal-actions{display:flex;gap:8px;align-items:center}
.microcopy{font-size:12px;color:var(--muted);margin-top:10px}
.status{margin-top:10px;font-size:0.95rem}
.hp{position:absolute;left:-9999px;opacity:0;height:0;width:0}

/* =======================
   AI Scanning Loader + Skeletons
   ======================= */

/* Loader banner */
.ai-loader {
  display:flex; align-items:center; gap:.6rem; padding:.8rem 1rem;
  border:1px solid var(--border, #e5e7eb); border-radius:12px; margin-bottom:12px;
  background: var(--surface, #fafafa);
}
.ai-loader strong { font-weight:600; }
.ai-loader small { opacity:.7; display:block; }

/* Pulsing dots */
.ai-dot {
  width:8px; height:8px; border-radius:50%;
  background: currentColor; opacity:.2; animation: aiPulse 1.4s infinite ease-in-out;
}
.ai-dot:nth-child(1){ animation-delay:0s; }
.ai-dot:nth-child(2){ animation-delay:.2s; }
.ai-dot:nth-child(3){ animation-delay:.4s; }
@keyframes aiPulse {
  0%, 80%, 100% { opacity:.2; transform:scale(1); }
  40% { opacity:1; transform:scale(1.25); }
}

/* Skeleton cards */
.card.skeleton {
  position:relative; overflow:hidden; padding:14px;
  border:1px solid var(--border, #e5e7eb);
  border-radius:14px; background:var(--surface, #fff); margin-bottom:12px;
}
.sk-line, .sk-pill {
  background: linear-gradient(90deg, rgba(0,0,0,0.06) 25%, rgba(0,0,0,0.12) 37%, rgba(0,0,0,0.06) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.25s infinite linear;
  border-radius: 8px;
}
.sk-title { height:18px; width:60%; margin-bottom:12px; }
.sk-line  { height:12px; width:90%; margin-bottom:10px; }
.sk-pill  { height:34px; width:40%; border-radius:999px; }

/* Shimmer animation */
@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .ai-dot, .sk-line, .sk-pill { animation: none; }
}

/* Visibility helpers (JS flips .loading -> .loaded on #featured) */
.loading .card.skeleton,
.loading #ai-loader { display:block; }
.loaded .card.skeleton,
.loaded #ai-loader { display:none; }

/* Optional: animated trailing dots for the tiny text loader */
#cards-loading::after {
  content: ".";
  animation: dots 1s steps(5, end) infinite;
}
@keyframes dots {
  0%, 20% { color: transparent; text-shadow: .25em 0 transparent, .5em 0 transparent; }
  40%     { color: currentColor; text-shadow: .25em 0 transparent, .5em 0 transparent; }
  60%     { text-shadow: .25em 0 currentColor, .5em 0 transparent; }
  80%,100%{ text-shadow: .25em 0 currentColor, .5em 0 currentColor; }
}

/* --- CTA band --- */
.cta-band{
  background:#f2f5fb;
  border-top:1px solid #e5e7eb;
  border-bottom:1px solid #e5e7eb;
  padding:1rem 1rem;
}
.cta-wrap{
  max-width:1000px;
  margin:0 auto;
  display:grid;
  gap:1.25rem;
}
@media (min-width: 900px){
  .cta-wrap{ grid-template-columns: 1fr 1fr; }
}
.cta-card{
  background:var(--card);
  border:1px solid #e6eaf2;
  box-shadow: var(--shadow);
  border-radius:14px;
  padding:1.25rem;
}
.cta-title{
  color:var(--ink);
  margin:0 0 .35rem;
  font-size:1.25rem;
}
.cta-sub{
  color:var(--muted);
  margin:.1rem 0 1rem;
  font-size:.97rem;
}

/* forms */
.form{ display:grid; grid-template-columns:1fr auto; gap:.7rem; align-items:start; }
.form-row{ grid-column:1 / -1; }
.input{
  width:100%; height:44px;
  border:1px solid #d9dfeb; border-radius:10px;
  padding:0 .9rem; color:var(--ink); background:#fff;
}
.input:focus{ outline:none; box-shadow: var(--ring); border-color:#b7c6eb; }
.btn{
  grid-column:2; height:44px; padding:0 1.1rem;
  border-radius:12px; border:0; background:var(--brand-2);
  color:#fff; font-weight:700; cursor:pointer; box-shadow:0 8px 20px rgba(31,47,96,.18);
}
.btn:focus{ box-shadow: var(--ring); }
@media (max-width: 899px){
  .form{ grid-template-columns:1fr; }
  .btn{ grid-column:1; width:100%; }
}

.form-hint{ grid-column:1 / -1; margin:.25rem 0 0; font-size:.8rem; color:#6b7280; }
.form-msg{ grid-column:1 / -1; margin:.4rem 0 0; font-size:.9rem; }

/* contact */
.cta-contact{
  max-width:1000px; margin:1rem auto 0; text-align:center; color:var(--ink);
}
.cta-contact a{ color:var(--brand); text-decoration:underline; }

/* accessibility helper */
.sr-only{ position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }

/* for the individual dru page layout  index.htl pages*/
.rx-lede { margin-bottom: 10px; }
.rx-title { font-size: clamp(32px, 5vw, 44px); line-height: 1.1; margin: 0 0 6px; }
.rx-sub { color: var(--muted); margin: 0; }

/* --- Step 3: hero/card rhythm like mock --- */
.section-pad { padding-top: 10px; }

.rx-hero { margin-top: 12px; }
.rx-hero .rx-card { padding: 16px 16px 12px; border-radius: 16px; }

.rx-hero .rx-head { font-size: 15px; letter-spacing: .2px; }
.rx-row { padding: 9px 0; gap: 12px; }

.rx-bullets { margin: 10px 0 8px; }   /* slight breathing room above/below bullets */
.rx-table { margin-top: 6px; }        /* a little air before the table */

@media (max-width: 900px){
  .section-pad { padding-top: 8px; }
  .rx-hero { margin-top: 8px; }
  .rx-hero .rx-card { margin-top: 8px; }
}

/* make AI messages render markdown nicely */
#srx-log .srx-msg { line-height: 1.5; }
#srx-log .srx-msg p { margin: 0.4rem 0; }
#srx-log .srx-msg ul { margin: 0.4rem 0 0.4rem 1.2rem; }
#srx-log .srx-msg li { margin: 0.2rem 0; }
#srx-log .srx-msg a { text-decoration: underline; }
