/* ================================================================
   INTERXPORT — CSS de Soporte (componentes JS, animaciones)
   El layout principal se maneja con Tailwind CSS.
   ================================================================ */

/* ── CSS CUSTOM PROPERTIES (usados por JS y componentes) ── */
:root {
  --navy:        #0266a1;
  --navy-light:  #0378bb;
  --navy-dark:   #012d4e;
  --orange:      #e67e22;
  --orange-d:    #c0620f;
  --white:       #ffffff;
  --gray-bg:     #f5f7fa;
  --gray-light:  #e8ecf0;
  --gray-text:   #6c7a8d;
  --dark-text:   #01324f;
  --success:     #27ae60;
  --danger:      #e74c3c;
  --shadow:      0 4px 20px rgba(2,102,161,.12);
  --shadow-lg:   0 8px 40px rgba(2,102,161,.20);
  --radius:      10px;
  --radius-lg:   16px;
  --tr:          all .28s ease;
  --nav-h:       80px;
}
@media (min-width: 768px) { :root { --nav-h: 108px; } }

/* ── RESET BASE ── */
*, *::before, *::after { box-sizing: border-box; }
html   { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body   { font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif; color: var(--dark-text); background: #fff; line-height: 1.6; overflow-x: hidden; }
img    { max-width: 100%; height: auto; display: block; }
a      { text-decoration: none; color: inherit; }
ul,ol  { list-style: none; margin: 0; padding: 0; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: inherit; }

/* ================================================================
   BOTONES — usados en HTML del modal cargado por JS
================================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 11px 22px; border-radius: 50px;
  font-weight: 600; font-size: .9rem;
  cursor: pointer; transition: var(--tr);
  border: 2px solid transparent; white-space: nowrap;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.btn-primary       { background: var(--orange); color: #fff; border-color: var(--orange); }
.btn-primary:hover { background: var(--orange-d); border-color: var(--orange-d); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(230,126,34,.35); }
.btn-outline       { background: transparent; color: var(--navy); border-color: var(--navy); }
.btn-outline:hover { background: var(--navy); color: #fff; transform: translateY(-2px); }
.btn-outline-white       { background: transparent; color: #fff; border-color: rgba(255,255,255,.7); }
.btn-outline-white:hover { background: #fff; color: var(--orange); transform: translateY(-2px); }
.btn-navy       { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn-navy:hover { background: var(--navy-light); border-color: var(--navy-light); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(2,102,161,.35); }
.btn-whatsapp       { background: #25d366; color: #fff; border-color: #25d366; }
.btn-whatsapp:hover { background: #128c7e; border-color: #128c7e; transform: translateY(-2px); box-shadow: 0 6px 20px rgba(37,211,102,.35); }
.btn-sm { padding: 8px 16px; font-size: .8rem; }
.btn-lg { padding: 14px 34px; font-size: 1rem; }

/* ================================================================
   NAVBAR — estado scrolled (toggled por JS)
================================================================ */
.navbar { border-bottom: 3px solid var(--navy); }
.navbar.scrolled { box-shadow: 0 6px 28px rgba(2,102,161,.18); }

/* ================================================================
   BURGER — animación JS-toggled
================================================================ */
.burger {
  display: flex; flex-direction: column; gap: 6px;
  padding: 8px; border: none; background: none;
  -webkit-tap-highlight-color: transparent;
}
@media (min-width: 768px) { .burger { display: none !important; } }
.burger span {
  display: block; width: 26px; height: 2.5px;
  background: var(--dark-text); border-radius: 2px; transition: var(--tr);
}
.burger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.burger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.burger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ================================================================
   MOBILE MENU — drawer JS-toggled
================================================================ */
.mobile-menu {
  position: fixed; inset: 0; top: var(--nav-h); z-index: 999;
  background: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  transform: translateX(100%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  overflow-y: auto;
}
.mobile-menu.open { transform: none; }
.mobile-menu a {
  display: block; color: var(--dark-text);
  font-size: 1.25rem; font-weight: 600;
  padding: 18px 32px; width: 100%; text-align: center;
  border-bottom: 1px solid var(--gray-light); transition: var(--tr);
}
.mobile-menu a:hover { color: var(--navy); background: var(--gray-bg); }
.mobile-menu .btn { margin: 20px auto; width: calc(100% - 48px); justify-content: center; }
@media (min-width: 768px) { .mobile-menu { display: none !important; } }

/* ================================================================
   PRODUCT MODAL — overlay animado
================================================================ */
.product-modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.72); z-index: 9000;
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity .28s;
}
@media (min-width: 640px) { .product-modal-overlay { align-items: center; } }
.product-modal-overlay.active { opacity: 1; pointer-events: all; }

.product-modal {
  background: #fff; border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%; max-height: 92svh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(30px); transition: transform .28s;
}
@media (min-width: 640px) {
  .product-modal {
    border-radius: var(--radius-lg); max-width: 900px;
    width: 94%; max-height: 92vh; transform: scale(.95);
  }
}
.product-modal-overlay.active .product-modal { transform: none; }

.product-modal-grid { display: grid; grid-template-columns: 1fr; }
@media (min-width: 640px) { .product-modal-grid { grid-template-columns: 1fr 1fr; } }

.product-modal-img {
  background: var(--gray-bg); display: flex; align-items: center; justify-content: center;
  padding: 28px; min-height: 220px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
@media (min-width: 640px) {
  .product-modal-img { border-radius: var(--radius-lg) 0 0 var(--radius-lg); min-height: 300px; }
}
.product-modal-img img { max-height: 260px; object-fit: contain; }

.product-modal-body { padding: 24px 20px; display: flex; flex-direction: column; }
@media (min-width: 640px) { .product-modal-body { padding: 32px; } }
.product-modal-body h2 { color: var(--navy); margin-bottom: 12px; font-size: 1.3rem; font-weight: 700; }
.product-modal-body p  { color: var(--gray-text); font-size: .875rem; margin-bottom: 20px; flex: 1; }

.product-modal-close {
  position: sticky; top: 0; float: right;
  background: rgba(0,0,0,.06); border: none; border-radius: 50%;
  width: 34px; height: 34px; font-size: 1.3rem;
  display: flex; align-items: center; justify-content: center;
  color: var(--gray-text); margin: 12px 12px 0 0; z-index: 1;
}

/* Usado en JS modal para mostrar la categoría */
.product-card-cat {
  font-size: .7rem; color: var(--orange); font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px;
}

/* ================================================================
   POPUP DINÁMICO
================================================================ */
.popup-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.65); z-index: 9999;
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity .3s;
}
@media (min-width: 640px) { .popup-overlay { align-items: center; } }
.popup-overlay.active { opacity: 1; pointer-events: all; }

