/* =============================================================================
   Jodii UI — "Midnight Mehndi" design system (2026-07)
   Dark-first, warm rose × saffron on ink. Fraunces display + DM Sans body —
   the same voice as the /nri/ landing, carried into the product.
   Loaded AFTER bootstrap + responsive_polish so its tokens win.
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  /* brand */
  --jd-rose: #ff4d6d;
  --jd-rose-deep: #c9184a;
  --jd-saffron: #ffb703;
  --jd-gold: #f2c14e;
  --jd-violet: #7b2cbf;

  --jd-grad: linear-gradient(135deg, #ff4d6d 0%, #ff758f 45%, #ffb703 110%);
  --jd-grad-soft: linear-gradient(135deg, rgba(255,77,109,.14), rgba(255,183,3,.10));

  /* light theme (default) */
  --jd-bg: #fdf7f2;
  --jd-bg-elev: #ffffff;
  --jd-ink: #1c1017;
  --jd-ink-soft: #6d5a63;
  --jd-line: rgba(28,16,23,.10);
  --jd-glass: rgba(255,255,255,.72);
  --jd-shadow: 0 10px 30px rgba(201,24,74,.10);
  --jd-shadow-lift: 0 18px 44px rgba(201,24,74,.16);
  --jd-radius: 20px;
  --jd-radius-lg: 28px;

  --jd-spring: cubic-bezier(.34,1.56,.64,1);
}

body.dark-mode {
  --jd-bg: #120a10;
  --jd-bg-elev: #1d1219;
  --jd-ink: #f7ecf0;
  --jd-ink-soft: #b9a4ad;
  --jd-line: rgba(247,236,240,.10);
  --jd-glass: rgba(24,14,20,.68);
  --jd-shadow: 0 10px 30px rgba(0,0,0,.45);
  --jd-shadow-lift: 0 18px 44px rgba(0,0,0,.55);
}

/* ---------- Base ---------- */
body {
  font-family: 'DM Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif !important;
  background:
    radial-gradient(1100px 500px at 85% -10%, rgba(255,77,109,.10), transparent 60%),
    radial-gradient(900px 460px at -10% 30%, rgba(255,183,3,.08), transparent 55%),
    var(--jd-bg) !important;
  color: var(--jd-ink) !important;
}

h1, h2, h3, .jd-display, .navbar-brand {
  font-family: 'Fraunces', Georgia, 'Times New Roman', serif;
  letter-spacing: -.01em;
}

a { color: var(--jd-rose-deep); }
body.dark-mode a { color: #ff8fa3; }

::selection { background: rgba(255,77,109,.28); }

/* ---------- Glass navbar ---------- */
.navbar {
  background: var(--jd-glass) !important;
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  backdrop-filter: blur(14px) saturate(160%);
  border-bottom: 1px solid var(--jd-line);
  box-shadow: none !important;
}
.navbar .nav-link, .navbar .navbar-brand { color: var(--jd-ink) !important; }
.navbar .nav-link { border-radius: 999px; padding: .42rem .85rem; transition: background .18s ease, transform .18s var(--jd-spring); }
.navbar .nav-link:hover { background: var(--jd-grad-soft); transform: translateY(-1px); }
.navbar-brand { font-weight: 700; font-size: 1.35rem; }
.navbar-brand::after { content: "♥"; font-size: .7em; color: var(--jd-rose); margin-left: .28rem; vertical-align: super; }
.navbar-toggler-icon { filter: none !important; }
body.dark-mode .navbar-toggler-icon { filter: invert(1) !important; }

/* ---------- Hero ---------- */
.hero-banner {
  background: var(--jd-grad) !important;
  border-radius: var(--jd-radius-lg) !important;
  box-shadow: var(--jd-shadow-lift) !important;
  position: relative; overflow: hidden;
}
.hero-banner::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(420px 190px at 90% 10%, rgba(255,255,255,.30), transparent 60%);
  pointer-events: none;
}
.hero-banner h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); margin-bottom: .25rem; }

