/* ==================================================
   PRODUCTOS PAGE - ENHANCED MODERN DESIGN
   ================================================== */

/* Variables para consistencia */
:root {
    --primary-color: #2c5aa0;
    --secondary-color: #1a2947;
    --text-color: #333;
    --light-bg: #f8f9fa;
    --white: #ffffff;
    --shadow-light: 0 2px 10px rgba(0,0,0,0.1);
    --shadow-medium: 0 10px 30px rgba(0,0,0,0.1);
    --shadow-heavy: 0 20px 40px rgba(0,0,0,0.15);
    --border-radius: 10px;
    --transition: all 0.3s ease;
    --gradient-primary: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    --gradient-ocean: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
}


/* ==================================================
   LAYOUT PRINCIPAL
   ================================================== */
.products-layout {
    display: flex;
    max-width: 1400px;
    margin: 0 auto;
    gap: 30px;
    padding: 30px 20px;
    margin-top: 100px;
}

/* ==================================================
   SIDEBAR NAVIGATION MEJORADA
   ================================================== */
.sidebar-navigation {
    width: 250px;
    flex-shrink: 0;
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    padding: 0;
    height: fit-content;
    position: sticky;
    top: 120px;
    overflow: hidden;
}

.sidebar-header {
    background: var(--gradient-primary);
    color: var(--white);
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--white);
    cursor: pointer;
    padding: 5px;
    border-radius: 5px;
    transition: var(--transition);
    display: none;
}

.sidebar-toggle:hover {
    background: rgba(255,255,255,0.2);
}

.sidebar-nav {
    padding: 20px 0;
}

.category-section {
    margin-bottom: 25px;
}

.category-title {
    margin: 0 0 10px 0;
    padding: 0 20px;
}

.category-link {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-color);
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    padding: 12px 0;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.category-link:hover,
.category-link.active {
    color: var(--primary-color);
    border-left-color: var(--primary-color);
    background: rgba(44, 90, 160, 0.05);
}

.category-link.active {
    font-weight: 700;
    border-left-width: 4px;
}

.category-icon {
    font-size: 1.2rem;
}

.product-list {
    list-style: none;
    padding: 0;
    margin: 0;
    padding-left: 20px;
}

.product-list li {
    margin-bottom: 5px;
}

.product-link {
    display: block;
    color: #666;
    text-decoration: none;
    padding: 8px 15px;
    font-size: 1rem;
    transition: var(--transition);
    border-radius: 5px;
}

.product-link:hover {
    color: var(--primary-color);
    background: var(--light-bg);
    transform: translateX(5px);
}

/* ==================================================
   SECCIÓN DE PRODUCTOS
   ================================================== */
.productos-section {
    flex: 1;
    min-width: 0;
}


/* Header de productos */
.products-header {
    margin-bottom: 40px;
}

.header-content {
    margin-bottom: 30px;
}

.section-title {
    font-size: clamp(2rem, 4vw, 2.5rem);
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 10px;
    position: relative;
    padding-bottom: 15px;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60px;
    height: 4px;
    background: var(--gradient-primary);
    border-radius: 2px;
}

.section-description {
    font-size: 1.1rem;
    color: #666;
    margin: 0;
    line-height: 1.6;
}

/* Filtros */
.products-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 25px;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(44, 90, 160, 0.1);
    border: 1px solid rgba(44, 90, 160, 0.08);
    margin-bottom: 30px;
    backdrop-filter: blur(10px);
}

.filters-left {
    display: flex;
    align-items: center;
    gap: 25px;
    flex-wrap: wrap;
}

.filters-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.filter-label {
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0;
    white-space: nowrap;
}

.filter-select {
    padding: 12px 16px;
    border: 2px solid transparent;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-color);
    font-size: 0.95rem;
    font-weight: 500;
    min-width: 140px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    backdrop-filter: blur(10px);
}

.filter-select:hover {
    border-color: var(--primary-color);
    background: var(--white);
    box-shadow: 0 4px 16px rgba(44, 90, 160, 0.15);
    transform: translateY(-1px);
}

