/* =========================================================
   Loja Lucão — estilos
   Cores: edite config/theme.php (não precisa mexer aqui)
   ========================================================= */

:root {
  /* Fallbacks caso o theme.php não carregue */
  --ink: #0f172a;
  --ink-soft: #334155;
  --text-muted: #64748b;
  --bg: #f8fafc;
  --bg-soft: #eff6ff;
  --line: #dbe3f0;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-contrast: #ffffff;
  --accent-soft: #dbeafe;
  --hero-from: #bfdbfe;
  --hero-to: #e0f2fe;
  --danger: #dc2626;
  --success: #059669;
  --admin-sidebar: #0f172a;
  --admin-sidebar-text: #ffffff;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(26,21,35,.06);
  --shadow-md: 0 8px 24px rgba(26,21,35,.08);
  --shadow-lg: 0 24px 60px rgba(26,21,35,.14);
  --font: 'Helvetica Neue', Arial, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html { height: 100%; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1 0 auto; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
ul { margin: 0; padding: 0; list-style: none; }
h1, h2, h3 { letter-spacing: -0.02em; font-weight: 600; margin: 0 0 .5rem; }

.container { max-width: 1160px; margin: 0 auto; padding: 0 1.5rem; }
.muted { color: var(--text-muted); }

/* ---------------- Header ---------------- */
.site-header { border-bottom: 1px solid var(--line); position: sticky; top: 0; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); z-index: 20; flex-shrink: 0; }
.site-header__inner { display: flex; align-items: center; gap: 2rem; height: 68px; }
.brand { font-size: 1.3rem; font-weight: 700; letter-spacing: -0.03em; margin-right: auto; color: var(--accent); }
.site-nav { display: flex; gap: 1.5rem; font-size: .92rem; }
.site-nav a { color: var(--ink-soft); transition: color .15s; }
.site-nav a:hover { color: var(--accent); }
.cart-link { display: flex; align-items: center; gap: .4rem; font-size: .92rem; font-weight: 600; white-space: nowrap; }
.cart-link:hover { color: var(--accent); }
.cart-badge { background: var(--accent); color: var(--accent-contrast); border-radius: 999px; font-size: .72rem; min-width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; padding: 0 5px; }
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  flex-shrink: 0;
}
.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  margin: 0 auto;
  background: var(--ink);
  transition: transform .2s, opacity .2s;
}
.nav-toggle.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.is-open span:nth-child(2) { opacity: 0; }
.nav-toggle.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------------- Footer ---------------- */
.site-footer { border-top: 1px solid var(--line); margin-top: auto; padding: 2rem 0; flex-shrink: 0; background: var(--bg-soft); }
.site-footer__inner { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; font-size: .85rem; color: var(--text-muted); }

/* ---------------- Buttons ---------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .75rem 1.4rem; border-radius: var(--radius-sm); border: 1px solid transparent; font-size: .92rem; font-weight: 600; transition: transform .1s, opacity .15s, background .15s, border-color .15s; }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--accent); color: var(--accent-contrast); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-outline { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger-outline { background: transparent; border-color: #f0b7b7; color: var(--danger); }
.btn-danger-outline:hover { border-color: var(--danger); background: #fdf1f1; }
.btn-block { width: 100%; }
.btn-sm { padding: .4rem .75rem; font-size: .8rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.table-actions { display: inline-flex; flex-wrap: wrap; gap: .4rem; align-items: center; }

/* ---------------- Hero ---------------- */
.hero {
  padding: 4.5rem 0 3rem;
  text-align: center;
  background: linear-gradient(135deg, var(--hero-from), var(--hero-to));
}
.hero h1 { font-size: 2.6rem; margin-bottom: .75rem; color: var(--ink); }
.hero p { color: var(--ink-soft); font-size: 1.05rem; max-width: 480px; margin: 0 auto; }

