:root {
    /* Paleta AS Visual */
    --creme: #f2f0e5;
    --papel: #fbfaf3;
    --azul: #1b3a4b;
    --azul-2: #2c556b;
    --dourado: #b8960c;
    --dourado-2: #9a7d08;
    --borda: #e3dfcf;
    --borda-forte: #d3ccb8;
    --texto: #23333d;
    --texto-suave: #726c5c;
    --sucesso: #2f6b4f;
    --sucesso-bg: #e7efe7;
    --erro: #9e3d3d;
    --erro-bg: #f6e9e5;
    --radius: 8px;
    --sombra: 0 2px 12px rgba(27, 58, 75, .07);
    --sombra-forte: 0 10px 30px rgba(27, 58, 75, .14);
    --serif: Georgia, "Iowan Old Style", "Palatino Linotype", "Book Antiqua", "Times New Roman", serif;
    --ease-suave: cubic-bezier(0.32, 0.72, 0, 1);
    --dur-rapida: 200ms;
    --dur-media: 300ms;
}

* { box-sizing: border-box; }

html { overflow-y: scroll; }

body {
    margin: 0;
    font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--creme);
    color: var(--texto);
    line-height: 1.55;
}

a { color: var(--azul-2); text-decoration: none; }
a:hover { color: var(--dourado-2); }

/* ---------- Topbar ---------- */
.topbar {
    background: var(--papel);
    border-bottom: 1px solid var(--borda);
    box-shadow: inset 0 -3px 0 rgba(184, 150, 12, .35);
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 50;
}
.topbar-inner {
    max-width: 1180px; margin: 0 auto; padding: 0 22px;
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 10px;
}
.topbar .marca { display: flex; align-items: center; gap: 10px; }
.topbar .marca img { height: 30px; width: auto; display: block; }
.topbar .marca .marca-txt {
    font-family: var(--serif); font-weight: 700; letter-spacing: .06em;
    font-size: 1.1rem; color: var(--azul); text-transform: uppercase;
}
.topbar nav { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.topbar nav a {
    margin-left: 16px; color: var(--azul); font-size: .9rem; font-weight: 500;
    padding-bottom: 2px; border-bottom: 2px solid transparent;
    transition: color .15s, border-color .15s;
}
.topbar nav a:hover, .topbar nav a.ativo { color: var(--dourado-2); border-bottom-color: var(--dourado); }
.topbar nav .usuario { color: var(--texto-suave); font-size: .85rem; }

/* Selo do carrinho */
.selo-carrinho {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 20px; height: 20px; padding: 0 6px; margin-left: 6px;
    background: var(--dourado); color: #221d00;
    border-radius: 20px; font-size: .72rem; font-weight: 700;
}

/* ---------- Layout ---------- */
.container { max-width: 1180px; margin: 0 auto; padding: 30px 22px 70px; }
.container-estreito { max-width: 430px; margin: 8vh auto; padding: 0 20px; }

h1 { font-family: var(--serif); font-size: 1.75rem; font-weight: 700; color: var(--azul); margin: 0 0 6px; }
h2 { font-family: var(--serif); font-size: 1.25rem; font-weight: 700; color: var(--azul); margin: 30px 0 12px; }
h3 { font-family: var(--serif); font-size: 1.05rem; color: var(--azul); margin: 0 0 8px; }
.subtitulo { color: var(--texto-suave); margin: 0 0 26px; font-size: .95rem; }

.card {
    background: var(--papel); border: 1px solid var(--borda);
    border-radius: var(--radius); padding: 24px; box-shadow: var(--sombra);
}

/* ---------- Formulários ---------- */
.form-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; align-items: start; }
.form-2col .col-span { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-2col { grid-template-columns: 1fr; } }

.form-grupo { margin-bottom: 15px; }
.form-grupo label { display: block; font-size: .82rem; font-weight: 600; color: var(--azul); margin-bottom: 5px; }
.form-grupo .ajuda { font-size: .78rem; color: var(--texto-suave); margin-top: 4px; }

input[type=text], input[type=password], input[type=number], input[type=file],
input[type=tel], select, textarea {
    width: 100%; padding: 10px 12px;
    border: 1px solid var(--borda-forte); border-radius: var(--radius);
    font-size: .95rem; font-family: inherit; background: #fff; color: var(--texto);
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--dourado);
    box-shadow: 0 0 0 3px rgba(184, 150, 12, .18);
}
.checkbox-linha { display: flex; align-items: center; gap: 8px; }
.checkbox-linha input { width: auto; }

