/* ===== SISTEMA RESPONSIVE AVANZADO - JYS COMPUTER ===== */

/* 
Breakpoints para diferentes pantallas:
- Mobile: 320px - 767px
- Tablet: 768px - 1023px
- Desktop Small: 1024px - 1365px
- Desktop Medium: 1366px - 1599px
- Desktop Large: 1600px - 1919px
- Desktop XL: 1920px+
*/

/* ===== VARIABLES CSS RESPONSIVE ===== */
:root {
    /* Contenedores responsive */
    --container-mobile: 100%;
    --container-tablet: 750px;
    --container-desktop-sm: 1170px;
    --container-desktop-md: 1320px;
    --container-desktop-lg: 1540px;
    --container-desktop-xl: 1800px;
    
    /* Espaciados responsive */
    --section-padding-mobile: 40px 0;
    --section-padding-tablet: 60px 0;
    --section-padding-desktop: 80px 0;
    --section-padding-large: 100px 0;
    
    /* Tipografía responsive */
    --title-size-mobile: 1.8rem;
    --title-size-tablet: 2.2rem;
    --title-size-desktop: 2.5rem;
    --title-size-large: 3rem;
}

/* ===== PANTALLAS EXTRA GRANDES (1920px+) ===== */
@media screen and (min-width: 1920px) {
    .container {
        max-width: var(--container-desktop-xl);
        padding: 0 40px;
    }
    
    .section {
        padding: var(--section-padding-large);
    }
    
    .section-title {
        font-size: var(--title-size-large);
        margin-bottom: 30px;
    }
    
    /* Navegación para pantallas grandes */
    .nav-container {
        max-width: 1800px;
        padding: 20px 40px;
        gap: 50px;
    }
    
    .nav-search-section {
        max-width: 800px;
    }
    
    .category-selector {
        min-width: 250px;
    }
    
    #main-search-input {
        font-size: 1.1rem;
        padding: 18px 20px;
    }
    
    /* Hero banner más alto en pantallas grandes */
    .hero-carousel-container {
        height: 600px;
    }
    
    /* Grid de categorías 3x2 */
    .categories-simple-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 40px;
        max-width: 1200px;
        margin: 0 auto;
    }
    
    .simple-category-card {
        height: 280px;
    }
    
    .simple-category-image {
        height: 220px;
    }
    
    /* Productos destacados - 4 por vista */
    .featured-products-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ===== PANTALLAS GRANDES (1600px - 1919px) ===== */
@media screen and (min-width: 1600px) and (max-width: 1919px) {
    .container {
        max-width: var(--container-desktop-lg);
        padding: 0 30px;
    }
    
    .nav-container {
        max-width: 1540px;
        gap: 40px;
    }
    
    .nav-search-section {
        max-width: 700px;
    }
    
    .hero-carousel-container {
        height: 550px;
    }
    
    /* Grid de categorías 3x2 */
    .categories-simple-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 35px;
        max-width: 1100px;
        margin: 0 auto;
    }
    
    /* Productos destacados - 4 por vista */
    .featured-products-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ===== PANTALLAS MEDIANAS (1366px - 1599px) ===== */
@media screen and (min-width: 1366px) and (max-width: 1599px) {
    .container {
        max-width: var(--container-desktop-md);
        padding: 0 25px;
    }
    
    .nav-container {
        max-width: 1320px;
        gap: 30px;
    }
    
    .nav-search-section {
        max-width: 600px;
    }
    
    .hero-carousel-container {
        height: 500px;
    }
    
    /* Grid de categorías 3x2 */
    .categories-simple-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 30px;
        max-width: 1000px;
        margin: 0 auto;
    }
    
    .simple-category-card {
        height: 240px;
    }
    
    .simple-category-image {
        height: 180px;
    }
    
    /* Productos destacados - 3 por vista */
    .featured-products-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ===== PANTALLAS PEQUEÑAS DESKTOP (1024px - 1365px) ===== */
@media screen and (min-width: 1024px) and (max-width: 1365px) {
    .container {
        max-width: var(--container-desktop-sm);
        padding: 0 20px;
    }
    
    .section {
        padding: 70px 0;
    }
    
    .nav-container {
        max-width: 1170px;
        gap: 25px;
    }
    
    .nav-search-section {
        max-width: 500px;
    }
    
    .category-selector {
        min-width: 180px;
    }
    
    .hero-carousel-container {
        height: 450px;
    }
    
    /* Grid de categorías 3x2 */
    .categories-simple-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 25px;
        max-width: 900px;
        margin: 0 auto;
    }
    
    .simple-category-card {
        height: 220px;
    }
    
    .simple-category-image {
        height: 160px;
    }
    
    /* Productos destacados - 3 por vista */
    .featured-products-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    /* Footer ajustado */
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 40px;
    }
    
    .footer-brand {
        grid-column: 1 / -1;
    }
}

