/*
Theme Name:  D4X4 Desarmaduria
Theme URI:   https://www.d4x4.cl
Author:      Desarmaduria4x4
Author URI:  https://www.d4x4.cl
Description: Tema personalizado para Desarmaduria4x4 — repuestos para vehículos 4x4, SUV y utilitarios. Diseñado para WooCommerce con soporte para vehículos en desarme.
Version:     1.0.0
Requires at least: 6.0
Tested up to: 6.5
Requires PHP: 8.0
License:     GNU General Public License v2 or later
Text Domain: d4x4
Tags:        woocommerce, custom-menu, custom-logo, footer-widgets, full-width-template, theme-options
*/

/* ─────────────────────────────────────────
   VARIABLES GLOBALES
───────────────────────────────────────── */
:root {
  --red:       #e63012;
  --red-dark:  #c9280f;
  --dark-bg:   #1a1a1a;
  --dark-hero: #222;
  --dark-nav:  #2d2d2d;
  --dark-card: #2a2a2a;
  --border:    #eee;
  --text:      #1a1a1a;
  --muted:     #555;
  --dimmed:    #888;
  --lighter:   #aaa;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --wa-green:  #25d366;
}

/* ─────────────────────────────────────────
   RESET & BASE
───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  color: var(--text);
  background: #f4f4f4;
  line-height: 1.6;
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; height: auto; display: block; }
ul { list-style: none; }

/* ─────────────────────────────────────────
   TOPBAR
───────────────────────────────────────── */
.site-topbar {
  background: var(--dark-bg);
  color: #fff;
  padding: 8px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
}
.site-topbar .topbar-left { display: flex; align-items: center; gap: 6px; opacity: .85; }
.site-topbar .topbar-right { display: flex; align-items: center; gap: 6px; color: var(--dimmed); }
.site-topbar i { font-size: 14px; }