.filter-select:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 4px rgba(44, 90, 160, 0.1), 0 4px 16px rgba(44, 90, 160, 0.15);
    transform: translateY(-1px);
}

.view-toggle {
    display: flex;
    gap: 3px;
    background: rgba(44, 90, 160, 0.05);
    padding: 4px;
    border-radius: 12px;
    border: 1px solid rgba(44, 90, 160, 0.1);
}

.view-btn {
    background: transparent;
    border: none;
    padding: 10px 12px;
    border-radius: 9px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    position: relative;
    overflow: hidden;
}

.view-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 9px;
}

.view-btn:hover {
    color: var(--primary-color);
    transform: translateY(-1px);
}

.view-btn.active {
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(44, 90, 160, 0.3);
}

.view-btn.active::before {
    opacity: 1;
}

.view-btn svg,
.view-btn i {
    position: relative;
    z-index: 1;
}

/* Buscador */
.search-container {
    position: relative;
    width: 100%;
    max-width: 400px;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--light-bg);
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    padding: 8px 16px;
    transition: var(--transition);
}

.search-input-wrapper:focus-within {
    border-color: var(--primary-color);
    background: var(--white);
    box-shadow: 0 0 0 3px rgba(44, 90, 160, 0.1);
}

.search-icon {
    width: 18px;
    height: 18px;
    color: #666;
    margin-right: 10px;
    flex-shrink: 0;
}

.search-input {
    flex: 1;
    border: none;
    background: none;
    outline: none;
    font-size: 0.9rem;
    color: var(--text-color);
    padding: 0;
}

.search-input::placeholder {
    color: #999;
}

.search-clear {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: #999;
    border-radius: 50%;
    transition: var(--transition);
    opacity: 0;
    visibility: hidden;
}

.search-clear:hover {
    color: #ff4757;
    background: rgba(255, 71, 87, 0.1);
}

.search-input:not(:placeholder-shown) ~ .search-clear {
    opacity: 1;
    visibility: visible;
}

.search-results-count {
    margin-top: 5px;
    font-size: 0.8rem;
    color: var(--primary-color);
    font-weight: 500;
}

/* Botón limpiar filtros */
.btn-clear-filters {
    background: #ff4757;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.9);
    transition: all 0.3s ease;
}

.btn-clear-filters.visible {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

.btn-clear-filters:hover {
    background: #ff3742;
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(255, 71, 87, 0.3);
}

.btn-clear-filters svg {
    width: 14px;
    height: 14px;
}

/* ==================================================
   GRID DE PRODUCTOS
   ================================================== */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.product-card {
    background: var(--white);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-light);
    transition: var(--transition);
    cursor: pointer;
    position: relative;
    group: product;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-heavy);
}