/* ---------------- Category chips ---------------- */
.chip-row { display: flex; gap: .6rem; flex-wrap: wrap; justify-content: center; padding: 1.5rem 0; }
.chip { padding: .5rem 1rem; border: 1px solid var(--line); border-radius: 999px; font-size: .85rem; color: var(--ink-soft); background: var(--bg); transition: background .15s, border-color .15s, color .15s; }
.chip.active, .chip:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* ---------------- Product grid ---------------- */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1.75rem; padding: 2.5rem 0 4rem; }
.product-card { display: block; }
.product-card__img { aspect-ratio: 3/4; background: var(--bg-soft); border-radius: var(--radius-md); overflow: hidden; margin-bottom: .85rem; display:flex; align-items:center; justify-content:center; }
.product-card__img img { width: 100%; height: 100%; object-fit: cover; }
.product-card:hover .product-card__name { color: var(--accent); }
.product-card__name { font-size: .95rem; font-weight: 600; margin-bottom: .2rem; transition: color .15s; }
.product-card__price { font-size: .92rem; color: var(--text-muted); }
.product-card__price strong { color: var(--ink); font-weight: 700; }
.badge-tier { display:inline-block; margin-top:.35rem; font-size:.72rem; background:var(--accent-soft); color:var(--accent); padding:.15rem .5rem; border-radius:999px; font-weight: 600; }

/* ---------------- Product detail ---------------- */
.product-detail { display: grid; grid-template-columns: 1.1fr 1fr; gap: 3.5rem; padding: 3rem 0; overflow: visible; }
.product-gallery { position: relative; z-index: 5; overflow: visible; }
.product-gallery__main { position: relative; aspect-ratio: 3/4; background: var(--bg-soft); border-radius: var(--radius-lg); overflow: hidden; cursor: crosshair; }
.product-gallery__main > img { width: 100%; height: 100%; object-fit: cover; display: block; user-select: none; -webkit-user-drag: none; }
.zoom-reticle {
  position: absolute;
  width: 220px;
  height: 220px;
  border: 2px solid var(--accent);
  background: rgba(37, 99, 235, .15);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  z-index: 4;
  box-sizing: border-box;
}
.zoom-preview {
  display: none;
  position: fixed;
  width: 380px;
  height: 480px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  z-index: 9999;
  pointer-events: none;
}
.zoom-preview img {
  position: absolute;
  max-width: none !important;
  width: auto;
  height: auto;
  display: block;
  object-fit: cover;
  pointer-events: none;
  user-select: none;
}
.zoom-hint { margin: .65rem 0 0; font-size: .8rem; color: var(--text-muted); text-align: center; }

@media (max-width: 860px) {
  .product-gallery__main { cursor: default; }
  .zoom-reticle, .zoom-preview, .zoom-hint { display: none !important; }
}
.product-info h1 { font-size: 1.9rem; }
.product-price { font-size: 1.6rem; font-weight: 700; margin: .75rem 0; color: var(--accent); }
.product-price .old { font-size: 1rem; color: var(--text-muted); text-decoration: line-through; margin-left: .5rem; font-weight: 400; }
.tier-table { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; margin: 1rem 0 1.5rem; }
.tier-table__row { display: flex; justify-content: space-between; padding: .6rem 1rem; font-size: .88rem; border-bottom: 1px solid var(--line); }
.tier-table__row:last-child { border-bottom: none; }
.tier-table__row.active { background: var(--accent-soft); font-weight: 700; color: var(--accent); }
.option-group { margin-bottom: 1.25rem; }
.option-group__label { font-size: .82rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); margin-bottom: .5rem; display: block; }
.option-pill { display: inline-flex; align-items: center; justify-content: center; min-width: 42px; height: 42px; padding: 0 .8rem; border: 1px solid var(--line); border-radius: var(--radius-sm); margin: 0 .4rem .4rem 0; font-size: .88rem; background: none; }
.option-pill.selected { border-color: var(--accent); background: var(--accent); color: var(--accent-contrast); }
.option-pill:disabled { opacity: .35; text-decoration: line-through; cursor: not-allowed; }
.qty-input { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.qty-input button { width: 38px; height: 42px; background: none; border: none; font-size: 1.1rem; }
.qty-input button:hover { color: var(--accent); }
.qty-input input { width: 48px; text-align: center; border: none; font-size: .95rem; background: transparent; }
.stock-note { font-size: .82rem; color: var(--text-muted); margin-top: .5rem; }
.product-desc { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--line); color: var(--ink-soft); font-size: .93rem; }

