/* ========================================
   COMPREHENSIVE RESPONSIVE ENHANCEMENTS
   100% Mobile-First Design for All Devices
   ======================================== */

/* ===== BASE MOBILE OPTIMIZATIONS ===== */
@media (max-width: 768px) {
    /* Container & Spacing */
    .container, .container-fluid {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    /* Hero Section Mobile */
    .hero-section {
        min-height: 35vh !important;
        padding: 2rem 0 !important;
    }

    .hero-content {
        text-align: center;
    }

    .hero-badge .badge {
        font-size: 0.7rem !important;
        padding: 0.3rem 0.7rem !important;
    }

    .hero-title {
        font-size: 1.75rem !important;
        line-height: 1.2 !important;
        margin-bottom: 1rem !important;
    }

    .hero-subtitle {
        font-size: 0.9rem !important;
        line-height: 1.4 !important;
        margin-bottom: 1.5rem !important;
        padding: 0 1rem;
    }

    /* Search Bar Mobile */
    .hero-search-container {
        padding: 0 1rem !important;
    }

    .search-input-group {
        height: 46px !important;
        border-radius: 8px !important;
    }

    .search-input {
        font-size: 14px !important;
        padding: 0 14px !important;
    }

    .search-btn {
        width: 50px !important;
        font-size: 16px !important;
    }

    /* Hero Action Buttons */
    .btn-hero {
        width: 100% !important;
        min-height: 44px !important;
        padding: 0.75rem 1.5rem !important;
        font-size: 0.9rem !important;
        margin: 0.25rem 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    /* Trust Indicators */
    .hero-trust-indicators {
        margin-top: 2rem !important;
    }

    .trust-item {
        margin-bottom: 1rem;
        padding: 0.5rem;
    }

    .trust-item i {
        font-size: 1.5rem !important;
        margin-bottom: 0.5rem !important;
    }

    .trust-item .small {
        font-size: 0.85rem !important;
    }

    /* Navbar Mobile */
    .main-navbar {
        padding: 0.75rem 0 !important;
    }

    .navbar-brand {
        font-size: 1.25rem !important;
    }

    .navbar-brand i {
        font-size: 1.5rem !important;
    }

    .navbar-toggler {
        padding: 0.5rem !important;
        border-width: 2px !important;
    }

    .navbar-collapse {
        margin-top: 1rem;
        background: white;
        padding: 1rem;
        border-radius: 0.75rem;
        box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    }

    /* Navigation Links */
    .nav-primary-actions {
        flex-direction: column;
        width: 100%;
        gap: 0.5rem;
    }

    .nav-action-btn {
        width: 100% !important;
        min-height: 44px !important;
        padding: 0.75rem 1.25rem !important;
        justify-content: center !important;
        font-size: 0.9rem !important;
    }

    .nav-action-btn i {
        margin-right: 0.5rem !important;
    }

    /* Account Section Mobile */
    .navbar-account-info {
        width: 100%;
        padding: 1rem 0;
    }

    .navbar-user-container,
    .navbar-login-container {
        width: 100% !important;
        min-height: 44px !important;
        padding: 0.75rem 1rem !important;
        justify-content: center !important;
    }

    /* User Dropdown Mobile */
    .user-dropdown {
        position: static !important;
        margin-top: 0.5rem;
        width: 100%;
    }

    .navbar-user-container:hover .user-dropdown {
        display: none;
    }

    /* Click to open dropdown on mobile */
    .navbar-user-container.active .user-dropdown {
        display: block !important;
    }

    /* Search in Nav - Hide on Mobile (Hero search is primary) */
    .nav-search-compact {
        display: none !important;
    }

    /* Categories Section */
    .popular-categories {
        padding: 1rem 0 !important;
    }

    .categories-header h2 {
        font-size: 1.25rem !important;
    }

    .category-link {
        padding: 0.75rem 1rem !important;
        font-size: 0.85rem !important;
        min-width: 140px !important;
    }

    .category-link i {
        font-size: 1.25rem !important;
    }

    /* Swipe Indicators */
    .swipe-indicator {
        width: 32px !important;
        height: 32px !important;
    }

    /* Section Titles */
    .section-title {
        font-size: 1.5rem !important;
        margin-bottom: 1rem !important;
    }

    .section-subtitle {
        font-size: 0.9rem !important;
        margin-bottom: 1.25rem !important;
    }

    /* Product Grid - 2 Columns */
    .row.row-cols-3,
    .row.row-cols-md-4 {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
    }

    .row.row-cols-3 > .col,
    .row.row-cols-md-4 > .col {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
    }

    /* Product Cards Mobile-Optimized */
    .product-card {
        height: auto !important;
        min-height: 280px !important;
    }

    .product-img-container {
        height: 140px !important;
    }

    .product-img {
        max-height: 85% !important;
        max-width: 85% !important;
    }

    .product-card .card-body {
        padding: 0.75rem !important;
    }

    .product-card .card-title {
        font-size: 0.85rem !important;
        line-height: 1.3 !important;
        height: auto !important;
        min-height: 2.4rem !important;
        margin-bottom: 0.5rem !important;
    }

    .product-card .card-text {
        font-size: 0.75rem !important;
        margin-bottom: 0.4rem !important;
    }

    .product-card .text-success {
        font-size: 0.95rem !important;
        margin-bottom: 0.4rem !important;
    }

    .product-card .text-muted,
    .product-card .text-warning {
        font-size: 0.75rem !important;
        margin-bottom: 0.4rem !important;
    }

    .product-card .btn {
        font-size: 0.8rem !important;
        padding: 0.5rem 0.75rem !important;
        min-height: 36px !important;
        width: 100% !important;
        margin-bottom: 0.35rem !important;
    }

    .product-card .btn:last-child {
        margin-bottom: 0 !important;
    }

    .product-card .btn i {
        display: inline-block !important;
        margin-right: 0.25rem !important;
        font-size: 0.85rem !important;
    }

    /* Featured Badge Mobile */
    .featured-badge {
        font-size: 0.65rem !important;
        padding: 0.2rem 0.4rem !important;
        top: 0.4rem !important;
        right: 0.4rem !important;
    }

    /* Badge Sizes */
    .badge {
        font-size: 0.7rem !important;
        padding: 0.25rem 0.5rem !important;
    }

    /* Category Cards */
    .category-card {
        padding: 1rem !important;
        margin-bottom: 0.75rem;
    }

    .category-card h5 {
        font-size: 0.95rem !important;
    }

    .category-card .category-icon i {
        font-size: 1.5rem !important;
    }

    /* Stats Cards */
    .stats-card {
        padding: 1rem !important;
        margin-bottom: 1rem;
    }

    .stats-card h3 {
        font-size: 1.5rem !important;
    }

    /* Footer Mobile */
    footer {
        padding: 2rem 0 1rem !important;
    }

    footer h5 {
        font-size: 1rem !important;
        margin-bottom: 0.75rem !important;
    }

    footer p,
    footer li,
    footer a {
        font-size: 0.85rem !important;
    }

    footer .social-links a {
        width: 36px !important;
        height: 36px !important;
    }

    /* Back to Top/Bottom Buttons */
    .back-to-top,
    .back-to-bottom {
        width: 44px !important;
        height: 44px !important;
        bottom: 1rem !important;
    }

    .back-to-bottom {
        bottom: 4.5rem !important;
    }

    /* Modals Mobile */
    .modal-dialog {
        margin: 0.5rem !important;
    }

    .modal-content {
        border-radius: 0.75rem !important;
    }

    /* Customer Welcome Bar */
    .customer-welcome-bar {
        padding: 0.75rem 0 !important;
        font-size: 0.85rem !important;
    }

    .welcome-message {
        justify-content: center;
        margin-bottom: 0.5rem;
    }

    .customer-badges {
        justify-content: center;
    }
}

/* ===== EXTRA SMALL DEVICES (< 480px) ===== */
@media (max-width: 480px) {
    /* Hero Section Ultra-Small */
    .hero-section {
        min-height: 40vh !important;
        padding: 1.5rem 0 !important;
    }

    .hero-title {
        font-size: 1.5rem !important;
    }

    .hero-subtitle {
        font-size: 0.85rem !important;
        padding: 0 0.5rem;
    }

    .search-input-group {
        height: 48px !important;
    }

    .btn-hero {
        padding: 0.8rem 1.25rem !important;
        font-size: 0.85rem !important;
    }

    /* Trust Items Compact */
    .trust-item i {
        font-size: 1.25rem !important;
    }

    .trust-item .small {
        font-size: 0.75rem !important;
    }

    /* Navbar Ultra-Small */
    .navbar-brand {
        font-size: 1.15rem !important;
    }

    .navbar-brand i {
        font-size: 1.35rem !important;
    }

    .nav-action-btn {
        font-size: 0.85rem !important;
        padding: 0.65rem 1rem !important;
    }

    /* Section Titles Ultra-Small */
    .section-title {
        font-size: 1.35rem !important;
    }

    .section-subtitle {
        font-size: 0.85rem !important;
    }

    /* Product Grid - Maintain 2 Columns */
    .row.row-cols-3,
    .row.row-cols-md-4 {
        gap: 0.65rem !important;
    }

    /* Product Cards Ultra-Small */
    .product-card {
        min-height: 270px !important;
    }

    .product-img-container {
        height: 130px !important;
    }

    .product-card .card-body {
        padding: 0.65rem !important;
    }

    .product-card .card-title {
        font-size: 0.8rem !important;
        min-height: 2.2rem !important;
    }

    .product-card .card-text {
        font-size: 0.7rem !important;
    }

    .product-card .text-success {
        font-size: 0.9rem !important;
    }

    .product-card .btn {
        font-size: 0.75rem !important;
        padding: 0.45rem 0.65rem !important;
        min-height: 34px !important;
    }

    .product-card .btn i {
        font-size: 0.8rem !important;
    }

    /* Featured Badge Ultra-Small */
    .featured-badge {
        font-size: 0.6rem !important;
        padding: 0.15rem 0.35rem !important;
    }

    /* Category Cards Ultra-Small */
    .category-link {
        font-size: 0.8rem !important;
        min-width: 130px !important;
        padding: 0.65rem 0.85rem !important;
    }

    .category-link i {
        font-size: 1.15rem !important;
    }

    /* Footer Ultra-Small */
    footer {
        text-align: center;
    }

    footer h5 {
        font-size: 0.95rem !important;
    }

    footer p,
    footer li,
    footer a {
        font-size: 0.8rem !important;
    }
}

/* ===== LANDSCAPE ORIENTATION FIXES ===== */
@media (max-width: 812px) and (orientation: landscape) {
    .hero-section {
        min-height: 60vh !important;
    }

    .product-card {
        min-height: 240px !important;
    }

    .product-img-container {
        height: 110px !important;
    }
}

/* ===== TABLET OPTIMIZATIONS (768px - 992px) ===== */
@media (min-width: 769px) and (max-width: 992px) {
    .row.row-cols-3,
    .row.row-cols-md-4 {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 1rem !important;
    }

    .product-card {
        min-height: 320px !important;
    }

    .nav-action-btn {
        padding: 0.65rem 1rem !important;
        font-size: 0.85rem !important;
    }
}

/* ===== TOUCH DEVICE IMPROVEMENTS ===== */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets for all interactive elements */
    .btn,
    .nav-link,
    .category-link,
    a {
        min-height: 44px !important;
        min-width: 44px !important;
    }

    /* Remove hover effects on touch devices */
    .product-card:hover {
        transform: none !important;
    }

    /* Active state for touch feedback */
    .btn:active,
    .nav-link:active,
    .category-link:active {
        opacity: 0.8;
        transform: scale(0.98);
    }
}

/* ===== ACCESSIBILITY IMPROVEMENTS ===== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== HIGH DPI DISPLAY IMPROVEMENTS ===== */
@media (-webkit-min-device-pixel-ratio: 2),
       (min-resolution: 192dpi) {
    .product-img,
    .category-icon,
    img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .navbar,
    .hero-section,
    .categories-container,
    footer,
    .back-to-top,
    .back-to-bottom,
    .modal {
        display: none !important;
    }

    .product-card {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}
