/**
 * Mobile Responsive CSS for ShopSpark
 * Applies to all pages for consistent mobile experience
 * Last Updated: January 2025
 */

/* ========================================
   BASE MOBILE IMPROVEMENTS
   ======================================== */

/* Prevent horizontal scroll on mobile */
html, body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

/* Better touch targets */
* {
    -webkit-tap-highlight-color: rgba(77, 133, 50, 0.2);
}

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

/* ========================================
   TYPOGRAPHY - MOBILE
   ======================================== */

@media (max-width: 768px) {
    body {
        font-size: 16px;
        line-height: 1.6;
    }
    
    h1 {
        font-size: 1.75rem !important;
        line-height: 1.2 !important;
    }
    
    h2 {
        font-size: 1.5rem !important;
        line-height: 1.3 !important;
    }
    
    h3 {
        font-size: 1.25rem !important;
        line-height: 1.3 !important;
    }
    
    p {
        font-size: 1rem;
        line-height: 1.6;
    }
}

/* ========================================
   HEADER - MOBILE
   ======================================== */

@media (max-width: 768px) {
    .header {
        padding: 0.75rem 0 !important;
        position: sticky;
        top: 0;
        z-index: 1000;
        background: #4d8532;
    }
    
    .header-content {
        flex-wrap: nowrap !important;
        gap: 0.5rem !important;
        padding: 0 1rem !important;
    }
    
    .logo h1 {
        font-size: 1.25rem !important;
        margin: 0 !important;
    }
    
    /* Hide desktop nav on mobile */
    .nav,
    .main-nav {
        display: none !important;
    }
    
    /* Mobile menu button */
    .mobile-menu-toggle,
    .mobile-menu-btn {
        display: block !important;
        background: transparent;
        border: none;
        color: white;
        font-size: 1.5rem;
        padding: 0.5rem;
        cursor: pointer;
        min-width: 44px;
        min-height: 44px;
    }
    
    /* Header search */
    .search-box {
        display: none !important; /* Hide on small mobile, show in menu */
    }
    
    /* Cart icon */
    .cart-icon {
        min-width: 44px !important;
        min-height: 44px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        position: relative;
    }
    
    .cart-count {
        min-width: 18px !important;
        min-height: 18px !important;
        font-size: 0.7rem !important;
        line-height: 18px !important;
    }
}

/* Show search on larger mobile */
@media (min-width: 480px) and (max-width: 768px) {
    .search-box {
        display: flex !important;
        flex: 1;
        min-width: 0;
    }
    
    .search-box input {
        font-size: 14px !important;
        padding: 0.5rem !important;
    }
}

/* ========================================
   HERO SECTIONS - MOBILE
   ======================================== */

@media (max-width: 768px) {
    .hero,
    .hero-section,
    .page-header {
        padding: 6rem 1rem 3rem !important;
        text-align: center !important;
    }
    
    .hero-content {
        padding: 0 1rem !important;
    }
    
    .hero h1,
    .hero-title {
        font-size: 1.75rem !important;
        margin-bottom: 1rem !important;
        line-height: 1.2 !important;
    }
    
    .hero p,
    .hero-subtitle {
        font-size: 1rem !important;
        margin-bottom: 1.5rem !important;
        line-height: 1.5 !important;
    }
    
    .hero-buttons {
        flex-direction: column !important;
        gap: 0.75rem !important;
        align-items: stretch !important;
    }
    
    .hero-buttons .btn {
        width: 100% !important;
        justify-content: center !important;
    }
}

/* ========================================
   BUTTONS - MOBILE
   ======================================== */

@media (max-width: 768px) {
    .btn,
    button:not(.mobile-menu-close):not(.mobile-menu-toggle) {
        min-height: 48px !important;
        padding: 0.75rem 1.25rem !important;
        font-size: 1rem !important;
        border-radius: 8px !important;
        font-weight: 600 !important;
    }
    
    .btn-primary {
        width: 100%;
        max-width: 100%;
    }
    
    .btn i {
        font-size: 1.1rem;
    }
}

/* ========================================
   CONTAINERS - MOBILE
   ======================================== */

