/**
 * Mobile Responsive Styles for GoodGuy E-commerce
 * Comprehensive mobile view optimization for the entire app
 * Date: October 29, 2025
 */

/* ==========================================================================
   Base Mobile Styles
   ========================================================================== */

/* Mobile-first approach: Start with mobile styles, then enhance for larger screens */

/* Ensure proper viewport scaling */
html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   Mobile Header Styles (< 992px)
   ========================================================================== */

@media (max-width: 991px) {
    /* Header Top - Simplified for mobile */
    .header-top {
        padding: 8px 0;
        font-size: 12px;
    }

    .header-top .header-left {
        min-width: auto;
    }

    .header-top .header-left a {
        font-size: 11px;
    }

    .header-top .top-menu {
        font-size: 11px;
    }

    .header-top .top-menu li {
        margin-left: 10px;
    }

    /* Header Middle - Mobile optimized */
    .header-middle {
        padding: 10px 0;
    }

    .header-middle .container {
        padding-left: 10px;
        padding-right: 10px;
    }

    .header-left {
        min-width: auto !important;
        flex: 0 0 auto;
    }

    /* Logo adjustments */
    .logo img {
        height: 35px !important;
        width: auto;
    }

    /* Mobile menu toggle button */
    .mobile-menu-toggler {
        display: inline-block;
        background: transparent;
        border: none;
        padding: 10px;
        margin-right: 10px;
        font-size: 20px;
        color: #333;
        cursor: pointer;
    }

    .mobile-menu-toggler:focus {
        outline: none;
    }

    /* Header center - Search bar */
    .header-center {
        display: none; /* Hide on mobile, show search in mobile menu */
    }

    /* Header right - Cart and wishlist */
    .header-right .header-dropdown-link {
        display: flex;
        align-items: center;
        gap: 15px;
    }

    .header-right .wishlist-link,
    .header-right .cart-dropdown > .dropdown-toggle {
        display: flex;
        flex-direction: column;
        align-items: center;
        font-size: 11px;
        padding: 5px;
    }

    .header-right .wishlist-link i,
    .header-right .cart-dropdown > .dropdown-toggle i {
        font-size: 20px;
        margin-bottom: 2px;
    }

    .header-right .wishlist-count,
    .header-right .cart-count {
        position: absolute;
        top: 0;
        right: -5px;
        background: #c96;
        color: white;
        border-radius: 50%;
        width: 18px;
        height: 18px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 10px;
        font-weight: bold;
    }

    .wishlist-txt,
    .cart-txt {
        font-size: 10px;
        display: block;
    }

    /* Header bottom - Hide on mobile */
    .header-bottom {
        display: none !important;
    }

    /* Cart dropdown on mobile */
    .dropdown-cart-products {
        max-height: 40vh;
    }

    .cart-dropdown .dropdown-menu {
        right: -10px !important;
        left: auto !important;
        min-width: 280px;
        max-width: 90vw;
    }

    .cart-dropdown .product {
        padding: 10px;
    }

    .cart-dropdown .product-title {
        font-size: 12px;
    }

    .cart-dropdown .product-image-container {
        width: 60px;
        height: 60px;
    }
}

/* ==========================================================================
   Mobile Navigation Menu
   ========================================================================== */