/* ===== TABLETS (768px - 1023px) ===== */
@media screen and (min-width: 768px) and (max-width: 1023px) {
    .container {
        max-width: var(--container-tablet);
        padding: 0 20px;
    }
    
    .section {
        padding: var(--section-padding-tablet);
    }
    
    .section-title {
        font-size: var(--title-size-tablet);
    }
    
    /* Navegación tablet */
    .nav-container {
        flex-wrap: wrap;
        gap: 15px;
    }
    
    .nav-search-section {
        order: 3;
        flex-basis: 100%;
        margin: 15px 0 0 0;
        max-width: none;
    }
    
    .category-selector {
        min-width: 150px;
        font-size: 0.8rem;
    }
    
    .hero-carousel-container {
        height: 350px;
    }
    
    /* Grid de categorías 2x3 */
    .categories-simple-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    .simple-category-card {
        height: 200px;
    }
    
    .simple-category-image {
        height: 140px;
    }
    
    /* Productos destacados - 2 por vista */
    .featured-products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Footer tablet */
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 30px;
    }
    
    .footer-brand {
        grid-column: 1 / -1;
        text-align: center;
    }
    
    .footer-features {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

/* ===== MÓVILES (320px - 767px) ===== */
@media screen and (max-width: 767px) {
    .container {
        max-width: var(--container-mobile);
        padding: 0 15px;
    }
    
    .section {
        padding: var(--section-padding-mobile);
    }
    
    .section-title {
        font-size: var(--title-size-mobile);
        margin-bottom: 15px;
    }
    
    .section-subtitle {
        font-size: 1rem;
        margin-bottom: 30px;
    }
    
    /* Navegación móvil */
    main {
        margin-top: 140px; /* Espacio para nav de 2 filas */
    }
    
    .nav-container {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }
    
    .nav-search-section {
        width: 100%;
        max-width: none;
        margin: 0;
    }
    
    .search-bar-main {
        flex-direction: column;
    }
    
    .category-selector {
        min-width: auto;
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
    }
    
    .nav-user-actions {
        width: 100%;
        justify-content: space-around;
    }
    
    .user-auth span {
        display: none;
    }
    
    /* Hero banner móvil */
    .hero-carousel-container {
        height: 250px;
    }
    

    
    /* Grid de categorías 1 columna */
    .categories-simple-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .simple-category-card {
        height: 120px;
        flex-direction: row;
        text-align: left;
    }
    
    .simple-category-image {
        width: 100px;
        height: 100px;
        flex-shrink: 0;
    }
    
    .simple-category-name {
        margin-left: 15px;
        font-size: 1.1rem;
        color: #ffffff !important;
        text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    }
    
        /* Productos destacados - 1 por vista */
    .featured-products-grid {
        grid-template-columns: 1fr;
    }

    .product-card {
        margin: 0 10px;
        height: 380px; /* Altura específica para móvil */
    }
    
    .product-info {
        padding: 15px;
    }
    
    .product-info h3 {
        font-size: 1.1rem;
        min-height: 2.2rem;
    }
    
    .product-description {
        font-size: 0.8rem;
        min-height: 2.4rem;
    }
    
    .product-price {
        margin: 10px 0;
    }
    
    .price-current {
        font-size: 1.3rem;
    }
    
    /* Footer móvil */
    .footer-newsletter {
        padding: 30px 0;
    }
    
    .newsletter-content {
        flex-direction: column;
        text-align: center;
        gap: 20px;
    }
    
    .modern-newsletter-form {
        width: 100%;
    }
    
    .newsletter-input-wrapper {
        flex-direction: column;
        gap: 10px;
    }
    
    .modern-newsletter-input {
        text-align: center;
    }
    
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 30px;
        text-align: center;
    }
    
    .footer-features {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .footer-bottom-content {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
}

/* ===== MÓVILES PEQUEÑOS (320px - 479px) ===== */
@media screen and (max-width: 479px) {
    .container {
        padding: 0 10px;
    }
    
    .section-title {
        font-size: 1.5rem;
    }
    
    .hero-carousel-container {
        height: 200px;
    }
    
    .simple-category-card {
        height: 100px;
    }
    
    .simple-category-image {
        width: 80px;
        height: 80px;
    }
    
    .simple-category-name {
        font-size: 1rem;
        margin-left: 10px;
        color: #ffffff !important;
        text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    }
    
    .btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
}

/* ===== OPTIMIZACIONES PARA RETINA Y HIGH-DPI ===== */
@media screen and (-webkit-min-device-pixel-ratio: 2),
       screen and (min-resolution: 192dpi) {
    .banner-image,
    .simple-category-image img,
    .product-image img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* ===== MODO OSCURO (RESPETA PREFERENCIAS DEL SISTEMA) ===== */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #1a1a1a;
        --text-color: #ffffff;
        --card-bg: #2a2a2a;
    }
    
    body {
        background-color: var(--bg-color);
        color: var(--text-color);
    }
    
    .card,
    .product-card,
    .simple-category-card {
        background: var(--card-bg);
        color: var(--text-color);
    }
}

/* ===== OPTIMIZACIONES DE PERFORMANCE ===== */
@media screen and (max-width: 1023px) {
    /* Reducir animaciones en dispositivos móviles/tablets */
    .hero-slide {
        transition: all 0.5s ease;
    }
    
    .banner-image:hover {
        transform: none;
    }
    
    .btn:hover {
        transform: none;
    }
}

/* ===== ACCESIBILIDAD ===== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .hero-slide {
        transition: none;
    }
    
    html {
        scroll-behavior: auto;
    }
}

/* ===== NAVEGADORES ESPECÍFICOS ===== */
/* Safari iOS fix */
@supports (-webkit-touch-callout: none) {
    .hero-carousel-container {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
}

/* Firefox optimizations */
@-moz-document url-prefix() {
    .search-bar-main {
        display: -moz-box;
        display: flex;
    }
}
