/* ==========================================================================
   HelloKpop.br — estilos
   Índice:  1. Base   2. Componentes   3. Loja   4. Janela do produto
            5. Carrinho   6. Admin   7. Login   8. Celular   9. Utilitários
   ========================================================================== */


/* ---------- 1. BASE ---------- */
:root {
  --p: #6d3fc0; --pd: #4b2790; --pl: #ede4ff;
  --y: #fff6c9; --y2: #ffe98a;
  --bg: #fffdf3; --tx: #2a1b47; --card: #fff; --mut: #7a6a99;
  --pt: #6d3fc0;   /* roxo de textos (fica mais claro no modo escuro) */
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #1b1230; --tx: #fff6c9; --card: #2a1d4a; --pl: #3a2766; --mut: #c9b8ee; --y: #3a2f1a; --pt: #d3bcff; }
}
* { box-sizing: border-box; margin: 0; }
body { background: var(--bg); color: var(--tx); font-family: Poppins, system-ui, sans-serif; line-height: 1.5; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; border: 0; }
input, select, textarea {
  padding: 9px; border-radius: 10px; border: 2px solid var(--p);
  background: var(--card); color: var(--tx); min-width: 0;
}
textarea { width: 100%; font-size: 13px; resize: vertical; }
h2 { margin: 28px 5% 12px; font-size: 22px; color: var(--pt); }


/* ---------- 2. COMPONENTES ---------- */
header {
  position: sticky; top: 0; z-index: 5; background: var(--card);
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 5%; border-bottom: 2px solid var(--y2);
}
.logo { font-size: 24px; font-weight: 800; color: var(--pt); }
.logo b { background: var(--y2); color: var(--pd); padding: 0 6px; border-radius: 8px; }