@media (max-width: 991px) {
    .mobile-menu-container {
        position: fixed;
        top: 0;
        left: -300px;
        width: 300px;
        height: 100vh;
        background: #fff;
        z-index: 9999;
        overflow-y: auto;
        transition: left 0.3s ease;
        box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
    }

    .mobile-menu-container.active {
        left: 0;
    }

    .mobile-menu-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        z-index: 9998;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }

    .mobile-menu-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    .mobile-menu-wrapper {
        padding: 20px;
    }

    .mobile-menu-close {
        display: block;
        text-align: right;
        font-size: 24px;
        margin-bottom: 20px;
        cursor: pointer;
        color: #333;
    }

    .mobile-search {
        margin-bottom: 20px;
    }

    .mobile-search .form-control {
        border-radius: 20px;
        padding-right: 50px;
    }

    .mobile-search .btn {
        position: absolute;
        right: 5px;
        top: 50%;
        transform: translateY(-50%);
        border-radius: 50%;
        width: 36px;
        height: 36px;
        padding: 0;
    }

    .mobile-menu {
        list-style: none;
        padding: 0;
        margin: 0;
    }

    .mobile-menu > li {
        border-bottom: 1px solid #eee;
    }

    .mobile-menu > li > a {
        display: block;
        padding: 12px 0;
        color: #333;
        font-size: 14px;
        font-weight: 500;
        text-decoration: none;
        position: relative;
    }

    .mobile-menu > li > a.sf-with-ul::after {
        content: '\f107';
        font-family: 'Font Awesome 5 Free';
        font-weight: 900;
        position: absolute;
        right: 0;
        transition: transform 0.3s ease;
    }

    .mobile-menu > li > a.sf-with-ul.active::after {
        transform: rotate(180deg);
    }

    .mobile-menu ul {
        list-style: none;
        padding-left: 20px;
        display: none;
        margin: 0;
    }

    .mobile-menu ul.active {
        display: block;
    }

    .mobile-menu ul li {
        border-bottom: 1px solid #f5f5f5;
    }

    .mobile-menu ul li a {
        display: block;
        padding: 10px 0;
        color: #666;
        font-size: 13px;
        text-decoration: none;
    }

    .mobile-menu ul ul {
        padding-left: 15px;
    }

    /* Mobile menu user section */
    .mobile-menu-user {
        margin-top: 20px;
        padding-top: 20px;
        border-top: 2px solid #eee;
    }

    .mobile-menu-user a {
        display: block;
        padding: 12px 0;
        color: #333;
        font-size: 14px;
        text-decoration: none;
        font-weight: 500;
    }

    .mobile-menu-user a i {
        margin-right: 10px;
        width: 20px;
        text-align: center;
    }
}

/* ==========================================================================
   Product Grid - Mobile Optimization
   ========================================================================== */

@media (max-width: 767px) {
    /* 2 columns on mobile */
    .products .col-6 {
        flex: 0 0 50%;
        max-width: 50%;
        padding-left: 5px;
        padding-right: 5px;
    }

    .product {
        margin-bottom: 15px;
    }

    .product-media {
        margin-bottom: 10px;
    }

    .product-image {
        width: 100%;
        height: auto;
    }

    .product-title {
        font-size: 13px;
        line-height: 1.3;
        margin-bottom: 5px;
    }

    .product-cat {
        font-size: 11px;
        margin-bottom: 5px;
    }

    .product-price {
        font-size: 14px;
        font-weight: bold;
    }

    .product-action {
        padding: 5px;
    }

    .product-action .btn-product {
        font-size: 11px;
        padding: 6px 10px;
    }

    /* Product labels */
    .product-label {
        font-size: 10px;
        padding: 3px 6px;
    }

    /* Ratings */
    .ratings-container {
        font-size: 11px;
    }
}

