/* ================================
   HOMEPAGE STYLES - index.html
   ================================ */

/* Header Corrections */
header {
    padding: 4px 0 !important;
}

header .container {
    min-height: 35px !important;
}

.logo img {
    height: 30px !important;
}

nav ul li {
    margin-left: 15px !important;
}

nav ul li a {
    padding: 6px 8px !important;
    font-size: 14px !important;
}

.user-controls a {
    padding: 6px 12px !important;
    font-size: 13px !important;
    gap: 4px !important;
}

/* ================================
   PRODUCT GRID LAYOUT (CRITICAL)
   ================================ */

/* ================================
   FILTROS DE CATEGORÍA Y PRECIO
   ================================ */

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

.category-filters {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid #e5e5e5;
    background: #ffffff;
    color: #666666;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    min-height: 36px;
    justify-content: center;
    outline: none;
}

.filter-btn:hover {
    border-color: #c41e3a;
    color: #c41e3a;
    background: #fff5f5;
}

.filter-btn.active {
    background: #c41e3a;
    color: white;
    border-color: #c41e3a;
    box-shadow: 0 2px 8px rgba(196, 30, 58, 0.2);
}

.filter-btn i {
    font-size: 14px;
    opacity: 0.8;
}

.filter-btn.active i {
    opacity: 1;
}

/* Filtro de Precio */
.price-filter {
    display: flex;
    align-items: center;
}

.price-sort-select {
    padding: 8px 12px;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    background: white;
    color: #666666;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    min-width: 180px;
    transition: all 0.2s ease;
    outline: none;
}

.price-sort-select:hover {
    border-color: #c41e3a;
    color: #c41e3a;
}

.price-sort-select:focus {
    border-color: #c41e3a;
    box-shadow: 0 0 0 2px rgba(196, 30, 58, 0.1);
}

/* Responsive Design */
@media (max-width: 768px) {
    .filters-container {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .category-filters {
        justify-content: center;
        gap: 8px;
    }
    
    .filter-btn {
        font-size: 12px;
        padding: 6px 12px;
        min-height: 32px;
    }
    
    .filter-btn span {
        display: none;
    }
    
    .filter-btn i {
        font-size: 16px;
    }
    
    .price-sort-select {
        min-width: 100%;
        text-align: center;
    }
}

/* Animación de filtrado */
.product-card {
    transition: all 0.4s ease;
}

.product-card.hidden {
    opacity: 0;
    transform: scale(0.8);
    pointer-events: none;
}

.products-section .product-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)) !important;
    gap: 20px !important;
    margin-top: 30px !important;
    padding: 0 20px !important;
    max-width: 1200px !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* ================================
   PRODUCT CARDS DESIGN
   ================================ */

.products-section .product-card {
    background-color: #fff !important;
    border-radius: 8px !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1) !important;
    overflow: hidden !important;
    transition: transform 0.3s ease, box-shadow 0.3s ease !important;
    display: flex !important;
    flex-direction: column !important;
    border: 1px solid #eee !important;
    max-height: 480px !important;
    height: auto !important;
    min-height: 460px !important;
    position: relative !important;
}

.products-section .product-card:hover {
    transform: translateY(-5px) !important;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15) !important;
}

/* ================================
   PRODUCT IMAGE SECTION
   ================================ */

.products-section .product-image {
    position: relative !important;
    height: 200px !important;
    max-height: 200px !important;
    min-height: 200px !important;
    overflow: hidden !important;
    cursor: pointer !important;
    background: #f8f9fa !important;
}

.products-section .product-image img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    background: #f8f9fa !important;
    display: block !important;
    transition: transform 0.3s ease !important;
}

.products-section .product-image:hover img {
    transform: scale(1.05) !important;
}

/* ================================
   PRODUCT INFO SECTION
   ================================ */

.products-section .product-info {
    padding: 15px !important;
    flex-grow: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
}

.products-section .product-card h3 {
    color: #c41e3a !important;
    margin: 0 0 10px 0 !important;
    font-size: 1.2rem !important;
    font-weight: 600 !important;
    line-height: 1.2 !important;
    text-align: center !important;
}

