/* ══════════════════════════════════════════════════
   Mobile bottom nav
══════════════════════════════════════════════════ */
.bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 200;
  height: var(--bottom-h);
  background: var(--ink); border-top: 1px solid rgba(255,255,255,.07);
  padding: 8px 8px 8px;
  align-items: center; justify-content: space-around;
  box-shadow: 0 -4px 20px rgba(30,26,20,.25);
  padding-bottom: calc(8px + env(safe-area-inset-bottom));
}
.bottom-nav-btn {
  display: flex; flex-direction: column; align-items: center;
  gap: 3px; padding: 8px 11px; border: none; background: transparent;
  color: rgba(255,255,255,.45); font-size: .64rem; cursor: pointer;
  border-radius: 8px; transition: color .15s; position: relative;
  touch-action: manipulation;
}
.bottom-nav-btn:active { background: rgba(255,255,255,.07); }
.bottom-nav-btn.primary-action {
  background: var(--accent); color: #fff;
  border-radius: 12px; padding: 8px 14px;
}
.bottom-nav-btn.primary-action:active { background: var(--accent-h); }
.filter-active-dot {
  position: absolute; top: 6px; right: 12px;
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
}

/* ══════════════════════════════════════════════════
   Modals
══════════════════════════════════════════════════ */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 400;
  background: rgba(30,26,20,.55); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 12px; animation: bdIn .2s ease;
}
@keyframes bdIn { from { opacity: 0; } }

.modal {
  background: var(--surface); border-radius: var(--r-lg);
  width: 100%; max-width: 500px;
  max-height: 94dvh; overflow-y: auto;
  box-shadow: var(--shadow-lg); animation: modalIn .22s ease;
}
.modal-lg { max-width: 680px; }
@keyframes modalIn { from { opacity:0; transform: translateY(14px); } }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 0; position: sticky; top: 0;
  background: var(--surface); z-index: 1;
  border-bottom: 1px solid transparent;
}
.modal-header h2 { font-family: 'Nunito', sans-serif; font-size: 1.35rem; font-weight: 500; }
.modal-close {
  width: 30px; height: 30px; border-radius: 50%;
  border: none; background: var(--bg2); color: var(--muted);
  cursor: pointer; font-size: .9rem; transition: all .15s; flex-shrink: 0;
}
.modal-close:hover { background: var(--bg3); color: var(--ink); }
.modal-body { padding: 16px 20px 24px; }

/* ══════════════════════════════════════════════════
   Scanner
══════════════════════════════════════════════════ */
#scanner-viewport { border-radius: 8px; overflow: hidden; min-height: 200px; }
.scanner-hint { font-size: .8rem; color: var(--muted); text-align: center; margin: 8px 0; }
.isbn-manual-row { display: flex; gap: 8px; margin-top: 8px; }
.isbn-manual-row input {
  flex: 1; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--r);
  background: var(--bg); color: var(--ink); font-size: 1rem; outline: none;
}
.isbn-manual-row input:focus { border-color: var(--accent); }
.isbn-found {
  margin-top: 14px; padding: 12px;
  background: var(--bg2); border-radius: var(--r); border: 1px solid var(--border);
  display: flex; gap: 12px; align-items: flex-start;
}
.isbn-found-cover { width: 52px; height: 78px; border-radius: 4px; overflow: hidden; background: var(--bg3); flex-shrink: 0; }
.isbn-found-cover img { width: 100%; height: 100%; object-fit: cover; }
.isbn-found-info { flex: 1; min-width: 0; }
.isbn-found-title { font-family: 'Nunito', sans-serif; font-size: 1rem; font-weight: 500; margin-bottom: 3px; }
.isbn-found-meta  { font-size: .76rem; color: var(--muted); margin-bottom: 10px; line-height: 1.4; }
.isbn-found-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.isbn-found-actions #btn-isbn-save { margin-left: auto; padding: 10px 22px; font-size: .9rem; }

/* ══════════════════════════════════════════════════
   Form
══════════════════════════════════════════════════ */
.form-cover-row { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 14px; }
.form-cover-thumb {
  width: 66px; height: 99px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--bg2);
  flex-shrink: 0; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.form-cover-thumb img { width: 100%; height: 100%; object-fit: cover; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group.col-2 { grid-column: 1/-1; }
.full-width { flex: 1; }
.form-group label {
  font-size: .68rem; font-weight: 500; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted);
}
.form-group input,
.form-group select,
.form-group textarea {
  padding: 9px 12px; border: 1px solid var(--border);
  border-radius: var(--r); background: var(--bg);
  color: var(--ink); font-size: 1rem; outline: none; transition: border-color .15s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: var(--accent); background: #fff; }
.form-group textarea { resize: vertical; line-height: 1.5; }
.field-hint { font-size: .7rem; color: var(--muted); margin-top: 2px; }

.leido-row { margin: 14px 0; }
.leido-toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.leido-toggle input { display: none; }
.toggle-track {
  width: 40px; height: 22px; border-radius: 12px;
  background: var(--border2); position: relative; transition: background .2s; flex-shrink: 0;
}
.leido-toggle input:checked + .toggle-track { background: var(--leido); }
.toggle-knob {
  position: absolute; top: 3px; left: 3px;
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: left .2s;
}
.leido-toggle input:checked + .toggle-track .toggle-knob { left: 21px; }
.toggle-label { font-size: .88rem; }

.form-actions {
  display: flex; justify-content: flex-end; gap: 8px;
  margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border);
}

