/* ============================================================
   MyJvault — Dark Mode UI (estilo app móvil de referencia)
   Paleta: fondo #121212, cards #1c1c1e, acento naranja #ff7a18
   Verde = mucho tiempo, Naranja = por vencer, Gris = vencido
   ============================================================ */

:root {
  --bg: #121212;
  --bg-elev: #1c1c1e;
  --bg-elev-2: #242427;
  --border: #2c2c30;
  --text: #f5f5f7;
  --text-muted: #9a9aa2;
  --accent: #ff7a18;
  --accent-soft: rgba(255, 122, 24, 0.15);
  --green: #34d399;
  --green-soft: rgba(52, 211, 153, 0.15);
  --orange: #fb923c;
  --orange-soft: rgba(251, 146, 60, 0.15);
  --red: #f87171;
  --red-soft: rgba(248, 113, 113, 0.15);
  --radius: 14px;
  --radius-sm: 10px;
  --nav-h: 64px;
  --fab: 56px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.45;
}

a { color: var(--accent); text-decoration: none; }
a:hover { opacity: 0.85; }

/* ---------- Layout ---------- */
.app-shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 16px 16px calc(var(--nav-h) + 24px);
  position: relative;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 4px 0 12px;
  color: var(--text);
}

.muted { color: var(--text-muted); font-size: 0.875rem; }

/* ---------- Header ---------- */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0 12px;
}
.app-header h1 { font-size: 1.4rem; font-weight: 700; margin: 0; }
.header-icon {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--border);
}

/* ---------- Cards ---------- */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}
.card-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.card-row:last-child { border-bottom: none; }

/* ---------- Stat cards (dashboard) ---------- */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.stat-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 10px;
  text-align: center;
}
.stat-card .stat-num { font-size: 1.7rem; font-weight: 800; line-height: 1; }
.stat-card .stat-label { font-size: 0.72rem; color: var(--text-muted); margin-top: 6px; }
.stat-green { color: var(--green); }
.stat-orange { color: var(--orange); }
.stat-red { color: var(--red); }

/* ---------- Product / warranty item card ---------- */
.item {
  display: flex;
  gap: 12px;
  align-items: center;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 10px;
}
.item-thumb {
  width: 56px; height: 56px;
  border-radius: var(--radius-sm);
  background: var(--bg-elev-2);
  display: grid; place-items: center;
  font-size: 1.5rem;
  flex: 0 0 auto;
  overflow: hidden;
}
.item-thumb img { width: 100%; height: 100%; object-fit: cover; }
.item-body { flex: 1 1 auto; min-width: 0; }
.item-title { font-weight: 600; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-meta { font-size: 0.78rem; color: var(--text-muted); }

/* ---------- Badges (días restantes) ---------- */
.badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
  flex: 0 0 auto;
}
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-orange { background: var(--orange-soft); color: var(--orange); }
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-neutral { background: var(--bg-elev-2); color: var(--text-muted); }

/* ---------- Chips / filters ---------- */
.chip-row { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 12px; scrollbar-width: none; }
.chip-row::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- Search ---------- */
.search {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.9rem;
  margin-bottom: 10px;
}
.search::placeholder { color: var(--text-muted); }

/* ---------- Forms ---------- */
label { display: block; font-size: 0.82rem; color: var(--text-muted); margin: 10px 0 4px; }
input, select, textarea {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.92rem;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
textarea { resize: vertical; min-height: 80px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 0.92rem;
  border: none;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { opacity: 0.9; }
.btn-secondary {
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-block { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: 0.82rem; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ---------- Floating Action Button ---------- */
.fab {
  position: fixed;
  right: max(16px, calc(50% - 240px + 16px));
  bottom: calc(var(--nav-h) + 16px);
  width: var(--fab); height: var(--fab);
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: grid; place-items: center;
  font-size: 1.6rem;
  box-shadow: 0 6px 20px rgba(255, 122, 24, 0.45);
  z-index: 50;
}

/* ---------- Bottom nav ---------- */
.bottom-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: 480px;
  height: var(--nav-h);
  background: var(--bg-elev);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 40;
}
.bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 600;
}
.bottom-nav a.active { color: var(--accent); }
.bottom-nav .nav-ico { font-size: 1.25rem; line-height: 1; }

/* ---------- Auth ---------- */
.auth-wrap { max-width: 360px; margin: 8vh auto 0; padding: 0 20px; }
.auth-wrap .btn { margin-top: 14px; }

/* ---------- Detail / gallery ---------- */
.gallery-main {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius);
  background: var(--bg-elev-2);
  display: grid; place-items: center;
  font-size: 3rem;
  overflow: hidden;
  margin-bottom: 10px;
}
.gallery-main img { width: 100%; height: 100%; object-fit: cover; }
.gallery-thumbs { display: flex; gap: 8px; margin-bottom: 14px; }
.gallery-thumbs .thumb {
  width: 60px; height: 60px;
  border-radius: var(--radius-sm);
  background: var(--bg-elev-2);
  border: 2px solid transparent;
  overflow: hidden;
  display: grid; place-items: center;
}
.gallery-thumbs .thumb.active { border-color: var(--accent); }
.gallery-thumbs .thumb img { width: 100%; height: 100%; object-fit: cover; }

.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.detail-row:last-child { border-bottom: none; }
.detail-row .k { color: var(--text-muted); }
.detail-row .v { font-weight: 600; text-align: right; }

.pill {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.82rem;
}

/* ---------- Toggles (settings) ---------- */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.switch { position: relative; width: 46px; height: 26px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0;
  background: var(--bg-elev-2);
  border-radius: 999px;
  transition: 0.2s;
}
.slider::before {
  content: ""; position: absolute;
  width: 20px; height: 20px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: 0.2s;
}
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(20px); }

/* ---------- Misc ---------- */
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 4px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.list-item .li-ico { font-size: 1.2rem; width: 24px; text-align: center; }
.list-item .chev { margin-left: auto; color: var(--text-muted); }
.empty-state { text-align: center; color: var(--text-muted); padding: 40px 0; }

.alert-success {
  background: var(--green-soft);
  color: var(--green);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  font-size: 0.88rem;
}
.alert-error {
  background: var(--red-soft);
  color: var(--red);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  font-size: 0.88rem;
}
