/* ============================================================================
   Apps móviles (dueño de mascota y médico) — shell
   Las primitivas (botones, tarjetas, formularios, chips, toast) viven en
   design-system.css. Aquí el armazón móvil y sus compuestos.
   ========================================================================= */

/* --------------------------------------------------------- Marco de la app */
/* En escritorio la app se centra en una columna de ancho móvil con un marco
   sobrio (sin simular un teléfono: eso lee a maqueta, no a producto). */

.stage { min-height: 100vh; display: grid; place-items: center; padding: var(--s6); background: var(--bg); }

.phone {
  width: 420px; height: 860px; max-height: 94vh;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-lg);
  overflow: hidden;
}

.screen {
  width: 100%; height: 100%;
  display: flex; flex-direction: column;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}

@media (max-width: 560px) {
  .stage { padding: 0; }
  .phone { width: 100%; height: 100vh; max-height: none; border: none; border-radius: 0; box-shadow: none; }
}

/* Ilustraciones decorativas a los lados del login (solo pantallas anchas;
   ocultas por defecto, se muestran cuando la pantalla visible es el login). */
.side-deco {
  display: none; position: fixed; top: 50%; transform: translateY(-50%); z-index: 0;
  width: min(30vw, 340px); height: auto; pointer-events: none; user-select: none;
}
.side-deco.left { left: clamp(0px, 3vw, 60px); }
.side-deco.right { right: clamp(0px, 3vw, 60px); }
@media (min-width: 1280px) {
  body:has(.login) .side-deco { display: block; }
}

/* ------------------------------------------------------------- Cabecera --- */

.topbar {
  display: flex; align-items: center; gap: var(--s2);
  padding: var(--s5) var(--s4) var(--s3);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: relative;
}
/* Identidad de la clínica: contenida y discreta */
.topbar img { max-height: 28px; max-width: 132px; object-fit: contain; }
.logo { font-size: 15px; font-weight: 600; letter-spacing: -.01em; color: var(--ink); }
.logo .vet { color: var(--ink); }
.logo .easy { color: var(--brand-600); }
.logo-paw { font-size: 17px; }

.bell {
  margin-left: auto; flex: none; position: relative;
  width: 36px; height: 36px; border-radius: var(--r-full);
  display: grid; place-items: center; font-size: 16px;
  background: var(--surface); border: 1px solid var(--border);
  transition: background var(--t), border-color var(--t);
}
.bell:hover { background: var(--surface-2); border-color: var(--border-2); }
.bell .badge {
  position: absolute; top: -5px; right: -5px;
  min-width: 18px; height: 18px; padding: 0 5px;
  display: none; align-items: center; justify-content: center;
  background: var(--err); color: #fff;
  font-size: 10.5px; font-weight: 600; line-height: 1;
  border: 2px solid var(--surface); border-radius: var(--r-full);
}
.bell .badge.on { display: flex; }

/* ------------------------------------------------------------ Contenido --- */

.content { flex: 1; overflow-y: auto; padding: var(--s4) var(--s4) var(--s7); scrollbar-width: thin; }

/* Navegación inferior */
.nav {
  display: flex; gap: var(--s1);
  padding: 6px var(--s2) calc(6px + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--border);
}
.nav button {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 7px 0 5px; border-radius: var(--r-sm);
  font-size: 10.5px; font-weight: 500; color: var(--text-muted);
  transition: color var(--t-fast), background var(--t-fast);
}
.nav button .ico { font-size: 19px; line-height: 1; opacity: .75; transition: opacity var(--t-fast); }
.nav button:hover { background: var(--surface-2); }
.nav button.active { color: var(--brand-600); font-weight: 600; }
.nav button.active .ico { opacity: 1; }

/* --------------------------------------------------------------- Saludo --- */

.hello { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s2) 0 var(--s4); }
.hello h1 { font-size: 21px; }
.avatar {
  width: 40px; height: 40px; flex: none; border-radius: var(--r-full);
  display: grid; place-items: center; font-size: 19px;
  background: var(--brand-50); border: 1px solid var(--brand-100);
}

/* ----------------------------------------------------------------- Hero --- */

.hero {
  display: flex; align-items: center; gap: var(--s4);
  padding: var(--s5); margin-bottom: var(--s4);
  border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--brand-700), var(--brand-500));
  color: #fff; box-shadow: var(--sh-sm);
}
.hero h2 { font-size: 18px; line-height: 1.3; color: #fff; margin-bottom: var(--s3); }
.hero .btn { --btn-bg: #fff; --btn-fg: var(--brand-700); --btn-br: #fff; box-shadow: var(--sh-xs); }
.hero .btn:hover { --btn-bg: var(--brand-50); --btn-br: var(--brand-50); }
.hero .art { font-size: 44px; flex: none; opacity: .95; }

/* ------------------------------------------------------- Accesos rápidos -- */

.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s2); margin-bottom: var(--s4); }
.quick button {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: var(--s3) var(--s1);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  color: var(--ink-2); box-shadow: var(--sh-xs);
  transition: border-color var(--t), box-shadow var(--t), transform var(--t-fast);
}
.quick button:hover { border-color: var(--border-2); box-shadow: var(--sh-sm); transform: translateY(-1px); }
.quick .ico { font-size: 21px; }
.quick .lbl { font-size: 10.5px; font-weight: 500; line-height: 1.2; text-align: center; }

/* ------------------------------------------------------ Tarjetas de lista - */

.card { padding: var(--s4); }

