/* ========================================
   MOBILE EXPERIENCE OPTIMIZATIONS
   CrocCity Furniture - Touch-First Design
   ======================================== */

/* =====================================
   GLOBAL MOBILE IMPROVEMENTS
   ===================================== */

/* Prevent text size adjustment on orientation change */
html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

/* Smooth scrolling for mobile */
@media (max-width: 768px) {
    html {
        scroll-behavior: smooth;
    }
    
    body {
        -webkit-overflow-scrolling: touch;
    }
}

/* Touch-friendly tap targets (minimum 44px x 44px) */
button,
a.btn,
.btn,
.social-link,
.payment-methods i,
input[type="submit"],
input[type="button"],
.cart-action,
.wishlist-btn,
.quick-view-btn {
    min-height: 44px;
    min-width: 44px;
}

/* Improve tap target spacing on mobile */
@media (max-width: 768px) {
    .nav-link {
        padding: 12px 15px !important;
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    .dropdown-item {
        padding: 12px 20px !important;
        min-height: 44px;
    }
}

/* =====================================
   HEADER MOBILE OPTIMIZATIONS
   ===================================== */

@media (max-width: 768px) {
    /* Optimize header spacing */
    .modern-navbar {
        padding: 0.75rem 0 !important;
    }
    
    .navbar-brand {
        font-size: 1.25rem !important;
    }
    
    .navbar-brand i {
        font-size: 1.5rem !important;
    }
    
    /* Make search bar full width on mobile */
    .search-bar {
        max-width: 100% !important;
        margin: 0.5rem 0 !important;
    }
    
    /* Improve cart/wishlist icon spacing */
    .nav-icons {
        gap: 0.75rem !important;
    }
    
    .nav-icon {
        width: 44px !important;
        height: 44px !important;
        font-size: 1.125rem !important;
    }
    
    /* Mobile menu improvements */
    .navbar-collapse {
        margin-top: 1rem;
        padding: 1rem 0;
        border-top: 1px solid rgba(0,0,0,0.1);
    }
    
    .navbar-nav {
        gap: 0.5rem;
    }
    
    /* Full-width dropdown on mobile */
    .dropdown-menu {
        width: 100% !important;
        position: relative !important;
        transform: none !important;
        box-shadow: none !important;
        border-radius: 8px !important;
        margin-top: 0.5rem !important;
    }
}

/* Extra small devices (320px - 375px) */
@media (max-width: 375px) {
    .navbar-brand span {
        font-size: 1.125rem !important;
    }
    
    .search-bar input {
        font-size: 0.875rem !important;
        padding: 0.5rem 0.75rem !important;
    }
}

/* =====================================
   HERO SECTION MOBILE
   ===================================== */

@media (max-width: 768px) {
    .hero-slide {
        min-height: 400px !important;
        padding: 3rem 1rem !important;
    }
    
    .hero-content h1 {
        font-size: 1.75rem !important;
        line-height: 1.2 !important;
        margin-bottom: 1rem !important;
    }
    
    .hero-content p {
        font-size: 0.95rem !important;
        margin-bottom: 1.5rem !important;
    }
    
    .hero-btn {
        padding: 0.875rem 2rem !important;
        font-size: 0.95rem !important;
        min-height: 48px !important;
    }
    
    /* Carousel controls */
    .carousel-control-prev,
    .carousel-control-next {
        width: 44px !important;
        height: 44px !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
    }
}

@media (max-width: 375px) {
    .hero-slide {
        min-height: 350px !important;
        padding: 2rem 1rem !important;
    }
    
    .hero-content h1 {
        font-size: 1.5rem !important;
    }
    
    .hero-content p {
        font-size: 0.875rem !important;
    }
}

/* =====================================
   PRODUCT CARDS MOBILE
   ===================================== */

@media (max-width: 768px) {
    /* Grid adjustments */
    .product-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem !important;
    }
    
    .product-card {
        margin-bottom: 0 !important;
    }
    
    /* Card content spacing */
    .product-card-body {
        padding: 0.875rem !important;
    }
    
    .product-title {
        font-size: 0.9rem !important;
        margin-bottom: 0.5rem !important;
        line-height: 1.3 !important;
    }
    
    .product-price {
        font-size: 1rem !important;
        margin-bottom: 0.75rem !important;
    }
    
    .product-price del {
        font-size: 0.8rem !important;
    }
    
    /* Product actions - stack vertically */
    .product-actions {
        flex-direction: column !important;
        gap: 0.5rem !important;
    }
    
    .product-actions button {
        width: 100% !important;
        min-height: 44px !important;
        font-size: 0.875rem !important;
        padding: 0.75rem !important;
    }
    
    /* Badge sizing */
    .product-badge {
        font-size: 0.7rem !important;
        padding: 0.25rem 0.5rem !important;
    }
}

@media (max-width: 375px) {
    .product-grid {
        grid-template-columns: 1fr !important;
        gap: 1.25rem !important;
    }
    
    .product-card-body {
        padding: 1rem !important;
    }
    
    .product-title {
        font-size: 1rem !important;
    }
}

