/* --- Estilos Globales y Reset version  7--- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Montserrat", sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f4f4f4;
}

.top-bar {
    background-color: #1a1a1a; /* Dark sleek background */
    color: #ffffff;
    padding: 8px 0;
    font-size: 0.85rem;
    font-family: Arial, sans-serif;
}

.top-bar-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
}

.top-bar i {
    margin-right: 5px;
    color: #ff0000; /* Red accent for icons to match many alarm logos */
}

.top-bar .ext {
    margin-left: 10px;
    color: #ccc;
}

.top-bar a {
    color: #ffffff;
    text-decoration: none;
    transition: color 0.3s;
}

.top-bar a:hover {
    color: #ff0000;
}

/* --- Header --- */
.main-header {
    position: relative;
    top: 0;
    left: 0;
    width: 100%;
    background: #fff;
    border-bottom: 1px solid #eee;
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: transform 0.5s ease, opacity 0.5s ease;
}

.main-header.hide {
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
}

.main-header.show {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.main-nav {
    display: flex;
    gap: 30px;
}

.main-nav a {
    font-size: 15px;
    text-decoration: none;
    text-align: center;
    color: #333;
    font-weight: 500;
    transition: color 0.3s;
    margin: 0;
    border-bottom: 1px solid #33333312;
}

.main-nav a:hover {
    color: #fb4041;
}

.header-icons {
    display: flex;
    gap: 15px;
    align-items: center;
}

.search-icon,
.menu-toggle {
    font-size: 1.5rem;
    cursor: pointer;
}

.menu-toggle {
    display: none;
}

/* --- Contenido Principal (padding para el header fijo) --- */
main, .product-detail-container, .container-form, .video-slider-section {
    padding-top: 80px; /* Ajuste para el header fijo */
    box-sizing: border-box;
}

/* --- Estilos Específicos para el Panel de Administración --- */
.admin-container {
    max-width: 1200px;
    margin: 100px auto 40px auto; /* Ajuste el margen superior para el header fijo */
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

.admin-container h1 {
    font-size: 2.2em;
    text-align: center;
    color: #333;
    margin-bottom: 25px;
}

.admin-container h2 {
    font-size: 1.8em;
    color: #333;
    margin-top: 30px;
    margin-bottom: 20px;
}

.product-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #555;
}

.product-form input[type="text"],
.product-form textarea,
.product-form input[type="file"] {
    width: 100%; /* Ajustado a 100% para evitar problemas con calc() */
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box; /* Asegura que padding y border no aumenten el width */
    font-size: 1em;
}
.product-form input[type="file"] {
    padding: 8px; /* Menos padding para inputs file */
}

/* Ajustes específicos para textareas */
textarea#description,
textarea#specifications {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 1em;
    resize: vertical; /* Permite redimensionar verticalmente */
}

.product-form button {
    background-color: #4CAF50; /* Verde para guardar/agregar */
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    margin-right: 10px;
    transition: background-color 0.3s ease;
}
.product-form button:hover {
    background-color: #45a049;
}

.product-form #cancel-edit-button {
    background-color: #f44336; /* Rojo para cancelar */
    display: none; /* Oculto por defecto */
}
.product-form #cancel-edit-button:hover {
    background-color: #da190b;
}

#image-preview-text {
    font-size: 0.9em;
    color: #666;
    margin-top: -10px;
    margin-bottom: 15px;
    display: block;
}

.product-list-container {
    margin-top: 40px;
}
.product-list-container table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}
.product-list-container th, .product-list-container td {
    border: 1px solid #ddd;
    padding: 10px; /* Un poco más de padding para mejor legibilidad */
    text-align: left;
    vertical-align: top; /* Alinea contenido en la parte superior, útil para descripciones largas */
}
.product-list-container th {
    background-color: #f2f2f2;
    font-weight: bold;
    color: #333;
}
.product-list-container .edit {
    background-color: #2196F3; /* Azul para editar */
    margin-right: 8px;
}
.product-list-container .edit:hover {
    background-color: #0b7dda;
}
.product-list-container .delete {
    background-color: #f44336; /* Rojo para borrar */
}
.product-list-container .delete:hover {
    background-color: #da190b;
}
.product-list-container .edit, .product-list-container .delete {
    color: white;
    padding: 8px 12px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background-color 0.3s ease;
}
.product-list-container img {
    vertical-align: middle;
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
}

/* --- SECCIONES GENERALES DEL SITIO (HOME, DETALLE, ETC.) --- */
.video-slider-section {
    position: relative;
    max-width: 1400px;
    margin: 0;
    padding: 20px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    text-align: center;
    overflow: hidden;
}

.video-slider-section h2 { /* Duplicado, verificar si es el mismo que .admin-container h2 */
    margin-bottom: 25px;
    color: #333;
    font-size: 2em;
}