/* ---------------- Cart ---------------- */
.cart-layout { display: grid; grid-template-columns: 1fr 340px; gap: 3rem; padding: 3rem 0 5rem; align-items: start; }
.cart-item { display: grid; grid-template-columns: 84px 1fr auto; gap: 1rem; align-items: center; padding: 1.25rem 0; border-bottom: 1px solid var(--line); }
.cart-item__img { width: 84px; height: 104px; border-radius: var(--radius-sm); background: var(--bg-soft); overflow: hidden; }
.cart-item__img img { width: 100%; height: 100%; object-fit: cover; }
.cart-item__name { font-weight: 600; font-size: .95rem; margin-bottom: .15rem; }
.cart-item__meta { font-size: .82rem; color: var(--text-muted); }
.cart-item__price { text-align: right; font-weight: 700; }
.cart-item__remove { font-size: .78rem; color: var(--danger); margin-top: .4rem; display: inline-block; }
.summary-card { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1.75rem; position: sticky; top: 90px; background: var(--bg); }
.summary-row { display: flex; justify-content: space-between; font-size: .92rem; margin-bottom: .65rem; }
.summary-row.total { font-size: 1.1rem; font-weight: 700; border-top: 1px solid var(--line); padding-top: .85rem; margin-top: .5rem; color: var(--accent); }
.coupon-row { display: flex; gap: .5rem; margin: 1rem 0; }
.coupon-row input { flex: 1; }
.empty-state { text-align: center; padding: 5rem 1rem; color: var(--text-muted); }

