/* shared/pidomi-brand.css — marca Pidomi + componentes comunes de los portales.
   Reutiliza la paleta de pidomi-track (teal oscuro #0E3A47 + naranja calido #FF7A33). */
:root {
  --pidomi-dark: #0E3A47;
  --pidomi-dark-2: #0a2c36;
  --pidomi-orange: #FF7A33;
  --pidomi-orange-soft: #ffd9c2;
  --pidomi-cream: #FFF6EF;
  --pidomi-text: #0E3A47;
  --pidomi-muted: #6b7d83;
  --pidomi-line: #e7ddd4;
  --ok: #1f9d6b;
  --warn: #e0a106;
  --bad: #d24b3e;
  --radius: 18px;
  --shadow: 0 8px 30px rgba(14, 58, 71, 0.18);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--pidomi-cream);
  color: var(--pidomi-text);
  overflow-x: hidden; /* red de seguridad global: nada debe permitir scroll horizontal de la pagina (movil) */
}

.hidden { display: none !important; }

/* ---- Topbar + marca ---- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  background: var(--pidomi-dark);
  color: #fff;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: 8px; }

/* logo: marca (mapa+corazón SVG) + wordmark. El punto de cada "i" = círculo naranja (resalta). */
.brand-mark { height: 28px; width: auto; display: block; flex: 0 0 auto; }
.brand-text { font-weight: 800; font-size: 22px; letter-spacing: 0.5px; color: #fff; }
.brand-i { color: inherit; }      /* sin punto sobre la "i" (decoración eliminada) */
.brand-i::after { content: none; }
/* nombre de marca en chino (拼多米): píldora naranja tipo sub-marca. Oculta si vacío (es). */
.brand-cn {
  font-size: 13px; font-weight: 800; letter-spacing: 2px; line-height: 1.4;
  color: #fff; background: var(--pidomi-orange);
  padding: 2px 9px 3px; border-radius: 999px; white-space: nowrap;
}
.brand-cn:empty { display: none; }

.org-name {
  font-size: 13px;
  color: var(--pidomi-orange-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 42vw;
}

.lang-switch { display: flex; gap: 6px; }
.lang-btn {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 0;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.lang-btn.active { background: var(--pidomi-orange); color: #fff; }
/* selector de idioma (multi-idioma; reemplaza los botones es/zh) */
.lang-select {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 0;
  border-radius: 999px;
  padding: 6px 28px 6px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%23fff' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.lang-select option { color: #111; }

.icon-btn {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 0;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

/* ---- Botones ---- */
.btn-primary {
  background: var(--pidomi-orange);
  color: #fff;
  border: 0;
  border-radius: 12px;
  padding: 14px 18px;
  font-weight: 700;
  font-size: 16px;
  width: 100%;
  cursor: pointer;
  position: relative;
}
.btn-primary:disabled { opacity: .5; cursor: default; }
.btn-ghost {
  background: transparent;
  color: var(--pidomi-dark);
  border: 1px solid var(--pidomi-line);
  border-radius: 12px;
  padding: 12px 16px;
  font-weight: 600;
  cursor: pointer;
}
.btn-ghost:disabled { opacity: .5; cursor: default; }

/* spinner para .is-loading (en cualquier boton) */
.is-loading { color: transparent !important; pointer-events: none; }
.is-loading::after {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  width: 18px; height: 18px;
  margin: -9px 0 0 -9px;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-top-color: #fff;
  border-radius: 50%;
  animation: pidomi-spin 0.7s linear infinite;
}
.btn-ghost.is-loading::after { border-color: rgba(14, 58, 71, .3); border-top-color: var(--pidomi-dark); }
@keyframes pidomi-spin { to { transform: rotate(360deg); } }

/* ---- Campos de formulario ---- */
.field { display: block; margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--pidomi-muted); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--pidomi-line);
  border-radius: 12px;
  font-size: 16px; /* 16px evita el zoom de iOS */
  background: #fff;
  color: var(--pidomi-text);
  font-family: inherit;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--pidomi-orange);
  box-shadow: 0 0 0 3px rgba(255, 122, 51, .15);
}
.field-error { color: var(--bad); font-size: 13px; margin: 6px 2px 0; min-height: 1em; }
.field-hint { color: var(--pidomi-muted); font-size: 12px; margin: 6px 2px 0; }

/* ---- Tarjetas / listas ---- */
.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 14px;
}
.card.tappable { cursor: pointer; transition: transform .08s ease; }
.card.tappable:active { transform: scale(0.99); }

.list-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--pidomi-line);
}
.list-row:last-child { border-bottom: 0; }