.appt-card { margin-bottom: var(--s3); }
.appt-card b { font-size: 14.5px; }

.pet-badge {
  width: 48px; height: 48px; flex: none; border-radius: var(--r-full);
  display: grid; place-items: center; font-size: 24px; overflow: hidden;
  background: var(--brand-50); border: 1px solid var(--brand-100);
}
.pet-badge img { width: 100%; height: 100%; object-fit: cover; }
.pet-badge.big { width: 72px; height: 72px; font-size: 34px; }
button.grow { flex: 1; }

/* Cuidados con semáforo: el estado se lee por color y por chip */
.care-card { margin-bottom: var(--s3); border-left: 3px solid var(--ok); }
.care-card.yellow { border-left-color: var(--warn); }
.care-card.red { border-left-color: var(--err); }
.care-card b { font-size: 14px; }

.notif-card { margin-bottom: var(--s3); border-left: 3px solid var(--border-2); }
.notif-card.unread { border-left-color: var(--brand-600); background: var(--brand-50); }
.notif-card b { font-size: 14px; }
.notif-card p { font-size: 13px; margin-top: 3px; color: var(--ink-2); }
.notif-card .when { font-size: 11px; color: var(--text-faint); margin-top: 5px; }

/* --------------------------------------------------------- Promociones --- */

.promo-card { margin-bottom: var(--s4); overflow: hidden; padding: 0; }
.promo-image { display: block; width: 100%; max-height: 168px; object-fit: cover; }
.promo-card h3, .promo-card p, .promo-badge, .promo-until { margin-left: var(--s4); margin-right: var(--s4); }
.promo-badge {
  display: inline-flex; margin-top: var(--s4); margin-bottom: var(--s2);
  padding: 3px 10px; border-radius: var(--r-full);
  background: var(--err-bg); color: var(--err); border: 1px solid var(--err-br);
  font-size: 12px; font-weight: 600;
}
.promo-card h3 { font-size: 15.5px; margin-bottom: 4px; }
.promo-card p { font-size: 13px; color: var(--ink-2); }
.promo-until { display: block; margin-top: var(--s2); padding-bottom: var(--s4); font-size: 11.5px; color: var(--text-faint); }

/* ------------------------------------------------------------- Mascotas --- */

.pets-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.pet-card { text-align: left; cursor: pointer; transition: border-color var(--t), box-shadow var(--t), transform var(--t-fast); }
.pet-card:hover { border-color: var(--border-2); box-shadow: var(--sh-sm); transform: translateY(-1px); }
.pet-card .row { gap: var(--s3); }
.pet-card b { display: block; font-size: 14.5px; }

.pet-hero { text-align: center; padding: var(--s5) var(--s4); }
.pet-hero .pet-badge { width: 76px; height: 76px; font-size: 38px; margin: 0 auto var(--s3); }
.pet-hero h2 { font-size: 20px; }

.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s2); margin-top: var(--s4); }
.stat { padding: var(--s3) var(--s2); text-align: center; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); }
.stat b { display: block; font-size: 15px; font-weight: 600; }
.stat span { font-size: 10px; font-weight: 550; letter-spacing: .04em; text-transform: uppercase; color: var(--text-faint); }

.record { margin-bottom: var(--s3); border-left: 3px solid var(--brand-500); }
.record .diag { font-weight: 600; font-size: 14.5px; color: var(--ink); }
.record p { font-size: 13px; margin-top: 4px; color: var(--ink-2); }

/* --------------------------------------------------- Hoja inferior (form) - */

.sheet-mask {
  position: absolute; inset: 0; z-index: 60;
  display: flex; align-items: flex-end;
  background: rgba(15, 23, 42, .45); backdrop-filter: blur(2px);
  animation: fade 160ms ease;
}
.sheet {
  width: 100%; max-height: 88%; overflow-y: auto;
  padding: var(--s5) var(--s5) calc(var(--s5) + env(safe-area-inset-bottom));
  background: var(--surface);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  box-shadow: 0 -12px 32px -8px rgba(16,24,40,.18);
  animation: rise 220ms cubic-bezier(.2,.7,.2,1);
}
/* Asidero visual de la hoja */
.sheet::before {
  content: ""; display: block; width: 36px; height: 4px; margin: 0 auto var(--s4);
  background: var(--border-2); border-radius: var(--r-full);
}
.sheet h3 { font-size: 17px; margin-bottom: var(--s4); }

@keyframes rise { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------------------------------------------------------------- Login --- */

.login {
  flex: 1; display: flex; flex-direction: column; justify-content: center;
  padding: var(--s7) var(--s6); background: var(--bg);
}
.login .logo { font-size: 17px; text-align: center; }
.login .logo-paw { font-size: 19px; }
.login .tagline { text-align: center; margin: var(--s2) 0 var(--s6); color: var(--text-muted); font-size: 13.5px; }
.login .card { padding: var(--s5); box-shadow: var(--sh-sm); }
.login .btn.block { height: 42px; margin-top: var(--s2); }

.demo-hint {
  margin-top: var(--s4); padding: var(--s3); text-align: center;
  font-size: 12px; color: var(--text-muted);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm);
}

/* ------------------------------------------------------------ Ajustes UI - */

/* El toast vive dentro del marco de la app, no del viewport */
.toast { position: absolute; bottom: var(--s8); }

.section-title { margin: var(--s5) 0 var(--s3); }
.back-btn { padding: var(--s2) 0; }
.skeleton { min-height: 72px; }