/* ---------------- Forms ---------------- */
.field { display: block; margin-bottom: 1rem; }
.field span { display: block; font-size: .82rem; font-weight: 700; margin-bottom: .35rem; color: var(--ink-soft); }
.field input, .field select, .field textarea {
  width: 100%; padding: .7rem .85rem; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: .93rem; font-family: inherit; background: #fff; color: var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.field-check { display: flex; align-items: center; gap: .5rem; margin-bottom: 1.25rem; font-size: .9rem; }
.form-card { max-width: 460px; margin: 3rem auto; border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 2.5rem; background: #fff; }
.form-card h1 { text-align: center; margin-bottom: .25rem; }
.form-card p.lead { text-align: center; color: var(--text-muted); margin-bottom: 1.75rem; font-size: .9rem; }
.form-foot { text-align: center; font-size: .87rem; color: var(--text-muted); margin-top: 1.25rem; }
.form-foot a { color: var(--accent); font-weight: 600; }

.alert { padding: .75rem 1rem; border-radius: var(--radius-sm); font-size: .87rem; margin-bottom: 1rem; }
.alert-error { background: #fdf1f1; border: 1px solid #f0b7b7; color: #a12a2a; }
.alert-success { background: #f0fbf4; border: 1px solid #b6e6c9; color: #1c7a44; }
.alert a { color: inherit; font-weight: 700; text-decoration: underline; }

.cart-added {
  display: flex;
  align-items: center;
  gap: .9rem;
  padding: 1rem 1.1rem;
  margin-top: .9rem;
  background: #ecfdf5;
  border: 1px solid #6ee7b7;
  border-radius: var(--radius-md);
  animation: cartAddedIn .28s ease;
}
.cart-added__icon {
  width: 28px;
  height: 28px;
  max-width: 28px;
  max-height: 28px;
  flex: 0 0 28px;
  box-sizing: border-box;
  overflow: hidden;
  border-radius: 50%;
  background: var(--success);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.cart-added__icon svg {
  width: 14px;
  height: 14px;
  max-width: 14px;
  max-height: 14px;
  display: block;
  flex: none;
}
.cart-added__text { flex: 1; min-width: 0; }
.cart-added__text strong { display: block; font-size: .98rem; color: var(--ink); line-height: 1.25; }
.cart-added__text span { display: block; margin-top: .15rem; font-size: .82rem; color: var(--text-muted); }
.cart-added .btn { flex-shrink: 0; white-space: nowrap; }
.cart-badge.pop { animation: cartBadgePop .45s ease; }

@keyframes cartAddedIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@keyframes cartBadgePop {
  0% { transform: scale(1); }
  35% { transform: scale(1.35); }
  100% { transform: scale(1); }
}

/* ---------------- Order tracking ---------------- */
.timeline { border-left: 2px solid var(--line); margin: 1.5rem 0 1.5rem 1rem; padding-left: 1.5rem; }
.timeline-step { position: relative; padding-bottom: 1.5rem; }
.timeline-step::before { content: ''; position: absolute; left: -1.65rem; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--line); }
.timeline-step.done::before { background: var(--accent); }
.timeline-step strong { display: block; font-size: .92rem; }
.timeline-step span { font-size: .8rem; color: var(--text-muted); }
.tracking-box { border: 1px solid var(--line); border-radius: var(--radius-md); padding: 1.25rem 1.5rem; margin: 1.5rem 0; display:flex; justify-content:space-between; align-items:center; background: var(--accent-soft); }
.tracking-box code { font-size: 1.05rem; font-weight: 700; letter-spacing: .04em; color: var(--accent); }

/* ---------------- Tables ---------------- */
.table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.table th, .table td { padding: .7rem .8rem; border-bottom: 1px solid var(--line); text-align: left; }
.table th { color: var(--text-muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; }
.table tr:hover td { background: var(--bg-soft); }
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table a { color: var(--accent); font-weight: 600; }
.table a.btn { color: inherit; font-weight: 600; }
.table a.btn-outline { color: var(--ink); }
.table a.btn-outline:hover { color: var(--accent); }
.table a.btn-danger-outline { color: var(--danger); }

.status-tag { display: inline-block; padding: .25rem .65rem; border-radius: 999px; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; }
.status-pending { background: #fdf3e3; color: #a3711b; }
.status-paid { background: #e7f0fd; color: #1a56b0; }
.status-processing { background: #eee7fd; color: #5a2eb0; }
.status-shipped { background: #e3f6fd; color: #147a9c; }
.status-delivered { background: #e6f8ec; color: #1c7a44; }
.status-cancelled { background: #fdeaea; color: #a12a2a; }
.status-approved { background: #e6f8ec; color: #1c7a44; }
.status-rejected { background: #fdeaea; color: #a12a2a; }
.status-in_process, .status-authorized { background: #e7f0fd; color: #1a56b0; }
.status-refunded, .status-charged_back { background: #fdeaea; color: #a12a2a; }

/* ---------------- Admin ---------------- */
.admin-body { background: var(--bg-soft); min-height: 100vh; }
.admin-shell { display: flex; min-height: 100vh; }
.admin-sidebar { width: 230px; background: var(--admin-sidebar); color: var(--admin-sidebar-text); padding: 1.5rem 1.1rem; flex-shrink: 0; }
.admin-sidebar .brand { color: var(--admin-sidebar-text); font-size: 1.15rem; display:block; margin-bottom: 2rem; }
.admin-sidebar nav a { display: block; padding: .65rem .8rem; border-radius: var(--radius-sm); color: rgba(255,255,255,.75); font-size: .9rem; margin-bottom: .2rem; }
.admin-sidebar nav a:hover, .admin-sidebar nav a.active { background: rgba(255,255,255,.12); color: #fff; }
.admin-main { flex: 1; padding: 2.25rem 2.75rem; max-width: 1180px; min-width: 0; }
.admin-topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.75rem; gap: 1rem; flex-wrap: wrap; }
.admin-topbar h1 { font-size: 1.5rem; margin: 0; }
.card { background: #fff; border-radius: var(--radius-lg); padding: 1.75rem; box-shadow: var(--shadow-sm); margin-bottom: 1.5rem; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1.25rem; margin-bottom: 1.75rem; }
.stat-card { background: #fff; border-radius: var(--radius-md); padding: 1.4rem; box-shadow: var(--shadow-sm); border-top: 3px solid var(--accent); }
.stat-card .value { font-size: 1.7rem; font-weight: 700; word-break: break-word; }
.stat-card .label { font-size: .82rem; color: var(--text-muted); }
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.25rem; gap: 1rem; flex-wrap: wrap; }
.variant-row { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr auto; gap: .6rem; align-items: end; margin-bottom: .6rem; }
.tier-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: .6rem; align-items: end; margin-bottom: .6rem; }
.remove-row-btn { height: 42px; padding: 0 .8rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: none; color: var(--danger); }
.modal-overlay { position: fixed; inset: 0; background: rgba(20,22,26,.5); display: none; align-items: center; justify-content: center; z-index: 50; padding: 1.5rem; }
.modal-overlay.open { display: flex; }
.modal-box { background: #fff; border-radius: var(--radius-lg); padding: 2rem; max-width: 460px; width: 100%; max-height: 88vh; overflow-y: auto; }

/* ---------------- Responsive ---------------- */
@media (max-width: 860px) {
  .container { padding: 0 1rem; }
  .site-header__inner { gap: .75rem; height: 60px; position: relative; }
  .brand { font-size: 1.1rem; margin-right: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .nav-toggle { display: flex; }
  .site-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-md);
    padding: .5rem 0;
    z-index: 30;
  }
  .site-nav.is-open { display: flex; }
  .site-nav a { padding: .85rem 1rem; border-bottom: 1px solid var(--line); }
  .site-nav a:last-child { border-bottom: none; }
  .cart-link { font-size: .85rem; }

  .hero { padding: 2.5rem 0 1.75rem; }
  .hero h1 { font-size: 1.9rem; }
  .hero p { font-size: .95rem; padding: 0 .5rem; }

  .product-grid { grid-template-columns: repeat(2, 1fr); gap: 1rem; padding: 1.5rem 0 3rem; }
  .product-detail { grid-template-columns: 1fr; gap: 1.75rem; padding: 1.5rem 0 2.5rem; }
  .product-info h1 { font-size: 1.45rem; }
  .cart-added { flex-wrap: wrap; }
  .cart-added .btn { width: 100%; }
  .product-price { font-size: 1.35rem; }

  .cart-layout { grid-template-columns: 1fr; gap: 1.5rem; padding: 1.5rem 0 3rem; }
  .summary-card { position: static; }
  .cart-item { grid-template-columns: 72px 1fr; gap: .85rem; }
  .cart-item__price { grid-column: 2; text-align: left; margin-top: .35rem; }
  .cart-item__img { width: 72px; height: 90px; }

  .field-row { grid-template-columns: 1fr; }
  .field input, .field select, .field textarea { font-size: 16px; }
  .form-card { margin: 1.5rem auto; padding: 1.5rem; border-radius: var(--radius-md); }
  .tracking-box { flex-direction: column; align-items: flex-start; gap: .75rem; padding: 1rem; }
  .empty-state { padding: 3rem 1rem; }

  .admin-shell { flex-direction: column; }
  .admin-sidebar { width: 100%; padding: 1rem; }
  .admin-sidebar .brand { margin-bottom: 1rem; }
  .admin-sidebar nav { display: flex; flex-wrap: wrap; gap: .25rem; }
  .admin-sidebar nav a { margin-bottom: 0; }
  .admin-main { padding: 1.25rem 1rem; }
  .admin-topbar h1 { font-size: 1.25rem; }
  .card { padding: 1.15rem; }
  .variant-row, .tier-row { grid-template-columns: 1fr 1fr; }
  .variant-row .remove-row-btn, .tier-row .remove-row-btn { grid-column: 1 / -1; width: 100%; }
  .stat-card .value { font-size: 1.35rem; }
}

@media (max-width: 480px) {
  .product-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.65rem; }
  .chip-row { justify-content: flex-start; overflow-x: auto; flex-wrap: nowrap; padding: 1rem 0; -webkit-overflow-scrolling: touch; }
  .chip { flex-shrink: 0; }
  .variant-row, .tier-row { grid-template-columns: 1fr; }
  .coupon-row { flex-direction: column; }
  .table { font-size: .8rem; }
  .table th, .table td { padding: .55rem .5rem; white-space: nowrap; }
}
