/* =============================================
   ModaNexo - Responsive Styles
   ============================================= */

/* Tablet */
@media (max-width: 1024px) {
    .hero-content {
        gap: 30px;
    }
    
    .hero-text h1 {
        font-size: 2.4rem;
    }
    
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .category-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .shop-layout {
        grid-template-columns: 220px 1fr;
        gap: 20px;
    }
    
    .product-detail-grid {
        gap: 30px;
    }
    
    .footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: 30px;
    }
    
    .about-features {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .cart-layout {
        grid-template-columns: 1fr 320px;
    }
    
    .checkout-layout {
        grid-template-columns: 1fr 340px;
    }
}

/* Tablet Portrait / Large Mobile */
@media (max-width: 768px) {
    .top-bar-content {
        font-size: 0.75rem;
    }
    
    .top-bar-links {
        gap: 10px;
    }
    
    /* Header */
    .search-bar {
        display: none;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
    
    .header-content {
        gap: 16px;
    }

    .header-actions {
        margin-left: auto;
    }
    
    .logo-text {
        font-size: 1.4rem;
    }
    
    /* Navigation - Mobile Slide-in Panel */
    .nav-overlay {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1999;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }
    
    .nav-overlay.active {
        opacity: 1;
        visibility: visible;
    }
    
    .main-nav {
        position: fixed;
        top: 0;
        right: 0;
        width: 300px;
        max-width: 85vw;
        height: 100vh;
        background: var(--bg-dark);
        z-index: 2000;
        padding: 0;
        overflow-y: auto;
        transform: translateX(100%);
        transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
        display: flex;
        flex-direction: column;
    }
    
    .main-nav.active {
        transform: translateX(0);
    }
    
    .mobile-nav-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 16px 20px;
        border-bottom: 1px solid var(--border-color);
        flex-shrink: 0;
    }
    
    .mobile-nav-header .logo-img {
        height: 28px;
        width: auto;
    }
    
    .mobile-nav-close {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        border: none;
        background: var(--bg-input);
        border-radius: 50%;
        cursor: pointer;
        color: var(--text-primary);
        font-size: 1.2rem;
        transition: var(--transition);
    }
    
    .mobile-nav-close:hover {
        background: var(--border-color);
    }
    
    .nav-list {
        flex-direction: column;
        padding: 8px 0;
        flex: 1;
    }
    
    .nav-list > li > a {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 14px 20px;
        font-size: 0.95rem;
        font-weight: 500;
        color: var(--text-primary);
        border-bottom: none;
        transition: background 0.2s ease;
    }
    
    .nav-list > li > a:hover {
        background: var(--bg-input);
    }
    
    .nav-list > li > a:active {
        background: var(--border-color);
    }
    
    /* Collapsible dropdown */
    .has-dropdown > a {
        position: relative;
    }
    
    .dropdown-toggle-icon {
        display: inline-flex;
        margin-left: 8px;
        color: var(--text-muted);
        transition: transform 0.3s ease;
    }
    
    .has-dropdown.open .dropdown-toggle-icon {
        transform: rotate(180deg);
    }
    
    .dropdown {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        border: none;
        background: var(--bg-input);
        padding: 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .has-dropdown.open .dropdown {
        max-height: 500px;
    }
    
    .dropdown li a {
        border-bottom: none;
        padding: 12px 20px 12px 36px;
        font-size: 0.88rem;
        color: var(--text-secondary);
    }
    
    .dropdown li a:hover {
        background: var(--border-color);
    }
    
    .nav-list-divider {
        display: block;
        height: 1px;
        background: var(--border-color);
        margin: 8px 20px;
    }
    
    /* Mobile search bar in nav */
    .main-nav .mobile-search {
        display: block;
        padding: 12px 20px;
        border-bottom: 1px solid var(--border-color);
    }
    
    .main-nav .mobile-search input {
        width: 100%;
        padding: 10px 14px;
        border: 1px solid var(--border-color);
        border-radius: var(--radius);
        background: var(--bg-input);
        font-size: 0.9rem;
        font-family: var(--font);
    }
    
    /* Hamburger to X animation */
    .mobile-menu-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }
    
    .mobile-menu-toggle.active span:nth-child(2) {
        opacity: 0;
    }
    
    .mobile-menu-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(5px, -5px);
    }
    
    /* Hero */
    .hero {
        padding: 50px 0;
    }
    
    .hero-content {
        flex-direction: column;
        text-align: center;
    }
    
    .hero-text h1 {
        font-size: 2rem;
    }
    
    .hero-text p {
        margin: 0 auto 24px;
    }
    
    .hero-buttons {
        justify-content: center;
    }
    
    .hero-image {
        display: block;
        order: -1;
    }
    
    /* Grids */
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    
    .category-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    
    /* Shop */
    .shop-layout {
        grid-template-columns: 1fr;
    }
    
    .shop-sidebar {
        position: static;
        display: none;
    }
    
    .shop-sidebar.active {
        display: block;
    }
    
    .filter-toggle-btn {
        display: inline-flex;
    }
    
    /* Product Detail */
    .product-price-above-cart {
        display: flex;
    }

    .product-detail {
        padding: 16px 0;
    }

    .product-detail-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        margin-bottom: 30px;
    }
    
    .product-gallery {
        position: static;
        max-width: 100%;
        overflow: hidden;
    }

    .product-gallery-main {
        max-height: none;
        aspect-ratio: 1;
        cursor: default;
    }

    .product-gallery-main img {
        object-fit: contain;
    }

    .zoom-lens,
    .zoom-result {
        display: none !important;
    }

    .product-detail-grid > .product-gallery {
        display: none;
    }

    #mobile-gallery-slot .product-gallery {
        display: block;
        margin-bottom: 16px;
        max-width: 100%;
        overflow: hidden;
    }

    #mobile-gallery-slot .product-gallery-main {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    #mobile-gallery-slot .product-gallery-main img {
        width: 100%;
        height: 100%;
        max-width: 100%;
    }

    .product-gallery-thumbs {
        gap: 6px;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .product-gallery-thumb {
        width: 60px;
        height: 60px;
        flex-shrink: 0;
    }
    
    /* Cart */
    .cart-layout {
        grid-template-columns: 1fr;
    }
    
    .cart-summary {
        position: static;
    }
    
    .cart-item {
        flex-wrap: wrap;
        gap: 12px;
    }
    
    /* Checkout */
    .checkout-steps {
        gap: 0;
    }
    
    .checkout-step {
        padding: 10px 14px;
        font-size: 0.85rem;
    }
    
    .checkout-step:not(:last-child)::after {
        width: 24px;
        right: -12px;
    }
    
    .checkout-layout {
        grid-template-columns: 1fr;
    }
    
    .checkout-order-summary {
        position: static;
        order: -1;
    }

    .summary-item {
        font-size: 0.9rem;
    }

    .cart-summary-row {
        font-size: 0.9rem;
    }

    .cart-summary-total {
        font-size: 1rem;
    }

    .checkout-nav-buttons {
        display: flex;
        flex-direction: column;
        gap: 12px;
        margin-top: 20px;
    }

    .checkout-nav-buttons .btn {
        width: 100%;
        text-align: center;
    }

    .checkout-pay-buttons {
        margin-top: 8px;
    }
    
    /* Account */
    .account-layout {
        grid-template-columns: 1fr;
    }
    
    /* Contact */
    .contact-grid {
        grid-template-columns: 1fr;
    }
    
    /* About */
    .about-features {
        grid-template-columns: 1fr;
    }
    
    .about-hero h1 {
        font-size: 1.8rem;
    }
    
    /* Footer */
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    
    .footer-bottom {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
    
    .footer-bottom-links {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    /* Section */
    .section {
        padding: 40px 0;
    }
    
    .section-header h2 {
        font-size: 1.5rem;
    }
    
    /* Form */
    .form-row {
        grid-template-columns: 1fr;
    }
    
    /* Orders table */
    .orders-table {
        display: block;
        overflow-x: auto;
    }

    .order-detail-header {
        flex-direction: column;
    }

    .order-detail-grid {
        grid-template-columns: 1fr;
    }
    
    /* Tabs */
    .tab-headers {
        overflow-x: auto;
        flex-wrap: nowrap;
    }
    
    .tab-header {
        white-space: nowrap;
        font-size: 0.85rem;
        padding: 12px 16px;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .container {
        padding: 0 16px;
    }
    
    .hero-text h1 {
        font-size: 1.6rem;
    }
    
    .hero-buttons {
        flex-direction: column;
        width: 100%;
    }
    
    .hero-buttons .btn {
        width: 100%;
    }
    
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .product-card-info {
        padding: 12px;
    }
    
    .product-card-name {
        font-size: 0.85rem;
    }
    
    .product-card-price .price-current {
        font-size: 0.95rem;
    }
    
    .product-card-actions {
        flex-direction: column;
    }

    .product-card-actions .btn {
        width: 100%;
    }
    
    .category-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .category-card {
        padding: 20px 12px;
    }
    
    .auth-card {
        padding: 24px;
    }
    
    .auth-card h1 {
        font-size: 1.4rem;
    }
    
    .cart-item-image {
        width: 70px;
        height: 70px;
    }
    
    .product-info {
        min-width: 0;
        overflow: hidden;
    }

    .product-info h1 {
        font-size: 1.4rem;
    }
    
    .product-info .product-price .current-price {
        font-size: 1.5rem;
    }
    
    .size-options .size-option {
        padding: 8px 14px;
        font-size: 0.8rem;
    }

    .color-option {
        width: 40px;
        height: 40px;
    }
    
    .product-actions {
        flex-direction: column;
    }
    
    .newsletter-popup-content {
        padding: 28px 20px;
    }
    
    .newsletter-popup-form {
        flex-direction: column;
    }
    
    .footer-newsletter .newsletter-input-group {
        flex-direction: column;
    }
    
    .coupon-form {
        flex-direction: column;
    }
    
    .shop-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    
    .top-bar {
        display: none;
    }
    
    .error-page h1 {
        font-size: 4rem;
    }
    
    .breadcrumb {
        font-size: 0.75rem;
    }
    
    .toast {
        min-width: auto;
        width: calc(100vw - 48px);
    }
    
    .toast-container {
        right: 16px;
        left: 16px;
    }
}

/* Filter toggle (shown only on mobile) */
.filter-toggle-btn {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
    margin-bottom: 16px;
}

@media (max-width: 768px) {
    .filter-toggle-btn {
        display: inline-flex;
    }
}
