/* Livraria - somente preto (#000) e branco (#fff). Fonte mínima: 16px. Corpo: 18px. */

*, *::before, *::after { box-sizing: border-box; }

html { font-size: 18px; -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: 'Poppins', Arial, Helvetica, sans-serif;
    font-size: 18px;
    line-height: 1.6;
    color: #000;
    background: #fff;
}

h1, h2, h3 { line-height: 1.25; margin: 0 0 16px; font-weight: 700; }
h1 { font-size: 34px; }
h2 { font-size: 26px; }
h3 { font-size: 21px; }
p { margin: 0 0 16px; }

a { color: #000; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 2px; }
a:hover { text-decoration-thickness: 4px; }

:focus-visible { outline: 3px solid #000; outline-offset: 3px; }

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

hr { border: 0; border-top: 2px solid #000; margin: 32px 0; }

pre, code { font-size: 16px; }
pre.debug { white-space: pre-wrap; word-break: break-word; border: 2px solid #000; padding: 16px; text-align: left; }

.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.skip-link {
    position: absolute; left: 16px; top: -100px; z-index: 10;
    background: #fff; color: #000; padding: 12px 16px; border: 2px solid #000; font-size: 18px;
}
.skip-link:focus { top: 16px; }

.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.main { padding-top: 32px; padding-bottom: 64px; min-height: 60vh; }
.narrow { max-width: 520px; margin: 0 auto; }
.section { margin-top: 48px; }
.section-head { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.section-head h1, .section-head h2 { margin: 0; }

/* Cabeçalho e rodapé (fundo preto, texto branco) */
.site-header { background: #000; color: #fff; }
.header-inner { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; justify-content: space-between; padding-top: 16px; padding-bottom: 16px; }
.site-header a, .site-footer a { color: #fff; }
.site-header :focus-visible, .site-footer :focus-visible { outline-color: #fff; }
.logo { font-size: 24px; font-weight: 700; text-decoration: none; }
.main-nav { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; }
.main-nav a { font-weight: 600; font-size: 18px; padding: 8px 0; }
.inline-form { display: inline; margin: 0; }
.nav-button {
    font: inherit; font-size: 18px; font-weight: 600; color: #fff; background: #000;
    border: 2px solid #fff; padding: 6px 16px; min-height: 44px; cursor: pointer;
}
.nav-button:hover { background: #fff; color: #000; }

.site-footer { background: #000; color: #fff; padding: 32px 0; }
.site-footer p { margin: 0 0 8px; }

/* Botões */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 52px; padding: 12px 24px;
    font: inherit; font-size: 18px; font-weight: 600; line-height: 1.2;
    color: #fff; background: #000; border: 2px solid #000; border-radius: 0;
    text-decoration: none; cursor: pointer; text-align: center;
}
.btn:hover { background: #fff; color: #000; text-decoration: none; }
.btn-outline { background: #fff; color: #000; }
.btn-outline:hover { background: #000; color: #fff; }
.btn-block { display: flex; width: 100%; }
.btn[disabled], .btn[disabled]:hover { background: #fff; color: #000; border-style: dashed; cursor: not-allowed; }

.actions, .cart-actions, .row-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 24px 0; }
.row-actions { margin: 0; }
.row-actions form { margin: 0; }

/* Formulários */
label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 18px; }
input[type="text"], input[type="email"], input[type="password"], input[type="search"],
input[type="number"], input[type="tel"], input:not([type]), input[type="file"], select, textarea {
    width: 100%; font: inherit; font-size: 18px; color: #000; background: #fff;
    border: 2px solid #000; border-radius: 0; padding: 12px; min-height: 52px;
}
textarea { min-height: 160px; resize: vertical; }
input::placeholder, textarea::placeholder { color: #000; opacity: 1; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-width: 4px; }
select {
    -webkit-appearance: none; appearance: none; padding-right: 44px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='10' viewBox='0 0 16 10'%3E%3Cpath d='M1 1l7 7 7-7' fill='none' stroke='%23000' stroke-width='3'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 14px center;
}
input[type="checkbox"], input[type="radio"] { width: 24px; height: 24px; accent-color: #000; margin: 0; flex: none; }
input[type="file"] { padding: 10px; }
input[type="file"]::file-selector-button {
    font: inherit; font-size: 16px; font-weight: 600; background: #000; color: #fff;
    border: 2px solid #000; padding: 8px 16px; margin-right: 12px; cursor: pointer;
}

.field { margin-bottom: 20px; }
.field-error { font-weight: 700; margin: 8px 0 0; }
.field-error::before { content: "Erro: "; }
.form-stack .btn { margin-top: 4px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 20px; }
.field-wide { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 12px; font-weight: 400; margin: 8px 0 20px; cursor: pointer; }
fieldset { border: 0; padding: 0; margin: 0; }
.radio-option { display: flex; gap: 12px; align-items: flex-start; border: 2px solid #000; padding: 16px; font-weight: 400; cursor: pointer; margin-bottom: 12px; }
.radio-option input { margin-top: 4px; }

.search-form { margin: 0 0 24px; max-width: 640px; }
.search-row { display: flex; gap: 0; }
.search-row input { flex: 1; min-width: 0; }
.search-row .btn { flex: none; }

/* Sugestões da busca */
.search-box { position: relative; }
.suggest {
    position: absolute; left: 0; right: 0; top: 100%; z-index: 20;
    background: #fff; border: 2px solid #000; border-top: 0;
    max-height: 70vh; overflow-y: auto;
}
.suggest[hidden] { display: none; }
.suggest-list { list-style: none; margin: 0; padding: 0; }
.suggest-list li + li { border-top: 2px solid #000; }
.suggest-item { display: flex; gap: 16px; align-items: center; padding: 12px 16px; text-decoration: none; color: #000; background: #fff; }
.suggest-item img { width: 48px; height: 72px; object-fit: cover; border: 2px solid #000; flex: none; }
.suggest-item:hover, .suggest-item:focus { background: #000; color: #fff; outline: none; }
.suggest-item:hover img, .suggest-item:focus img { border-color: #fff; }
.suggest-info { display: flex; flex-direction: column; font-size: 16px; line-height: 1.4; min-width: 0; }
.suggest-info strong { font-size: 18px; }
.suggest-price { font-weight: 700; }
.suggest-empty { margin: 0; padding: 16px; }
.suggest-all { display: block; padding: 14px 16px; border-top: 2px solid #000; font-weight: 700; background: #fff; color: #000; }
.suggest-all:hover, .suggest-all:focus { background: #000; color: #fff; outline: none; }

/* Avisos */
.alert { border: 2px solid #000; padding: 16px; margin: 0 0 24px; font-size: 18px; word-break: break-word; }
.alert-success, .alert-info { background: #000; color: #fff; }
.alert-error { background: #fff; color: #000; border-width: 4px; }
.alert-success a, .alert-info a { color: #fff; }

/* Cards e grade de livros */
.card { border: 2px solid #000; padding: 24px; background: #fff; }
.card-strong { border-width: 4px; margin-bottom: 32px; }
.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 24px; }
.book-card { display: flex; flex-direction: column; padding: 16px; }
.book-card .btn { margin-top: auto; }
.book-cover { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border: 2px solid #000; background: #fff; }
.cover-link { display: block; margin-bottom: 16px; }
.book-title { font-size: 20px; margin: 0 0 4px; }
.book-title a { text-decoration: none; }
.book-title a:hover { text-decoration: underline; }
.book-author { margin: 0 0 8px; }
.book-price { font-size: 22px; font-weight: 700; margin: 0 0 16px; }
.tag { display: inline-block; border: 2px solid #000; padding: 2px 12px; font-weight: 700; margin: 0 0 16px; align-self: flex-start; }

.hero { border: 2px solid #000; padding: 32px 24px; }
.hero h1 { font-size: 38px; }
.hero .search-form { margin-bottom: 0; }

.breadcrumb { margin-bottom: 24px; }
.book-detail { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 40px; align-items: start; }
.book-author-lg { font-size: 20px; }
.price-lg { font-size: 32px; font-weight: 700; }
.add-form { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; margin: 16px 0 32px; }
.add-form .field { margin: 0; }
.field-qty { width: 140px; }
.buy-buttons { display: flex; flex-wrap: wrap; gap: 12px; }
@media (max-width: 640px) {
    .add-form { flex-direction: column; align-items: stretch; }
    .buy-buttons { flex-direction: column; }
    .buy-buttons .btn { width: 100%; }
}
.description { max-width: 70ch; }

.empty { border: 2px dashed #000; padding: 32px 24px; text-align: center; }
.empty .btn { margin-top: 8px; }

.result-info { margin-bottom: 24px; }
.pagination { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: center; margin-top: 32px; }

/* Tabelas */
.table-wrap { width: 100%; overflow-x: auto; margin-bottom: 24px; }
table { width: 100%; border-collapse: collapse; font-size: 18px; }
th, td { border: 2px solid #000; padding: 12px; text-align: left; vertical-align: middle; }
th { background: #000; color: #fff; font-weight: 600; }
.qty-input { width: 100px; }
.thumb { width: 60px; height: 90px; object-fit: cover; border: 2px solid #000; }
.thumb-lg { width: 120px; height: 180px; object-fit: cover; border: 2px solid #000; }
.current-image { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; margin-bottom: 8px; }

/* Totais e resumo */
.summary-box { border: 2px solid #000; padding: 24px; margin-left: auto; max-width: 420px; }
.totals { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; margin: 0 0 16px; }
.totals dt, .totals dd { margin: 0; }
.totals dd { text-align: right; font-weight: 600; }
.totals .total { font-size: 22px; font-weight: 700; border-top: 2px solid #000; padding-top: 8px; }
.summary-list { list-style: none; margin: 0 0 16px; padding: 0; }
.summary-list li { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 2px solid #000; }

.checkout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 32px; align-items: start; }
.checkout-main { display: grid; gap: 24px; }
.checkout .summary-box { margin: 0; max-width: none; position: sticky; top: 16px; }

.info-list { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0 0 16px; }
.info-list dt { font-weight: 600; }
.info-list dd { margin: 0; font-weight: 700; word-break: break-all; }
.address { font-style: normal; }

/* Status dos pedidos */
.status { display: inline-block; padding: 2px 12px; border: 2px solid #000; font-weight: 700; white-space: nowrap; }
.status-pago, .status-enviado, .status-entregue { background: #000; color: #fff; }
.status-cancelado { text-decoration: line-through; }
.status-line { font-size: 20px; }

.steps { list-style: none; padding: 0; margin: 0 0 32px; display: grid; grid-template-columns: repeat(4, 1fr); }
.steps li { border: 2px solid #000; padding: 12px; text-align: center; font-weight: 600; }
.steps li + li { border-left: 0; }
.steps li.done { background: #000; color: #fff; }
.steps li.current { text-decoration: underline; text-underline-offset: 4px; }

.confirm-head { border: 4px solid #000; padding: 24px; margin-bottom: 32px; }

/* Perfil e painel */
.profile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 24px; align-items: start; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.stat { display: flex; flex-direction: column; border: 2px solid #000; padding: 20px; text-decoration: none; font-weight: 600; }
.stat:hover { background: #000; color: #fff; }
.stat-strong { background: #000; color: #fff; }
.stat-strong:hover { background: #fff; color: #000; }
.stat-number { font-size: 40px; font-weight: 700; line-height: 1.1; }
.filter-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.filter-tabs .btn { min-height: 48px; padding: 8px 16px; }
.danger-zone { border: 2px dashed #000; padding: 24px; margin-top: 40px; }

.error-page { text-align: center; padding: 48px 0; max-width: 760px; margin: 0 auto; }
.error-code { font-size: 80px; font-weight: 700; line-height: 1; margin-bottom: 16px; }
.error-page .actions { justify-content: center; }

/* Celular */
@media (max-width: 860px) {
    .checkout { grid-template-columns: 1fr; }
    .checkout .summary-box { position: static; }
    .book-detail { grid-template-columns: 1fr; gap: 24px; }
    .book-detail .book-cover { max-width: 300px; }
}

@media (max-width: 640px) {
    h1 { font-size: 28px; }
    h2 { font-size: 23px; }
    .hero { padding: 24px 16px; }
    .hero h1 { font-size: 30px; }
    .card { padding: 16px; }
    .summary-box { max-width: none; padding: 16px; }
    .book-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; }
    .search-row { flex-direction: column; gap: 12px; }
    .search-row .btn { width: 100%; }
    .info-list { grid-template-columns: 1fr; gap: 0; }
    .info-list dd { margin-bottom: 12px; }
    .steps { grid-template-columns: 1fr 1fr; }
    .steps li + li { border-left: 2px solid #000; }
    .steps li:nth-child(n+3) { border-top: 0; }
    .steps li:nth-child(2n) { border-left: 0; }
    .profile-grid { grid-template-columns: 1fr; }

    /* Tabelas viram blocos empilhados */
    table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
    table, tbody, tr, td { display: block; width: 100%; }
    tr { border: 2px solid #000; margin-bottom: 16px; }
    td { border: 0; border-bottom: 2px solid #000; }
    td:last-child { border-bottom: 0; }
    td[data-label]::before { content: attr(data-label); display: block; font-weight: 700; }
    .table-wrap { overflow-x: visible; }
}

/* ---------- Dicas e erros grandes ---------- */
.hint { margin: 8px 0 0; font-size: 16px; }
.field-error-lg { font-size: 20px; border: 4px solid #000; padding: 12px; }

/* ---------- Barra de frete grátis (sem animação) ---------- */
.free-bar { border: 2px solid #000; padding: 16px; margin: 0 0 16px; background: #fff; color: #000; }
.free-bar-text { font-size: 20px; margin: 0 0 12px; }
.free-bar-track { height: 20px; border: 2px solid #000; background: #fff; }
.free-bar-fill { height: 100%; background: #000; max-width: 100%; }
.free-bar-note { font-size: 16px; margin: 12px 0 0; }

.counter { font-size: 16px; font-weight: 600; margin: 8px 0 0; }
.counter.counter-full::after { content: " (limite atingido)"; }
.summary-list li { flex-wrap: wrap; }

/* ---------- Mini-carrinho no topo ---------- */
.mini-cart { position: relative; }
.mini-cart > summary { font-weight: 600; font-size: 18px; padding: 8px 0; cursor: pointer; list-style: none; text-decoration: underline; }
.mini-cart > summary::-webkit-details-marker { display: none; }
.mini-cart > summary::after { content: " ▾"; }
.mini-cart[open] > summary::after { content: " ▴"; }
.mini-cart-panel { position: absolute; right: 0; top: 100%; z-index: 20; width: 360px; max-width: calc(100vw - 32px); background: #fff; color: #000; border: 2px solid #000; padding: 16px; }
.mini-cart-panel .btn { margin-top: 8px; }
.mini-cart-list { list-style: none; margin: 0 0 12px; padding: 0; }
.mini-cart-list li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 2px solid #000; }
.mini-cart-ded { flex-basis: 100%; font-size: 16px; }
.mini-cart-total { margin: 0 0 12px; }
@media (max-width: 640px) {
    .mini-cart-panel { position: static; width: auto; max-width: none; margin-top: 8px; }
}


@media print {
    * { background: #fff !important; color: #000 !important; }
    body { font-size: 20px; }
    .site-header, .admin-menu, .site-footer, .skip-link, .alert, .no-print, .btn { display: none !important; }
    .main { padding: 0; margin: 0; }
    a { text-decoration: none; }
}
.error-list { margin: 8px 0 0; padding-left: 24px; } .error-list li { margin: 4px 0; } .alert-error .error-list a { color: #000; }
.return-request { border: 2px solid #000; padding: 16px; margin: 0 0 16px; } .return-items { border: 0; padding: 0; margin: 0; } .return-items legend, .radio-list legend { font-weight: 700; margin-bottom: 8px; }