/* Single column for very small devices */
@media (max-width: 480px) {
    .products .col-6.single-column {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* ==========================================================================
   Product Detail Page - Mobile
   ========================================================================== */

@media (max-width: 767px) {
    .product-detail .product-gallery {
        margin-bottom: 20px;
    }

    .product-detail .product-gallery img {
        width: 100%;
        height: auto;
    }

    .product-detail .product-title {
        font-size: 20px;
        margin-bottom: 10px;
    }

    .product-detail .product-price {
        font-size: 24px;
        margin-bottom: 15px;
    }

    .product-detail .product-details {
        padding: 15px;
    }

    .product-detail .product-content {
        font-size: 14px;
    }

    /* Product tabs */
    .product-tabs .nav-tabs {
        flex-direction: column;
        border-bottom: none;
    }

    .product-tabs .nav-link {
        border: 1px solid #ddd;
        margin-bottom: 5px;
        border-radius: 4px;
    }

    /* Add to cart section */
    .product-details-action {
        flex-direction: column;
    }

    .product-details-action .btn {
        width: 100%;
        margin-bottom: 10px;
    }

    .product-details-quantity {
        margin-bottom: 15px;
    }
}

/* ==========================================================================
   Cart Page - Mobile
   ========================================================================== */

@media (max-width: 767px) {
    .cart-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .cart-table table {
        min-width: 100%;
    }

    .cart-table th,
    .cart-table td {
        padding: 10px 5px;
        font-size: 12px;
    }

    .cart-table .product-col {
        min-width: 200px;
    }

    .cart-table .product-title {
        font-size: 13px;
    }

    .cart-table .product-image-container {
        width: 60px;
        height: 60px;
    }

    .cart-summary {
        margin-top: 20px;
    }

    .cart-summary table {
        font-size: 14px;
    }

    .cart-summary .btn {
        width: 100%;
        margin-bottom: 10px;
    }

    /* Coupon section */
    .cart-bottom .coupon-form {
        flex-direction: column;
    }

    .cart-bottom .form-control {
        margin-bottom: 10px;
        width: 100%;
    }

    .cart-bottom .btn {
        width: 100%;
    }
}

/* ==========================================================================
   Checkout Page - Mobile
   ========================================================================== */

@media (max-width: 767px) {
    .checkout .checkout-steps {
        flex-direction: column;
    }

    .checkout-step {
        margin-bottom: 20px;
    }

    .checkout-form .form-group {
        margin-bottom: 15px;
    }

    .checkout-form .form-control {
        font-size: 14px;
        padding: 10px;
    }

    .checkout-form label {
        font-size: 13px;
    }

    .order-summary {
        margin-top: 30px;
    }

    .order-summary table {
        font-size: 13px;
    }

    .checkout .btn {
        width: 100%;
        padding: 12px;
    }
}

/* ==========================================================================
   Shop/Category Page - Mobile
   ========================================================================== */

@media (max-width: 991px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: -300px;
        width: 300px;
        height: 100vh;
        background: #fff;
        z-index: 9999;
        overflow-y: auto;
        transition: left 0.3s ease;
        padding: 20px;
        box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
    }

    .sidebar.active {
        left: 0;
    }

    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        z-index: 9998;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }

    .sidebar-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    /* Filter toggle button */
    .filter-toggle {
        display: block;
        width: 100%;
        padding: 12px;
        background: #007bff;
        color: white;
        border: none;
        border-radius: 4px;
        margin-bottom: 15px;
        font-size: 14px;
        font-weight: 500;
        cursor: pointer;
    }

    .filter-toggle i {
        margin-right: 8px;
    }

    .toolbox {
        flex-direction: column;
        gap: 10px;
    }

    .toolbox-left,
    .toolbox-right {
        width: 100%;
    }

    .toolbox-sort {
        width: 100%;
    }

    .toolbox-sort select {
        width: 100%;
    }
}

/* ==========================================================================
   Dashboard - Mobile
   ========================================================================== */

@media (max-width: 767px) {
    .dashboard-sidebar {
        position: fixed;
        top: 0;
        left: -280px;
        width: 280px;
        height: 100vh;
        background: #fff;
        z-index: 9999;
        overflow-y: auto;
        transition: left 0.3s ease;
        box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
    }

    .dashboard-sidebar.active {
        left: 0;
    }

    .dashboard-menu-toggle {
        display: block;
        padding: 10px;
        background: #007bff;
        color: white;
        border: none;
        border-radius: 4px;
        margin-bottom: 15px;
        width: 100%;
    }

    .dashboard-content {
        padding: 15px;
    }

    .dashboard-card {
        margin-bottom: 15px;
    }

    .dashboard .table-responsive {
        font-size: 12px;
    }

    .dashboard .btn {
        font-size: 12px;
        padding: 6px 10px;
    }
}

/* ==========================================================================
   Footer - Mobile
   ========================================================================== */

@media (max-width: 767px) {
    .footer {
        padding: 30px 0 20px;
    }

    .footer .widget {
        margin-bottom: 25px;
    }

    .footer .widget-title {
        font-size: 16px;
        margin-bottom: 15px;
    }

    .footer .widget ul {
        font-size: 13px;
    }

    .footer .widget ul li {
        margin-bottom: 8px;
    }

    .footer-bottom {
        text-align: center;
        padding: 15px 0;
    }

    .footer-bottom .footer-left,
    .footer-bottom .footer-right {
        width: 100%;
        text-align: center;
        margin-bottom: 10px;
    }

    .social-icons {
        justify-content: center;
        margin-top: 15px;
    }
}

/* ==========================================================================
   Forms - Mobile Optimization
   ========================================================================== */

@media (max-width: 767px) {
    .form-group {
        margin-bottom: 15px;
    }

    .form-control {
        font-size: 14px;
        padding: 10px 12px;
        height: auto;
    }

    .form-control:focus {
        border-color: #007bff;
        box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    }

    .btn {
        padding: 10px 20px;
        font-size: 14px;
    }

    .btn-block {
        width: 100%;
        display: block;
    }

    label {
        font-size: 13px;
        margin-bottom: 5px;
    }

    .input-group {
        flex-direction: column;
    }

    .input-group .btn {
        width: 100%;
        margin-top: 10px;
    }
}

