/*
Theme Name: Joias Digitais
Theme URI: https://example.com
Author: Sua Loja
Description: Tema para loja de arquivos digitais STL/DXF de joias, integrado ao WooCommerce (produtos virtuais/baixáveis, preço promocional nativo, categorias e subcategorias).
Version: 1.0
Requires PHP: 7.4
Text Domain: joias-digitais
*/

:root {
  --jd-paper: #F6F3EE;
  --jd-ink: #1E1B18;
  --jd-plum: #3A2740;
  --jd-gold: #B8925A;
  --jd-rose: #A8555A;
}

* { box-sizing: border-box; }

body {
  background: var(--jd-paper);
  color: var(--jd-ink);
  font-family: Georgia, 'Times New Roman', serif;
  margin: 0;
}

a { text-decoration: none; color: inherit; }

.jd-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Banner de aviso */
.jd-banner {
  background: var(--jd-gold);
  color: #2b1f10;
  text-align: center;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  font-family: sans-serif;
}

/* Header */
.jd-header {
  background: var(--jd-plum);
  color: var(--jd-paper);
  padding: 14px 20px;
}

.jd-header-top {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.jd-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 1px;
}

.jd-logo img { height: 28px; }

.jd-search-form {
  flex: 1;
  min-width: 180px;
  display: flex;
  align-items: center;
  background: var(--jd-paper);
  border-radius: 6px;
  padding: 6px 10px;
}

.jd-search-form input {
  border: none;
  outline: none;
  background: transparent;
  margin-left: 8px;
  width: 100%;
  font-family: sans-serif;
  font-size: 14px;
}

.jd-header-actions {
  display: flex;
  gap: 8px;
}

.jd-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  border-radius: 6px;
  padding: 8px 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: sans-serif;
  font-size: 13px;
  border: 1px solid var(--jd-gold);
  background: transparent;
  color: var(--jd-paper);
}

.jd-btn-solid {
  background: var(--jd-gold);
  color: #2b1f10;
  border: none;
}

/* Menu de categorias com dropdown de subcategorias no hover */
.jd-category-menu {
  max-width: 1000px;
  margin: 10px auto 0;
  display: flex;
  gap: 18px;
  overflow-x: auto;
  padding-bottom: 4px;
  align-items: center;
  list-style: none;
  padding-left: 0;
}

.jd-category-menu > li {
  position: relative;
  white-space: nowrap;
  font-family: sans-serif;
  font-size: 13px;
}

.jd-category-menu > li > a {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-bottom: 4px;
  border-bottom: 2px solid transparent;
}

.jd-category-menu > li:hover > a {
  border-bottom: 2px solid var(--jd-gold);
}

.jd-subcategory-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 6px 16px rgba(0,0,0,0.18);
  min-width: 150px;
  z-index: 20;
  margin-top: 4px;
  list-style: none;
  padding: 0;
}

.jd-category-menu > li:hover .jd-subcategory-dropdown {
  display: block;
}

.jd-subcategory-dropdown li a {
  display: block;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--jd-plum);
  white-space: nowrap;
}

.jd-subcategory-dropdown li a:hover {
  background: #f2ede6;
}

.jd-subcategory-dropdown li.jd-todos a {
  font-weight: 700;
  border-bottom: 1px solid #eee;
}

/* Trust badges */
.jd-trust-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
  font-family: sans-serif;
}

.jd-trust-badge {
  background: #fff;
  border: 1px solid #e4ded2;
  border-radius: 8px;
  padding: 14px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.jd-trust-badge .jd-icon-circle {
  background: rgba(184,146,90,0.2);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Grid de produtos */
.jd-product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.jd-product-card {
  background: #fff;
  border: 1px solid #e4ded2;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  font-family: sans-serif;
}

.jd-product-card img {
  width: 100%;
  height: 140px;
  object-fit: cover;
}

.jd-product-card .jd-product-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 6px;
}

.jd-product-card .jd-price {
  font-size: 16px;
  font-weight: 700;
  color: var(--jd-rose);
  margin: 4px 0;
}

.jd-product-card .jd-price del {
  font-size: 12px;
  font-weight: 400;
  color: #aaa;
  margin-right: 6px;
}

.jd-format-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--jd-plum);
  background: rgba(184,146,90,0.2);
  border-radius: 4px;
  padding: 4px 8px;
  width: fit-content;
}

.jd-add-to-cart-btn {
  margin-top: auto;
  background: var(--jd-plum);
  color: var(--jd-paper);
  border: none;
  border-radius: 6px;
  padding: 8px;
  font-weight: 700;
  cursor: pointer;
  font-size: 12px;
}

/* Footer */
.jd-footer {
  background: var(--jd-plum);
  color: var(--jd-paper);
  margin-top: 40px;
  font-family: sans-serif;
}

.jd-footer-grid {
  max-width: 1000px;
  margin: 0 auto;
  padding: 32px 20px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 24px;
}

.jd-footer-grid h4 {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 10px;
  color: var(--jd-gold);
}

.jd-footer-grid ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.jd-footer-grid ul li a {
  display: block;
  font-size: 13px;
  opacity: 0.85;
  margin-bottom: 8px;
}

.jd-footer-grid ul li a:hover { text-decoration: underline; }

.jd-social-icons { display: flex; gap: 10px; }