/* =====================================
   CATEGORY CARDS MOBILE
   ===================================== */

@media (max-width: 768px) {
    .categories-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem !important;
    }
    
    .category-card {
        height: 180px !important;
    }
    
    .category-overlay h3 {
        font-size: 1.125rem !important;
    }
    
    .category-overlay p {
        font-size: 0.8rem !important;
    }
}

@media (max-width: 375px) {
    .categories-grid {
        grid-template-columns: 1fr !important;
        gap: 1.25rem !important;
    }
    
    .category-card {
        height: 220px !important;
    }
}

/* =====================================
   PRODUCT DETAIL PAGE MOBILE
   ===================================== */

@media (max-width: 768px) {
    /* Gallery optimization */
    .product-detail-container {
        padding: 1.5rem 0 !important;
    }
    
    .product-gallery {
        margin-bottom: 2rem !important;
    }
    
    .main-image {
        height: 350px !important;
        margin-bottom: 1rem !important;
    }
    
    .thumbnail-grid {
        gap: 0.5rem !important;
    }
    
    .thumbnail-item {
        height: 70px !important;
    }
    
    /* Product info spacing */
    .product-detail-info {
        padding: 1.5rem !important;
    }
    
    .product-detail-title {
        font-size: 1.5rem !important;
        margin-bottom: 1rem !important;
    }
    
    .product-detail-price {
        font-size: 1.75rem !important;
    }
    
    /* Options layout */
    .option-group {
        margin-bottom: 1.25rem !important;
    }
    
    .option-label {
        font-size: 0.9rem !important;
        margin-bottom: 0.75rem !important;
    }
    
    /* Color/Size options - larger touch targets */
    .color-option,
    .size-option {
        min-width: 44px !important;
        min-height: 44px !important;
        font-size: 0.875rem !important;
    }
    
    /* Quantity selector */
    .quantity-selector {
        margin-bottom: 1.5rem !important;
    }
    
    .quantity-selector button {
        width: 44px !important;
        height: 44px !important;
        font-size: 1.125rem !important;
    }
    
    .quantity-selector input {
        height: 44px !important;
        font-size: 1rem !important;
    }
    
    /* Action buttons */
    .detail-actions {
        flex-direction: column !important;
        gap: 0.75rem !important;
    }
    
    .detail-actions .btn {
        width: 100% !important;
        min-height: 50px !important;
        font-size: 1rem !important;
    }
    
    /* Tabs */
    .nav-tabs {
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        border-bottom: 2px solid #e0e0e0 !important;
    }
    
    .nav-tabs .nav-link {
        white-space: nowrap !important;
        padding: 1rem 1.25rem !important;
        min-height: 48px !important;
        font-size: 0.9rem !important;
    }
    
    .tab-content {
        padding: 1.5rem 1rem !important;
    }
}

@media (max-width: 375px) {
    .main-image {
        height: 280px !important;
    }
    
    .product-detail-title {
        font-size: 1.25rem !important;
    }
    
    .product-detail-price {
        font-size: 1.5rem !important;
    }
}

/* =====================================
   FOOTER MOBILE
   ===================================== */

@media (max-width: 768px) {
    .footer-main {
        padding: 2.5rem 0 2rem !important;
    }
    
    .footer-widget {
        margin-bottom: 2rem !important;
        text-align: center !important;
    }
    
    .footer-logo {
        justify-content: center !important;
        font-size: 1.5rem !important;
    }
    
    .footer-social {
        justify-content: center !important;
        gap: 1rem !important;
    }
    
    .social-link {
        width: 44px !important;
        height: 44px !important;
        font-size: 1.125rem !important;
    }
    
    .footer-links {
        text-align: center !important;
    }
    
    .footer-links a {
        padding: 0.5rem !important;
        display: inline-block !important;
    }
    
    .footer-contact {
        text-align: left !important;
        max-width: 100% !important;
    }
    
    .footer-contact li {
        margin-bottom: 1rem !important;
        font-size: 0.9rem !important;
    }
    
    /* Newsletter */
    .newsletter-widget {
        padding: 1.25rem !important;
        text-align: left !important;
    }
    
    .newsletter-form input {
        min-height: 44px !important;
        font-size: 0.9rem !important;
    }
    
    .btn-newsletter {
        min-height: 44px !important;
        min-width: 60px !important;
    }
    
    /* Footer bottom */
    .footer-bottom {
        padding: 1.25rem 0 !important;
    }
    
    .copyright-text {
        text-align: center !important;
        margin-bottom: 1rem !important;
        font-size: 0.85rem !important;
    }
    
    .payment-methods {
        justify-content: center !important;
        gap: 0.75rem !important;
        flex-wrap: wrap !important;
    }
    
    .payment-text {
        width: 100% !important;
        text-align: center !important;
        margin-bottom: 0.5rem !important;
    }
}

/* =====================================
   CTA SECTION MOBILE
   ===================================== */