/* ---- Insignias de estado ---- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge.ok { background: rgba(31, 157, 107, .14); color: var(--ok); }
.badge.live { background: rgba(255, 122, 51, .16); color: var(--pidomi-orange); }
.badge.bad { background: rgba(210, 75, 62, .14); color: var(--bad); }
.badge.muted { background: var(--pidomi-cream); color: var(--pidomi-muted); }

/* Pedido que lleva demasiado tiempo abierto. Franja lateral + edad en texto: el color solo no
   basta (el portal lo usa gente que no es técnica, y .live ya es naranja). La edad SIEMPRE se
   escribe con letras para que se lea de un vistazo y a un metro de distancia. */
.card.o-warn  { border-left: 5px solid #d98324; }
.card.o-stuck { border-left: 5px solid var(--bad, #d24b3e); }
.o-age { font-size: 12px; font-weight: 700; margin-top: 2px; }
.o-warn  .o-age { color: #d98324; }
.o-stuck .o-age { color: var(--bad, #d24b3e); }

/* ---- Toast ---- */
.toast {
  position: fixed;
  bottom: 84px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: var(--pidomi-dark);
  color: #fff;
  padding: 12px 18px;
  border-radius: 999px;
  font-size: 14px;
  z-index: 90;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  max-width: 90vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- Banner de aviso (experimental / errores no bloqueantes) ---- */
.notice {
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13px;
  margin-bottom: 14px;
  line-height: 1.4;
}
.notice.warn { background: rgba(224, 161, 6, .12); color: #8a6400; border: 1px solid rgba(224, 161, 6, .3); }
.notice.info { background: rgba(14, 58, 71, .06); color: var(--pidomi-dark); border: 1px solid var(--pidomi-line); }

/* ---- Estados de pantalla (loading / vacio / error) ---- */
.state {
  text-align: center;
  padding: 48px 24px;
  color: var(--pidomi-muted);
}
.state .state-icon { font-size: 40px; margin-bottom: 10px; }
.state h3 { margin: 0 0 6px; color: var(--pidomi-text); font-size: 17px; }
.state p { margin: 0; font-size: 14px; }
.spinner-block {
  width: 28px; height: 28px;
  margin: 0 auto 14px;
  border: 3px solid var(--pidomi-line);
  border-top-color: var(--pidomi-orange);
  border-radius: 50%;
  animation: pidomi-spin 0.7s linear infinite;
}

/* ---- Chips de filtro ---- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 12px; -webkit-overflow-scrolling: touch; }
.chip {
  flex: 0 0 auto;
  background: #fff;
  border: 1px solid var(--pidomi-line);
  color: var(--pidomi-muted);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.chip.active { background: var(--pidomi-dark); color: #fff; border-color: var(--pidomi-dark); }

/* ---- Barra de navegacion inferior (movil) ---- */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  display: flex;
  background: #fff;
  border-top: 1px solid var(--pidomi-line);
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -2px 12px rgba(14, 58, 71, 0.06);
}
.tab {
  flex: 1;
  text-align: center;
  padding: 10px 4px 8px;
  color: var(--pidomi-muted);
  text-decoration: none;
  font-size: 11px;
  font-weight: 600;
  border: 0;
  background: transparent;
  cursor: pointer;
}
.tab .tab-ico { display: block; font-size: 20px; line-height: 1.2; }
.tab.active { color: var(--pidomi-orange); }

/* ---- entrada de teléfono internacional (shared/pidomi-phone.js) ---- */
.pp-row { display: flex; gap: 8px; }
.pp-row .pp-cc {
  flex: 0 0 auto; max-width: 42%; padding: 12px 8px; border-radius: 10px;
  border: 1px solid var(--pidomi-line, #d8dee3); background: #fff; font-size: 15px; color: var(--pidomi-dark, #0E3A47);
}
.pp-row .pp-num {
  flex: 1 1 auto; min-width: 0; padding: 12px 12px; border-radius: 10px;
  border: 1px solid var(--pidomi-line, #d8dee3); font-size: 16px;
}
