/* ==========================================
   MOBILE NAVIGATION & TOUCH IMPROVEMENTS
   ========================================== */

/* Touch Target Sizes - WCAG 2.1 AAA */
@media (max-width: 768px) {
    /* Minimum 44x44px touch targets */
    button,
    .btn,
    a.btn,
    input[type="button"],
    input[type="submit"],
    select,
    .form-control,
    .navbar-toggler,
    .dropdown-toggle {
        min-height: 44px;
        min-width: 44px;
        padding: 0.75rem 1rem;
    }
    
    /* Navigation Links */
    .navbar-nav .nav-link {
        padding: 1rem;
        min-height: 48px;
        display: flex;
        align-items: center;
    }
    
    /* Icon Buttons */
    .btn-icon,
    .cart-icon,
    .wishlist-icon,
    .search-icon {
        min-width: 48px;
        min-height: 48px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 0.75rem;
    }
    
    /* Product Cards */
    .product-card .btn {
        min-height: 44px;
        width: 100%;
    }
    
    /* Form Controls */
    .form-control,
    .form-select {
        min-height: 48px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    /* Quantity Controls */
    .quantity-controls button {
        min-width: 44px;
        min-height: 44px;
    }
}

/* Mobile Navigation Enhancements */
@media (max-width: 992px) {
    .navbar-collapse {
        background: #232f3e !important;
        margin-top: 1rem;
        padding: 1rem;
        border-radius: 8px;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        display: none !important;
    }
    
    .navbar-collapse.show,
    .navbar-collapse.collapsing {
        display: flex !important;
        flex-direction: column;
    }
    
    .navbar-nav {
        gap: 0.5rem;
        width: 100%;
    }
    
    .navbar-nav .nav-link {
        border-radius: 4px;
        transition: background-color 0.2s;
        color: rgba(255,255,255,0.9) !important;
    }
    
    .navbar-nav .nav-link:hover,
    .navbar-nav .nav-link:focus {
        background-color: rgba(255,255,255,0.1) !important;
        color: #fff !important;
    }
    
    .navbar-nav .dropdown-menu {
        position: static;
        float: none;
        width: 100%;
        margin-top: 0;
        border: none;
        box-shadow: none;
        background: rgba(255,255,255,0.05) !important;
    }
    
    .navbar-nav .dropdown-item {
        padding: 0.75rem 1.5rem;
        min-height: 44px;
        color: rgba(255,255,255,0.8) !important;
    }
    
    .navbar-nav .dropdown-item:hover {
        background-color: rgba(255,255,255,0.1) !important;
        color: #fff !important;
    }
}

/* Swipe Gestures */
.swipeable {
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
}

/* Mobile Menu Toggle */
.navbar-toggler {
    padding: 0.5rem;
    border: none;
    background: transparent;
}

.navbar-toggler:focus {
    outline: 2px solid var(--primary-color, #4361ee);
    outline-offset: 2px;
}

.navbar-toggler-icon {
    width: 24px;
    height: 24px;
}

/* Mobile Search */
@media (max-width: 768px) {
    .search-bar {
        width: 100%;
        margin: 1rem 0;
    }
    
    .search-bar .form-control {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .search-bar .btn {
        min-width: 48px;
    }
}

/* Mobile Cart & Wishlist */
@media (max-width: 768px) {
    .cart-icon,
    .wishlist-icon {
        position: relative;
        min-width: 48px;
        min-height: 48px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    
    .cart-count,
    .wishlist-counter {
        position: absolute;
        top: 0;
        right: 0;
        transform: translate(25%, -25%);
        font-size: 0.75rem;
        min-width: 20px;
        height: 20px;
        padding: 0 6px;
    }
}

/* Mobile Product Cards */
@media (max-width: 768px) {
    .product-card {
        margin-bottom: 1.5rem;
    }
    
    .product-card .card-img-top {
        height: auto;
        min-height: 200px;
    }
    
    .product-card .btn-group {
        width: 100%;
        flex-direction: column;
    }
    
    .product-card .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
}

/* Mobile Forms */
@media (max-width: 768px) {
    .form-row {
        flex-direction: column;
    }
    
    .form-group {
        margin-bottom: 1rem;
    }
    
    .form-control,
    .form-select {
        width: 100%;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .btn-group {
        width: 100%;
        flex-direction: column;
    }
    
    .btn-group .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
}

/* Mobile Tables */
@media (max-width: 768px) {
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table-responsive {
        border: none;
    }
}

/* Mobile Modals */
@media (max-width: 768px) {
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }
    
    .modal-content {
        border-radius: 8px;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem;
    }
    
    .modal-header .btn-close {
        padding: 0.5rem;
        margin: -0.5rem -0.5rem -0.5rem auto;
    }
}

/* Mobile Toast Notifications */
@media (max-width: 768px) {
    .toast-container {
        left: 10px;
        right: 10px;
        max-width: none;
    }
    
    .toast {
        width: 100%;
        max-width: none;
    }
}

/* Mobile Pagination */
@media (max-width: 768px) {
    .pagination {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .pagination .page-link {
        min-width: 44px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 0.5rem;
    }
}

/* Safe Area Support for iOS */
@supports (padding: max(0px)) {
    .navbar,
    .footer,
    .main-content {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }
    
    .navbar {
        padding-top: max(0.5rem, env(safe-area-inset-top));
    }
    
    .footer {
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }
}

/* Landscape Orientation Adjustments */
@media (max-width: 768px) and (orientation: landscape) {
    .navbar-collapse {
        max-height: calc(100vh - 120px);
        overflow-y: auto;
    }
}

/* Improved Scrolling on Mobile */
@media (max-width: 768px) {
    body {
        -webkit-overflow-scrolling: touch;
    }
    
    .overflow-auto,
    .overflow-scroll {
        -webkit-overflow-scrolling: touch;
    }
}

