/* ============================================================================
   Biblioteca Semear — Sistema visual (Manual de Identidade AV Kids)
   Cor institucional: #1d475c (navy) · Pastéis: lilás, amarelo, laranja, verde
   Fontes: Fredoka (títulos, ~Funky Smile) · Nunito (texto, ~Mango AC/Garet)
   ============================================================================ */

:root {
  --navy:       #1d475c;
  --navy-deep:  #143242;
  --navy-soft:  #2f6079;
  --lilac:      #b5aedc;
  --lilac-soft: #e9e6f6;
  --yellow:     #f7e8a9;
  --orange:     #ea8b54;
  --green:      #9fc7aa;
  --green-deep: #2d6a4f;   /* verde "semear" funcional (e-mails / sucesso) */
  --green-mid:  #52b788;

  --paper:      #f7f6f2;   /* off-white texturizado do manual */
  --card:       #ffffff;
  --ink:        #1d475c;
  --muted:      #6b7d86;
  --line:       #e6e3da;
  --danger:     #c0492f;

  --radius:     18px;
  --radius-sm:  12px;
  --shadow:     0 6px 24px rgba(29, 71, 92, .08);
  --shadow-lg:  0 14px 40px rgba(29, 71, 92, .14);
  --font-title: 'Fredoka', system-ui, sans-serif;
  --font-body:  'Nunito', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .font-title { font-family: var(--font-title); font-weight: 600; line-height: 1.15; }

a { color: var(--navy-soft); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

.container { width: min(1140px, 92vw); margin-inline: auto; }
.section { padding: 56px 0; }
.text-center { text-align: center; }
.muted { color: var(--muted); }

/* ── Botões ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  font-family: var(--font-title); font-weight: 500; font-size: 1rem;
  padding: .8rem 1.5rem; border-radius: 999px; border: 2px solid transparent;
  cursor: pointer; transition: transform .12s ease, box-shadow .2s ease, background .2s;
  text-decoration: none; line-height: 1;
}
.btn:hover { transform: translateY(-2px); text-decoration: none; }
.btn-primary  { background: var(--navy); color: #fff; }
.btn-primary:hover  { background: var(--navy-deep); color: #fff; }
.btn-accent   { background: var(--orange); color: #fff; }
.btn-accent:hover   { background: #d9763e; color: #fff; }
.btn-lilac    { background: var(--lilac); color: var(--navy-deep); }
.btn-success  { background: var(--green); color: var(--navy-deep); }
.btn-success:hover { background: #88b099; color: var(--navy-deep); }
.btn-ghost    { background: transparent; border-color: currentColor; }
.btn-outline  { background: #fff; border-color: var(--line); color: var(--navy); }
.btn-danger   { background: #fff; border-color: var(--orange); color: #b85225; }
.btn-danger:hover { background: var(--orange); color: #fff; }
.btn-sm       { padding: .5rem 1rem; font-size: .9rem; }
.btn-block    { width: 100%; justify-content: center; }
.btn:disabled, .btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }

/* ── Badges ───────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .78rem; font-weight: 700; padding: .3rem .7rem; border-radius: 999px;
}
.badge-available { background: #e3f3ea; color: var(--green-deep); }
.badge-borrowed  { background: #fbe4dd; color: var(--danger); }
.badge-active    { background: #e8e5f5; color: #4a3f8a; }
.badge-soft      { background: var(--lilac-soft); color: var(--navy); }

/* ── Cards ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1.5rem; border: 1px solid var(--line);
}

/* ============================================================================
   HEADER PÚBLICO
   ============================================================================ */
.site-header {
  background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 40;
}
.site-header .container { display: flex; align-items: center; justify-content: space-between; padding: .7rem 0; gap: 1rem; }
.site-header .brand img { height: 46px; width: auto; }
.site-nav { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.site-nav a {
  font-family: var(--font-title); font-weight: 500; color: var(--navy);
  padding: .5rem .9rem; border-radius: 999px;
}
.site-nav a:hover { background: var(--lilac-soft); text-decoration: none; }
.nav-toggle { display: none; background: none; border: 0; font-size: 1.6rem; color: var(--navy); cursor: pointer; }

/* ============================================================================
   HERO
   ============================================================================ */
.hero { position: relative; color: #fff; padding: 72px 0; background-size: cover; background-position: center; }
.hero::after { content: ''; position: absolute; inset: 0; background: rgba(0,0,0,.18); z-index: 0; }
.hero.no-image::after { display: none; }
.hero .container { position: relative; z-index: 1; max-width: 760px; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); margin: 0 0 .4rem; }
.hero .tagline { font-family: var(--font-title); font-weight: 400; font-size: 1.25rem; opacity: .95; margin-bottom: 1.2rem; }
.hero .hero-body { font-size: 1.05rem; }
.hero .hero-body p { margin: 0 0 .9rem; }
.hero .hero-actions { display: flex; gap: .8rem; flex-wrap: wrap; margin-top: 1.6rem; }

/* ── Sprinkle de bolinhas (decoração do manual) ───────────────────────────── */
.sprinkles { position: absolute; inset: 0; overflow: hidden; z-index: 0; pointer-events: none; opacity: .9; }
.sprinkles span { position: absolute; width: 12px; height: 12px; border-radius: 50%; }

/* ============================================================================
   ATALHOS RÁPIDOS (HOME)
   ============================================================================ */
.shortcuts { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.4rem; }
.shortcut {
  display: block; text-align: center; padding: 2.2rem 1.5rem; border-radius: var(--radius);
  background: var(--card); border: 2px solid var(--line); box-shadow: var(--shadow);
  transition: transform .15s ease, box-shadow .2s, border-color .2s; color: var(--ink);
}
.shortcut:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); text-decoration: none; border-color: var(--lilac); }
.shortcut .ico { font-size: 2.6rem; display: block; margin-bottom: .6rem; }
.shortcut h3 { font-size: 1.3rem; margin: 0 0 .4rem; }
.shortcut p { color: var(--muted); margin: 0 0 1rem; font-size: .95rem; }
.shortcut .go { font-family: var(--font-title); color: var(--orange); font-weight: 500; }

.section-title { text-align: center; margin-bottom: .4rem; font-size: 1.9rem; }
.section-sub { text-align: center; color: var(--muted); margin: 0 auto 2.4rem; max-width: 560px; }

/* ============================================================================
   FOOTER DINÂMICO
   ============================================================================ */
.site-footer { background: var(--navy); color: #fff; padding: 40px 0; margin-top: 40px; text-align: center; }
.site-footer .brand-name { font-family: var(--font-title); font-size: 1.3rem; margin-bottom: .8rem; }
.site-footer .socials { display: flex; gap: 1rem; justify-content: center; margin-bottom: 1rem; }
.site-footer .socials a {
  width: 44px; height: 44px; border-radius: 50%; background: rgba(255,255,255,.12);
  display: grid; place-items: center; color: #fff; transition: background .2s;
}
.site-footer .socials a:hover { background: rgba(255,255,255,.25); text-decoration: none; }
.site-footer .socials svg { width: 20px; height: 20px; fill: currentColor; }
.site-footer .copy { font-size: .85rem; opacity: .75; }

/* ============================================================================
   SCANNER QR / RETIRADA-DEVOLUÇÃO
   ============================================================================ */
.scan-wrap { max-width: 560px; margin: 0 auto; }
.scan-box {
  border-radius: var(--radius); overflow: hidden; background: #000;
  aspect-ratio: 1; position: relative; box-shadow: var(--shadow-lg);
  transition: box-shadow .3s;
}
.scan-box.lib-ok { box-shadow: 0 0 0 4px var(--green), var(--shadow-lg); }
#qr-reader { width: 100%; }
.scan-hint { text-align: center; color: var(--muted); margin: 1rem 0; }

/* Step indicators */
.scan-steps { display: flex; gap: .6rem; justify-content: center; align-items: center; margin-bottom: 1.2rem; }
.scan-step { display: inline-flex; align-items: center; gap: .45rem; font-size: .88rem; font-weight: 700; color: var(--muted); transition: color .3s; }
.scan-step .sn { width: 26px; height: 26px; border-radius: 50%; border: 2px solid currentColor; display: grid; place-items: center; font-size: .78rem; font-weight: 800; transition: background .3s, color .3s, border-color .3s; }
.scan-step.active { color: var(--navy); }
.scan-step.active .sn { background: var(--navy); color: #fff; border-color: var(--navy); }
.scan-step.done { color: var(--green-deep); }
.scan-step.done .sn { background: var(--green-deep); color: #fff; border-color: var(--green-deep); }
.scan-step-arrow { color: var(--line); font-size: 1.2rem; line-height: 1; }

/* Library confirmed banner */
#libConfirm {
  display: none; text-align: center; margin-top: .8rem;
  padding: .7rem 1.2rem; border-radius: var(--radius-sm);
  background: #e3f3ea; color: var(--green-deep);
  font-weight: 700; font-size: .93rem; border: 1.5px solid #b7e0c6;
}
#libConfirm.show {
  display: flex; align-items: center; justify-content: center; gap: .5rem;
  animation: libPop .45s cubic-bezier(.175,.885,.32,1.275) forwards;
}
@keyframes libPop {
  0%   { transform: scale(.7) translateY(-6px); opacity: 0; }
  100% { transform: scale(1) translateY(0);    opacity: 1; }
}

.step-pill {
  display: inline-flex; gap: .5rem; align-items: center; background: var(--lilac-soft);
  color: var(--navy); padding: .4rem .9rem; border-radius: 999px; font-weight: 700; font-size: .85rem;
}
.book-preview { display: flex; gap: 1rem; align-items: center; }
.book-preview img { width: 90px; height: 120px; object-fit: cover; border-radius: var(--radius-sm); }

/* ============================================================================
   FORMULÁRIOS
   ============================================================================ */
.form-grid { display: grid; gap: 1rem; }
.form-grid.cols-2 { grid-template-columns: 1fr 1fr; }
.field { display: flex; flex-direction: column; gap: .35rem; }
.field label { font-weight: 700; font-size: .9rem; color: var(--navy); }
.field .req { color: var(--orange); }
input[type=text], input[type=email], input[type=tel], input[type=date],
input[type=password], input[type=number], input[type=url], select, textarea {
  font-family: var(--font-body); font-size: 1rem; padding: .7rem .9rem;
  border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: #fff; color: var(--ink);
  width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--lilac); box-shadow: 0 0 0 3px var(--lilac-soft); }
textarea { resize: vertical; min-height: 90px; }
.help { font-size: .8rem; color: var(--muted); }

/* ── Alerts ───────────────────────────────────────────────────────────────── */
.alert { padding: .9rem 1.1rem; border-radius: var(--radius-sm); margin: 1rem 0; font-size: .95rem; }
.alert-success { background: #e3f3ea; color: var(--green-deep); }
.alert-error   { background: #fbe4dd; color: var(--danger); }
.alert-info    { background: var(--lilac-soft); color: var(--navy); }
.alert-warn    { background: #fcf3d9; color: #8a6d1c; }

/* ============================================================================
   CATÁLOGO PÚBLICO
   ============================================================================ */
.catalog-nav { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: center; margin-bottom: 2rem; }
.catalog-nav a, .catalog-nav button {
  font-family: var(--font-title); font-weight: 500; padding: .5rem 1rem; border-radius: 999px;
  background: #fff; border: 1.5px solid var(--line); color: var(--navy); cursor: pointer;
}
.catalog-nav a:hover, .catalog-nav .active { background: var(--navy); color: #fff; text-decoration: none; }
.category-block { margin-bottom: 3rem; scroll-margin-top: 80px; }
.category-head { display: flex; align-items: center; gap: .8rem; padding: 1rem 1.2rem; border-radius: var(--radius); margin-bottom: 1.2rem; }
.category-head .cat-ico { font-size: 1.8rem; }
.category-head h2 { margin: 0; font-size: 1.5rem; }
.category-head p { margin: 0; font-size: .9rem; color: var(--muted); }
.books-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1.4rem; }
.book-card {
  background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  border: 1px solid var(--line); display: flex; flex-direction: column; transition: transform .15s, box-shadow .2s;
}
.book-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.book-cover { aspect-ratio: 3/4; background: var(--lilac-soft); position: relative; overflow: hidden; }
.book-cover img { width: 100%; height: 100%; object-fit: cover; }
.book-cover.borrowed img { filter: grayscale(.4) brightness(.85); }
.book-cover .badge { position: absolute; top: .6rem; left: .6rem; }
.book-info { padding: .9rem 1rem 1.1rem; display: flex; flex-direction: column; gap: .3rem; flex: 1; }
.book-info h3 { font-size: 1rem; margin: 0; }
.book-info .author { font-size: .85rem; color: var(--muted); }
.book-info .btn { margin-top: auto; }
.search-bar { max-width: 480px; margin: 0 auto 2rem; position: relative; }
.search-bar input { padding-left: 2.6rem; }
.search-bar .ico { position: absolute; left: .9rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.empty-state { text-align: center; color: var(--muted); padding: 3rem 1rem; }

/* Hint de zoom na capa */
.book-cover.has-photo { position: relative; }
.cover-zoom {
  position: absolute; bottom: .5rem; right: .5rem;
  font-size: .85rem; background: rgba(0,0,0,.45); color: #fff;
  border-radius: 999px; padding: .15rem .45rem;
  opacity: 0; transition: opacity .2s; pointer-events: none;
}
.book-cover.has-photo:hover .cover-zoom { opacity: 1; }
.book-cover.has-photo:hover img { transform: scale(1.04); transition: transform .25s; }

/* ── Lightbox ──────────────────────────────────────────────────────────────── */
.lb-backdrop {
  position: fixed; inset: 0; background: rgba(10,24,32,.82);
  display: none; place-items: center; z-index: 200;
  padding: 1rem; overflow-y: auto;
}
.lb-backdrop.open { display: grid; }
.lb-box {
  background: #fff; border-radius: var(--radius); max-width: 820px; width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,.4); position: relative; overflow: hidden;
}
.lb-close {
  position: absolute; top: .8rem; right: .8rem; z-index: 2;
  width: 36px; height: 36px; border-radius: 50%; border: 0;
  background: rgba(255,255,255,.9); cursor: pointer;
  display: grid; place-items: center; color: var(--navy);
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.lb-close:hover { background: #fff; }
.lb-photos {
  display: flex; gap: 1rem; justify-content: center;
  background: var(--navy); padding: 1.6rem; min-height: 240px; align-items: center;
}
.lb-photos img {
  max-height: 420px; max-width: 100%; border-radius: 10px;
  object-fit: contain; flex: 1; min-width: 0;
  box-shadow: 0 6px 24px rgba(0,0,0,.35);
}
.lb-photos.two img { max-width: calc(50% - .5rem); }
.lb-meta {
  padding: 1.4rem 1.6rem 1.6rem; text-align: center;
}
.lb-meta h3 { margin: 0 0 .25rem; font-size: 1.25rem; color: var(--navy); }
.lb-meta p  { margin: 0 0 1rem; color: var(--muted); font-size: .95rem; }

/* ============================================================================
   RESPONSIVO
   ============================================================================ */
@media (max-width: 720px) {
  .form-grid.cols-2 { grid-template-columns: 1fr; }
  .nav-toggle { display: block; }
  .site-nav { display: none; position: absolute; top: 64px; right: 4vw; flex-direction: column;
    background: #fff; padding: .6rem; border-radius: var(--radius); box-shadow: var(--shadow-lg); border: 1px solid var(--line); }
  .site-nav.open { display: flex; }
  .section { padding: 40px 0; }
}