.video-slider-container {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: 5px;
    touch-action: pan-y;
}

.video-slider-wrapper {
    display: flex;
    transition: transform 0.5s ease-in-out;
    touch-action: pan-y;
}

.video-slide {
    min-width: 100%;
    box-sizing: border-box;
    flex-shrink: 0;
    padding: 10px;
    position: relative;
}

.video-slide iframe {
    width: 100%;
    aspect-ratio: 16 / 9;
    display: block;
    border: none;
    border-radius: 5px;
}

.slider-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    padding: 10px 15px;
    cursor: pointer;
    font-size: 1.5em;
    z-index: 10;
    border-radius: 5px;
    transition: background-color 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}

.slider-arrow:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

.slider-arrow:disabled {
    background-color: rgba(0, 0, 0, 0.2);
    cursor: not-allowed;
}

.prev-video {
    left: 10px;
}

.next-video {
    right: 10px;
}

.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    cursor: grab;
    background: transparent;
}

.video-slider-container.dragging .video-overlay {
    cursor: grabbing;
}

.video-slider-dots {
    display: flex;
    justify-content: center;
    margin-top: 20px;
}

.video-dot {
    height: 10px;
    width: 10px;
    margin: 0 5px;
    background-color: #bbbbbb00;
    border-radius: 50%;
    display: inline-block;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.video-dot.active {
    background-color: #007bff00;
}

.title-important {
    margin: 0;
    font-size: 18px;
    line-height: 100px;
    text-align: center;
}

/* === Estructura principal === */
.catalog-container {
  display: flex;
  gap: 25px;
  padding: 20px;
  max-width: 1400px;
  margin: 0 auto;
}

/* === Botón del filtro móvil === */
.filter-toggle {
  display: none;
  background: #fb4041;
  color: #fff;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  margin-bottom: 15px;
}

.filter-toggle:hover {
  background: #0056b3;
}

.filter-sidebar {
  flex: 0 0 260px;
  background: #f8f8f8;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  height: fit-content;
  position: sticky;
  top: 20px;
}

.filter-title {
  font-size: 1.3rem;
  margin-bottom: 15px;
  color: #222;
  font-weight: 600;
}

.filter-list,
.filter-sublist {
  list-style: none;
  margin: 0;
  padding: 0;
}

.filter-list > li {
  margin-bottom: 12px;
}

/* Enlaces principales (marca) */
.filter-link {
  display: block;
  text-decoration: none;
  color: #333;
  background: #fff;
  border: 1px solid #ddd;
  padding: 8px 12px;
  border-radius: 8px;
  transition: all 0.2s ease;
  font-size: 0.95rem;
}

.filter-link:hover {
  background: #fb4041;
  color: #fff;
  border-color: #fb4041;
}

.filter-link.active {
  background: #007bff;
  color: #fff;
  border-color: #007bff;
}

/* Subcategorías */
.filter-sublist {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.3s ease;
  opacity: 0;
}

.filter-sublist.active {
  max-height: 800px; /* suficiente espacio para desplegar todas las categorías */
  opacity: 1;
}

.filter-sublist li {
  margin-bottom: 6px;
}

.filter-sublist .filter-link {
  font-size: 0.9rem;
}

.products-container {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.products-grid {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(auto-fit, minmax(115px, 1fr));
    gap: 20px;
}

.product-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  padding: 15px;
  text-align: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.product-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
}

.product-card a {
    text-decoration: none;
    color: #020202;
    display: block;
}

.product-card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 10px;
}

.product-card h3 {
    font-size: 14px;
    margin-bottom: 8px;
    color: #333;
}

.product-card p {
    font-size: 0.9em;
    color: #555;
    margin-bottom: 5px;
}

.product-card .price {
    font-weight: bold;
    color: #007bff;
    font-size: 1.1em;
}

.pagination {
    display: flex;
    justify-content: center;
    margin-top: 30px;
    gap: 10px;
}

.pagination button {
    background-color: #fb4041;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s ease;
}

.pagination button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