.products-section .product-description {
    color: #666 !important;
    margin-bottom: 12px !important;
    font-size: 0.9rem !important;
    line-height: 1.4 !important;
    max-height: 42px !important;
    overflow: hidden !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    text-align: center !important;
}

/* ================================
   PRODUCT DETAILS SECTION
   ================================ */

.products-section .product-details {
    margin: 10px 0 15px !important;
    background: #f8f9fa !important;
    padding: 10px !important;
    border-radius: 6px !important;
    border: 1px solid #e9ecef !important;
}

.products-section .product-price {
    font-size: 1.3rem !important;
    font-weight: 700 !important;
    color: #c41e3a !important;
    margin-bottom: 8px !important;
    display: block !important;
    text-align: center !important;
}

.products-section .product-specs {
    font-size: 0.9rem !important;
    color: #666 !important;
    display: flex !important;
    align-items: center !important;
    gap: 15px !important;
    margin-bottom: 0 !important;
    justify-content: center !important;
}

.products-section .product-specs i {
    color: #c41e3a !important;
    margin-right: 4px !important;
}

/* ================================
   PRODUCT ACTIONS SECTION
   ================================ */

.products-section .product-actions {
    display: flex !important;
    gap: 8px !important;
    margin-top: auto !important;
    padding: 15px !important;
    padding-top: 15px !important;
}

.products-section .product-actions .btn {
    flex: 1 !important;
    text-align: center !important;
    padding: 12px 14px !important;
    font-size: 0.95rem !important;
    border-radius: 6px !important;
    text-decoration: none !important;
    transition: all 0.3s ease !important;
    border: none !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
}

.products-section .btn-secondary {
    background-color: #25d366 !important;
    color: white !important;
}

.products-section .btn-secondary:hover {
    background-color: #20b355 !important;
    transform: translateY(-1px) !important;
}

.products-section .btn-primary {
    background-color: #c41e3a !important;
    color: white !important;
}

.products-section .btn-primary:hover {
    background-color: #a01729 !important;
    transform: translateY(-1px) !important;
}

/* Botón específico para WhatsApp */
.products-section .btn-contact {
    background-color: #25d366 !important;
    color: white !important;
}

.products-section .btn-contact:hover {
    background-color: #20b355 !important;
}

/* Botón específico para detalles */
.products-section .btn-details {
    background-color: #c41e3a !important;
    color: white !important;
}

.products-section .btn-details:hover {
    background-color: #a01729 !important;
}

.products-section .btn-sold {
    background-color: #6c757d !important;
    color: white !important;
    cursor: not-allowed !important;
    opacity: 0.7 !important;
}

/* ================================
   SOLD OVERLAY FOR PRODUCTS
   ================================ */

.products-section .product-card.sold .product-image::after {
    content: 'VENDIDO' !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: rgba(220, 53, 69, 0.85) !important;
    color: white !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-weight: bold !important;
    font-size: 1.2rem !important;
    z-index: 10 !important;
}

/* ================================
   UTILITY CLASSES
   ================================ */

#create-db-btn {
    padding: 4px 8px !important;
    font-size: 12px !important;
}

/* ================================
   RESPONSIVE DESIGN
   ================================ */

@media (max-width: 768px) {
    .products-section .product-grid {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
        padding: 0 15px !important;
    }
    
    .products-section .product-card {
        max-height: none !important;
        min-height: 400px !important;
    }
    
    .products-section .product-actions {
        flex-direction: column !important;
        gap: 8px !important;
    }
    
    .products-section .product-actions .btn {
        padding: 12px 16px !important;
        font-size: 0.85rem !important;
        width: 100% !important;
        min-height: 44px !important;
    }
    
    /* Asegurar que los botones sean distintos visualmente */
    .products-section .btn-contact {
        background-color: #25d366 !important;
        color: white !important;
    }
    
    .products-section .btn-details {
        background-color: #c41e3a !important;
        color: white !important;
    }
}

