/* European Community Pet Club — Design System
 * Navy + Gold institutional, cream/peach warmth. Editorial sophistication.
 */

:root {
  /* Core palette — European flag blue (#003399 Reflex Blue) */
  --navy-900: #001A4D;
  --navy-800: #003399;
  --navy-700: #1A4DB3;
  --navy-600: #3D6BC7;
  --navy-100: #DCE3F5;

  --gold-600: #B8932C;
  --gold-500: #D4AF37;
  --gold-400: #E2C457;
  --gold-200: #F0DDA0;
  --gold-100: #F8EFD3;

  --teal-700: #0A5C60;
  --teal-600: #0D7377;
  --teal-500: #1A9499;

  --cream-50:  #FBF7EE;
  --cream-100: #F5EFE2;
  --cream-200: #ECE2CD;

  --peach-100: #F7E2D6;
  --peach-200: #EFCBB8;

  --ink-900: #0E1422;
  --ink-700: #2C3346;
  --ink-500: #5A6178;
  --ink-300: #9AA0B0;

  --border: rgba(0,51,153,0.10);
  --border-strong: rgba(0,51,153,0.22);

  /* Type */
  --font-serif: "Cormorant Garamond", "Playfair Display", "Times New Roman", serif;
  --font-sans:  "Inter", "Manrope", system-ui, -apple-system, "Helvetica Neue", sans-serif;
  --font-mono:  "JetBrains Mono", "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 18px;

  --shadow-sm: 0 1px 2px rgba(10,31,61,.06), 0 1px 1px rgba(10,31,61,.04);
  --shadow-md: 0 4px 14px rgba(10,31,61,.08), 0 2px 4px rgba(10,31,61,.04);
  --shadow-lg: 0 24px 60px rgba(10,31,61,.18), 0 6px 16px rgba(10,31,61,.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: var(--cream-50);
  color: var(--ink-900);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button { font-family: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }

/* ─────────── TYPE ─────────── */
.serif { font-family: var(--font-serif); font-weight: 500; letter-spacing: -0.005em; }
.mono  { font-family: var(--font-mono); }
.eyebrow {
  font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase;
  font-weight: 600; color: var(--gold-600);
}
.eyebrow--navy { color: var(--navy-700); }
.eyebrow--light { color: var(--gold-200); }

h1, h2, h3 { margin: 0; font-family: var(--font-serif); font-weight: 500; letter-spacing: -0.01em; }
h1 { font-size: clamp(48px, 6vw, 84px); line-height: 1.02; }
h2 { font-size: clamp(34px, 4vw, 52px); line-height: 1.08; }
h3 { font-size: 24px; line-height: 1.2; }

p { margin: 0; }

/* ─────────── LAYOUT ─────────── */
#root { min-height: 100vh; display: flex; flex-direction: column; }

.app-shell {
  display: flex; flex-direction: column;
  min-height: 100vh;
}

.container { width: 100%; max-width: 1340px; margin: 0 auto; padding: 0 40px; }

/* ─────────── TOP BAR ─────────── */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(251, 247, 238, 0.86);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar__inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 32px;
  padding: 18px 0;
}
.brand {
  display: flex; align-items: center; gap: 14px;
  cursor: pointer;
}
.brand__seal {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--navy-800);
  display: grid; place-items: center;
  flex-shrink: 0;
  position: relative;
}
.brand__seal::after {
  content: ""; position: absolute; inset: 3px;
  border: 1px solid var(--gold-500); border-radius: 50%;
}
.brand__name { display: flex; flex-direction: column; line-height: 1; }
.brand__name b {
  font-family: var(--font-serif); font-weight: 600;
  font-size: 18px; color: var(--navy-800); letter-spacing: 0.01em;
}
.brand__name span {
  font-size: 9px; letter-spacing: 0.16em; color: var(--gold-600); white-space: nowrap;
  text-transform: uppercase; margin-top: 4px; font-weight: 600;
}

.nav { display: flex; gap: 4px; }
.nav__item {
  border: 0; background: transparent;
  font: inherit; font-size: 13.5px; font-weight: 500;
  color: var(--ink-700);
  padding: 10px 16px; border-radius: 8px;
  position: relative; transition: color .15s, background .15s;
  display: flex; align-items: center; gap: 8px;
}
.nav__item:hover { color: var(--navy-800); background: rgba(10,31,61,0.04); }
.nav__item--active { color: var(--navy-800); }
.nav__item--active::after {
  content: ""; position: absolute;
  bottom: -19px; left: 16px; right: 16px; height: 2px;
  background: var(--gold-500);
}
.nav__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--gold-500); opacity: 0; }
.nav__item--active .nav__dot { opacity: 1; }