.product-detail-container {
    display: flex;
    flex-direction: column;
    max-width: 1000px;
    margin: 0 auto 40px auto;
    padding: 20px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.product-image-column {
    flex: 1;
    padding: 15px;
    text-align: center;
}

.product-image-column img {
    max-width: 100%;
    height: auto;
    max-height: 400px;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.thumbnail-container {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.thumbnail-image {
    width: 80px;
    height: auto;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.3s ease;
    border-radius: 4px;
    object-fit: cover;
}

.thumbnail-image:hover {
    border-color: #333;
}

.thumbnail-image.active {
    border-color: #007bff;
}

.product-info-column {
    flex: 1;
    padding: 15px;
}

.product-info-column h1 {
    font-size: 2em;
    color: #333;
    margin-bottom: 15px;
}

.product-info-column .product-sku {
    font-size: 1.2em;
    color: #666;
    margin-bottom: 20px;
    font-weight: bold;
}

.product-info-column .product-description-label {
    font-size: 1.1em;
    color: #444;
    margin-top: 15px;
    margin-bottom: 5px;
    font-weight: bold;
}

.product-info-column pre {
    background-color: #f8f8f8;
    border: 1px solid #eee;
    padding: 15px;
    border-radius: 5px;
    white-space: pre-wrap;
    font-family: inherit;
    font-size: 1em;
    color: #333;
    line-height: 1.6;
    overflow-x: auto;
}

.video-label {
    font-weight: bold;
    margin-top: 20px;
    margin-bottom: 5px;
    color: #333;
    font-size: 1.1em;
}

.video-wrapper {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    background-color: #000;
    border-radius: 5px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

#video-container video {
    width: 100%;
    height: auto;
    border: 1px solid #ddd;
    border-radius: 5px;
    display: block;
}

.container-form { /* Estos estilos pueden ser para otro formulario, no el admin directamente */
    background-color: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    width: 90%;
    margin: 0 auto;
}

h2 { /* Este H2 global puede ser anulado por .admin-container h2 o .video-slider-section h2 */
    text-align: center;
    color: #333;
    margin-bottom: 25px;
    font-size: 1.8em;
}

.form-group {
    margin-bottom: 30px;
}

label { /* Este label global puede ser anulado por .product-form label */
    display: block;
    margin-bottom: 6px;
    color: #555;
    font-weight: 500;
    font-size: 15px;
}

input[type="text"],
input[type="number"],
input[type="email"],
select { /* Estos inputs globales pueden ser anulados por .product-form input */
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 1em;
    transition: border-color 0.3s ease;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="email"]:focus,
select:focus {
    border-color: #007bff;
    outline: none;
}

.radio-group,
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.radio-item,
.checkbox-item {
    display: flex;
    align-items: center;
}

.radio-item input[type="radio"],
.checkbox-item input[type="checkbox"] {
    margin-right: 8px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.radio-item label,
.checkbox-item label {
    font-weight: normal;
    display: inline-block;
    margin-bottom: 0;
    color: #333;
    cursor: pointer;
}

.button-group {
    text-align: center;
    margin-top: 30px;
}

button { /* Este botón global puede ser anulado por .product-form button */
    background-color: #fe0000;
    color: white;
    padding: 9px 13px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

button:hover {
    background-color: #0056b3;
}

button:active {
    transform: translateY(0);
}

.whatsapp-button {
    position: fixed;
    width: 60px;
    height: 60px;
    bottom: 40px;
    right: 40px;
    background-color: #25d366;
    color: #FFF;
    border-radius: 50px;
    text-align: center;
    font-size: 30px;
    box-shadow: 2px 2px 3px #999;
    z-index: 100;
}

.whatsapp-button img {
    width: 35px;
    height: 35px;
    margin-top: 12.5px;
}

.whatsapp-button:hover {
    background-color: #128C7E;
}

.btn-catalogo-admin {
    background: #fe0000;
    color: aliceblue;
    padding: 5px;
    border-radius: 50px;
    text-decoration: none;
}

.cta-section {
    text-align: center;
    padding: 40px 20px;
    background-color: #f0f0f0;
    border-radius: 10px;
    margin: 15% auto;
    max-width: 600px;
}

.cta-content h2 {
    color: #333;
    font-size: 2em;
    margin-bottom: 10px;
}

.cta-content p {
    color: #666;
    font-size: 1em;
    margin-bottom: 20%;
}

.cta-button {
    display: inline-block;
    background-color: #25d366;
    color: white;
    padding: 12px 24px;
    border-radius: 50px;
    text-decoration: none;
    font-size: 1em;
    font-weight: bold;
    transition: background-color 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.cta-button:hover {
    background-color: #128c7e;
}

.cta-button .bi {
    margin-right: 8px;
    font-size: 1.2em;
}

.main-footer {
    background-color: #1a1a1a; /* Matches the top bar */
    color: #ffffff;
    padding: 30px 20px;
    text-align: center;
    font-family: Arial, sans-serif;
    border-top: 3px solid #ff0000; /* Subtle red accent line */
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
}

.footer-info p {
    margin: 10px 0;
    font-size: 0.95rem;
    line-height: 1.6;
}

.footer-info a {
    color: #ffffff;
    text-decoration: none;
    font-weight: bold;
    transition: color 0.3s ease;
}

.footer-info a:hover {
    color: #ff0000;
}

.footer-address {
    color: #cccccc;
    font-size: 0.85rem;
}

.footer-address i {
    margin-right: 8px;
    color: #fff;
}

/* Botón WhatsApp Flotante */
.whatsapp-float {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: #25d366;
    color: #fff;
    padding: 12px 25px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    z-index: 1000;
    transition: 0.3s;
}
.whatsapp-float:hover {
    background-color: #128c7e;
    transform: translateY(-5px);
    color: #fff;
}

/* --- Media Queries --- */

/* === Responsive === */
@media (max-width: 900px) {
  .filter-toggle {
    display: block;
  }

  .catalog-container {
    flex-direction: column;
  }

  .filter-sidebar {
    position: fixed;
    top: 0;
    left: -100%;
    width: 80%;
    max-width: 300px;
    height: 100vh;
    background: #fff;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.2);
    padding: 20px;
    transition: left 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
  }

  .filter-sidebar.active {
    left: 0;
  }

  /* Fondo oscuro cuando el filtro está abierto */
  .filter-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 900;
    display: none;
  }

  .filter-overlay.active {
    display: block;
  }
}

@media (max-width: 767.98px) {

    .container-desktop {
    display: block!important;
    }

    .header-container {
        padding: 10px 20px;
    }

    .main-nav {
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: #fff;
        flex-direction: column;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease-in-out;
        border-bottom: 1px solid #eee;
        gap: 0;
    }

    .main-nav.show {
        max-height: 300px;
    }

    .search-icon {
        display: none;
    }

    .menu-toggle {
        display: block;
    }

    .products-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 15px;
    }

    .product-card img {
        max-width: 100%;
    }

    .product-detail-container {
        margin: 0 10px 20px 10px;
        padding: 15px;
    }

    .video-slider-section {
        margin: 15% 0;
        padding: 2px;
    }
    .video-slider-section h2 {
        font-size: 1.8em;
    }
    
    .container-form {
        width: 95%;
        padding: 20px;
        margin: 22% auto;
    }

    /* Estilos responsivos para la tabla de administración */
    .admin-container table,
    .admin-container thead,
    .admin-container tbody,
    .admin-container th,
    .admin-container td,
    .admin-container tr {
        display: block;
    }

    .admin-container thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    .admin-container tr {
        border: 1px solid #ddd;
        margin-bottom: 10px;
        border-radius: 8px;
        box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    }

    .admin-container td {
        border: none;
        border-bottom: 1px solid #eee;
        position: relative;
        text-align: justify;
        padding-top: 66px;
        padding-bottom: 12px;
    }
    
    .admin-container td:last-child {
        border-bottom: none;
    }

    .admin-container td:before {
        position: absolute;
        top: 10px;
        left: 6px;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        content: attr(data-label);
        font-weight: bold;
        text-align: left;
        color: #555;
    }
    
    /* Etiquetas data-label para celdas específicas */
    .admin-container td:nth-of-type(1):before { content: "Imagen"; }
    .admin-container td:nth-of-type(2):before { content: "SKU"; }
    .admin-container td:nth-of-type(3):before { content: "Título"; }
    .admin-container td:nth-of-type(4):before { content: "Descripción"; }
    .admin-container td:nth-of-type(5):before { content: "Especificaciones"; }
    .admin-container td:nth-of-type(6):before { content: "Acciones"; }

    .admin-container {
        width: 95%; /* Usar un ancho porcentual */
        margin: 100px auto 20px auto; /* Centrarlo y ajustar margen superior e inferior */
        padding: 15px; /* Reducir padding para pantallas pequeñas */
        box-shadow: none; /* Opcional: quitar sombra para un look más limpio en móvil */
    }

    /* Estilos específicos para los botones dentro de las celdas en móvil */
    .admin-container td:last-child {
        text-align: center;
        padding: 53px 10px;
    }

    .admin-container td:last-child button {
        margin: 5px;
        width: calc(50% - 10px);
        min-width: 100px;
        padding: 10px 0;
    }

    .admin-container td:nth-of-type(1) img {
        display: inline-block;
        margin-left: auto;
        margin-right: auto;
    }
}

@media (min-width: 768px) and (max-width: 991.98px) {
    .main-nav {
        gap: 20px;
    }

    .menu-toggle {
        display: none;
    }

    .products-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .product-detail-container {
        flex-direction: row;
        align-items: flex-start;
        margin: 0 auto 40px auto;
    }

    .product-image-column,
    .product-info-column {
        padding: 20px;
    }

    .container-form {
        width: 70%;
    }
    .admin-container {
        padding: 20px;
    }
}

@media (min-width: 992px) {
    .products-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .main-nav {
        max-height: none;
        overflow: visible;
        flex-direction: row;
        position: static;
        border-bottom: none;
    }
}



@media (max-width: 768px) {
    .top-bar-container {
        flex-direction: column;
        text-align: center;
        gap: 5px;
    }
}