@media (max-width: 480px) {
    .products-section .product-grid {
        padding: 0 10px !important;
    }
    
    .products-section .product-info {
        padding: 15px !important;
    }
    
    .products-section .product-price {
        font-size: 1.2rem !important;
    }
    
    .products-section .product-card h3 {
        font-size: 1.1rem !important;
        margin-bottom: 8px !important;
    }
    
    .products-section .product-actions .btn {
        padding: 14px 16px !important;
        font-size: 0.9rem !important;
        min-height: 48px !important;
    }
}

/* ================================
   CONTACT SECTION ENHANCEMENTS
   ================================ */

/* Contenedor de información de contacto - Integrado al grid */
.contact-info-container {
    display: contents; /* Para que sus hijos se integren al grid principal */
}

/* Info box y location box lado a lado */
.info-box, .location-box {
    background: #fff;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: 1px solid #e9ecef;
    margin: 0;
    display: flex;
    flex-direction: column;
    height: 100%; /* Que ocupen toda la altura disponible del grid */
    min-height: 500px; /* Altura mínima igual al formulario */
}

/* Específico para info-box */
.info-box {
    justify-content: flex-start; /* Contenido al inicio */
}

/* Hacer que los métodos de pago ocupen el espacio restante */
.payment-methods {
    margin-top: auto; /* Empujar hacia abajo para llenar el espacio */
    padding-top: 20px;
    text-align: center;
}

.payment-methods h4 {
    color: #c41e3a;
    margin-bottom: 12px; /* Más espacio abajo del título */
    font-size: 1.1rem; /* Tamaño más grande */
    font-weight: 600;
}

