@import "base.css";
@import "header.css";
@import "componentes.css";
@import "catalog.css";
@import "footer.css";

/* Estilos propios de la página principal */
body {
    margin: 0;
    font-family: "Inter", Arial, Helvetica, sans-serif;
}

/* ==========================================================================
   SISTEMA DE RESPONSIVIDAD INTEGRAL (COMPUTADOR, TABLET Y MÓVIL)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. REGULACIÓN GLOBAL Y CONTENEDOR BASE
   -------------------------------------------------------------------------- */
html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden !important;
}

img, canvas, svg, video {
  max-width: 100%;
  height: auto;
}

/* Ajuste progresivo del ancho del contenedor */
@media (max-width: 1200px) {
  .container {
    width: min(var(--container, 1320px), calc(100% - 48px));
  }
}

@media (max-width: 768px) {
  .container {
    width: min(var(--container, 1320px), calc(100% - 32px));
  }
}

/* --------------------------------------------------------------------------
   2. TOP BAR Y HEADER / NAVBAR
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .top-bar-inner {
    gap: 24px;
    font-size: 13px;
  }
  
  .navbar {
    min-height: 70px;
    gap: 20px;
  }

  .navbar-search {
    max-width: 200px;
  }
}

@media (max-width: 768px) {
  .top-bar {
    padding: 6px 0;
  }

  .top-bar-inner {
    flex-wrap: wrap;
    gap: 10px 20px;
    justify-content: center;
    font-size: 12px;
  }

  .site-header {
    position: sticky;
    top: 0;
  }

  .navbar {
    min-height: 64px;
  }

  .brand-name {
    font-size: 20px;
  }

  .brand-icon {
    width: 36px;
    height: 36px;
    font-size: 15px;
  }

  .navbar-right {
    gap: 8px;
  }

  .navbar-search {
    display: none; /* Se oculta la barra fija para evitar saturación en móviles */
  }
}

@media (max-width: 480px) {
  .top-bar-item:nth-child(2) {
    display: none; /* Oculta ítems secundarios en pantallas muy pequeñas */
  }
}

/* --------------------------------------------------------------------------
   3. SECCIÓN HERO Y ELEMENTOS FLOTANTES
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .hero-container {
    grid-template-columns: 1fr;
    padding: 36px 0 50px;
    gap: 30px;
    text-align: center;
  }

  .hero-copy {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .hero-kicker {
    justify-content: center;
  }

  .hero-copy h1 {
    font-size: clamp(40px, 7.5vw, 75px);
  }

  .hero-lead {
    margin-left: auto;
    margin-right: auto;
  }

  .hero-buttons {
    justify-content: center;
  }

  .hero-trust {
    justify-content: center;
  }

  .hero-giant-text {
    font-size: clamp(80px, 18vw, 180px);
    left: 50% !important;
    transform: translateX(-50%);
  }

  .hero-giant-top {
    top: 20px;
  }

  .hero-giant-bottom {
    bottom: 20px;
  }

  /* Ajuste del área del teclado 3D flotante */
  .hero-product-area {
    min-height: 480px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .keyboard-floating {
    width: min(600px, 85vw);
  }
}

@media (max-width: 768px) {
  .hero {
    min-height: auto;
  }

  .hero-container {
    padding: 28px 0 40px;
  }

  .hero-buttons {
    width: 100%;
    flex-direction: column;
  }

  .hero-buttons .btn {
    width: 100%;
  }

  .hero-trust {
    flex-direction: column;
    gap: 14px;
    align-items: center;
  }

  .trust-divider {
    width: 40px;
    height: 1px;
  }

  .hero-product-area {
    min-height: 380px;
  }

  .hero-ring-large {
    width: 360px;
    height: 360px;
  }

  .hero-ring-small {
    width: 270px;
    height: 270px;
  }

  .hero-platform {
    width: 340px;
    height: 110px;
  }

  .keyboard-floating {
    width: 90%;
    max-width: 420px;
  }

  /* Reposicionamiento seguro para etiquetas flotantes sin desbordar la pantalla */
  .floating-label {
    display: none;
  }

  .floating-badge {
    bottom: 5% !important;
    right: 2% !important;
    left: auto !important;
    padding: 8px 12px;
  }
}

@media (max-width: 480px) {
  .hero-copy h1 {
    font-size: clamp(32px, 9vw, 44px);
  }

  .hero-lead {
    font-size: 14px;
  }

  .hero-product-area {
    min-height: 300px;
  }

  .hero-ring-large {
    width: 280px;
    height: 280px;
  }

  .hero-ring-small {
    width: 210px;
    height: 210px;
  }

  .keyboard-floating {
    max-width: 310px;
  }
}

/* --------------------------------------------------------------------------
   4. CATÁLOGO DE PRODUCTOS Y COMPONENTES
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .catalog-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 20px;
  }

  .catalog-card-large {
    grid-column: span 2;
  }
}

@media (max-width: 640px) {
  .category-quick-nav {
    gap: 1rem;
    justify-content: flex-start;
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .quick-nav-item {
    min-width: 72px;
    font-size: 0.78rem;
  }

  .quick-nav-icon {
    width: 56px;
    height: 56px;
    font-size: 1.25rem;
  }

  .catalog-grid {
    grid-template-columns: 1fr !important;
  }

  .catalog-card-large {
    grid-column: span 1;
    min-height: 300px;
  }

  .catalog-card {
    min-height: 220px;
  }
}

/* --------------------------------------------------------------------------
   5. CONFIGURADOR / EDITOR INTERACTIVO DE TECLADOS
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
  body.configurator-page {
    overflow-y: auto !important;
  }

  .configurator {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: calc(100vh - 60px);
  }

  .viewer-panel {
    height: 45vh;
    min-height: 320px;
    width: 100%;
    position: relative;
  }

  .config-panel {
    width: 100%;
    min-height: auto;
    border-left: 0;
    border-top: 1px solid var(--cfg-border, rgba(255, 255, 255, 0.09));
  }

  .config-header {
    height: 60px;
    padding: 0 16px;
    grid-template-columns: 1fr auto;
  }

  .config-header-center {
    display: none;
  }

  .config-footer {
    position: sticky;
    bottom: 0;
    z-index: 100;
  }
}

@media (max-width: 550px) {
  .step-options {
    grid-template-columns: 1fr !important;
  }

  .price-summary small {
    display: none;
  }

  .footer-actions {
    gap: 8px;
  }

  .btn-back, .btn-next {
    padding: 10px 14px;
    font-size: 13px;
  }
}

/* --------------------------------------------------------------------------
   6. CARRITO Y DESPLEGABLES (DRAWER Y TOAST)
   -------------------------------------------------------------------------- */
@media (max-width: 500px) {
  .cart-drawer {
    width: 100% !important;
    max-width: 100% !important;
  }

  .toast {
    width: calc(100% - 32px);
    left: 16px !important;
    transform: translateY(20px);
  }

  .toast.show {
    transform: translateY(0);
  }
}

/* --------------------------------------------------------------------------
   7. PIE DE PÁGINA (FOOTER)
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .footer-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    padding: 40px 0 30px;
  }

  .footer-brand {
    grid-column: span 3;
    margin-bottom: 10px;
  }

  .footer-brand p {
    max-width: 100%;
  }
}

@media (max-width: 640px) {
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .footer-brand {
    grid-column: span 1;
  }

  .footer-bottom {
    flex-direction: column;
    justify-content: center;
    text-align: center;
    padding: 20px 0;
    gap: 10px;
  }
}