/* ---------- Botões ---------- */
.btn {
    display: inline-block; background: var(--azul); color: #fff;
    border: 1px solid var(--azul); padding: 10px 20px; border-radius: var(--radius);
    font-size: .92rem; font-weight: 600; cursor: pointer; text-decoration: none;
    transition: background .15s, transform .05s, box-shadow .15s;
}
.btn:hover { background: var(--azul-2); border-color: var(--azul-2); color: #fff; }
.btn:active { transform: translateY(1px) scale(.985); }
.btn:disabled { background: #b7b3a6; border-color: #b7b3a6; cursor: not-allowed; }
.btn-ouro { background: var(--dourado); border-color: var(--dourado); color: #221d00; }
.btn-ouro:hover { background: var(--dourado-2); border-color: var(--dourado-2); color: #221d00; }
.btn-secundario { background: transparent; color: var(--azul); border: 1px solid var(--borda-forte); }
.btn-secundario:hover { background: #ece8d9; color: var(--azul); }
.btn-perigo { background: var(--erro); border-color: var(--erro); }
.btn-perigo:hover { background: #863232; border-color: #863232; color: #fff; }
.btn-zap { background: #25d366; border-color: #1fb355; color: #06301a; }
.btn-zap:hover { background: #1fb355; border-color: #1a9648; color: #06301a; }
.btn-sm { padding: 6px 12px; font-size: .8rem; }
.btn-bloco { display: block; width: 100%; text-align: center; }

/* ---------- Alertas ---------- */
.alerta { padding: 12px 15px; border-radius: var(--radius); margin-bottom: 18px; font-size: .9rem; border: 1px solid transparent; }
.alerta-sucesso { background: var(--sucesso-bg); color: var(--sucesso); border-color: #cfe3d3; }
.alerta-erro { background: var(--erro-bg); color: var(--erro); border-color: #eccece; }
.alerta-aviso { background: #fdf6e3; color: #7a5c00; border-color: #ece0bd; }

/* ---------- Tabelas ---------- */
table { width: 100%; border-collapse: collapse; background: var(--papel); border-radius: var(--radius); overflow: hidden; box-shadow: var(--sombra); }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--borda); font-size: .9rem; vertical-align: middle; }
th { background: rgba(27, 58, 75, .04); color: var(--azul); font-weight: 700; font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; }
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: .74rem; font-weight: 600; }
.badge-ok { background: var(--sucesso-bg); color: var(--sucesso); }
.badge-erro { background: var(--erro-bg); color: var(--erro); }
.badge-neutro { background: #ece8d9; color: var(--texto-suave); }
.badge-ouro { background: #f7edc8; color: #7a5c00; }

/* ---------- Categorias e grade ---------- */
.categorias-nav {
    display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 26px;
    padding-bottom: 18px; border-bottom: 1px solid var(--borda);
}
.categorias-nav a {
    padding: 6px 14px; border-radius: 20px; font-size: .85rem;
    background: var(--papel); border: 1px solid var(--borda-forte); color: var(--azul);
    transition: background .15s, border-color .15s, color .15s;
}
.categorias-nav a:hover { background: #ece8d9; color: var(--azul); }
.categorias-nav a.ativo { background: var(--azul); border-color: var(--azul); color: #fff; }

.grid-artes { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 18px; }

/* ---------- Card de arte ---------- */
.arte-card {
    background: var(--papel); border: 1px solid var(--borda); border-radius: var(--radius);
    overflow: hidden; box-shadow: var(--sombra);
    transition: transform .12s ease, box-shadow .12s ease;
    display: flex; flex-direction: column; position: relative; isolation: isolate;
}
.arte-card:hover { transform: translateY(-3px); box-shadow: var(--sombra-forte); }
.arte-card .arte-img-wrap { position: relative; cursor: pointer; }
.arte-card img {
    width: 100%; height: 190px; object-fit: contain; display: block;
    background: var(--creme); border-bottom: 1px solid var(--borda);
}
.arte-card .sem-imagem {
    width: 100%; height: 190px; display: flex; align-items: center; justify-content: center;
    background: #eceadd; color: var(--texto-suave); font-size: .8rem; border-bottom: 1px solid var(--borda);
}
.arte-info { padding: 12px 14px; flex: 1; }
.arte-info .nome { font-weight: 600; font-size: .95rem; color: var(--azul); line-height: 1.25; }
.arte-info .codigo { font-size: .76rem; color: var(--texto-suave); min-height: 1.1em; margin-top: 3px; letter-spacing: .02em; }
.arte-acao { padding: 0 14px 14px; }
.arte-card .no-carrinho {
    position: absolute; top: 8px; right: 8px; z-index: 2;
    background: var(--dourado); color: #221d00; border-radius: 20px;
    padding: 2px 9px; font-size: .72rem; font-weight: 700;
    box-shadow: 0 2px 6px rgba(0,0,0,.18);
}

/* ---------- Modal ---------- */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(15, 26, 33, .55);
    display: none; align-items: center; justify-content: center;
    padding: 20px; z-index: 1500;
}
.modal-overlay.aberto { display: flex; }
.js .modal-overlay.aberto { animation: modal-fade .2s var(--ease-suave); }
.modal-box {
    background: var(--papel); border: 1px solid var(--borda-forte); border-radius: var(--radius);
    max-width: 620px; width: 100%; max-height: 88vh; overflow: auto;
    box-shadow: var(--sombra-forte); padding: 24px;
}
.js .modal-overlay.aberto .modal-box { animation: modal-surge .22s var(--ease-suave); }
@keyframes modal-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-surge { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }
.modal-box > h2 { margin-top: 0; }
.modal-acoes { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.modal-topo { display: flex; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.modal-topo img {
    width: 150px; height: 150px; object-fit: contain;
    background: var(--creme); border: 1px solid var(--borda); border-radius: 6px; flex: 0 0 auto;
}
.modal-topo .modal-txt { min-width: 0; flex: 1; }

/* Opções de tamanho e material */
.opcoes { display: flex; flex-wrap: wrap; gap: 8px; }
.opcao {
    position: relative; border: 1px solid var(--borda-forte); border-radius: var(--radius);
    padding: 8px 14px; cursor: pointer; background: #fff; font-size: .88rem;
    transition: border-color .15s, background .15s, box-shadow .15s;
}
.opcao:hover { border-color: var(--dourado); }
.opcao input { position: absolute; opacity: 0; pointer-events: none; }
.opcao.marcada { border-color: var(--dourado); background: #fdf8e6; box-shadow: 0 0 0 2px rgba(184,150,12,.18); }
.opcao .op-sub { display: block; font-size: .74rem; color: var(--texto-suave); }

#medidas-custom { margin-top: 12px; display: none; gap: 12px; }
#medidas-custom.visivel { display: flex; }
#medidas-custom .form-grupo { margin-bottom: 0; flex: 1; }

/* Prévia de preço */
.previa {
    margin-top: 18px; padding: 14px; border-radius: var(--radius);
    background: #fff; border: 1px dashed var(--borda-forte);
}
.previa .linha { display: flex; justify-content: space-between; font-size: .88rem; margin-bottom: 4px; }
.previa .total { font-size: 1.15rem; font-weight: 700; color: var(--azul); border-top: 1px solid var(--borda); padding-top: 8px; margin-top: 8px; }
.previa .aviso-minimo { font-size: .78rem; color: #7a5c00; background: #fdf6e3; padding: 6px 9px; border-radius: 6px; margin-top: 8px; }

/* ---------- Carrinho ---------- */
.carrinho-mini { width: 62px; height: 62px; object-fit: contain; background: var(--creme); border: 1px solid var(--borda); border-radius: 6px; }
.carrinho-total {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 1.2rem; font-weight: 700; color: var(--azul);
    padding: 16px; background: var(--papel); border: 1px solid var(--borda-forte);
    border-radius: var(--radius); margin-top: 18px;
}
.linha-min { font-size: .74rem; color: #7a5c00; }

footer.rodape-acao {
    position: sticky; bottom: 0; z-index: 30;
    background: var(--papel); border-top: 2px solid var(--dourado);
    padding: 14px 20px; display: flex; justify-content: space-between; align-items: center;
    gap: 16px; margin-top: 24px; box-shadow: 0 -6px 18px rgba(27, 58, 75, .06);
    border-radius: var(--radius) var(--radius) 0 0; flex-wrap: wrap;
}

/* ---------- Diversos ---------- */
.barra-acoes { display: flex; justify-content: space-between; align-items: center; margin: 26px 0 0; flex-wrap: wrap; gap: 10px; }
.acoes-linha { display: flex; gap: 8px; flex-wrap: wrap; }
.vazio { color: var(--texto-suave); padding: 34px 0; text-align: center; font-size: .9rem; }
.busca-linha { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 22px; }
.busca-linha input { max-width: 300px; }

/* ---------- Login ---------- */
.login-box { text-align: center; margin-bottom: 26px; }
.login-box img { height: 54px; width: auto; margin-bottom: 10px; }
.login-box .marca-txt { font-family: var(--serif); font-size: 1.5rem; color: var(--azul); letter-spacing: .06em; text-transform: uppercase; }
.card-login { box-shadow: var(--sombra-forte); border-color: var(--borda-forte); }

/* ---------- Proteção das imagens ---------- */
.protegida, .zoomable, .arte-card img, .lightbox-overlay img {
    -webkit-user-drag: none; -webkit-user-select: none; -moz-user-select: none;
    user-select: none; -webkit-touch-callout: none;
}
.zoomable { cursor: zoom-in; }

/* ---------- Lightbox ---------- */
.lightbox-overlay {
    position: fixed; inset: 0; width: 100%; height: 100vh;
    background: rgba(15, 26, 33, .9);
    display: flex; align-items: center; justify-content: center;
    padding: 24px; margin: 0; z-index: 10000; cursor: zoom-out;
    animation: lightbox-fade .12s ease-out;
}
.lightbox-quadro { position: relative; display: inline-flex; align-items: center; justify-content: center; max-width: 100%; max-height: 100%; }
.lightbox-overlay img {
    display: block; max-width: 96vw; max-height: 92vh; width: auto; height: auto;
    object-fit: contain; border-radius: 6px; box-shadow: 0 12px 48px rgba(0, 0, 0, .55); background: var(--papel);
}
.lightbox-cover { position: absolute; inset: 0; cursor: zoom-out; }
.lightbox-fechar { position: fixed; top: 16px; right: 22px; color: #fff; font-size: 2rem; line-height: 1; font-weight: 300; cursor: pointer; opacity: .85; z-index: 10001; }
.lightbox-fechar:hover { opacity: 1; }
@keyframes lightbox-fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Motion ---------- */
.js body { animation: pagina-fade var(--dur-media) var(--ease-suave) both; }
@keyframes pagina-fade { from { opacity: 0; } to { opacity: 1; } }
body.pagina-saindo { opacity: 0; transition: opacity .16s ease; }

.page-progress {
    position: fixed; top: 0; left: 0; height: 2px; width: 0;
    background: linear-gradient(90deg, var(--dourado), var(--dourado-2));
    box-shadow: 0 0 8px rgba(184, 150, 12, .55);
    z-index: 2000; opacity: 0; pointer-events: none;
    transition: width .25s var(--ease-suave), opacity .3s ease;
}
.page-progress.ativa { opacity: 1; }

.js .reveal { opacity: 0; transform: translateY(10px); }
.js .reveal.visivel { opacity: 1; transform: none; transition: opacity var(--dur-media) var(--ease-suave), transform var(--dur-media) var(--ease-suave); }

.js .arte-card.tem-skel::before {
    content: ""; position: absolute; top: 0; left: 0; right: 0; height: 190px;
    background: linear-gradient(100deg, #ece9db 30%, #f6f4ea 50%, #ece9db 70%);
    background-size: 200% 100%; animation: skeleton 1.25s ease-in-out infinite; z-index: 0;
}
.js .arte-card.tem-skel.img-ok::before { display: none; }
.js .arte-card.tem-skel img { position: relative; z-index: 1; opacity: 0; }
.js .arte-card.tem-skel img.is-loaded { opacity: 1; transition: opacity var(--dur-media) var(--ease-suave); }
@keyframes skeleton { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.js img.lazy-fade { opacity: 0; }
.js img.lazy-fade.is-loaded { opacity: 1; transition: opacity var(--dur-media) var(--ease-suave); }

.btn.carregando { color: transparent !important; pointer-events: none; position: relative; }
.btn.carregando::after {
    content: ""; position: absolute; top: 50%; left: 50%;
    width: 15px; height: 15px; margin: -8px 0 0 -8px;
    border: 2px solid rgba(255, 255, 255, .45); border-top-color: #fff;
    border-radius: 50%; animation: girar .6s linear infinite;
}
.btn-secundario.carregando::after, .btn-ouro.carregando::after {
    border-color: rgba(27, 58, 75, .3); border-top-color: var(--azul);
}
@keyframes girar { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .001ms !important; animation-iteration-count: 1 !important;
        transition-duration: .001ms !important; scroll-behavior: auto !important;
    }
    .js .reveal { opacity: 1 !important; transform: none !important; }
    .js .arte-card.tem-skel img, .js img.lazy-fade { opacity: 1 !important; }
    .js .arte-card.tem-skel::before { display: none !important; }
    .page-progress { display: none !important; }
}

/* ---------- Responsivo ---------- */
@media (max-width: 600px) {
    .topbar { padding: 10px 0; }
    .topbar-inner { padding: 0 16px; }
    .topbar nav a { margin-left: 10px; font-size: .85rem; }
    .container { padding: 22px 16px 60px; }
    .lightbox-overlay { padding: 12px; }
    .lightbox-overlay img { max-width: calc(100vw - 24px); max-height: calc(100vh - 24px); }
    .modal-topo img { width: 110px; height: 110px; }
}

/* Segunda linha da navegação: subcategorias da categoria aberta */
.categorias-nav.subnivel {
    margin-top: -14px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--borda);
}
.categorias-nav.subnivel a {
    font-size: .8rem;
    padding: 4px 12px;
    background: transparent;
    border-style: dashed;
}
.categorias-nav.subnivel a.ativo {
    background: var(--dourado);
    border-color: var(--dourado);
    border-style: solid;
    color: #221d00;
}
