/* Mobile Optimizations for Product, Category, and Orders Pages */

/* ============================================
   PRODUCT DETAIL PAGE - MOBILE OPTIMIZATIONS
   ============================================ */

@media (max-width: 768px) {
    .product-detail-container {
        grid-template-columns: 1fr !important;
        gap: 24px !important;
    }
    
    .product-gallery {
        order: 1;
    }
    
    .product-details-content {
        order: 2;
    }
    
    .main-image {
        height: 400px !important;
        border-radius: 12px;
    }
    
    .main-image img {
        border-radius: 12px;
    }
    
    .image-thumbnails {
        display: flex;
        gap: 8px;
        overflow-x: auto;
        padding: 8px 0;
        scrollbar-width: thin;
        scrollbar-color: #BDBDBD #F5F5F5;
    }
    
    .image-thumbnails::-webkit-scrollbar {
        height: 4px;
    }
    
    .image-thumbnails::-webkit-scrollbar-track {
        background: #F5F5F5;
        border-radius: 10px;
    }
    
    .image-thumbnails::-webkit-scrollbar-thumb {
        background: #BDBDBD;
        border-radius: 10px;
    }
    
    .image-thumbnail {
        min-width: 70px !important;
        height: 70px !important;
    }
    
    .product-details-content h1 {
        font-size: 24px !important;
        line-height: 1.3;
    }
    
    .product-rating {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 4px;
    }
    
    .current-price {
        font-size: 28px !important;
    }
    
    .original-price {
        font-size: 18px !important;
    }
    
    .size-selector {
        gap: 8px !important;
    }
    
    .size-option {
        min-width: 50px !important;
        height: 50px !important;
        font-size: 14px !important;
    }
    
    .quantity-selector {
        justify-content: center;
        width: 100%;
    }
    
    .quantity-btn {
        width: 44px !important;
        height: 44px !important;
    }
    
    .quantity-value {
        min-width: 60px !important;
        font-size: 18px !important;
    }
    
    .product-actions {
        flex-direction: column !important;
        gap: 12px !important;
    }
    
    .product-actions .btn {
        width: 100% !important;
        justify-content: center;
    }
    
    .product-description {
        font-size: 14px !important;
        line-height: 1.6;
    }
    
    .related-products-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }
}

@media (max-width: 480px) {
    .main-image {
        height: 300px !important;
    }
    
    .current-price {
        font-size: 24px !important;
    }
    
    .size-option {
        min-width: 45px !important;
        height: 45px !important;
        font-size: 13px !important;
    }
    
    .product-details-content h1 {
        font-size: 20px !important;
    }
}

/* ============================================
   CATEGORY/FILTER PAGE - MOBILE OPTIMIZATIONS
   ============================================ */

@media (max-width: 768px) {
    .page-header {
        padding: 32px 0 24px !important;
    }
    
    .page-title {
        font-size: 28px !important;
    }
    
    .filter-section {
        background: white;
        padding: 16px !important;
        border-radius: 12px;
        margin-bottom: 24px;
    }
    
    .filter-row {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }
    
    .filter-group {
        width: 100% !important;
    }
    
    .filter-group label {
        font-size: 13px !important;
        font-weight: 600;
        margin-bottom: 6px;
    }
    
    .filter-group select,
    .filter-group input {
        width: 100% !important;
        padding: 10px 12px !important;
        font-size: 14px !important;
        border: 2px solid #E0E0E0;
        border-radius: 8px;
    }
    
    .filter-actions {
        grid-column: 1 !important;
        display: flex;
        gap: 8px;
    }
    
    .filter-actions .btn {
        flex: 1;
        padding: 10px 16px !important;
        font-size: 14px !important;
    }
    
    .products-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }
    
    .product-card {
        border-radius: 10px !important;
    }
    
    .product-image {
        height: 180px !important;
    }
    
    .product-info {
        padding: 10px !important;
    }
    
    .product-name {
        font-size: 13px !important;
        margin-bottom: 4px !important;
        line-height: 1.3;
        max-height: 2.6em;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }
    
    .product-price {
        font-size: 15px !important;
    }
    
    .product-original-price {
        font-size: 12px !important;
    }
    
    .discount-badge {
        font-size: 10px !important;
        padding: 3px 6px !important;
    }
    
    .pagination {
        flex-wrap: wrap;
        gap: 6px !important;
    }
    
    .pagination .page-link {
        min-width: 36px !important;
        height: 36px !important;
        font-size: 13px !important;
    }
}

@media (max-width: 480px) {
    .page-title {
        font-size: 24px !important;
    }
    
    .products-grid {
        gap: 10px !important;
    }
    
    .product-image {
        height: 160px !important;
    }
    
    .product-name {
        font-size: 12px !important;
    }
    
    .product-price {
        font-size: 14px !important;
    }
}