/* ---------- Cards ---------- */
.card, .rp-card {
  background: var(--jd-bg-elev);
  border: 1px solid var(--jd-line);
  border-radius: var(--jd-radius) !important;
  box-shadow: var(--jd-shadow);
  color: var(--jd-ink);
  transition: transform .22s var(--jd-spring), box-shadow .22s ease;
}
a.card:hover, .jd-hover-lift:hover { transform: translateY(-4px); box-shadow: var(--jd-shadow-lift); }
body.dark-mode .card, body.dark-mode .rp-card { background: var(--jd-bg-elev); }

/* ---------- Buttons ---------- */
.btn { border-radius: 999px !important; transition: transform .16s var(--jd-spring), box-shadow .16s ease, filter .16s ease; }
.btn:active { transform: scale(.94); }
.btn-primary, .btn-success {
  background: var(--jd-grad) !important; border: none !important; color: #fff !important;
  box-shadow: 0 8px 22px rgba(255,77,109,.35);
}
.btn-primary:hover, .btn-success:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn-outline-primary { border-color: var(--jd-rose) !important; color: var(--jd-rose-deep) !important; }
.btn-outline-primary:hover { background: var(--jd-grad-soft) !important; color: var(--jd-rose-deep) !important; }
body.dark-mode .btn-light { background: var(--jd-bg-elev); border-color: var(--jd-line); color: var(--jd-ink); }

