/*=========================================================
| Additional Responsive Fixes for Complete Mobile Support
==========================================================*/

/* Ensure viewport meta tag is respected */
html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

/* Global container improvements */
@media (max-width: 1200px) {
    .container-fluid {
        max-width: 100%;
        padding-left: 15px;
        padding-right: 15px;
    }
}

/* Header comprehensive fixes */
@media (max-width: 991.98px) {
    /* Top header completely hidden on mobile */
    .top-header {
        display: none !important;
    }
    
    /* Main navigation hidden on mobile */
    .main-nav {
        display: none !important;
    }
    
    /* Header sticky improvements */
    .header-sticky {
        padding: 8px 0 !important;
        min-height: 60px;
        display: flex;
        align-items: center;
    }
    
    .header-sticky .row {
        --bs-gutter-x: 15px;
    }
    
    /* Mobile header layout optimization */
    .header-sticky .col-6:first-child {
        display: flex;
        align-items: center;
    }
    
    .header-sticky .col-6:last-child {
        display: flex;
        align-items: center;
        justify-content: flex-end;
    }
}

/* Extra small devices optimization */
@media (max-width: 575.98px) {
    .header-sticky {
        padding: 5px 0 !important;
        min-height: 55px;
    }
    
    /* Hide less important elements on very small screens */
    .sign-in .has-dropdown {
        padding: 5px !important;
    }
    
    /* Optimize spacing */
    .header-cart-1 {
        margin-left: 3px;
        margin-right: 3px;
    }
}

/* Product pages responsive */
@media (max-width: 767.98px) {
    .product-details {
        padding: 15px 0;
    }
    
    .product-images {
        margin-bottom: 20px;
    }
    
    .product-info {
        text-align: center;
    }
    
    .product-info h1 {
        font-size: 20px;
        margin-bottom: 10px;
    }
    
    .product-price {
        font-size: 18px;
        margin-bottom: 15px;
    }
}

/* Cart page responsive */
@media (max-width: 767.98px) {
    .cart-table {
        font-size: 14px;
    }
    
    .cart-table th,
    .cart-table td {
        padding: 8px 4px;
    }
    
    .cart-table .product-thumbnail {
        width: 60px;
        height: 60px;
    }
    
    .cart-table .product-name {
        font-size: 12px;
        line-height: 1.3;
    }
    
    .cart-summary {
        margin-top: 20px;
        text-align: center;
    }
}

/* Category page responsive */
@media (max-width: 991.98px) {
    .shop-sidebar {
        margin-bottom: 30px;
    }
    
    .products-grid {
        margin-top: 20px;
    }
    
    .product-item {
        margin-bottom: 20px;
    }
}

/* Blog responsive */
@media (max-width: 767.98px) {
    .blog-post {
        margin-bottom: 30px;
    }
    
    .blog-post .post-thumbnail {
        margin-bottom: 15px;
    }
    
    .blog-post .post-content {
        padding: 15px;
    }
    
    .blog-post h3 {
        font-size: 18px;
        margin-bottom: 10px;
    }
}

