/* ============================================================
   1. TU CÓDIGO BASE (INTACTO)
   ============================================================ */

body {
  margin: 0;
  font-family: Arial, sans-serif;
}

#sidebar-panel {
  position: fixed;
  left: 0;
  top: 0;
  height: 100vh;
  width: 70px;
  background: #3B59F7;
  color: white;
  z-index: 1000;
  overflow: hidden;
  transition: transform 0.4s cubic-bezier(.4,0,.2,1);
  box-shadow: 2px 0 10px rgba(0,0,0,0.05);
  padding: 0;
}

#sidebar-panel.active {
  width: 220px;
  transform: translateX(0);
  padding-top: 40px;
}

.sidebar-marca {
  opacity: 0;
  pointer-events: none;
  transition:  opacity 0.s;
  padding: 40px 0 0 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  overflow: hidden;
}

#sidebar-panel.active .sidebar-marca {
  opacity: 1;
  pointer-events: auto;
  transition-delay: 0.1s;
}

.sidebar-marca ul {
  list-style: none;
  padding: 0;
  margin: 0;
  width: 100%;
}

.sidebar-marca li {
  margin: 8px 10px;
  width: auto;;
  border-radius: 15px;
  transition: all 0.3s ease;
  border: 1px solid transparent;
}

.sidebar-marca a {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  padding: 12px 10px;
  display: flex;
  align-items: center;
  width: 100%;
  font-family: "Segoe UI", 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-weight: 500;
  letter-spacing: 0.5px;
  font-size: 16px;
  transition: color 0.3s;
  white-space: nowrap;
  justify-content: flex-start;
}

.sidebar-marca li:not(.active):hover a {
    color: #ffffff;
}

.sidebar-marca li:not(.active):hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: translateX(6px);
    border: 1px solid rgba(255,255,255,0.2);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.sidebar-marca li.active {
  background-color: #ffffff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transform: scale(1.02);
}

.sidebar-marca li.active a {
    color: #3B59F7;
    font-weight: 700;
}

#menu-toggle {
  position: fixed;
  left: 13px;
  top: 20px;
  width: 38px;
  height: 38px;
  font-size: 26px;
  background: #3B59F7;
  color: white;
  border: none;
  z-index: 1101;
  cursor: pointer;
  border-radius: 8px;
  display: block;
}

#sidebar-panel.active .close-btn {
  display: block;
}

main {
  margin-left: 65px;
  padding: 20px;
}

@media (max-width: 768px) {
  main {
    margin-left: 0;
  }
}

#config-container {
  position: fixed;
  bottom: 20px;
  left: 13px; 
  z-index: 1102;
}

.config-link {
  display: flex;
  align-items: center;
  height: 50px;
  width: 50px; 
  background-color: white;
  border-radius: 25px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  text-decoration: none;
  overflow: hidden;
  transition: width 0s cubic-bezier(.4,0,.2,1), background-color 0.2s, transform 0.2s;
}

#sidebar-panel.active ~ #config-container .config-link {
  width: 160px;
}

#sidebar-panel.active ~ #config-container .config-link h1 {
  opacity: 1;
}

.config-link:hover {
  background-color: #eef2ff;
  transform: scale(1.1);    
  box-shadow: 0 6px 15px rgba(59, 89, 247, 0.4); 
}

.ia-icon {
  width: 30px;
  height: 30px;
  object-fit: contain;
  margin-left: 10px;
  flex-shrink: 0;
  filter: drop-shadow(0 0 1px black);
}

.config-link h1 {
  font-family: Arial, sans-serif;
  font-size: 16px;
  color: #333;
  margin: 0 0 0 10px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.3s ease 0.1s;
}

#sidebar-panel.active ~ #config-container {
  left: 30px;
}

#sidebar-panel.active {
  width: 220px;
  transform: translateX(0);
  padding-top: 40px;
  box-shadow: 5px 0 15px rgba(0, 0, 0, 0.1);
}

#top-navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 50px;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  z-index: 999;
}

.brand-name {
  font-family: "poppins", sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: #3B59F7;
  letter-spacing: 0.5px;
  margin-left: 90px;
  padding-top: 20px;
}

.brand-name.movido {
  margin-left: 240px;
}

/* ============================================================
   2. NUEVOS ESTILOS PRO (NETWORLD SHOP)
   Estos estilos se suman a los anteriores para el diseño
   ============================================================ */