/* ==========================================================================
   Modals - Mobile
   ========================================================================== */

@media (max-width: 767px) {
    .modal-dialog {
        margin: 10px;
        max-width: calc(100% - 20px);
    }

    .modal-content {
        border-radius: 8px;
    }

    .modal-header {
        padding: 15px;
    }

    .modal-title {
        font-size: 18px;
    }

    .modal-body {
        padding: 15px;
    }

    .modal-footer {
        padding: 15px;
        flex-direction: column;
    }

    .modal-footer .btn {
        width: 100%;
        margin-bottom: 10px;
    }
}

/* ==========================================================================
   Pagination - Mobile
   ========================================================================== */

@media (max-width: 767px) {
    .pagination {
        font-size: 12px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .pagination .page-item {
        margin: 2px;
    }

    .pagination .page-link {
        padding: 6px 10px;
    }

    /* Hide some page numbers on mobile */
    .pagination .page-item:not(.active):not(:first-child):not(:last-child):not(.page-item-prev):not(.page-item-next) {
        display: none;
    }

    .pagination .page-item.active,
    .pagination .page-item:first-child,
    .pagination .page-item:last-child,
    .pagination .page-item:nth-child(2),
    .pagination .page-item:nth-last-child(2) {
        display: block;
    }
}

/* ==========================================================================
   Breadcrumbs - Mobile
   ========================================================================== */

@media (max-width: 767px) {
    .breadcrumb-nav {
        padding: 10px 0;
        font-size: 12px;
    }

    .breadcrumb {
        padding: 8px 0;
        flex-wrap: wrap;
    }

    .breadcrumb-item {
        font-size: 11px;
    }
}

/* ==========================================================================
   Alert Messages - Mobile
   ========================================================================== */

@media (max-width: 767px) {
    .alert {
        padding: 12px;
        font-size: 13px;
        margin-bottom: 15px;
    }

    .alert-dismissible .close {
        padding: 10px;
    }
}

/* ==========================================================================
   Utility Classes - Mobile
   ========================================================================== */

@media (max-width: 767px) {
    .text-center-mobile {
        text-align: center !important;
    }

    .hidden-mobile {
        display: none !important;
    }

    .visible-mobile {
        display: block !important;
    }

    .mb-mobile-10 {
        margin-bottom: 10px !important;
    }

    .mb-mobile-15 {
        margin-bottom: 15px !important;
    }

    .mb-mobile-20 {
        margin-bottom: 20px !important;
    }

    .p-mobile-10 {
        padding: 10px !important;
    }

    .p-mobile-15 {
        padding: 15px !important;
    }

    .w-100-mobile {
        width: 100% !important;
    }
}

/* ==========================================================================
   Touch Optimizations
   ========================================================================== */

@media (hover: none) and (pointer: coarse) {
    /* Increase tap targets for better touch experience */
    a,
    button,
    .btn,
    input[type="button"],
    input[type="submit"] {
        min-height: 44px;
        min-width: 44px;
    }

    /* Remove hover effects on touch devices */
    .product:hover {
        transform: none;
    }

    .btn:hover {
        transform: none;
    }
}

/* ==========================================================================
   Landscape Orientation - Tablets
   ========================================================================== */

@media (min-width: 768px) and (max-width: 991px) and (orientation: landscape) {
    .header-middle {
        padding: 15px 0;
    }

    .products .col-md-4 {
        flex: 0 0 33.333%;
        max-width: 33.333%;
    }

    .logo img {
        height: 45px !important;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .header,
    .footer,
    .mobile-menu-container,
    .sidebar,
    .toolbox,
    .pagination,
    .product-action,
    .btn-remove,
    .social-icons {
        display: none !important;
    }

    body {
        font-size: 12pt;
        color: #000;
        background: #fff;
    }

    .container {
        width: 100%;
        max-width: none;
    }
}

/* ==========================================================================
   Accessibility Improvements
   ========================================================================== */

/* Focus visible for keyboard navigation */
*:focus-visible {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Skip to main content link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #007bff;
    color: white;
    padding: 8px;
    text-decoration: none;
    z-index: 10000;
}

.skip-link:focus {
    top: 0;
}

/* Screen reader only content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ==========================================================================
   Dark Mode Support (Optional)
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    /* Add dark mode styles here if desired */
    /* Example:
    body {
        background: #1a1a1a;
        color: #fff;
    }
    */
}