.product-card:focus {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

.product-image-container {
    position: relative;
    overflow: hidden;
    height: 200px;
    background: var(--light-bg);
}

.product-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.product-card:hover .product-image-container img {
    transform: scale(1.1);
}

.product-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(44, 90, 160, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
    backdrop-filter: blur(2px);
}

.product-card:hover .product-overlay {
    opacity: 1;
}

.view-details {
    color: var(--white);
    font-weight: 600;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.product-info {
    padding: 20px;
}

.product-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 0 0 8px 0;
    line-height: 1.3;
}

.product-description {
    color: #666;
    font-size: 0.9rem;
    margin: 0;
    line-height: 1.4;
}

/* Footer de productos */
.products-footer {
    padding: 20px;
    text-align: center;
    background: var(--light-bg);
    border-radius: var(--border-radius);
}

.products-count {
    margin: 0;
    color: #666;
    font-size: 0.9rem;
    font-weight: 500;
}

/* ==================================================
   VISTA EN LISTA
   ================================================== */
.products-grid.list-view {
    grid-template-columns: 1fr;
    gap: 20px;
}

.products-grid.list-view .product-card {
    display: flex;
    align-items: center;
    height: 120px;
}

.products-grid.list-view .product-image-container {
    width: 150px;
    height: 100%;
    flex-shrink: 0;
}

.products-grid.list-view .product-info {
    padding: 20px;
    flex: 1;
}

.products-grid.list-view .product-name {
    font-size: 1.1rem;
    margin-bottom: 5px;
    color: var(--text-color) !important;
    font-weight: 600;
}

.products-grid.list-view .product-description {
    color: #666 !important;
    font-size: 0.9rem;
    margin: 0;
    line-height: 1.4;
}

/* Asegurar visibilidad del texto en todas las vistas */
.products-grid .product-card .product-info * {
    color: inherit;
}

.products-grid .product-card .product-name {
    color: var(--text-color) !important;
}

.products-grid .product-card .product-description {
    color: #666 !important;
}

/* ==================================================
   RESPONSIVE DESIGN
   ================================================== */

/* Large tablets */
@media (max-width: 1200px) {
    .products-layout {
        gap: 20px;
        padding: 25px 15px;
        margin-top: 90px;
    }
    
    .sidebar-navigation {
        width: 270px;
        top: 110px;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
        gap: 25px;
    }
}

/* Tablets */
@media (max-width: 768px) {
    .products-layout {
        flex-direction: column;
        gap: 20px;
        padding: 15px 10px;
        margin-top: 80px;
    }
    
    .sidebar-navigation {
        width: 100%;
        position: static;
        order: 2;
        top: auto;
        margin-bottom: 20px;
    }
    
    .sidebar-header {
        cursor: pointer;
        padding: 18px 20px;
        background: var(--gradient-primary);
    }
    
    .sidebar-toggle {
        display: block;
    }
    
    .sidebar-nav {
        display: none;
        animation: slideDown 0.3s ease;
    }
    
    .sidebar-navigation.open .sidebar-nav {
        display: block;
    }
    
    .products-filters {
        flex-direction: column;
        gap: 20px;
        padding: 20px 15px;
        border-radius: 12px;
        margin-bottom: 20px;
    }
    
    .filters-left {
        width: 100%;
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .filters-right {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 12px;
    }
    
    .search-container {
        width: 100%;
        max-width: 100%;
        order: -1;
    }
    
    .filter-group {
        width: 100%;
        flex-direction: column;
        gap: 8px;
        align-items: stretch;
    }
    
    .filter-label {
        font-size: 0.8rem;
        text-align: left;
        margin-bottom: 4px;
    }
    
    .filter-select {
        width: 100%;
        min-width: auto;
        padding: 14px 16px;
        font-size: 16px; /* Previene zoom en iOS */
        border-radius: 10px;
    }
    
    .view-toggle {
        width: 100%;
        justify-content: center;
        padding: 6px;
        border-radius: 10px;
        margin-top: 10px;
    }
    
    .view-btn {
        flex: 1;
        padding: 12px;
        font-size: 18px;
        border-radius: 8px;
    }
    
    .btn-clear-filters {
        width: 100%;
        justify-content: center;
        font-size: 0.9rem;
        padding: 12px 16px;
        border-radius: 10px;
        margin-top: 10px;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 20px;
    }
    
    .product-card {
        margin-bottom: 10px;
    }
}

/* Mobile */
@media (max-width: 480px) {
    .products-layout {
        padding: 12px 8px;
        margin-top: 70px;
        gap: 15px;
    }
    
    .sidebar-navigation {
        margin-bottom: 15px;
        border-radius: 10px;
    }
    
    .sidebar-header {
        padding: 15px 18px;
        border-radius: 10px 10px 0 0;
    }
    
    .sidebar-title {
        font-size: 1rem;
    }
    
    .products-filters {
        padding: 18px 12px;
        gap: 15px;
        border-radius: 10px;
        margin-bottom: 15px;
    }
    
    .filters-left {
        gap: 12px;
    }
    
    .filters-right {
        gap: 10px;
        flex-direction: column;
    }
    
    .filter-group {
        gap: 6px;
    }
    
    .filter-label {
        font-size: 0.75rem;
        font-weight: 700;
        color: var(--primary-color);
    }
    
    .filter-select {
        padding: 12px 14px;
        font-size: 15px;
        border-radius: 8px;
    }
    
    .search-input-wrapper {
        padding: 10px 14px;
        border-radius: 20px;
    }
    
    .search-input {
        font-size: 15px;
    }
    
    .view-toggle {
        padding: 4px;
        border-radius: 8px;
        gap: 2px;
    }
    
    .view-btn {
        padding: 10px;
        font-size: 16px;
        border-radius: 6px;
    }
    
    .btn-clear-filters {
        padding: 10px 14px;
        font-size: 0.85rem;
        border-radius: 8px;
    }
    
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .product-card {
        margin-bottom: 5px;
        border-radius: 8px;
    }
    
    .product-image-container {
        height: 120px;
        border-radius: 8px 8px 0 0;
    }
    
    .product-info {
        padding: 10px;
    }
    
    .product-name {
        font-size: 0.85rem;
        line-height: 1.2;
        margin-bottom: 4px;
    }
    
    .product-description {
        font-size: 0.75rem;
        line-height: 1.3;
    }
    
    .products-grid.list-view {
        grid-template-columns: 1fr;
    }
    
    .products-grid.list-view .product-card {
        display: flex;
        flex-direction: row;
        height: 100px;
        align-items: center;
    }
    
    .products-grid.list-view .product-image-container {
        width: 100px;
        height: 80px;
        flex-shrink: 0;
        border-radius: 6px;
        margin: 10px;
    }
    
    .products-grid.list-view .product-info {
        padding: 10px;
        flex: 1;
    }
    
    .products-grid.list-view .product-name {
        font-size: 0.85rem;
        margin-bottom: 2px;
    }
    
    .products-grid.list-view .product-description {
        font-size: 0.75rem;
    }
}

/* Extra small mobile */
@media (max-width: 360px) {
    .products-layout {
        padding: 8px 6px;
        margin-top: 60px;
        gap: 12px;
    }
    
    .products-filters {
        padding: 15px 10px;
        gap: 12px;
        border-radius: 8px;
    }
    
    .filter-label {
        font-size: 0.7rem;
    }
    
    .filter-select {
        padding: 10px 12px;
        font-size: 14px;
    }
    
    .search-input-wrapper {
        padding: 8px 12px;
        border-radius: 18px;
    }
    
    .view-btn {
        padding: 8px;
        font-size: 14px;
    }
    
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .product-card {
        border-radius: 6px;
    }
    
    .product-image-container {
        height: 100px;
        border-radius: 6px 6px 0 0;
    }
    
    .product-info {
        padding: 8px;
    }
    
    .product-name {
        font-size: 0.8rem;
        line-height: 1.1;
    }
    
    .product-description {
        font-size: 0.7rem;
        line-height: 1.2;
    }
    
    .sidebar-header {
        padding: 12px 15px;
    }
    
    .sidebar-title {
        font-size: 0.95rem;
    }
    
    .btn-clear-filters {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
    
    .products-grid.list-view .product-card {
        height: 90px;
    }
    
    .products-grid.list-view .product-image-container {
        width: 80px;
        height: 70px;
        margin: 8px;
    }
    
    .products-grid.list-view .product-info {
        padding: 8px;
    }
}

/* ==================================================
   ANIMATIONS
   ================================================== */
@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        max-height: 800px;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ==================================================
   ACCESSIBILITY IMPROVEMENTS
   ================================================== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .product-card {
        border: 2px solid var(--text-color);
    }
    
    .sidebar-navigation {
        border: 2px solid var(--text-color);
    }
}

/* ==================================================
   PRINT STYLES
   ================================================== */
@media print {
    .sidebar-navigation,
    .products-filters {
        display: none;
    }
    
    .products-layout {
        flex-direction: column;
        margin-top: 0;
        padding: 20px;
    }
    
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
    
    .product-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}