.jd-social-icons a {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(246,243,238,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
}

.jd-footer-bottom {
  border-top: 1px solid rgba(246,243,238,0.15);
  text-align: center;
  padding: 14px;
  font-size: 12px;
  opacity: 0.7;
}

/* Página institucional simples */
.jd-static-page {
  max-width: 640px;
  font-family: sans-serif;
  padding: 24px 0;
}

.jd-static-page h1 {
  font-size: 22px;
  margin: 12px 0 16px;
  font-family: Georgia, serif;
}

.jd-static-page p {
  font-size: 14px;
  line-height: 1.7;
  color: #333;
  margin-bottom: 14px;
}

/* ==========================================================
   Compatibilidade visual com o WooCommerce
   Alinha os elementos nativos (loja, produto, carrinho,
   checkout) com a paleta de cores do tema.
   ========================================================== */

.jd-woocommerce-wrap { font-family: sans-serif; }

.jd-woocommerce-wrap ul.products {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  list-style: none;
  padding: 0;
}

.jd-woocommerce-wrap ul.products li.product {
  background: #fff;
  border: 1px solid #e4ded2;
  border-radius: 8px;
  overflow: hidden;
  padding: 0 0 12px;
}

.jd-woocommerce-wrap ul.products li.product img {
  width: 100%;
  height: 140px;
  object-fit: cover;
}

.jd-woocommerce-wrap ul.products li.product h2,
.jd-woocommerce-wrap ul.products li.product .woocommerce-loop-product__title {
  font-size: 14px;
  font-weight: 700;
  padding: 10px 12px 0;
  color: var(--jd-ink);
}

.jd-woocommerce-wrap .price {
  color: var(--jd-rose) !important;
  font-weight: 700;
  padding: 0 12px;
}

.jd-woocommerce-wrap .price del {
  color: #aaa !important;
  font-weight: 400;
  opacity: 1 !important;
}

.jd-woocommerce-wrap .price ins {
  text-decoration: none;
}

.jd-woocommerce-wrap .onsale {
  background: var(--jd-gold) !important;
  color: #2b1f10 !important;
  font-weight: 700;
  font-size: 11px;
}

.jd-woocommerce-wrap .button,
.jd-woocommerce-wrap button.button,
.jd-woocommerce-wrap input.button,
.jd-woocommerce-wrap a.button,
.jd-woocommerce-wrap .checkout-button {
  background: var(--jd-plum) !important;
  color: var(--jd-paper) !important;
  border-radius: 6px !important;
  border: none !important;
  font-weight: 700 !important;
  padding: 10px 16px !important;
}

.jd-woocommerce-wrap .button:hover,
.jd-woocommerce-wrap a.button:hover {
  background: #2c1d31 !important;
}

.jd-woocommerce-wrap a.added_to_cart {
  color: var(--jd-plum) !important;
  font-size: 12px;
}

.jd-woocommerce-wrap .woocommerce-message,
.jd-woocommerce-wrap .woocommerce-info {
  border-top-color: var(--jd-gold) !important;
}

.jd-woocommerce-wrap .woocommerce-message::before,
.jd-woocommerce-wrap .woocommerce-info::before {
  color: var(--jd-gold) !important;
}

.jd-woocommerce-wrap table.shop_table {
  border-color: #e4ded2;
}

.jd-woocommerce-wrap #payment .payment_methods {
  background: #fdfaf5;
}

.jd-woocommerce-wrap .woocommerce-Price-amount {
  color: inherit;
}

/* Aviso de produto virtual/baixável, se o tema/plugin exibir */
.jd-woocommerce-wrap p.stock,
.jd-woocommerce-wrap .product_meta {
  font-size: 12px;
  color: #888;
}

/* Responsivo */
@media (max-width: 640px) {
  .jd-header-top { flex-direction: column; align-items: stretch; }
  .jd-search-form { order: 3; width: 100%; }
  .jd-btn span.jd-btn-label { display: none; }
  .jd-category-menu-desktop { display: none !important; }
  .jd-hamburger-btn { display: flex !important; }
}

@media (min-width: 641px) {
  .jd-hamburger-btn { display: none !important; }
  .jd-drawer, .jd-drawer-overlay { display: none !important; }
}

/* Botão hambúrguer */
.jd-hamburger-btn {
  display: none;
  background: none;
  border: none;
  color: var(--jd-paper);
  cursor: pointer;
  padding: 4px;
  align-items: center;
  font-size: 22px;
}

/* Menu lateral (gaveta) */
.jd-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.jd-drawer-overlay.jd-open {
  opacity: 1;
  pointer-events: auto;
}

.jd-drawer {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: 82%;
  max-width: 320px;
  background: #fff;
  z-index: 100;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  overflow-y: auto;
  font-family: sans-serif;
  box-shadow: 4px 0 20px rgba(0,0,0,0.25);
}

.jd-drawer.jd-open {
  transform: translateX(0);
}

.jd-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid #eee;
}

.jd-drawer-header strong {
  font-size: 16px;
  color: var(--jd-plum);
}

.jd-drawer-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--jd-plum);
  font-size: 22px;
  line-height: 1;
}

.jd-drawer-cat {
  border-bottom: 1px solid #f0f0f0;
}

.jd-drawer-cat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  cursor: pointer;
  font-size: 15px;
  color: var(--jd-ink);
}

.jd-drawer-cat-row .jd-chevron {
  transition: transform 0.2s ease;
  color: #999;
  display: inline-block;
}

.jd-drawer-cat.jd-open .jd-chevron {
  transform: rotate(90deg);
}

.jd-drawer-subitems {
  display: none;
  padding-bottom: 8px;
}

.jd-drawer-cat.jd-open .jd-drawer-subitems {
  display: block;
}

.jd-drawer-subitems a {
  display: block;
  padding: 10px 16px 10px 28px;
  font-size: 14px;
  color: #444;
}

.jd-drawer-subitems a.jd-todos {
  color: var(--jd-plum);
  font-weight: 700;
}

.jd-drawer-help {
  padding: 16px;
  margin-top: 8px;
}

.jd-drawer-help p.jd-title {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 10px;
}

.jd-drawer-help .jd-contact-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  margin-bottom: 8px;
  color: #444;
}