.payment-image {
    max-width: 100%;
    max-height: 120px; /* Altura más grande */
    height: auto;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.payment-image:hover {
    transform: scale(1.02);
}

/* Caja de ubicación con mapa */
.location-box {
    justify-content: space-between; /* Distribuir el contenido uniformemente */
}

.location-box h3 {
    color: #c41e3a;
    margin-bottom: 15px;
    font-size: 1.3rem; /* Tamaño más grande */
    font-weight: 600;
    text-align: center;
    flex-shrink: 0; /* No permitir que se reduzca */
}

/* Información de dirección */
.address-info {
    margin-bottom: 15px;
    text-align: center;
    flex-shrink: 0; /* No permitir que se reduzca */
}

.address-info h4 {
    color: #c41e3a;
    margin-bottom: 8px;
    font-size: 1.1rem; /* Tamaño más grande */
    font-weight: 600;
}

.full-address {
    color: #666;
    font-size: 0.95rem; /* Tamaño más grande */
    line-height: 1.5; /* Más espacio entre líneas */
    margin: 0;
    padding: 12px; /* Más padding */
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.full-address i {
    color: #c41e3a;
    margin-right: 8px;
}

/* Contenedor del mapa más espacioso */
.map-container {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-top: auto; /* Empujar el mapa hacia abajo para llenar el espacio */
}

.map-container iframe {
    width: 100%;
    height: 250px; /* Altura más grande para igualar con la otra tarjeta */
    border: none;
    display: block;
}

/* Responsive para la sección de contacto */
@media (max-width: 1300px) {
    .contact-container {
        max-width: 1300px;
        gap: 30px;
    }
    
    .info-box, .location-box {
        min-width: 300px;
        padding: 25px;
    }
}

@media (max-width: 1024px) {
    .contact-container {
        gap: 25px;
        padding: 0 15px;
    }
    
    .contact-info-container {
        gap: 25px;
    }
    
    .info-box, .location-box {
        padding: 20px;
        min-width: 250px;
        min-height: 450px; /* Altura mínima ajustada para tablets */
    }
    
    .map-container iframe {
        height: 220px;
    }
}

@media (max-width: 900px) {
    .contact-container {
        flex-direction: column;
    }
    
    .contact-info-container {
        margin-top: 20px;
        /* Mantener horizontal en tablet */
    }
    
    .info-box, .location-box {
        min-width: 350px; /* Más ancho cuando están uno al lado del otro */
        min-height: 400px; /* Altura mínima para tablet horizontal */
    }
}

@media (max-width: 768px) {
    .contact-info-container {
        flex-direction: column; /* Apilar en móvil */
        gap: 20px;
        align-items: stretch; /* Mantener ancho completo */
    }
    
    .info-box, .location-box {
        min-width: 0; /* Sin restricción de ancho mínimo en móvil */
        min-height: auto; /* Sin altura mínima en móvil para ahorrar espacio */
    }
    
    .map-container iframe {
        height: 200px;
    }
}

@media (max-width: 480px) {
    .contact-container {
        padding: 0 10px;
    }
    
    .map-container iframe {
        height: 180px;
    }
    
    .payment-image {
        max-width: 90%;
        max-height: 100px;
    }
    
    .info-box, .location-box {
        padding: 15px;
    }
    
    .full-address {
        font-size: 0.9rem;
        padding: 10px;
    }
}

/* ================================
   CONTAINER COMPARISON TABLE
   ================================ */

.container-comparison-section {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 80px 0;
    margin-top: 0;
}

.container-comparison-section h2 {
    color: var(--primary-color);
    font-size: 2.5em;
    margin-bottom: 20px;
    text-align: center;
    position: relative;
}

.container-comparison-section h2::after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 2px;
}

.section-description {
    text-align: center;
    color: var(--text-muted);
    font-size: 1.1em;
    margin-bottom: 50px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.comparison-table-container {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    margin: 0 auto;
    max-width: 1000px;
}

.container-comparison-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Roboto', sans-serif;
}

.container-comparison-table th {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 20px 15px;
    text-align: center;
    font-weight: 600;
    font-size: 1em;
}

.container-comparison-table th:first-child {
    background: var(--dark-gray);
    text-align: left;
    width: 25%;
}

.container-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.container-header i {
    font-size: 1.2em;
    opacity: 0.9;
}

.container-comparison-table td {
    padding: 15px;
    text-align: center;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.95em;
    transition: all 0.3s ease;
}

.container-comparison-table tbody tr:hover {
    background-color: #f8f9fa;
}

.container-comparison-table tbody tr:hover td {
    transform: translateY(-1px);
}

.spec-category {
    background-color: #f8f9fa !important;
    font-weight: 600 !important;
    color: var(--primary-color) !important;
    text-align: left !important;
    border-left: 4px solid var(--primary-color);
}

.spec-category i {
    margin-right: 8px;
    color: var(--primary-color);
}

.spec-item {
    text-align: left !important;
    padding-left: 20px !important;
    color: var(--text-dark);
}

.spec-item.indent {
    padding-left: 35px !important;
    font-style: italic;
    color: var(--text-muted);
}

.spec-item i {
    margin-right: 8px;
    color: var(--secondary-color);
    width: 16px;
}

.highlight {
    background-color: #e8f5e8 !important;
    color: #28a745 !important;
    font-weight: 700 !important;
    font-size: 1.1em !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    /* Filtros de categoría responsivos */
    .category-filters {
        gap: 10px;
        margin: 20px 0;
        padding: 0 10px;
    }
    
    .filter-btn {
        padding: 10px 16px;
        font-size: 13px;
        min-width: 120px;
        gap: 6px;
    }
    
    .filter-btn i {
        font-size: 14px;
    }
    
    .container-comparison-section {
        padding: 60px 0;
    }
    
    .comparison-table-container {
        margin: 0 10px;
        border-radius: 10px;
    }
    
    .container-comparison-table th,
    .container-comparison-table td {
        padding: 12px 8px;
        font-size: 0.85em;
    }
    
    .container-comparison-section h2 {
        font-size: 2em;
    }
    
    .section-description {
        font-size: 1em;
        padding: 0 20px;
    }
    
    .container-header {
        flex-direction: column;
        gap: 4px;
    }
    
    .container-header span {
        font-size: 0.9em;
    }
}

@media (max-width: 480px) {
    .container-comparison-table th,
    .container-comparison-table td {
        padding: 8px 4px;
        font-size: 0.8em;
    }
    
    .spec-item {
        padding-left: 12px !important;
    }
    
    .spec-item.indent {
        padding-left: 20px !important;
    }
}