/* Ajustes generales adicionales (sin borrar los tuyos) */
body {
    background-color: #f4f7fe; /* Fondo profesional */
    padding-top: 70px; /* Espacio para navbar */
    padding-left: 80px; /* Espacio para sidebar cerrado */
    padding-right: 20px;
    padding-bottom: 100px;
    transition: padding-left 0.4s ease;
}

body.sidebar-open {
    padding-left: 230px;
}

/* --- BARRA DE BÚSQUEDA (NAVBAR) --- */
.search-container {
    /* Quitamos flex-grow: 1 para que no ocupe todo el centro */
    display: flex;
    justify-content: flex-end;
    align-items: center;
    
    /* EL TRUCO: margin-left: auto empuja el elemento todo a la derecha */
    margin-left: auto; 
    
    /* Espacio de separación desde el borde derecho de la pantalla */
    margin-right: 30px; 
    
    max-width: 350px; /* Ajustamos el ancho para que se vea estético */
    position: relative;
    width: 100%;
}

.search-input {
    width: 100%;
    padding: 10px 45px 10px 20px;
    border-radius: 25px;
    border: 2px solid #eef2ff;
    background: #f8faff;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    transition: all 0.3s ease;
    outline: none;
}

.search-input:focus {
    border-color: #3B59F7;
    background: #fff;
    box-shadow: 0 4px 15px rgba(59, 89, 247, 0.1);
}

.search-btn {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    color: #3B59F7;
    cursor: pointer;
    padding: 5px;
}

/* --- SECCIONES Y TÍTULOS --- */
.section-title {
    font-family: 'Poppins', sans-serif;
    font-size: 28px;
    color: #1a1a2e;
    margin-bottom: 30px;
    border-left: 5px solid #3B59F7;
    padding-left: 15px;
}

.category-section {
    margin-bottom: 50px;
}

.category-title {
    font-family: 'Poppins', sans-serif;
    font-size: 20px;
    color: #4a4a6a;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.category-icon {
    color: #3B59F7;
}

/* --- GRID DE PRODUCTOS --- */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
}

/* --- CARDS DE PRODUCTOS --- */
.product-card {
    background: #ffffff;
    border-radius: 20px;
    padding: 25px;
    position: relative;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    border: 1px solid rgba(0,0,0,0.04);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 30px rgba(59, 89, 247, 0.15);
    border-color: #3B59F7;
}

.product-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: linear-gradient(135deg, #3B59F7, #2a43c2);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 10px rgba(59, 89, 247, 0.3);
}

.product-platforms {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    height: 40px;
    align-items: center;
}

.platform-logo {
    width: 30px;
    height: 30px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
    transition: transform 0.2s;
}

.platform-logo.single {
    width: 45px;
    height: 45px;
}

.product-card:hover .platform-logo {
    transform: scale(1.1);
}

.product-card h4 {
    font-family: 'Poppins', sans-serif;
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 10px 0;
    color: #1a1a2e;
}

.product-description {
    font-size: 13px;
    color: #6e6e85;
    line-height: 1.5;
    margin-bottom: 20px;
    flex-grow: 1;
}

.product-price {
    font-family: 'Poppins', sans-serif;
    font-size: 24px;
    font-weight: 700;
    color: #3B59F7;
    margin: 0 0 15px 0;
}

/* Botón Agregar al Carrito */
.btn-add-cart {
    width: 100%;
    padding: 12px;
    background-color: #f0f3ff;
    color: #3B59F7;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-add-cart:hover {
    background-color: #3B59F7;
    color: white;
    box-shadow: 0 5px 15px rgba(59, 89, 247, 0.3);
}

/* --- CARRITO DE COMPRAS (PANEL) --- */
.cart-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 380px;
    height: 100vh;
    background: white;
    z-index: 2000;
    box-shadow: -5px 0 30px rgba(0,0,0,0.1);
    transform: translateX(105%);
    transition: transform 0.4s cubic-bezier(0.77, 0, 0.175, 1);
    display: flex;
    flex-direction: column;
}

.cart-panel.open {
    transform: translateX(0);
}

.cart-header {
    padding: 20px;
    background: #3B59F7;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-header h3 {
    margin: 0;
    font-family: 'Poppins', sans-serif;
}