/* ─────────────────────────────────────────
   HEADER
───────────────────────────────────────── */
.site-header {
  background: var(--dark-hero);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.site-logo { display: flex; align-items: center; gap: 12px; }
.logo-icon {
  width: 44px; height: 44px;
  background: var(--red);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.logo-icon i { font-size: 24px; color: #fff; }
.logo-name { color: #fff; font-size: 18px; font-weight: 600; line-height: 1.2; }
.logo-name span { color: var(--red); }
.logo-sub { color: var(--dimmed); font-size: 11px; margin-top: 2px; }

.header-search { flex: 1; max-width: 340px; position: relative; }
.header-search input {
  width: 100%; padding: 9px 14px 9px 38px;
  border-radius: var(--radius-md); border: none;
  font-size: 13px; background: #3a3a3a; color: #fff; outline: none;
}
.header-search input::placeholder { color: var(--dimmed); }
.header-search .search-icon {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  color: var(--dimmed); font-size: 16px; pointer-events: none;
}
.header-actions { display: flex; align-items: center; gap: 10px; }

.cart-icon-btn {
  position: relative;
  width: 42px; height: 42px;
  background: #2a2a2a;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 20px;
}
.cart-icon-btn .cart-count {
  position: absolute; top: -6px; right: -6px;
  background: var(--red); color: #fff;
  font-size: 10px; font-weight: 700;
  width: 18px; height: 18px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

.btn-wa {
  background: var(--wa-green); color: #fff; border: none;
  padding: 9px 16px; border-radius: var(--radius-md);
  font-size: 13px; font-weight: 500; cursor: pointer;
  display: flex; align-items: center; gap: 7px; white-space: nowrap;
}
.btn-wa:hover { background: #1db954; }

/* ─────────────────────────────────────────
   NAVEGACIÓN
───────────────────────────────────────── */
.site-nav {
  background: var(--dark-nav);
}
.site-nav ul {
  display: flex; list-style: none; margin: 0; padding: 0;
}
.site-nav ul li a {
  color: #ccc; padding: 11px 18px; font-size: 13px;
  display: block; border-right: 1px solid #3a3a3a;
  transition: color .15s, background .15s;
}
.site-nav ul li a:hover { color: #fff; background: #383838; }
.site-nav ul li.current-menu-item > a,
.site-nav ul li.current_page_item > a { color: var(--red); }

/* Submenú */
.site-nav ul li { position: relative; }
.site-nav ul ul {
  display: none; position: absolute; top: 100%; left: 0;
  background: var(--dark-nav); min-width: 200px; z-index: 200;
  box-shadow: 0 8px 24px rgba(0,0,0,.3);
}
.site-nav ul li:hover > ul { display: block; }
.site-nav ul ul li a { border-right: none; border-bottom: 1px solid #3a3a3a; }

/* ─────────────────────────────────────────
   HERO (front-page)
───────────────────────────────────────── */
.site-hero {
  background: var(--dark-bg);
  padding: 40px 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  align-items: center;
}
.hero-text h1 { color: #fff; font-size: 26px; font-weight: 600; line-height: 1.3; margin-bottom: 12px; }
.hero-text p  { color: var(--lighter); font-size: 14px; line-height: 1.7; margin-bottom: 20px; }
.hero-btns    { display: flex; gap: 12px; flex-wrap: wrap; }

.btn-red {
  background: var(--red); color: #fff; border: none;
  padding: 10px 20px; border-radius: var(--radius-md);
  font-size: 13px; font-weight: 500; cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px;
  transition: background .15s;
}
.btn-red:hover { background: var(--red-dark); }

.btn-outline {
  background: transparent; color: #fff;
  border: 1px solid #555; padding: 10px 20px;
  border-radius: var(--radius-md); font-size: 13px;
  cursor: pointer; display: inline-flex; align-items: center; gap: 7px;
  transition: border-color .15s;
}
.btn-outline:hover { border-color: #888; }

.hero-search-box {
  background: var(--dark-card);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.hero-search-box h3 {
  color: #fff; font-size: 15px; font-weight: 500;
  margin-bottom: 16px; display: flex; align-items: center; gap: 8px;
}
.hero-search-box h3 i { color: var(--red); font-size: 18px; }
.vehicle-search-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px;
}
.vehicle-search-row select {
  background: #3a3a3a; border: 1px solid #555; color: #ccc;
  padding: 9px 12px; border-radius: var(--radius-md); font-size: 13px;
  width: 100%; cursor: pointer; outline: none; appearance: none;
  font-family: inherit;
}
.vehicle-search-row select:focus { border-color: var(--red); }
.btn-search {
  width: 100%; background: var(--red); color: #fff; border: none;
  padding: 11px; border-radius: var(--radius-md); font-size: 14px; font-weight: 500;
  cursor: pointer; margin-top: 6px; display: flex; align-items: center;
  justify-content: center; gap: 8px; transition: background .15s;
}
.btn-search:hover { background: var(--red-dark); }

/* ─────────────────────────────────────────
   TRUST BAR
───────────────────────────────────────── */
.trust-bar {
  background: #f8f8f8;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: grid; grid-template-columns: repeat(4,1fr); gap: 8px;
}
.trust-item {
  display: flex; flex-direction: column; align-items: center;
  gap: 6px; font-size: 11px; color: var(--muted); text-align: center;
}
.trust-item i { font-size: 22px; color: var(--red); }

/* ─────────────────────────────────────────
   SECCIONES GENERALES
───────────────────────────────────────── */
.section { padding: 28px 24px; }
.section-max { max-width: 1100px; margin: 0 auto; }
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.section-title { font-size: 18px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.section-title i { color: var(--red); font-size: 20px; }
.section-link { font-size: 13px; color: var(--red); }
.section-link:hover { text-decoration: underline; }

/* ─────────────────────────────────────────
   BANNERS
───────────────────────────────────────── */
.promo-banner {
  display: block; width: 100%;
  margin: 0 0 4px;
  overflow: hidden;
}
.promo-banner img { width: 100%; height: auto; display: block; }

/* ─────────────────────────────────────────
   PRODUCTOS WOOCOMMERCE
───────────────────────────────────────── */
.products-grid,
ul.products {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)) !important;
  gap: 16px !important;
  list-style: none !important;
  padding: 0 !important;
  margin: 0 !important;
}
li.product,
.product-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: box-shadow .2s, transform .15s;
  display: flex; flex-direction: column;
}
li.product:hover, .product-card:hover {
  box-shadow: 0 6px 20px rgba(0,0,0,.09);
  transform: translateY(-2px);
}
li.product .woocommerce-loop-product__link,
.product-card .product-thumb {
  display: block;
  background: #f5f5f5;
  height: 180px;
  display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}
li.product .woocommerce-loop-product__link img { width: 100%; height: 100%; object-fit: cover; }
li.product .woocommerce-loop-product__title,
.product-card .product-name {
  font-size: 13px; font-weight: 600;
  padding: 12px 14px 4px; color: var(--text); line-height: 1.4;
}
li.product .price,
.product-card .product-price {
  font-size: 17px; font-weight: 600;
  color: var(--red); padding: 4px 14px 10px;
}
li.product .price del { font-size: 12px; color: #bbb; margin-right: 6px; }
li.product .button,
.product-card .btn-add {
  margin: auto 14px 14px;
  background: var(--wa-green); color: #fff; border: none;
  padding: 9px 12px; border-radius: var(--radius-md);
  font-size: 12px; font-weight: 500; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: calc(100% - 28px);
  transition: background .15s;
}
li.product .button:hover { background: #1db954; }

/* Badges WooCommerce */
.onsale {
  background: var(--red) !important;
  border-radius: 4px !important;
  font-size: 11px !important; font-weight: 600 !important;
  padding: 3px 7px !important;
}

/* ─────────────────────────────────────────
   EN DESARME — FICHAS
───────────────────────────────────────── */
.desarme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}
.desarme-card {
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
  transition: box-shadow .2s, transform .15s;
}
.desarme-card:hover { box-shadow: 0 8px 24px rgba(0,0,0,.1); transform: translateY(-2px); }

.vehicle-gallery { position: relative; height: 220px; background: #f0f0f0; overflow: hidden; }
.vehicle-gallery img { width: 100%; height: 100%; object-fit: cover; }
.vehicle-gallery .no-image {
  height: 100%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px;
  color: #ccc;
}
.vehicle-gallery .no-image i { font-size: 64px; }
.vehicle-badge-new {
  position: absolute; top: 10px; left: 10px;
  background: var(--red); color: #fff;
  font-size: 10px; font-weight: 600; padding: 3px 8px; border-radius: 4px;
}
.vehicle-badge-month {
  position: absolute; top: 10px; right: 10px;
  background: rgba(0,0,0,.6); color: #fff;
  font-size: 10px; padding: 3px 8px; border-radius: 4px;
}
.vehicle-card-body { padding: 16px; }
.vehicle-card-title { font-size: 15px; font-weight: 600; margin-bottom: 10px; }
.vehicle-specs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 12px;
}
.vehicle-spec { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); }
.vehicle-spec i { font-size: 15px; color: var(--red); flex-shrink: 0; }
.vehicle-piezas-title { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.vehicle-piezas-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 12px; }
.pieza-tag { font-size: 11px; background: #f5f5f5; color: var(--muted); padding: 3px 8px; border-radius: 4px; border: 1px solid var(--border); }
.pieza-tag.destacada { background: #fef0ed; color: var(--red); border-color: #f5c4a0; }
.vehicle-card-footer {
  display: grid; grid-template-columns: 1fr 44px; gap: 8px;
  padding-top: 12px; border-top: 1px solid var(--border);
}
.btn-consultar-wa {
  background: var(--wa-green); color: #fff; border: none;
  padding: 10px; border-radius: var(--radius-md); font-size: 13px; font-weight: 500;
  cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 7px;
}
.btn-ver-ficha {
  background: #f5f5f5; border: 1px solid var(--border); border-radius: var(--radius-md);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: var(--dimmed); font-size: 18px;
}
.btn-ver-ficha:hover { background: #ebebeb; color: var(--red); }

/* ─────────────────────────────────────────
   ANTI-FRAUDE
───────────────────────────────────────── */
.fraud-warning {
  background: #fef9f5; border: 1px solid #f5c4a0;
  border-radius: var(--radius-md); padding: 14px 18px;
  margin: 0 24px 28px; font-size: 12px; line-height: 1.8;
}
.fraud-warning strong { display: block; color: #884400; margin-bottom: 4px; font-size: 13px; }

/* ─────────────────────────────────────────
   FOOTER
───────────────────────────────────────── */
.site-footer {
  background: var(--dark-bg);
  padding: 32px 24px;
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 32px;
}
.footer-col h4 { color: #fff; font-size: 14px; font-weight: 600; margin-bottom: 14px; }
.footer-col p  { color: var(--dimmed); font-size: 13px; line-height: 1.7; margin-bottom: 12px; }
.footer-col a  { color: var(--dimmed); font-size: 13px; display: block; margin-bottom: 8px; transition: color .15s; }
.footer-col a:hover { color: var(--red); }
.footer-addr {
  display: flex; align-items: flex-start; gap: 8px;
  color: var(--dimmed); font-size: 13px; line-height: 1.7; margin-bottom: 14px;
}
.footer-addr i { color: var(--red); font-size: 16px; margin-top: 3px; flex-shrink: 0; }
.social-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: var(--radius-md);
  font-size: 13px; font-weight: 500; margin-bottom: 10px;
  transition: opacity .15s;
}
.social-btn:hover { opacity: .85; }
.social-btn i { font-size: 18px; }
.social-ig { background: #c13584; color: #fff; }
.social-fb { background: #1877f2; color: #fff; }
.social-wa { background: var(--wa-green); color: #fff; }

.site-footer-bottom {
  background: #111; padding: 12px 24px;
  text-align: center; font-size: 12px; color: #555;
}
.site-footer-bottom a { color: #666; }
.site-footer-bottom a:hover { color: var(--red); }

/* ─────────────────────────────────────────
   BOTÓN FLOTANTE WHATSAPP
───────────────────────────────────────── */
.wa-float {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--wa-green); color: #fff;
  width: 56px; height: 56px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
  font-size: 28px; z-index: 9999;
  transition: background .15s, transform .15s;
}
.wa-float:hover { background: #1db954; transform: scale(1.06); }

/* ─────────────────────────────────────────
   WOOCOMMERCE — SINGLE PRODUCT
───────────────────────────────────────── */
.woocommerce-product-gallery { border-radius: var(--radius-lg); overflow: hidden; }
.woocommerce div.product .product_title { font-size: 22px; font-weight: 600; margin-bottom: 8px; }
.woocommerce div.product p.price { font-size: 24px; color: var(--red); font-weight: 600; }
.woocommerce div.product .single_add_to_cart_button {
  background: var(--red) !important; border-radius: var(--radius-md) !important;
  font-weight: 500 !important; transition: background .15s !important;
}
.woocommerce div.product .single_add_to_cart_button:hover { background: var(--red-dark) !important; }

/* ─────────────────────────────────────────
   WOOCOMMERCE — CART & CHECKOUT
───────────────────────────────────────── */
.woocommerce .cart-collaterals { background: #fff; border-radius: var(--radius-lg); padding: 20px; border: 1px solid var(--border); }
.woocommerce .woocommerce-checkout .woocommerce-billing-fields h3,
.woocommerce .woocommerce-checkout #order_review_heading { font-size: 16px; font-weight: 600; }
.woocommerce .woocommerce-checkout #place_order {
  background: var(--red) !important; border-radius: var(--radius-md) !important; font-weight: 500 !important;
}
.woocommerce input, .woocommerce select, .woocommerce textarea {
  border-radius: var(--radius-md) !important;
  border: 1px solid #ddd !important;
  font-family: inherit !important;
}
.woocommerce input:focus, .woocommerce select:focus { border-color: var(--red) !important; }

/* ─────────────────────────────────────────
   PÁGINAS INTERIORES
───────────────────────────────────────── */
.page-hero {
  background: var(--dark-bg); padding: 40px 24px; text-align: center;
}
.page-hero .eyebrow {
  display: inline-flex; align-items: center; gap: 7px;
  background: rgba(230,48,18,.15); color: #f87b64;
  font-size: 12px; font-weight: 500;
  padding: 5px 14px; border-radius: 20px; margin-bottom: 14px;
}
.page-hero h1 { color: #fff; font-size: 28px; font-weight: 600; margin-bottom: 10px; }
.page-hero h1 span { color: var(--red); }
.page-hero p { color: var(--lighter); font-size: 14px; max-width: 500px; margin: 0 auto; line-height: 1.7; }

.page-content { max-width: 900px; margin: 0 auto; padding: 36px 24px; }
.page-content h2 { font-size: 20px; font-weight: 600; margin: 28px 0 12px; }
.page-content h3 { font-size: 16px; font-weight: 600; margin: 20px 0 8px; }
.page-content p  { font-size: 14px; color: var(--muted); line-height: 1.85; margin-bottom: 12px; }
.page-content ul { padding-left: 20px; margin-bottom: 12px; }
.page-content li { font-size: 14px; color: var(--muted); line-height: 1.85; margin-bottom: 4px; }
.page-content a  { color: var(--red); }
.page-content a:hover { text-decoration: underline; }

/* ─────────────────────────────────────────
   RESPONSIVO
───────────────────────────────────────── */
@media (max-width: 900px) {
  .site-hero { grid-template-columns: 1fr; }
  .trust-bar { grid-template-columns: repeat(2,1fr); }
  .site-footer { grid-template-columns: 1fr; gap: 24px; }
  .vehicle-search-row { grid-template-columns: 1fr; }
  .desarme-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .site-header { flex-wrap: wrap; }
  .header-search { order: 3; max-width: 100%; flex-basis: 100%; }
  .site-nav ul { flex-wrap: wrap; }
  .site-nav ul li a { font-size: 12px; padding: 9px 12px; }
  ul.products, .products-grid { grid-template-columns: repeat(2,1fr) !important; }
}