/* ---------- Forms ---------- */
.form-control, .form-select {
  background: var(--jd-bg-elev) !important;
  border: 1.5px solid var(--jd-line) !important;
  border-radius: 14px !important;
  color: var(--jd-ink) !important;
  padding: .7rem .95rem;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.form-control:focus, .form-select:focus {
  border-color: var(--jd-rose) !important;
  box-shadow: 0 0 0 .25rem rgba(255,77,109,.18) !important;
}
.form-control::placeholder { color: var(--jd-ink-soft); opacity: .75; }
.form-label { font-weight: 600; font-size: .9rem; color: var(--jd-ink); }
.form-text, .text-muted { color: var(--jd-ink-soft) !important; }

/* ---------- Dropdown options ----------
   The rule above colours the <select> box. It does NOT colour the popup list,
   which the OS paints: the <option>s inherited --jd-ink and landed on the
   popup's own white background, so in dark mode the choices were near-white
   on white — present, focusable, and invisible. Country code, gender,
   profession, education, community and every console filter were all affected.

   Options get their own colours, stated for both themes rather than inherited,
   and color-scheme tells the browser which way to paint the popup's own
   chrome (scrollbar, highlight) so the two agree. Literal values, not custom
   properties: some engines resolve neither variables nor inherited colour
   inside the native popup, and a dropdown nobody can read is exactly the
   failure this is fixing. Covers bare `select` too — register.html has a
   hand-written country-code fallback with no Bootstrap class on it. */
.form-select,
select,
select.form-control { color-scheme: light; }

.form-select option, .form-select optgroup,
select option, select optgroup {
  background-color: #ffffff;
  color: #1c1017;
}

body.dark-mode .form-select,
body.dark-mode select,
body.dark-mode select.form-control { color-scheme: dark; }

body.dark-mode .form-select option, body.dark-mode .form-select optgroup,
body.dark-mode select option, body.dark-mode select optgroup {
  background-color: #1d1219;
  color: #f7ecf0;
}

/* A disabled/placeholder first option ("Select one…") should read as muted,
   not as another choice — but still legibly, in both themes. */
.form-select option[value=""], select option[value=""] { color: #6d5a63; }
body.dark-mode .form-select option[value=""],
body.dark-mode select option[value=""] { color: #b9a4ad; }

/* ---------- Chips (quick nav) ---------- */
.rp-chip, .jd-chip {
  display: inline-flex; align-items: center; gap: .35rem;
  background: var(--jd-bg-elev); border: 1px solid var(--jd-line);
  color: var(--jd-ink); border-radius: 999px; padding: .45rem 1rem;
  font-weight: 600; font-size: .86rem; text-decoration: none;
  transition: transform .18s var(--jd-spring), background .18s ease;
}
.rp-chip:hover, .jd-chip:hover { background: var(--jd-grad-soft); transform: translateY(-2px); color: var(--jd-ink); }

/* ---------- Auth (login / register) ---------- */
.jd-auth-wrap { max-width: 460px; margin: 0 auto; }
.jd-auth-card {
  background: var(--jd-glass);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  backdrop-filter: blur(18px) saturate(150%);
  border: 1px solid var(--jd-line);
  border-radius: var(--jd-radius-lg);
  box-shadow: var(--jd-shadow-lift);
  padding: 2.2rem 1.9rem;
  animation: jd-rise .5s var(--jd-spring) both;
}
.jd-auth-title { font-size: clamp(1.7rem, 5vw, 2.2rem); margin-bottom: .2rem; }
.jd-badge-invite {
  display: inline-flex; align-items: center; gap: .4rem;
  background: var(--jd-grad-soft); border: 1px solid rgba(255,77,109,.35);
  color: var(--jd-rose-deep); font-weight: 700; font-size: .78rem;
  letter-spacing: .06em; text-transform: uppercase;
  border-radius: 999px; padding: .35rem .9rem; margin-bottom: .9rem;
}
body.dark-mode .jd-badge-invite { color: #ff8fa3; }

/* invite-code field gets the hero treatment */
.jd-invite-field .form-control {
  border: 2px dashed rgba(255,77,109,.55) !important;
  background: var(--jd-grad-soft) !important;
  font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  text-align: center; font-size: 1.05rem;
}
.jd-invite-field .form-control:focus { border-style: solid !important; }

/* ...but never a password box. The rule above is written for the invite code
   (JODIUSA-XXXX-XXXX is uppercase by construction) and matches any
   .form-control inside the wrapper, so a password field placed there later
   would render the characters uppercase while submitting them unchanged —
   the user sees one thing, types another, and the login just fails. Operator-
   created referrers are emailed a mixed-case password, so this is the exact
   case that would break. */
input[type="password"] {
  text-transform: none !important;
  letter-spacing: normal !important;
}

/* ---------- Swipe stack ---------- */
.jd-swipe-stage { max-width: 420px; margin: 0 auto; position: relative; }
.jd-swipe-stage::before, .jd-swipe-stage::after {
  content: ""; position: absolute; left: 8%; right: 8%; height: 100%;
  border-radius: var(--jd-radius-lg); background: var(--jd-bg-elev);
  border: 1px solid var(--jd-line); z-index: 0;
}
.jd-swipe-stage::before { top: 14px; transform: scale(.955); opacity: .55; }
.jd-swipe-stage::after  { top: 26px; transform: scale(.91);  opacity: .30; }

.jd-swipe-card {
  position: relative; z-index: 1; overflow: hidden;
  border-radius: var(--jd-radius-lg); border: 1px solid var(--jd-line);
  background: var(--jd-bg-elev); box-shadow: var(--jd-shadow-lift);
  animation: jd-rise .45s var(--jd-spring) both;
}
.jd-swipe-photo { position: relative; aspect-ratio: 4/5; overflow: hidden; }
.jd-swipe-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.jd-swipe-photo::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(10,4,8,.82) 0%, rgba(10,4,8,.25) 38%, transparent 62%);
}
.jd-swipe-id {
  position: absolute; left: 1.1rem; right: 1.1rem; bottom: .95rem; z-index: 2;
  color: #fff; text-align: left;
}
.jd-swipe-id h2 { font-size: 1.5rem; margin: 0; color: #fff; text-shadow: 0 2px 12px rgba(0,0,0,.4); }
.jd-swipe-id .jd-loc { font-size: .88rem; opacity: .85; }
.jd-swipe-bio { padding: 1rem 1.2rem .4rem; text-align: left; color: var(--jd-ink-soft); font-size: .93rem; min-height: 3.2rem; }

.jd-actions { display: flex; justify-content: center; gap: 1.1rem; padding: .9rem 0 1.3rem; }
.jd-act {
  width: 62px; height: 62px; border-radius: 50%; border: none;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.45rem; cursor: pointer;
  background: var(--jd-bg-elev); border: 1.5px solid var(--jd-line); color: var(--jd-ink);
  box-shadow: var(--jd-shadow);
  transition: transform .18s var(--jd-spring), box-shadow .18s ease;
}
.jd-act:hover { transform: translateY(-4px) scale(1.07); box-shadow: var(--jd-shadow-lift); }
.jd-act:active { transform: scale(.88); }
.jd-act-pass { color: #8d99ae; }
.jd-act-super { width: 52px; height: 52px; font-size: 1.15rem; align-self: center; color: var(--jd-saffron); }
.jd-act-like { background: var(--jd-grad); color: #fff; border: none; box-shadow: 0 10px 26px rgba(255,77,109,.45); }

.jd-daily-pill {
  display: inline-flex; align-items: center; gap: .45rem;
  background: var(--jd-bg-elev); border: 1px solid var(--jd-line);
  border-radius: 999px; padding: .4rem 1rem; font-size: .85rem; font-weight: 600;
  color: var(--jd-ink-soft);
}
.jd-daily-pill b { color: var(--jd-rose-deep); }
body.dark-mode .jd-daily-pill b { color: #ff8fa3; }

/* exit animations driven by JS before reload */
.jd-fly-right { animation: jd-fly-right .45s ease-in both; }
.jd-fly-left  { animation: jd-fly-left  .45s ease-in both; }
.jd-fly-up    { animation: jd-fly-up    .45s ease-in both; }
@keyframes jd-fly-right { to { transform: translateX(130%) rotate(14deg); opacity: 0; } }
@keyframes jd-fly-left  { to { transform: translateX(-130%) rotate(-14deg); opacity: 0; } }
@keyframes jd-fly-up    { to { transform: translateY(-120%) scale(1.05); opacity: 0; } }

/* ---------- Match modal ---------- */
.jd-match-overlay {
  position: fixed; inset: 0; z-index: 3000; display: none;
  align-items: center; justify-content: center;
  background: rgba(10,4,8,.72);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.jd-match-overlay.show { display: flex; }
.jd-match-card {
  text-align: center; color: #fff; padding: 2.5rem 3rem;
  animation: jd-pop .55s var(--jd-spring) both;
}
.jd-match-card .jd-match-title {
  font-family: 'Fraunces', serif; font-size: clamp(2.2rem, 8vw, 3.4rem);
  background: var(--jd-grad); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; margin-bottom: .4rem;
}
.jd-match-hearts span {
  display: inline-block; font-size: 1.6rem; margin: 0 .18rem;
  animation: jd-float 1.6s ease-in-out infinite;
}
.jd-match-hearts span:nth-child(2) { animation-delay: .2s; font-size: 2.1rem; }
.jd-match-hearts span:nth-child(3) { animation-delay: .4s; }

/* ---------- Mobile bottom nav ---------- */
.jd-bottom-nav {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: max(.8rem, env(safe-area-inset-bottom)); z-index: 1500;
  display: flex; gap: .25rem; padding: .35rem;
  background: var(--jd-glass);
  -webkit-backdrop-filter: blur(16px) saturate(160%); backdrop-filter: blur(16px) saturate(160%);
  border: 1px solid var(--jd-line); border-radius: 999px;
  box-shadow: var(--jd-shadow-lift);
}
.jd-bottom-nav a {
  display: flex; flex-direction: column; align-items: center; gap: .1rem;
  min-width: 62px; padding: .45rem .55rem; border-radius: 999px;
  color: var(--jd-ink-soft); text-decoration: none; font-size: .66rem; font-weight: 600;
  transition: background .18s ease, color .18s ease, transform .18s var(--jd-spring);
}
.jd-bottom-nav a i { font-size: 1.15rem; }
.jd-bottom-nav a:hover, .jd-bottom-nav a.active { color: var(--jd-rose-deep); background: var(--jd-grad-soft); transform: translateY(-2px); }
body.dark-mode .jd-bottom-nav a.active, body.dark-mode .jd-bottom-nav a:hover { color: #ff8fa3; }
@media (min-width: 992px) { .jd-bottom-nav { display: none; } }
body.jd-has-bottom-nav { padding-bottom: 92px; }

/* ---------- Footer / misc ---------- */
footer { color: var(--jd-ink-soft); }
footer a { color: var(--jd-ink-soft); text-decoration: none; }
footer a:hover { color: var(--jd-rose-deep); }
.breadcrumb { background: transparent; padding-left: 0; }
.breadcrumb-item, .breadcrumb-item a { color: var(--jd-ink-soft); }
#consent-banner {
  background: var(--jd-bg-elev) !important; color: var(--jd-ink) !important;
  border-top: 1px solid var(--jd-line) !important;
  box-shadow: 0 -8px 30px rgba(0,0,0,.18);
}
body.dark-mode .dropdown-menu { background: var(--jd-bg-elev); border-color: var(--jd-line); }
body.dark-mode .dropdown-item { color: var(--jd-ink); }
body.dark-mode .dropdown-item:hover { background: var(--jd-grad-soft); }
body.dark-mode .toast { background: var(--jd-bg-elev) !important; }

/* ---------- Keyframes & motion safety ---------- */
@keyframes jd-rise { from { opacity: 0; transform: translateY(18px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes jd-pop { from { opacity: 0; transform: scale(.7); } to { opacity: 1; transform: none; } }
@keyframes jd-float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- Focus visibility (keyboard users get a clear, on-brand ring;
   pointer users are not distracted by one) ---------- */
:focus-visible {
  outline: 3px solid var(--jd-rose);
  outline-offset: 2px;
  border-radius: 6px;
}
a:focus:not(:focus-visible),
button:focus:not(:focus-visible),
.btn:focus:not(:focus-visible),
input:focus:not(:focus-visible),
select:focus:not(:focus-visible),
textarea:focus:not(:focus-visible) { outline: none; box-shadow: none; }
/* Form controls keep a soft on-brand focus ring instead of the browser default. */
.form-control:focus, .form-select:focus {
  border-color: var(--jd-rose);
  box-shadow: 0 0 0 .2rem rgba(255, 77, 109, .22);
}

/* ---------- Dark-mode inputs (so text and PLACEHOLDERS stay legible) ----------
   Bootstrap's default light input on a dark card left placeholder/help text
   almost invisible — reported on the AI assistant's text box. Give every text
   input a dark surface, light text, and a clearly-visible placeholder in dark
   mode. !important because some pages carry their own inline .dark-mode rules. */
body.dark-mode .form-control,
body.dark-mode textarea,
body.dark-mode input[type="text"],
body.dark-mode input[type="email"],
body.dark-mode input[type="password"],
body.dark-mode input[type="number"],
body.dark-mode input[type="search"],
body.dark-mode input[type="tel"],
body.dark-mode input[type="url"] {
  background-color: var(--jd-bg-elev) !important;
  color: var(--jd-ink) !important;
  border-color: var(--jd-line) !important;
}
body.dark-mode .form-control::placeholder,
body.dark-mode textarea::placeholder,
body.dark-mode input::placeholder {
  color: var(--jd-ink-soft) !important;
  opacity: 1 !important;
}
/* The AI answer box uses Bootstrap's .bg-light; make it a dark surface too so a
   reply is readable in dark mode. */
body.dark-mode .bg-light {
  background-color: var(--jd-bg-elev) !important;
  color: var(--jd-ink) !important;
}