@media (max-width: 768px) {
    .container {
        padding: 0 1rem !important;
        max-width: 100% !important;
    }
    
    .section,
    section {
        padding: 2.5rem 0 !important;
    }
}

/* ========================================
   PRODUCT CARDS - MOBILE
   ======================================== */

@media (max-width: 768px) {
    .products-grid,
    #productsGrid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
        padding: 0 !important;
    }
    
    .product-card,
    .category-product-card {
        margin: 0 !important;
        border-radius: 12px !important;
    }
    
    .product-image-container {
        height: 200px !important;
        max-height: 200px !important;
    }
    
    .product-image {
        max-height: 200px !important;
    }
    
    .product-info {
        padding: 1rem !important;
    }
    
    .product-name {
        font-size: 1rem !important;
        line-height: 1.3 !important;
        min-height: 40px !important;
    }
    
    .product-price,
    .price-current {
        font-size: 1.25rem !important;
    }
    
    .product-actions {
        margin-top: 0.75rem !important;
    }
    
    .add-to-cart-btn {
        width: 100% !important;
        min-height: 48px !important;
        font-size: 1rem !important;
    }
}

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

@media (max-width: 768px) {
    .product-grid {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }
    
    .image-gallery {
        position: static !important;
        max-width: 100% !important;
        margin-bottom: 1rem !important;
    }
    
    .main-image-container {
        height: 250px !important;
        max-height: 250px !important;
    }
    
    .main-image {
        max-height: 250px !important;
    }
    
    .thumbnail {
        width: 60px !important;
        height: 60px !important;
    }
    
    .product-details {
        padding: 0 !important;
    }
    
    .product-info h1 {
        font-size: 1.5rem !important;
    }
    
    .variation-option {
        min-width: 70px !important;
        padding: 0.6rem 0.75rem !important;
        font-size: 0.9rem !important;
    }
    
    .quantity-control {
        width: 100% !important;
        justify-content: center !important;
    }
    
    .cart-section {
        position: sticky !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        background: white !important;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1) !important;
        padding: 1rem !important;
        margin: 0 !important;
        border-radius: 16px 16px 0 0 !important;
        z-index: 999 !important;
    }
}

/* ========================================
   FILTERS - MOBILE
   ======================================== */