.popup-box {
  background: #fff; border-radius: 16px 16px 0 0; max-width: 520px; width: 100%;
  overflow: hidden; box-shadow: var(--shadow-lg);
  transform: translateY(40px); transition: transform .3s;
}
@media (min-width: 640px) { .popup-box { border-radius: var(--radius-lg); transform: scale(.92); } }
.popup-overlay.active .popup-box { transform: none; }
.popup-close {
  position: absolute; top: 10px; right: 14px;
  background: rgba(0,0,0,.08); border: none; border-radius: 50%;
  width: 30px; height: 30px; font-size: 1.2rem;
  display: flex; align-items: center; justify-content: center;
  color: var(--gray-text); z-index: 1;
}
.popup-img {
  width: 100%;
  max-height: 300px;
  object-fit: contain;
  background: #f8fafc;
  display: block;
}
.popup-body { padding: 22px 20px; }
.popup-body h3 { color: var(--navy); margin-bottom: 8px; font-weight: 700; }
.popup-body p  { color: var(--gray-text); margin-bottom: 18px; font-size: .9rem; }

/* ================================================================
   WHATSAPP FLOTANTE
================================================================ */
.whatsapp-float { position: fixed; bottom: 20px; right: 16px; z-index: 999; }
@media (min-width: 640px) { .whatsapp-float { bottom: 28px; right: 24px; } }
.whatsapp-float a {
  width: 56px; height: 56px; background: #25d366; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 20px rgba(37,211,102,.5);
  transition: transform .3s; animation: wapulse 2.5s infinite;
}
.whatsapp-float a:hover { transform: scale(1.1); }
.whatsapp-float svg { width: 30px; height: 30px; fill: #fff; }
@keyframes wapulse {
  0%,100% { box-shadow: 0 4px 20px rgba(37,211,102,.5); }
  50%      { box-shadow: 0 4px 44px rgba(37,211,102,.82); }
}

/* ================================================================
   LOADING / ALERTAS — usados por JS
================================================================ */
.loading {
  display: inline-block; width: 20px; height: 20px;
  border: 3px solid rgba(255,255,255,.3); border-top-color: #fff;
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.alert {
  padding: 13px 18px; border-radius: var(--radius); font-size: .875rem;
  margin-bottom: 18px; display: flex; align-items: flex-start; gap: 10px;
}
.alert-success { background: #d4edda; color: #155724; border-left: 4px solid var(--success); }
.alert-danger  { background: #f8d7da; color: #721c24; border-left: 4px solid var(--danger); }
.alert-info    { background: #d1ecf1; color: #0c5460; border-left: 4px solid #17a2b8; }

/* ================================================================
   FILTROS CATÁLOGO — JS-toggled .active
================================================================ */
.filter-btn {
  padding: 7px 16px; border-radius: 50px; border: 2px solid var(--gray-light);
  background: #fff; color: var(--gray-text); font-weight: 500;
  cursor: pointer; transition: var(--tr); font-size: .82rem; touch-action: manipulation;
}
.filter-btn:hover, .filter-btn.active {
  border-color: var(--orange); background: var(--orange); color: #fff;
}

/* ================================================================
   CATÁLOGO — sidebar y mobile cats scroll
================================================================ */
.catalog-mobile-cats {
  display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px;
  margin-bottom: 20px; scrollbar-width: none; -ms-overflow-style: none;
}
.catalog-mobile-cats::-webkit-scrollbar { display: none; }
.catalog-mobile-cats a {
  flex-shrink: 0; padding: 7px 14px; border-radius: 50px;
  background: var(--gray-bg); color: var(--gray-text); font-size: .82rem; font-weight: 500;
  white-space: nowrap; border: 2px solid transparent; transition: var(--tr);
}
.catalog-mobile-cats a.active { background: var(--orange); color: #fff; border-color: var(--orange); }
@media (min-width: 768px) { .catalog-mobile-cats { display: none; } }

.catalog-layout { display: block; }
.catalog-sidebar { display: none; }
@media (min-width: 768px) {
  .catalog-layout { display: flex; gap: 32px; align-items: flex-start; }
  .catalog-sidebar {
    display: block; width: 220px; flex-shrink: 0;
    position: sticky; top: calc(var(--nav-h) + 16px);
  }
}

/* ================================================================
   FORMULARIOS — input/select/textarea
================================================================ */
.form-group  { margin-bottom: 16px; }
.form-label  { display: block; font-weight: 600; font-size: .875rem; color: var(--navy); margin-bottom: 5px; }
.form-control {
  width: 100%; padding: 12px 14px;
  border: 2px solid var(--gray-light); border-radius: var(--radius);
  font-size: .9rem; transition: var(--tr); background: #fff; color: var(--dark-text);
}
.form-control:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px rgba(230,126,34,.12); }
textarea.form-control { resize: vertical; min-height: 120px; }
.form-row { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 480px) { .form-row { grid-template-columns: 1fr 1fr; } }

/* ================================================================
   UTILIDADES VARIAS
================================================================ */
.text-center { text-align: center; }

/* ── BREADCRUMB ── */
.breadcrumb { background: var(--gray-bg); padding: 12px 0; margin-top: var(--nav-h); }
.breadcrumb-inner {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  font-size: .8rem; color: var(--gray-text);
}
.breadcrumb-inner a { color: var(--orange); }

/* ── ANIMACIONES ── */
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }
@keyframes fadeUp  { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* Prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