@media (max-width: 768px) {
    .cta-section {
        padding: 3rem 1.5rem !important;
    }
    
    .cta-content h2 {
        font-size: 1.75rem !important;
        line-height: 1.3 !important;
        margin-bottom: 1rem !important;
    }
    
    .cta-content p {
        font-size: 0.95rem !important;
        margin-bottom: 1.5rem !important;
    }
    
    .cta-btn {
        min-height: 50px !important;
        padding: 0.875rem 2rem !important;
        font-size: 1rem !important;
    }
}

@media (max-width: 375px) {
    .cta-section {
        padding: 2.5rem 1rem !important;
    }
    
    .cta-content h2 {
        font-size: 1.5rem !important;
    }
}

/* =====================================
   MODAL MOBILE OPTIMIZATIONS
   ===================================== */

@media (max-width: 768px) {
    .modal-dialog {
        margin: 0.5rem !important;
        width: calc(100% - 1rem) !important;
        max-width: calc(100% - 1rem) !important;
    }
    
    .modal-content {
        width: 100% !important;
        height: auto !important;
        max-height: 90vh !important;
        overflow-y: auto !important;
    }
    
    .modal-header {
        padding: 1rem !important;
    }
    
    .modal-title {
        font-size: 1.125rem !important;
    }
    
    .modal-body {
        padding: 1rem !important;
    }
    
    /* Stack modal content vertically */
    .modal-body .row {
        flex-direction: column !important;
    }
    
    .modal-body .col-md-4 {
        width: 100% !important;
        margin-bottom: 1rem !important;
    }
    
    .modal-body img {
        width: 100% !important;
        height: auto !important;
        max-width: 250px !important;
        margin: 0 auto !important;
        display: block !important;
    }
    
    .modal-body .btn {
        width: 100% !important;
        min-height: 48px !important;
    }
    
    .close {
        padding: 1rem !important;
        font-size: 1.5rem !important;
    }
}

/* =====================================
   FORM INPUTS MOBILE
   ===================================== */

@media (max-width: 768px) {
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="tel"],
    select,
    textarea {
        min-height: 44px !important;
        font-size: 16px !important; /* Prevents zoom on iOS */
        padding: 0.75rem 1rem !important;
    }
    
    textarea {
        min-height: 100px !important;
    }
    
    .form-control {
        min-height: 44px !important;
        font-size: 16px !important;
    }
    
    .form-group {
        margin-bottom: 1.25rem !important;
    }
}

/* =====================================
   BREADCRUMB MOBILE
   ===================================== */

@media (max-width: 768px) {
    .breadcrumb {
        padding: 1rem 0 !important;
        font-size: 0.85rem !important;
        flex-wrap: wrap !important;
    }
    
    .breadcrumb-item {
        padding: 0.25rem 0 !important;
    }
}

/* =====================================
   LOADING & SPINNER
   ===================================== */

@media (max-width: 768px) {
    .spinner-border,
    .spinner-grow {
        width: 2.5rem !important;
        height: 2.5rem !important;
    }
}

/* =====================================
   ACCESSIBILITY IMPROVEMENTS
   ===================================== */

/* Improve focus visibility on mobile */
@media (max-width: 768px) {
    a:focus,
    button:focus,
    input:focus,
    select:focus,
    textarea:focus {
        outline: 3px solid #8B7355 !important;
        outline-offset: 2px !important;
    }
}

/* =====================================
   PERFORMANCE OPTIMIZATIONS
   ===================================== */

/* Optimize images for mobile */
@media (max-width: 768px) {
    img {
        max-width: 100%;
        height: auto;
    }
}

/* Prevent horizontal scroll */
@media (max-width: 768px) {
    body {
        overflow-x: hidden !important;
    }
    
    .container-fluid,
    .row {
        max-width: 100vw !important;
        overflow-x: hidden !important;
    }
}

/* =====================================
   TOUCH IMPROVEMENTS
   ===================================== */

/* Prevent text selection on double-tap */
.product-actions button,
.btn,
.nav-link,
.dropdown-item {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Prevent tap highlight on touch devices */
* {
    -webkit-tap-highlight-color: transparent;
}

/* Active state for touch feedback */
@media (max-width: 768px) {
    .btn:active,
    button:active,
    a:active {
        transform: scale(0.98);
        opacity: 0.9;
    }
}

/* =====================================
   LANDSCAPE ORIENTATION
   ===================================== */

@media (max-width: 768px) and (orientation: landscape) {
    .hero-slide {
        min-height: 300px !important;
    }
    
    .main-image {
        height: 250px !important;
    }
}

/* =====================================
   EXTRA SMALL DEVICES (< 320px)
   ===================================== */

@media (max-width: 320px) {
    body {
        font-size: 14px !important;
    }
    
    .container {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }
    
    h1 {
        font-size: 1.5rem !important;
    }
    
    h2 {
        font-size: 1.25rem !important;
    }
    
    h3 {
        font-size: 1.125rem !important;
    }
}