/* ══════════════════════════════════════════════════
   Autocomplete
══════════════════════════════════════════════════ */
.autocomplete-wrap { position: relative; }
.autocomplete-list {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); box-shadow: var(--shadow);
  z-index: 600; overflow: hidden; max-height: 190px; overflow-y: auto;
}
.autocomplete-item {
  padding: 9px 12px; cursor: pointer; font-size: .87rem;
  transition: background .1s; display: flex; align-items: center;
  touch-action: manipulation;
}
.autocomplete-item:hover,
.autocomplete-item.highlighted { background: var(--bg2); }
.autocomplete-item mark {
  background: transparent; color: var(--accent); font-weight: 500;
}

/* ══════════════════════════════════════════════════
   Detail
══════════════════════════════════════════════════ */
.detail-layout { display: flex; gap: 20px; }
.detail-cover {
  width: 110px; flex-shrink: 0; border-radius: 8px;
  overflow: hidden; box-shadow: var(--shadow); background: var(--bg3);
  aspect-ratio: 2/3; display: flex; align-items: center; justify-content: center;
}
.detail-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.detail-info { flex: 1; min-width: 0; }
.detail-titulo {
  font-family: 'Nunito', sans-serif;
  font-size: 1.45rem; font-weight: 500; line-height: 1.2; margin-bottom: 4px;
}
.detail-autor { color: var(--gold); font-size: .88rem; margin-bottom: 14px; }
.detail-dl { display: flex; flex-direction: column; gap: 7px; }
.detail-dl .row { display: flex; gap: 8px; font-size: .82rem; }
.detail-dl dt { color: var(--muted); min-width: 76px; flex-shrink: 0; }
.detail-dl dd { color: var(--ink2); }
.detail-para-leer {
  display: inline-flex; align-items: center; gap: 5px;
  margin-top: 10px; padding: 4px 11px; border-radius: 20px; font-size: .78rem;
}
.detail-sinopsis {
  margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border);
  font-size: .86rem; line-height: 1.7; color: var(--ink2);
}
.detail-sinopsis-label {
  font-size: .68rem; font-weight: 500; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 6px;
}
.detail-actions {
  display: flex; gap: 8px; margin-top: 18px;
  padding-top: 14px; border-top: 1px solid var(--border); flex-wrap: wrap;
}

/* ══════════════════════════════════════════════════
   Toast
══════════════════════════════════════════════════ */
.toast {
  position: fixed; left: 50%; z-index: 999; pointer-events: none;
  transform: translateX(-50%) translateY(60px);
  background: var(--ink); color: var(--bg);
  padding: 10px 20px; border-radius: 20px; font-size: .84rem;
  transition: transform .28s ease, opacity .28s ease; white-space: nowrap;
  box-shadow: var(--shadow); max-width: calc(100vw - 32px);
  bottom: 20px;
  opacity: 0;
}
.toast.visible { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.ok  { background: var(--leido); }
.toast.err { background: #9b2c2c; }

/* ══════════════════════════════════════════════════
   Página de información
══════════════════════════════════════════════════ */
.btn-info-header {
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.75);
  border: 1px solid rgba(255,255,255,.14);
  padding: 7px 9px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
}
.btn-info-header:hover { background: rgba(255,255,255,.16); color: #fff; }

.info-body { line-height: 1.6; color: var(--ink2); }
.info-intro {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--r); padding: 14px 16px; font-size: .92rem;
  margin-bottom: 20px;
}
.info-section { margin-bottom: 22px; }
.info-section h3 {
  font-size: 1.05rem; font-weight: 700; color: var(--ink);
  margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--border);
}
.info-section ul {
  list-style: none; padding-left: 0; margin: 0;
  font-size: .9rem; color: var(--ink2);
}
.info-section li { padding: 4px 0 4px 18px; position: relative; }
.info-section li::before {
  content: "·"; position: absolute; left: 4px; top: 2px;
  color: var(--accent); font-weight: 700; font-size: 1.2em;
}
.info-section li ul { margin-top: 4px; margin-bottom: 4px; }
.info-section li ul li::before { content: "›"; font-size: .85em; top: 5px; }
.info-section b, .info-section strong { color: var(--ink); font-weight: 600; }
.info-section code {
  background: var(--bg2); padding: 1px 6px; border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85em;
}
.info-tip {
  margin-top: 8px; font-size: .82rem; color: var(--muted);
  background: var(--bg); border-left: 3px solid var(--gold);
  padding: 7px 11px; border-radius: 0 4px 4px 0;
}

/* Badge de versión en el modal de información */
.info-version-badge {
  display: inline-block; margin-left: 10px;
  font-size: .7rem; font-weight: 500; letter-spacing: .04em;
  color: var(--muted); background: var(--bg2);
  padding: 3px 9px; border-radius: 10px;
  border: 1px solid var(--border); vertical-align: middle;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