.topbar--dark .brand__name b,
.topbar--dark .brand__name b * { color: #FFFFFF !important; }

.topbar--dark .nav__item { color: rgba(255,255,255,0.85); }
.topbar--dark .nav__item:hover { color: #FFFFFF; background: rgba(255,255,255,0.08); }
.topbar--dark .nav__item--active { color: #FFFFFF; }
.topbar--dark .lang__btn { color: rgba(255,255,255,0.7); }
.topbar--dark .lang__btn--active { background: rgba(255,255,255,0.15); color: #FFD700; }

.lang {
  display: flex; align-items: center; flex-wrap: wrap; gap: 2px;
  background: rgba(10,31,61,0.04);
  border-radius: 999px; padding: 3px;
}
.lang__btn {
  border: 0; background: transparent;
  font: inherit; font-size: 11px; font-weight: 600;
  color: var(--ink-500);
  padding: 5px 9px; border-radius: 999px;
  letter-spacing: 0.04em;
}
.lang__btn--active { background: var(--navy-800); color: var(--gold-400); }

.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--navy-800);
  display: grid; place-items: center;
  color: var(--gold-400);
  font-family: var(--font-serif); font-size: 16px; font-weight: 600;
  border: 1.5px solid var(--gold-500);
}

/* ─────────── BUTTONS ─────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 0; padding: 14px 22px; border-radius: 10px;
  font: inherit; font-size: 14px; font-weight: 500;
  transition: transform .12s, box-shadow .12s, background .15s;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn--primary {
  background: var(--navy-800); color: var(--gold-400);
  box-shadow: 0 1px 0 var(--gold-500) inset, 0 6px 18px rgba(10,31,61,.18);
}
.btn--primary:hover { background: var(--navy-700); }
.btn--gold {
  background: var(--gold-500); color: var(--navy-900);
  box-shadow: 0 1px 0 rgba(255,255,255,.4) inset, 0 6px 18px rgba(212,175,55,.30);
}
.btn--gold:hover { background: var(--gold-400); }
.btn--ghost {
  background: transparent; color: var(--navy-800);
  border: 1px solid var(--border-strong);
}
.btn--ghost:hover { background: rgba(10,31,61,0.04); }
.btn--sm { padding: 9px 14px; font-size: 12.5px; border-radius: 8px; }

/* ─────────── CARDS ─────────── */
.card {
  background: white; border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card--quiet {
  background: var(--cream-50); border-color: rgba(10,31,61,0.06);
  box-shadow: none;
}

/* ─────────── BADGES ─────────── */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 5px 10px; border-radius: 999px;
}
.badge--gold { background: var(--gold-100); color: var(--gold-600); }
.badge--teal { background: rgba(13,115,119,.10); color: var(--teal-700); }
.badge--navy { background: rgba(10,31,61,.08); color: var(--navy-800); }
.badge--warn { background: #FEEDD6; color: #8C5A12; }
.badge--ok { background: #D9EDDD; color: #1E6A3A; }

.divider { height: 1px; background: var(--border); border: 0; margin: 0; }

/* ─────────── SCREEN TRANSITIONS ─────────── */
.screen {
  animation: fade-up .35s cubic-bezier(.2,.7,.2,1);
}
@keyframes fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Carnet flip (anverso/reverso) — never hides content: no opacity in the
   keyframes, so even if the animation frame freezes the card stays fully visible. */
.carnet-flip { transform-origin: center; }
@media (prefers-reduced-motion: no-preference) {
  .carnet-flip { animation: carnet-flip .4s cubic-bezier(.34,.1,.2,1) both; }
}

/* ─────────── RESPONSIVE (mobile/tablet) ─────────── */
@media (max-width: 1080px) {
  .container { padding: 0 24px; }
  h1 { font-size: clamp(36px, 7vw, 60px); }
  h2 { font-size: clamp(28px, 6vw, 40px); }
}
@media (max-width: 720px) {
  body { font-size: 14px; }
  .container { padding: 0 16px; }
  h1 { font-size: clamp(30px, 8vw, 44px); }
  h2 { font-size: clamp(24px, 7vw, 32px); }
  h3 { font-size: 20px; }
  .topbar { padding: 12px 0; }
  /* Community rail becomes a fixed bottom bar (icons only, no hover-expand — there's no
     hover on touch) instead of a left sidebar eating horizontal space. */
  .community-rail { position: fixed; bottom: 0; left: 0; right: 0; top: auto; width: 100% !important;
    height: calc(62px + env(safe-area-inset-bottom, 0px)); box-sizing: border-box; flex-direction: row !important; justify-content: space-around;
    padding: 0 6px env(safe-area-inset-bottom, 0px) !important; border-right: none; border-top: 1px solid rgba(255,255,255,0.08); z-index: 40; }
  .community-rail:hover { width: 100% !important; }
  .community-rail .community-nav-label { display: none !important; }
  .community-rail > div:first-child { display: none; }
  .community-rail button { padding: 8px !important; }
  .community-main-col { padding-bottom: calc(78px + env(safe-area-inset-bottom, 0px)) !important; }
  .chat-widget-fab--in-community { bottom: calc(78px + env(safe-area-inset-bottom, 0px)) !important; }
  /* Messages screen: 300px-sidebar + chat two-column layout collapses to a single column —
     show the thread list OR the open chat, never both, with a Back button to return. */
  .messages-shell { position: relative; }
  .messages-shell .messages-sidebar { width: 100% !important; border-right: none !important; }
  .messages-shell:not(.has-active) .messages-chat { display: none !important; }
  .messages-shell.has-active .messages-sidebar { display: none !important; }
  .messages-shell.has-active .messages-back-btn { display: flex !important; }
  .pet-modal-grid { grid-template-columns: 1fr !important; }
  /* Floating chat widget: fixed 340px panel would overflow small phone viewports. */
  .chat-widget-fab { right: 12px !important; bottom: 12px !important; }
  .chat-widget-panel { width: calc(100vw - 24px) !important; max-width: 340px; height: calc(100vh - 140px) !important; max-height: 490px; }
}
@media (max-width: 480px) {
  .container { padding: 0 14px; }
}
@keyframes carnet-flip {
  0%   { transform: translateY(12px) scale(.985); }
  100% { transform: translateY(0) scale(1); }
}

.modal-scroll{scrollbar-width:thin;scrollbar-color:var(--navy-600,#3D6BC7) #EEE}
.modal-scroll::-webkit-scrollbar{width:9px}
.modal-scroll::-webkit-scrollbar-track{background:#F0F0F0}
.modal-scroll::-webkit-scrollbar-thumb{background:var(--navy-600,#3D6BC7);border-radius:6px;border:2px solid #F0F0F0}
.modal-scroll::-webkit-scrollbar-thumb:hover{background:var(--navy-800,#003399)}
@keyframes likePop {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.5); }
  55%  { transform: scale(0.8); }
  75%  { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* ─────────── UTIL ─────────── */
.row { display: flex; }
.col { display: flex; flex-direction: column; }
.gap-4 { gap: 4px; } .gap-6 { gap: 6px; } .gap-8 { gap: 8px; }
.gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-20 { gap: 20px; }
.gap-24 { gap: 24px; } .gap-32 { gap: 32px; } .gap-40 { gap: 40px; }
.center { align-items: center; }
.between { justify-content: space-between; }

/* Icons (line, premium) */
.icn { width: 18px; height: 18px; stroke: currentColor; fill: none;
  stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.icn--sm { width: 14px; height: 14px; }
.icn--lg { width: 24px; height: 24px; stroke-width: 1.4; }

/* ─────────── PASSPORT MRZ FONT helper ─────────── */
.mrz {
  font-family: var(--font-mono);
  font-size: 12px; letter-spacing: 0.06em;
  color: var(--navy-900); font-weight: 500;
  word-break: break-all;
}

/* ─────────── EU MAP wash (for backgrounds) ─────────── */
.eu-wash {
  background:
    radial-gradient(ellipse at 30% 40%, rgba(247,226,214,0.7), transparent 55%),
    radial-gradient(ellipse at 75% 65%, rgba(220,227,238,0.55), transparent 50%),
    var(--cream-50);
}