@media (max-width: 768px) {
    .filters-container {
        flex-direction: column !important;
        gap: 0.75rem !important;
        align-items: stretch !important;
        padding: 1rem !important;
        background: white !important;
        border-radius: 12px !important;
        margin-bottom: 1rem !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
    }
    
    .search-box,
    .filter-group {
        width: 100% !important;
        min-width: 0 !important;
    }
    
    .filter-group {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .filter-group label {
        font-size: 0.9rem;
        font-weight: 600;
    }
    
    .filter-group select,
    .filter-group input {
        width: 100% !important;
        min-height: 44px !important;
        font-size: 1rem !important;
        padding: 0.75rem !important;
    }
    
    .price-filter {
        flex-direction: column !important;
        gap: 0.75rem !important;
    }
    
    .price-inputs {
        width: 100% !important;
        justify-content: space-between !important;
    }
    
    .price-inputs input {
        flex: 1 !important;
        min-width: 0 !important;
        min-height: 44px !important;
    }
    
    .btn-apply {
        width: 100% !important;
        min-height: 48px !important;
    }
}

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

@media (max-width: 768px) {
    .cart-layout {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }
    
    .cart-items,
    .cart-summary {
        padding: 1rem !important;
    }
    
    .cart-table-header {
        display: none !important;
    }
    
    .cart-item-row {
        display: flex !important;
        flex-direction: column !important;
        gap: 1rem !important;
        padding: 1rem !important;
        border: 1px solid #e5e5e5 !important;
        border-radius: 12px !important;
        margin-bottom: 1rem !important;
    }
    
    .cart-item-product {
        flex-direction: row !important;
        gap: 1rem !important;
    }
    
    .cart-item-image {
        width: 80px !important;
        height: 80px !important;
    }
    
    .cart-item-details {
        flex: 1;
    }
    
    .cart-item-price,
    .cart-item-total {
        font-size: 1.1rem !important;
    }
    
    .quantity-control {
        justify-content: center !important;
    }
    
    .cart-actions {
        flex-direction: column !important;
        gap: 0.75rem !important;
    }
    
    .cart-actions .btn {
        width: 100% !important;
    }
    
    .cart-summary {
        position: static !important;
    }
}

/* ========================================
   TABLES - MOBILE
   ======================================== */

@media (max-width: 768px) {
    table {
        display: block !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    thead {
        display: none !important;
    }
    
    tbody,
    tr {
        display: block !important;
    }
    
    td {
        display: flex !important;
        justify-content: space-between !important;
        padding: 0.75rem !important;
        border-bottom: 1px solid #e5e5e5 !important;
    }
    
    td:before {
        content: attr(data-label);
        font-weight: 600;
        margin-right: 1rem;
    }
}

/* ========================================
   FORMS - MOBILE
   ======================================== */

@media (max-width: 768px) {
    form {
        width: 100% !important;
    }
    
    input,
    textarea,
    select {
        width: 100% !important;
        min-height: 48px !important;
        font-size: 16px !important; /* Prevents zoom on iOS */
        padding: 0.75rem 1rem !important;
        border-radius: 8px !important;
    }
    
    textarea {
        min-height: 120px !important;
    }
    
    label {
        display: block !important;
        margin-bottom: 0.5rem !important;
        font-weight: 600 !important;
    }
    
    .form-group {
        margin-bottom: 1.25rem !important;
    }
}

/* ========================================
   FOOTER - MOBILE
   ======================================== */

@media (max-width: 768px) {
    .footer {
        padding: 2rem 0 1rem !important;
    }
    
    .footer-content {
        grid-template-columns: 1fr !important;
        gap: 2rem !important;
        text-align: center !important;
    }
    
    .footer-section {
        padding: 0 1rem !important;
    }
    
    .footer-section h3 {
        font-size: 1.2rem !important;
        margin-bottom: 1rem !important;
    }
    
    .footer-section ul {
        list-style: none !important;
        padding: 0 !important;
    }
    
    .footer-section li {
        margin-bottom: 0.75rem !important;
    }
    
    .social-links {
        justify-content: center !important;
        gap: 1rem !important;
    }
    
    .social-link {
        min-width: 48px !important;
        min-height: 48px !important;
    }
    
    .footer-bottom {
        padding: 1.5rem 1rem !important;
        font-size: 0.9rem !important;
    }
}

/* ========================================
   BREADCRUMBS - MOBILE
   ======================================== */

@media (max-width: 768px) {
    .breadcrumb {
        font-size: 0.85rem !important;
        padding: 0.75rem 0 !important;
        overflow-x: auto !important;
        white-space: nowrap !important;
        -webkit-overflow-scrolling: touch !important;
    }
}

/* ========================================
   MODALS - MOBILE
   ======================================== */

@media (max-width: 768px) {
    .modal,
    .modal-content {
        width: 95% !important;
        max-width: 95% !important;
        margin: 1rem auto !important;
        padding: 1.5rem 1rem !important;
    }
    
    .modal-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 1rem !important;
    }
    
    .modal-close {
        min-width: 44px !important;
        min-height: 44px !important;
        position: absolute !important;
        top: 0.5rem !important;
        right: 0.5rem !important;
    }
}

/* ========================================
   NOTIFICATIONS - MOBILE
   ======================================== */

@media (max-width: 768px) {
    .woo-cart-notification,
    .notification,
    .toast {
        left: 1rem !important;
        right: 1rem !important;
        top: 80px !important;
        max-width: calc(100% - 2rem) !important;
        min-width: 0 !important;
        transform: translateX(0) translateY(-100px) !important;
    }
    
    .woo-cart-notification.show,
    .notification.show,
    .toast.show {
        transform: translateX(0) translateY(0) !important;
    }
    
    .notification-content {
        padding: 1rem !important;
        font-size: 0.95rem !important;
    }
}

/* ========================================
   FEATURED PRODUCTS SLIDER - MOBILE
   ======================================== */

@media (max-width: 768px) {
    .product-swiper {
        padding-bottom: 3rem !important;
    }
    
    .swiper-button-next,
    .swiper-button-prev {
        width: 36px !important;
        height: 36px !important;
    }
    
    .swiper-button-next:after,
    .swiper-button-prev:after {
        font-size: 1rem !important;
    }
    
    .swiper-pagination-bullet {
        width: 8px !important;
        height: 8px !important;
    }
}

/* ========================================
   CATEGORIES GRID - MOBILE
   ======================================== */

@media (max-width: 768px) {
    .categories-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
        padding: 0 1rem !important;
    }
    
    .category-card {
        padding: 2rem 1.5rem !important;
        text-align: center !important;
    }
    
    .category-icon {
        width: 60px !important;
        height: 60px !important;
        font-size: 1.8rem !important;
        margin-bottom: 1rem !important;
    }
    
    .category-card h3 {
        font-size: 1.3rem !important;
    }
}