/* Form responsive */
@media (max-width: 575.98px) {
    .form-group {
        margin-bottom: 20px;
    }
    
    .form-control {
        padding: 12px 15px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .btn {
        padding: 12px 20px;
        font-size: 16px;
        width: 100%;
        margin-bottom: 10px;
    }
    
    .btn-group .btn {
        width: auto;
    }
}

/* Checkout responsive */
@media (max-width: 767.98px) {
    .checkout-form {
        margin-bottom: 30px;
    }
    
    .order-summary {
        background: #f8f9fa;
        padding: 20px;
        border-radius: 8px;
    }
    
    .payment-methods {
        margin-top: 20px;
    }
    
    .payment-method {
        margin-bottom: 15px;
        padding: 15px;
        border: 1px solid #ddd;
        border-radius: 5px;
    }
}

/* User dashboard responsive */
@media (max-width: 991.98px) {
    .dashboard-sidebar {
        margin-bottom: 30px;
    }
    
    .dashboard-content {
        padding: 15px;
    }
    
    .dashboard-sidebar-btn {
        width: 100%;
        margin-bottom: 20px;
        padding: 10px;
        background: var(--theme-primary-color);
        color: white;
        border: none;
        border-radius: 5px;
    }
}

/* Modal responsive */
@media (max-width: 575.98px) {
    .modal-dialog {
        margin: 10px;
    }
    
    .modal-content {
        border-radius: 10px;
    }
    
    .modal-header {
        padding: 15px;
        border-bottom: 1px solid #dee2e6;
    }
    
    .modal-body {
        padding: 20px 15px;
    }
    
    .modal-footer {
        padding: 15px;
        border-top: 1px solid #dee2e6;
    }
}

/* Pagination responsive */
@media (max-width: 575.98px) {
    .pagination {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .page-link {
        padding: 8px 12px;
        margin: 2px;
        font-size: 14px;
    }
    
    .pagination .page-item:first-child .page-link,
    .pagination .page-item:last-child .page-link {
        border-radius: 5px;
    }
}

/* Breadcrumb enhancements */
@media (max-width: 575.98px) {
    .breadcrumb {
        background: transparent;
        padding: 10px 0;
        margin-bottom: 20px;
        font-size: 12px;
        overflow-x: auto;
        white-space: nowrap;
    }
    
    .breadcrumb-item + .breadcrumb-item::before {
        padding: 0 5px;
    }
}

/* Image responsive fixes */
@media (max-width: 767.98px) {
    img {
        max-width: 100%;
        height: auto;
    }
    
    .img-responsive {
        width: 100%;
        height: auto;
    }
    
    .banner-image,
    .hero-image {
        width: 100%;
        height: 250px;
        object-fit: cover;
    }
}

/* Table responsive wrapper */
@media (max-width: 767.98px) {
    .table-responsive {
        border: none;
        margin-bottom: 0;
    }
    
    .table-responsive > .table {
        margin-bottom: 0;
        background-color: #fff;
    }
    
    .table-responsive > .table > thead > tr > th,
    .table-responsive > .table > tbody > tr > th,
    .table-responsive > .table > tfoot > tr > th,
    .table-responsive > .table > thead > tr > td,
    .table-responsive > .table > tbody > tr > td,
    .table-responsive > .table > tfoot > tr > td {
        white-space: nowrap;
        font-size: 12px;
        padding: 8px;
    }
}

/* Footer responsive improvements */
@media (max-width: 991.98px) {
    .footer {
        text-align: center;
        padding: 40px 0;
    }
    
    .footer-widget {
        margin-bottom: 30px;
    }
    
    .footer-widget h6 {
        margin-bottom: 15px;
        font-size: 16px;
    }
    
    .footer-widget ul {
        list-style: none;
        padding: 0;
    }
    
    .footer-widget ul li {
        margin-bottom: 8px;
    }
    
    .footer-widget ul li a {
        color: #666;
        text-decoration: none;
        font-size: 14px;
    }
    
    .footer-widget ul li a:hover {
        color: var(--theme-primary-color);
    }
}

/* Social media responsive */
@media (max-width: 575.98px) {
    .social-media {
        text-align: center;
        margin: 20px 0;
    }
    
    .social-media a {
        display: inline-block;
        margin: 0 10px;
        width: 40px;
        height: 40px;
        line-height: 40px;
        text-align: center;
        border-radius: 50%;
        background: #f8f9fa;
        color: #666;
        transition: all 0.3s ease;
    }
    
    .social-media a:hover {
        background: var(--theme-primary-color);
        color: white;
        transform: translateY(-2px);
    }
}

/* Loading spinner responsive */
@media (max-width: 575.98px) {
    .loader {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(255,255,255,0.9);
        z-index: 99999;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .spinner {
        width: 40px;
        height: 40px;
        border: 4px solid #f3f3f3;
        border-top: 4px solid var(--theme-primary-color);
        border-radius: 50%;
        animation: spin 1s linear infinite;
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Accessibility improvements for mobile */
@media (max-width: 767.98px) {
    /* Increase touch target sizes */
    a, button, input, select, textarea {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Better contrast for small text */
    small, .small {
        font-size: 12px;
        color: #333;
    }
    
    /* Focus states */
    a:focus, button:focus, input:focus, select:focus, textarea:focus {
        outline: 2px solid var(--theme-primary-color);
        outline-offset: 2px;
    }
}

/* Performance optimizations */
* {
    -webkit-tap-highlight-color: transparent;
}

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

/* Optimize animations for mobile */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