/* ============================================
   ORDERS PAGE - MOBILE OPTIMIZATIONS
   ============================================ */

@media (max-width: 768px) {
    .order-history {
        margin-top: 24px;
    }
    
    .order-card {
        padding: 16px !important;
        border-radius: 12px !important;
        margin-bottom: 16px !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    }
    
    .order-card-header {
        display: flex;
        flex-direction: column !important;
        gap: 8px !important;
        margin-bottom: 12px !important;
    }
    
    .order-card-header > div:first-child {
        width: 100%;
    }
    
    .order-card-header strong {
        font-size: 15px !important;
        display: block;
        margin-bottom: 4px;
    }
    
    .order-card-header .order-date {
        font-size: 13px !important;
        color: #757575;
    }
    
    .order-card-header .order-total {
        font-size: 18px !important;
        font-weight: 700;
        color: #7B1FA2;
        text-align: right;
    }
    
    .order-status {
        display: inline-block;
        padding: 4px 12px;
        border-radius: 12px;
        font-size: 12px;
        font-weight: 600;
        margin: 8px 0;
    }
    
    .order-items-list {
        margin-top: 12px;
    }
    
    .order-item-row {
        display: flex;
        justify-content: space-between;
        padding: 8px 0;
        font-size: 13px;
        border-bottom: 1px solid #F5F5F5;
    }
    
    .order-item-row:last-child {
        border-bottom: none;
    }
    
    .order-item-name {
        flex: 1;
        color: #212121;
        line-height: 1.4;
    }
    
    .order-item-price {
        font-weight: 600;
        color: #7B1FA2;
        margin-left: 12px;
        white-space: nowrap;
    }
    
    .section-header {
        padding-bottom: 20px;
    }
    
    .section-title {
        font-size: 26px !important;
    }
    
    .section-subtitle {
        font-size: 14px !important;
    }
}

@media (max-width: 480px) {
    .order-card {
        padding: 12px !important;
    }
    
    .order-card-header strong {
        font-size: 14px !important;
    }
    
    .order-card-header .order-total {
        font-size: 16px !important;
    }
    
    .order-item-row {
        font-size: 12px;
        padding: 6px 0;
    }
    
    .section-title {
        font-size: 22px !important;
    }
}

/* ============================================
   CART PAGE - MOBILE OPTIMIZATIONS
   ============================================ */

@media (max-width: 768px) {
    .cart-container {
        grid-template-columns: 1fr !important;
    }
    
    .cart-items {
        order: 1;
    }
    
    .cart-summary {
        order: 2;
        position: sticky;
        bottom: 0;
        background: white;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
        padding: 16px;
        border-radius: 12px 12px 0 0;
        margin-top: 20px;
    }
    
    .cart-item {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 12px !important;
    }
    
    .cart-item-image {
        width: 100% !important;
        height: 200px !important;
        border-radius: 8px;
    }
    
    .cart-item-details {
        width: 100% !important;
    }
    
    .cart-item-actions {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
}

/* ============================================
   GENERAL MOBILE UTILITIES
   ============================================ */

@media (max-width: 768px) {
    .container {
        padding-left: 16px !important;
        padding-right: 16px !important;
    }
    
    .section {
        padding: 32px 0 !important;
    }
    
    /* Ensure touch targets are at least 44x44px */
    button,
    .btn,
    a.btn,
    input[type="submit"],
    input[type="button"] {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Better form inputs on mobile */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="number"],
    select,
    textarea {
        font-size: 16px !important; /* Prevents zoom on iOS */
    }
    
    /* Prevent horizontal scroll */
    body {
        overflow-x: hidden;
    }
    
    /* Better image loading */
    img {
        max-width: 100%;
        height: auto;
    }
    
    /* Spacing utilities */
    .mobile-mt-2 {
        margin-top: 8px;
    }
    
    .mobile-mt-4 {
        margin-top: 16px;
    }
    
    .mobile-mb-2 {
        margin-bottom: 8px;
    }
    
    .mobile-mb-4 {
        margin-bottom: 16px;
    }
    
    /* Hide on mobile */
    .hide-mobile {
        display: none !important;
    }
    
    /* Show only on mobile */
    .show-mobile {
        display: block !important;
    }
}

/* ============================================
   PERFORMANCE OPTIMIZATIONS
   ============================================ */

/* Lazy loading optimization */
img[loading="lazy"] {
    /* opacity: 0; */
    transition: opacity 0.3s;
}

img[loading="lazy"].loaded {
    opacity: 1;
}

/* Reduce animations on low-end devices */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Better tap highlight */
* {
    -webkit-tap-highlight-color: rgba(255, 152, 0, 0.1);
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Better font rendering */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