/* ========================================
   FEATURES GRID - MOBILE
   ======================================== */

@media (max-width: 768px) {
    .features-grid {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
        padding: 0 1rem !important;
    }
    
    .feature-card {
        padding: 1.5rem 1rem !important;
        text-align: center !important;
    }
    
    .feature-icon {
        width: 60px !important;
        height: 60px !important;
        font-size: 1.6rem !important;
        margin-bottom: 1rem !important;
    }
}

/* ========================================
   PAGINATION - MOBILE
   ======================================== */

@media (max-width: 768px) {
    .pagination {
        flex-wrap: wrap !important;
        gap: 0.5rem !important;
        justify-content: center !important;
        padding: 1rem !important;
    }
    
    .pagination button,
    .pagination a {
        min-width: 44px !important;
        min-height: 44px !important;
        padding: 0.5rem !important;
        font-size: 0.9rem !important;
    }
    
    #pageNumbers {
        display: flex !important;
        gap: 0.5rem !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
    }
}

/* ========================================
   LOADING STATES - MOBILE
   ======================================== */

@media (max-width: 768px) {
    .loading {
        padding: 3rem 1rem !important;
        min-height: 200px !important;
    }
    
    .loading i {
        font-size: 2.5rem !important;
    }
    
    .spinner {
        width: 40px !important;
        height: 40px !important;
    }
}

/* ========================================
   EMPTY STATES - MOBILE
   ======================================== */

@media (max-width: 768px) {
    .empty-cart,
    .no-results,
    .no-products {
        padding: 3rem 1.5rem !important;
    }
    
    .empty-cart-icon,
    .no-results i {
        font-size: 3rem !important;
        margin-bottom: 1rem !important;
    }
    
    .empty-cart h2,
    .no-results h3 {
        font-size: 1.3rem !important;
        margin-bottom: 0.75rem !important;
    }
}

/* ========================================
   UTILITY CLASSES - MOBILE
   ======================================== */

@media (max-width: 768px) {
    .hide-mobile {
        display: none !important;
    }
    
    .show-mobile {
        display: block !important;
    }
    
    .text-center-mobile {
        text-align: center !important;
    }
    
    .full-width-mobile {
        width: 100% !important;
    }
}

/* ========================================
   ACCESSIBILITY - MOBILE
   ======================================== */

/* Larger touch targets for better accessibility */
@media (max-width: 768px) {
    a,
    button,
    input[type="submit"],
    input[type="button"],
    .clickable {
        min-width: 44px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

/* Focus visible for keyboard navigation */
*:focus-visible {
    outline: 2px solid #4d8532 !important;
    outline-offset: 2px !important;
}

/* ========================================
   PERFORMANCE - MOBILE
   ======================================== */

/* Hardware acceleration for smoother animations */
@media (max-width: 768px) {
    .product-card,
    .category-card,
    .btn,
    .modal {
        transform: translateZ(0);
        will-change: transform;
    }
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
    .header,
    .footer,
    .mobile-menu,
    .cart-icon,
    .add-to-cart-btn,
    .filters-container {
        display: none !important;
    }
    
    .container {
        max-width: 100% !important;
    }
}

/* ========================================
   END OF MOBILE RESPONSIVE STYLES
   ======================================== */