.close-cart-btn {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
}

.cart-items {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.cart-item-info h5 {
    margin: 0 0 5px 0;
    font-size: 14px;
    color: #333;
}

.cart-item-info p {
    margin: 0;
    font-size: 13px;
    color: #666;
}

.remove-item-btn {
    color: #ff4757;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
}

.cart-footer {
    padding: 25px;
    background: #f9f9f9;
    border-top: 1px solid #eee;
}

.cart-total {
    display: flex;
    justify-content: space-between;
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 20px;
    color: #1a1a2e;
}

.checkout-btn {
    width: 100%;
    padding: 15px;
    background: #25D366; /* WhatsApp */
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.checkout-btn:hover {
    background: #128C7E;
    box-shadow: 0 5px 15px rgba(37, 211, 102, 0.3);
}

/* --- BOTÓN FLOTANTE CARRITO --- */
#cart-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1100;
}

.cart-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #3B59F7;
    color: white;
    border: none;
    box-shadow: 0 4px 20px rgba(59, 89, 247, 0.4);
    font-size: 24px;
    cursor: pointer;
    position: relative;
    transition: transform 0.2s;
}

.cart-button:hover {
    transform: scale(1.1);
}

#cart-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4757;
    color: white;
    font-size: 12px;
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 50%;
    border: 2px solid white;
}

/* =========================================
   CORRECCIÓN PARA VER BUSCADOR EN MÓVIL
   ========================================= */

@media (max-width: 768px) {
    
    /* 1. Hacemos visible el buscador de nuevo */
    .search-container {
        display: flex !important; /* Forzamos que se vea */
        margin-right: 10px;
        max-width: 160px;
    }

    /* 2. Achicamos un poco el input para que se vea bien */
    .search-input {
        padding: 8px 30px 8px 15px; /* Menos relleno */
        font-size: 12px; /* Letra un poco más chica */
    }

    /* 3. Ajustamos el título (Networld) para que no choque */
    .brand-name {
        font-size: 18px; /* Logo un poco más pequeño */
        margin-left: 60px; /* Ajuste para el botón de menú */
    }
    
    /* En móvil el buscador se ve mejor centrado o pegado a la derecha */
    .brand-name.movido {
         margin-left: 60px; /* Evitamos que el JS empuje el logo fuera de pantalla */
    }
}

/* --- CORRECCIONES RESPONSIVE (MÓVIL Y TABLET) --- */

@media screen and (max-width: 1024px) {
    
    /* 1. Quitar márgenes izquierdos que empujan el contenido */
    body, 
    #top-navbar, 
    section, 
    .products-grid {
        margin-left: 0 !important;
        padding-left: 1rem !important; /* Pequeño espacio para que no pegue al borde */
        padding-right: 1rem !important;
        width: 100% !important;
        box-sizing: border-box; /* Asegura que el padding no rompa el ancho */
    }

    /* 2. Ajustar el Navbar superior */
    #top-navbar {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px 1rem !important;
    }

    /* 3. Asegurar que las tarjetas de productos se centren */
    .products-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); /* Adaptable */
        gap: 20px;
        justify-content: center;
    }

    /* 4. Esconder el sidebar por defecto en móvil (si no lo estaba) */
    #sidebar-panel {
        transform: translateX(-100%); /* Oculto a la izquierda */
        /* Aseguramos que sea flotante y no empuje contenido */
        position: fixed; 
        z-index: 1000;
        top: 0;
        left: 0;
        height: 100vh;
        width: 250px; /* Ancho del menú */
    }

    /* Cuando se activa el menú en móvil */
    #sidebar-panel.active {
        transform: translateX(0);
    }
}


/* --- ESTILOS DEL SELECTOR DE CANTIDAD --- */
.quantity-controls {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 5px;
}

.qty-btn {
    background: #e2e8f0;
    border: none;
    color: #333;
    width: 25px;
    height: 25px;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qty-btn:hover {
    background: #cbd5e1;
}

.qty-input {
    width: 40px;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 2px;
    font-size: 14px;
    /* Quitar flechas del input number por defecto */
    -moz-appearance: textfield;
}

.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.item-subtotal {
    font-size: 0.85rem;
    color: #2563eb; /* Azul para resaltar el precio */
    font-weight: 600;
    margin-top: 4px;
}