.btn { background: var(--p); color: #fff6c9; padding: 8px 16px; border-radius: 20px; font-weight: 700; display: inline-block; }
.btn.g { background: #2e9e57; color: #fff; }
.btn.r { background: #c0392b; color: #fff; }
.btn.s { padding: 5px 11px; border-radius: 10px; font-size: 13px; }
.btn-full { width: 100%; padding: 12px; }

.sf { color: var(--mut); font-size: 12px; }
.err { color: #c0392b; }
.st { padding: 2px 10px; border-radius: 12px; font-size: 12px; font-weight: 700; background: var(--y2); color: #3a2670; }
.st.confirmado, .st.enviado { background: #b8f0c8; }
.st.recusado { background: #ffc9c9; }
.img { aspect-ratio: 1; display: grid; place-items: center; font-size: 56px; background: linear-gradient(135deg, var(--pl), var(--y)); }
.img img { width: 100%; height: 100%; object-fit: cover; }
.price { font-weight: 800; color: var(--pt); font-size: 18px; }
.ver { cursor: pointer; }
.det { font-size: 12px; color: var(--pt); font-weight: 700; text-decoration: underline; }


/* ---------- 3. LOJA ---------- */
.top { background: var(--p); color: #fff6c9; text-align: center; font-size: 13px; padding: 8px; font-weight: 600; }
.hdr-acoes { display: flex; gap: 8px; }

nav { display: flex; gap: 6px; overflow-x: auto; padding: 10px 5%; background: var(--pl); }
nav a {
  white-space: nowrap; font-size: 13px; font-weight: 600; padding: 6px 14px; border-radius: 20px;
  background: var(--card); border: 1px solid var(--p); color: var(--tx);
}

.hero { margin: 20px 5%; border-radius: 24px; padding: 48px 28px; background: linear-gradient(135deg, var(--p), #9a6ee8); color: #fff; }
.hero h1 { font-size: clamp(26px, 5vw, 44px); line-height: 1.15; max-width: 520px; }
.hero p { margin: 10px 0 20px; max-width: 440px; }
.hero a { background: var(--y2); color: var(--pd); padding: 12px 26px; border-radius: 30px; font-weight: 800; display: inline-block; }

.grid { display: grid; gap: 14px; margin: 0 5%; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.card { background: var(--card); border-radius: 18px; overflow: hidden; box-shadow: 0 2px 10px #6d3fc01f; display: flex; flex-direction: column; }
.info { padding: 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.info small { color: var(--mut); font-size: 12px; }
.info .btn { margin-top: auto; text-align: center; border-radius: 12px; padding: 9px; }

footer { background: var(--pd); color: #fff6c9; padding: 28px 5%; font-size: 13px; margin-top: 34px; }
footer span { background: #fff6c9; color: #4b2790; border-radius: 6px; padding: 2px 9px; font-weight: 700; }
.pix { margin: 8px 0; }

.ajuda {
  position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 15;
  background: #25d366; color: #fff; font-weight: 800; padding: 12px 18px; border-radius: 30px;
  box-shadow: 0 4px 14px #0006; display: flex; gap: 6px; align-items: center; transition: transform .15s;
}
.ajuda:hover { transform: scale(1.06); }
@media (max-width: 480px) { .ajuda span { display: none; } .ajuda { padding: 14px 16px; } }


/* ---------- 4. JANELA DO PRODUTO ---------- */
#modal { position: fixed; inset: 0; background: #000a; z-index: 30; display: grid; place-items: center; padding: 16px; overflow-y: auto; }
#modal.hide { display: none; }
.mbox {
  position: relative; background: var(--card); border-radius: 20px; max-width: 720px; width: 100%;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); overflow: hidden; max-height: 92vh;
}
.mbox .img { aspect-ratio: auto; min-height: 260px; font-size: 90px; }
.mbox .img img { width: 100%; height: auto; max-height: 80vh; object-fit: contain; display: block; }
.mtxt { padding: 20px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; }
.mtxt h3 { font-size: 20px; }
.mtxt .price { font-size: 26px; }
.mtxt ul { padding-left: 18px; font-size: 14px; }
.mtxt .btn { margin-top: 8px; text-align: center; }
.dsc { white-space: pre-line; font-size: 14px; }
.mx {
  position: absolute; top: 8px; right: 10px; z-index: 3; width: 32px; height: 32px;
  background: var(--card); color: var(--tx); border-radius: 50%; font-size: 16px; box-shadow: 0 2px 8px #0005;
}
/* celular: o modal inteiro rola; imagem cabe na tela; nome, preço e botão ficam visíveis */
@media (max-width: 560px) {
  #modal { align-items: center; padding: 10px; }
  .mbox { display: block; overflow-y: auto; overflow-x: hidden; max-height: 90vh; max-height: 90dvh; -webkit-overflow-scrolling: touch; }
  .mx { position: sticky; top: 8px; display: block; margin: 8px 8px -40px auto; right: auto; }
  .mbox .img { aspect-ratio: auto; min-height: 0; font-size: 70px; background: var(--pl); padding: 0; }
  .mbox .img img { width: 100%; height: auto; max-height: 40vh; object-fit: contain; }
  .mtxt { overflow: visible; padding: 14px 16px 0; gap: 6px; }
  .mtxt h3 { font-size: 18px; line-height: 1.25; }
  .mtxt .price { font-size: 26px; line-height: 1.2; }
  .mtxt .btn {
    position: sticky; bottom: 0; z-index: 2; margin: 10px -16px 0; padding: 14px; border-radius: 0;
    font-size: 15px; min-height: 46px; box-shadow: 0 -10px 14px var(--card);
  }
}


/* ---------- 5. CARRINHO ---------- */
#drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(400px, 100%); background: var(--card); z-index: 20;
  transform: translateX(100%); transition: .25s; padding: 20px; overflow-y: auto; overflow-x: hidden; box-shadow: -6px 0 24px #0004;
}
#drawer.open { transform: none; }
.drawer-titulo { font-size: 18px; }
.fechar-carrinho { background: none; font-size: 20px; color: var(--tx); }

.row { display: flex; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--pl); font-size: 14px; }
.cep { display: flex; gap: 6px; margin: 10px 0; }
.cep input { flex: 1; min-width: 0; }
.cep .btn { flex: none; }
.cep .uf { max-width: 70px; flex: none; }
.m { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; margin: 10px 0; }
.total { font-size: 20px; font-weight: 800; color: var(--pt); margin: 12px 0; }

.opt { display: flex; gap: 8px; align-items: center; padding: 8px; border: 2px solid var(--pl); border-radius: 12px; margin: 6px 0; font-size: 14px; }
.opt:has(input:checked) { border-color: var(--p); background: var(--y); }
.opt small { color: var(--mut); }

.ok { background: var(--y2); color: #2a1b47; border-radius: 14px; padding: 12px; margin-top: 10px; }
.ok b { display: block; font-size: 22px; }

/* o carrinho usa campos e opções mais compactos */
#drawer input { width: 100%; }
#drawer input[type=radio] { width: auto; padding: 0; flex: none; margin: 0; }
#drawer input:not([type=radio]) { padding: 6px 10px; font-size: 13px; }
#drawer .opt { padding: 5px 9px; margin: 3px 0; font-size: 13px; line-height: 1.3; border-width: 1px; gap: 7px; }
#drawer .m { gap: 4px; margin: 6px 0; }
#drawer .cep { margin: 6px 0; }
#cepmsg { color: #e57373; font-weight: 600; min-height: 0; }
#cepmsg:empty { display: none; }


/* ---------- 6. ADMIN ---------- */
.wrap { margin: 24px 5%; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs a { padding: 9px 18px; border-radius: 20px; background: var(--pl); color: var(--tx); font-weight: 700; }
.tabs .on { background: var(--p); color: #fff6c9; }

.panel { background: var(--card); border-radius: 18px; padding: 16px; overflow-x: auto; margin-bottom: 16px; }
.panel .sf { margin-top: 4px; }

table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { padding: 8px; border-bottom: 1px solid var(--pl); text-align: left; white-space: nowrap; vertical-align: middle; }
th { background: var(--y2); color: #2a1b47; font-weight: 700; }
.td-wrap { white-space: normal; min-width: 230px; }
.td-desc { white-space: normal; min-width: 260px; }
td textarea { display: block; margin-bottom: 4px; }

/* formulários: cada campo = rótulo em cima + caixa embaixo */
.f { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.campo { display: flex; flex-direction: column; gap: 3px; }
.campo label { font-size: 12px; color: var(--mut); }
.campo.largo { flex: 1 1 100%; }
.num-sm { width: 90px; }

/* botões lado a lado dentro de uma célula ou formulário */
.acoes { display: flex; gap: 4px; align-items: center; }
td.acoes { display: table-cell; white-space: nowrap; }
td.acoes form { display: inline; }

.thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; vertical-align: middle; }
.emoji-lg { font-size: 28px; }
.file-sm { max-width: 190px; font-size: 12px; }

.kpis { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 14px; }
.kpi { background: var(--y2); color: #2a1b47; border-radius: 14px; padding: 12px; }
.kpi b { display: block; font-size: 20px; }
.kpi small { color: inherit; }


/* ---------- 7. LOGIN ---------- */
.login { max-width: 340px; margin: 12vh auto; background: var(--card); padding: 24px; border-radius: 18px; display: grid; gap: 10px; }


/* ---------- 8. CELULAR ---------- */
/* título principal em uma única linha */
.hero-title { white-space: nowrap; max-width: none; width: 100%; font-size: clamp(14px, 4.2vw, 44px); letter-spacing: -0.045em; }

@media (max-width: 560px) {
  .hero { padding: 32px 14px; margin-left: 3%; margin-right: 3%; }
  .hero-title { font-size: clamp(13px, 4.5vw, 23px); letter-spacing: -0.055em; }

  header { padding: 9px 3%; gap: 8px; }
  header > div { gap: 5px !important; flex-shrink: 0; }
  .logo { font-size: clamp(17px, 5vw, 21px); white-space: nowrap; }
  header .btn { padding: 7px 9px; font-size: 11px; line-height: 1.2; border-radius: 14px; white-space: nowrap; }
  .btn { min-height: 34px; padding: 7px 12px; font-size: 13px; line-height: 1.25; }
  .hero a { padding: 9px 17px; font-size: 13px; }
  .info { padding: 9px; gap: 4px; }
  .info .btn { width: 100%; min-height: 34px; padding: 7px 8px; font-size: 12px; border-radius: 9px; }
  .det { font-size: 11px; }
  .cep { align-items: stretch; gap: 5px; }
  .cep .btn { padding: 7px 10px; font-size: 12px; min-height: 34px; }
  #drawer > .btn, #drawer button[onclick="enviar()"] { min-height: 40px; padding: 9px 12px !important; font-size: 13px; }
  .tabs a { padding: 7px 12px; font-size: 12px; }
  .ajuda { padding: 10px 12px; font-size: 13px; }
}

@media (max-width: 380px) {
  header { padding-left: 2%; padding-right: 2%; }
  .logo { font-size: 16px; }
  header .btn { padding: 6px 7px; font-size: 10px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-left: 3%; margin-right: 3%; }
}


/* ---------- 9. UTILITÁRIOS ---------- */
.mt6 { margin-top: 6px; }
.mt10 { margin-top: 10px; }
.mb12 { margin-bottom: 12px; }
.hide { display: none; }
