/* Estilos responsivos para NauticHub - Mobile First */

/* Estructura principal flexible */
.nautichub-marketplace {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.nautichub-filters {
    width: 100%;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 8px;
    margin-bottom: 20px;
}

.nautichub-products {
    width: 100%;
}

/* Botón de filtros móvil y panel móvil */
.mobile-filter-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    background-color: #4d6d80;
    color: white;
    padding: 10px 15px;
    border-radius: 4px;
    margin-bottom: 15px;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.mobile-filter-toggle i {
    margin-right: 8px;
}

.filter-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.filter-overlay.active {
    opacity: 1;
}

.mobile-filter-panel {
    display: block; /* Cambiado de display:none a block */
    position: fixed;
    top: 0;
    left: -100%; /* Comienza fuera de la pantalla */
    width: 85%; /* Un poco más ancho */
    max-width: 350px;
    height: 100vh;
    background-color: white;
    z-index: 999;
    overflow-y: auto;
    transition: transform 0.3s ease; /* Cambiado de left a transform para mejor rendimiento */
    transform: translateX(-100%); /* Inicialmente transformado fuera de la pantalla */
    box-shadow: 2px 0 10px rgba(0,0,0,0.2);
    padding: 15px;
}

.mobile-filter-panel.active {
    left: 0; /* Asegúrate de que vuelve a la posición 0 */
    transform: translateX(0); /* Transformación a posición visible */
}
.filter-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.filter-panel-header h3 {
    margin: 0;
    font-size: 18px;
}

.close-filter-panel {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
}

.filter-panel-footer {
    position: sticky;
    bottom: 0;
    background-color: white;
    padding: 15px 0;
    border-top: 1px solid #eee;
    margin-top: 20px;
}

.apply-filters-btn {
    width: 100%;
    padding: 12px;
    background-color: #4d6d80;
    color: white;
    border: none;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
}

.apply-filters-btn:hover {
    background-color: #3a5a68;
}

.clear-filters-btn {
    width: 100%;
    padding: 10px;
    background-color: transparent;
    color: #4d6d80;
    border: 1px solid #4d6d80;
    border-radius: 4px;
    margin-top: 10px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
}

.clear-filters-btn:hover {
    background-color: #f0f0f0;
}

/* Mejorar los grupos de filtros para móvil */
.filter-group {
    margin-bottom: 20px;
}

.filter-group h4 {
    position: relative;
    padding: 12px 15px;
    margin: 0 0 10px 0;
    background-color: #f2f2f2;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.filter-group h4::after {
    content: "\f107";
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    transition: transform 0.3s;
}

.filter-group.collapsed h4::after {
    transform: rotate(-90deg);
}

.filter-group-content {
    overflow: hidden;
    transition: max-height 0.3s ease;
    max-height: 1000px;
}

.filter-group.collapsed .filter-group-content {
    max-height: 0;
}

/* Optimizar la búsqueda y ordenación para móvil */
.nautichub-tools {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.nautichub-search {
    width: 100%;
}

.nautichub-search .search-field {
    width: calc(100% - 40px);
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px 0 0 4px;
}

.nautichub-search .search-submit {
    width: 40px;
    padding: 10px;
    background-color: #4d6d80;
    color: white;
    border: none;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
}

.nautichub-sorting {
    width: 100%;
    display: flex;
    align-items: center;
}

.nautichub-sorting label {
    margin-right: 10px;
    white-space: nowrap;
}

.nautichub-sorting select {
    flex-grow: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Mejorar la cuadrícula de productos para móvil */
.nautichub-products-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.nautichub-product-item {
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: hidden;
    background-color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: transform 0.2s, box-shadow 0.2s;
}

.nautichub-product-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.product-image {
    position: relative;
    height: 200px;
    overflow: hidden;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.nautichub-product-item:hover .product-image img {
    transform: scale(1.05);
}

.product-content {
    padding: 15px;
}

.product-categories {
    font-size: 12px;
    color: #777;
    margin-bottom: 5px;
}

.product-title {
    font-size: 16px;
    margin: 0 0 8px 0;
    line-height: 1.3;
}

.product-title a {
    color: #333;
    text-decoration: none;
}

.product-excerpt {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-prices {
    margin-bottom: 10px;
}

.price {
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

.price-regular {
    font-size: 14px;
    color: #999;
    text-decoration: line-through;
    margin-right: 5px;
}

.price-sale {
    font-size: 18px;
    font-weight: bold;
    color: #e74c3c;
}

.product-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.nautichub-button {
    padding: 8px 12px;
    background-color: #f0f0f0;
    color: #333;
    border: none;
    border-radius: 4px;
    text-decoration: none;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s;
    flex: 1;
    text-align: center;
    min-width: 80px;
}

.nautichub-button:hover {
    background-color: #e0e0e0;
}

.nautichub-button-primary {
    background-color: #4d6d80;
    color: white;
}

.nautichub-button-primary:hover {
    background-color: #3a5a68;
}

/* Ajustes del modal de detalles del producto */
.nautichub-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    overflow-y: auto;
}

.modal-container {
    position: relative;
    width: 90%;
    max-width: 1000px;
    margin: 50px auto;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    padding: 20px;
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 24px;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 10;
}

.modal-product-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.modal-product-gallery,
.modal-product-info {
    width: 100%;
}

.tabs-nav {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
    border-bottom: 1px solid #ddd;
    overflow-x: auto;
    white-space: nowrap;
}

.tabs-nav li {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
}

.tabs-nav li.active {
    border-bottom-color: #4d6d80;
    font-weight: bold;
}

.tabs-nav a {
    color: #333;
    text-decoration: none;
}

.tab-content {
    display: none;
    padding: 20px 0;
}

.tab-content.active {
    display: block;
}

/* Estilos para paginación */
.nautichub-pagination {
    margin-top: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
}

.nautichub-pagination a,
.nautichub-pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 10px;
    background-color: #f0f0f0;
    color: #333;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.nautichub-pagination a:hover {
    background-color: #e0e0e0;
}

.nautichub-pagination .current {
    background-color: #4d6d80;
    color: white;
}

/* Media queries para dispositivos móviles y tablets */
@media (max-width: 991px) {
    /* Mostrar botón de filtros y configurar panel */
    .mobile-filter-toggle {
        display: flex;
    }
    
    .nautichub-filters {
        display: none; /* Ocultar filtros normales */
    }
    
    /* Optimizar la barra de herramientas */
    .nautichub-tools {
        flex-direction: column;
    }
    
    /* Mejorar el modal para móvil */
    .modal-container {
        width: 95%;
        margin: 30px auto;
    }
}

@media (min-width: 768px) and (max-width: 991px) {
    /* Tabletas */
    .nautichub-products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 992px) {
    /* Escritorio */
    .nautichub-marketplace {
        flex-direction: row;
        gap: 30px;
    }
    
    .nautichub-filters {
        width: 280px;
        flex-shrink: 0;
    }
    
    .nautichub-products {
        flex-grow: 1;
    }
    
    .nautichub-products-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .nautichub-tools {
        flex-direction: row;
        justify-content: space-between;
    }
    
    .nautichub-search {
        width: auto;
    }
    
    .nautichub-sorting {
        width: auto;
    }
    
    /* Modal en escritorio */
    .modal-product-container {
        flex-direction: row;
    }
    
    .modal-product-gallery {
        width: 40%;
    }
    
    .modal-product-info {
        width: 60%;
    }
}

/* Estilos adicionales para experiencia móvil mejorada */
.active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}

.active-filter {
    display: inline-flex;
    align-items: center;
    background-color: #f0f0f0;
    border-radius: 20px;
    padding: 5px 10px;
    font-size: 12px;
}

.active-filter .remove-filter {
    margin-left: 5px;
    cursor: pointer;
    color: #777;
}

.active-filter .remove-filter:hover {
    color: #333;
}

/* Mejorar la categoría seleccionada */
.category-list a.active {
    color: #4d6d80;
    font-weight: bold;
}

/* Ajustar el input de rango para mejor táctil */
input[type="range"] {
    width: 100%;
    height: 25px;
    -webkit-appearance: none;
    background: transparent;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 25px;
    width: 25px;
    border-radius: 50%;
    background: #4d6d80;
    cursor: pointer;
    margin-top: -8px;
}

input[type="range"]::-moz-range-thumb {
    height: 25px;
    width: 25px;
    border-radius: 50%;
    background: #4d6d80;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
    width: 100%;
    height: 10px;
    cursor: pointer;
    background: #ddd;
    border-radius: 5px;
}

input[type="range"]::-moz-range-track {
    width: 100%;
    height: 10px;
    cursor: pointer;
    background: #ddd;
    border-radius: 5px;
}

/* Mejorar elementos del formulario */
.price-inputs {
    display: flex;
    justify-content: space-between;
    margin: 15px 0;
}

.price-inputs input {
    width: calc(50% - 10px);
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

#apply-price-filter {
    width: 100%;
    padding: 10px;
    margin-top: 10px;
}

/* Ocultar scrollbar pero permitir scroll */
.category-list {
    max-height: 300px;
    overflow-y: auto;
    scrollbar-width: thin;
}

.category-list::-webkit-scrollbar {
    width: 6px;
}

.category-list::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.category-list::-webkit-scrollbar-thumb {
    background: #ccc;
}

.category-list::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Estilos adaptados para barra superior de filtros aplicados */
.applied-filters-bar {
    display: none;
    background-color: #f9f9f9;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 15px;
}

.applied-filters-title {
    font-weight: bold;
    margin-right: 10px;
}

@media (max-width: 991px) {
    .applied-filters-bar {
        display: block;
    }
}

/* Estado "Cargando" */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255,255,255,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #4d6d80;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}


/* Ajustes responsivos para la nueva galería */
@media (max-width: 767px) {
    .modal-main-image {
        height: 250px;
    }
    
    .modal-thumbnails {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
        scroll-snap-type: x mandatory;
    }
    
    .modal-thumbnail {
        width: 60px;
        height: 60px;
        flex: 0 0 60px;
        scroll-snap-align: start;
    }
    
    .product-main-image {
        height: 180px;
    }
}