/**
 * Mobile Optimization CSS
 *
 * Purpose: Enhance mobile usability following Google's mobile-friendly guidelines
 * Date: November 19, 2025
 * Related: SEO-ANALYSIS Action 11 - Mobile Optimization Improvements
 *
 * Key Requirements:
 * - Tap targets minimum 48x48px
 * - Text minimum 16px readable size
 * - Proper spacing between interactive elements
 * - Form inputs optimized for mobile
 * - No horizontal scrolling
 */

/* ============================================
   1. TAP TARGET OPTIMIZATION (48px minimum)
   ============================================ */

@media (max-width: 991px) {

    /* Mobile menu toggle button */
    .menu-btn,
    .menu-btn i {
        min-width: 48px;
        min-height: 48px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 12px;
    }

    /* Cart icon */
    .mini-cart,
    .minicart-btn,
    .header-toolbar__item a {
        min-width: 48px;
        min-height: 48px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 10px;
    }

    /* Language switcher links */
    .languages a,
    .header-toolbar a {
        min-height: 44px;
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 8px;
    }

    /* Mobile navigation menu items */
    .dl-menu li a,
    .mobile-navigation a {
        min-height: 48px;
        padding: 14px 20px;
        display: block;
        line-height: 1.5;
    }

    /* Close buttons */
    .btn-close,
    .remove-from-cart,
    .close {
        min-width: 48px;
        min-height: 48px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 12px;
    }

    /* Remove button in cart - ensure proper size */
    .mini-cart__product .remove {
        min-width: 40px;
        min-height: 40px;
        padding: 8px;
    }
}


/* ============================================
   2. BUTTON OPTIMIZATION
   ============================================ */

@media (max-width: 767px) {

    /* All buttons should be full width on mobile for easier tapping */
    .btn,
    .add-to-cart,
    .btn-style-1,
    .btn-fullwidth {
        width: 100%;
        min-height: 50px;
        padding: 14px 20px;
        font-size: 16px;
        line-height: 1.4;
        margin-bottom: 10px;
    }

    /* Cart buttons */
    .mini-cart__buttons .btn {
        min-height: 52px;
        margin-bottom: 12px;
        font-size: 16px;
        font-weight: 600;
    }

    /* Product page buttons */
    .product-action .btn,
    .product-summary .btn {
        min-height: 54px;
        font-size: 17px;
        margin-bottom: 15px;
    }
}


/* ============================================
   3. TYPOGRAPHY & READABILITY
   ============================================ */

@media (max-width: 767px) {

    /* Base font size - minimum 16px for readability */
    body {
        font-size: 16px;
        line-height: 1.6;
    }

    /* Headings - ensure proper hierarchy */
    h1, .h1 {
        font-size: 28px;
        line-height: 1.3;
        margin-bottom: 16px;
    }

    h2, .h2 {
        font-size: 24px;
        line-height: 1.3;
        margin-bottom: 14px;
    }

    h3, .h3 {
        font-size: 20px;
        line-height: 1.4;
        margin-bottom: 12px;
    }

    h4, .h4,
    h5, .h5,
    h6, .h6 {
        font-size: 18px;
        line-height: 1.4;
        margin-bottom: 10px;
    }

    /* Product titles */
    .product-title,
    .product-name {
        font-size: 22px !important;
        line-height: 1.3;
    }

    /* Product descriptions */
    .product-description,
    .product-details {
        font-size: 16px;
        line-height: 1.7;
    }

    /* Category titles */
    .banner-title-2 {
        font-size: 18px !important;
        line-height: 1.4;
    }

    /* Links - ensure readable */
    a {
        font-size: inherit;
        min-height: 24px;
        display: inline-block;
    }

    /* Price display */
    .price,
    .product-price {
        font-size: 20px;
        font-weight: 700;
    }
}


/* ============================================
   4. FORM OPTIMIZATION
   ============================================ */

@media (max-width: 767px) {

    /* All form inputs */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="number"],
    input[type="password"],
    input[type="search"],
    textarea,
    select,
    .form-control {
        min-height: 48px;
        font-size: 16px; /* Prevents iOS zoom on focus */
        padding: 12px 16px;
        border-radius: 4px;
        width: 100%;
        margin-bottom: 16px;
        line-height: 1.5;
    }

    /* Textarea specific */
    textarea {
        min-height: 120px;
        resize: vertical;
    }

    /* Select dropdowns */
    select {
        min-height: 50px;
        padding-right: 40px; /* Space for dropdown arrow */
        background-position: right 12px center;
    }

    /* Radio buttons and checkboxes */
    input[type="radio"],
    input[type="checkbox"] {
        min-width: 24px;
        min-height: 24px;
        margin-right: 12px;
    }

    /* Form labels */
    label {
        font-size: 16px;
        margin-bottom: 8px;
        display: block;
        line-height: 1.5;
    }

    /* Form groups */
    .form-group {
        margin-bottom: 20px;
    }

    /* Error messages */
    .error-message,
    .field-error {
        font-size: 14px;
        padding: 8px;
        margin-top: 4px;
    }

    /* Search form */
    .search-form input[type="search"] {
        min-height: 48px;
        font-size: 16px;
    }
}


/* ============================================
   5. SPACING & LAYOUT
   ============================================ */

@media (max-width: 767px) {

    /* Container padding - prevent edge-to-edge content */
    .container,
    .container-fluid {
        padding-left: 16px;
        padding-right: 16px;
    }

    /* Section spacing */
    section,
    .section {
        padding-top: 32px;
        padding-bottom: 32px;
    }

    /* Card spacing */
    .product-card,
    .category-card {
        margin-bottom: 20px;
        padding: 16px;
    }

    /* List items spacing */
    .product-list li,
    .category-list li {
        padding: 12px 0;
        margin-bottom: 8px;
    }

    /* Ensure touch targets aren't too close */
    .btn + .btn,
    a + a,
    button + button {
        margin-left: 12px;
    }

    /* Footer links - prevent cramming */
    .footer a {
        padding: 10px 0;
        display: inline-block;
        margin-right: 16px;
    }
}


/* ============================================
   6. MOBILE NAVIGATION IMPROVEMENTS
   ============================================ */

@media (max-width: 991px) {

    /* Mobile header - ensure proper height */
    .header-mobile {
        min-height: 60px;
        padding: 8px 0;
    }

    /* Logo sizing */
    .logo-box img {
        max-height: 40px;
        width: auto;
    }

    /* Mobile menu panel */
    .mobile-navigation {
        max-width: 90vw;
    }

    /* Menu items */
    .dl-menu {
        font-size: 16px;
    }

    .dl-menu > li {
        border-bottom: 1px solid rgba(0,0,0,0.1);
    }

    /* Submenu indicators */
    .dl-menu .dl-submenu-toggle {
        min-width: 48px;
        min-height: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}


/* ============================================
   7. CART & CHECKOUT OPTIMIZATION
   ============================================ */

@media (max-width: 767px) {

    /* Mini cart */
    .mini-cart-wrapper {
        width: 100%;
        max-width: 380px;
        right: 0;
    }

    /* Cart product items */
    .mini-cart__product {
        padding: 16px 0;
        min-height: 100px;
    }

    /* Cart product image */
    .mini-cart__product__image {
        width: 80px;
        height: 80px;
        flex-shrink: 0;
    }

    /* Cart product content */
    .mini-cart__product__content {
        padding-left: 12px;
        font-size: 15px;
    }

    /* Cart product title */
    .mini-cart__product__title {
        font-size: 15px;
        line-height: 1.4;
        margin-bottom: 8px;
    }

    /* Quantity controls */
    .qty-box {
        min-height: 44px;
    }

    .qty-box button {
        min-width: 44px;
        min-height: 44px;
        font-size: 18px;
    }

    .qty-box input {
        min-height: 44px;
        font-size: 16px;
        text-align: center;
    }
}


/* ============================================
   8. IMAGE OPTIMIZATION
   ============================================ */

@media (max-width: 767px) {

    /* Product images - ensure they fit screen */
    .product-image img {
        max-width: 100%;
        height: auto;
        display: block;
    }

    /* Category images */
    .banner-image img {
        max-width: 100%;
        height: auto;
    }

    /* Thumbnail images - ensure tappable */
    .product-thumbnail,
    .product-image-thumb {
        min-width: 60px;
        min-height: 60px;
        margin: 4px;
    }

    /* Gallery images */
    .product-gallery__image {
        margin-bottom: 16px;
    }
}


/* ============================================
   9. PRODUCT PAGE MOBILE OPTIMIZATION
   ============================================ */

@media (max-width: 767px) {

    /* Product summary */
    .product-summary {
        padding: 20px 16px;
    }

    /* Product attributes */
    .product-attribute {
        margin-bottom: 20px;
    }

    .product-attribute select {
        width: 100%;
        min-height: 50px;
        font-size: 16px;
    }

    /* Product badges */
    .product-badge {
        font-size: 13px;
        padding: 6px 12px;
        min-height: 28px;
    }

    /* Product tabs */
    .product-tabs {
        font-size: 16px;
    }

    .product-tab-link {
        min-height: 48px;
        padding: 12px 16px;
        display: flex;
        align-items: center;
    }

    /* Add to cart section */
    .product-action {
        position: sticky;
        bottom: 0;
        left: 0;
        right: 0;
        background: #fff;
        padding: 16px;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
        z-index: 100;
    }
}


/* ============================================
   10. CATEGORY PAGE MOBILE OPTIMIZATION
   ============================================ */

@media (max-width: 767px) {

    /* Category grid */
    .category-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 16px;
    }

    /* Product grid */
    .product-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    /* Filters on mobile */
    .filter-section {
        margin-bottom: 20px;
    }

    .filter-toggle {
        min-height: 50px;
        width: 100%;
        font-size: 16px;
    }

    /* Sort dropdown */
    .sort-by select {
        width: 100%;
        min-height: 48px;
        font-size: 16px;
    }
}


/* ============================================
   11. PERFORMANCE OPTIMIZATIONS
   ============================================ */

@media (max-width: 767px) {

    /* Optimize hover effects (remove for touch devices) */
    .product-card:hover,
    .category-card:hover {
        transform: none;
    }

    /* Speed up only specific UI transitions (NOT loading/banner animations) */
    .btn,
    .menu-btn,
    .dropdown,
    .accordion,
    .tab,
    .modal {
        transition-duration: 0.2s !important;
    }

    /* Keep normal speed for important animations */
    .spinner,
    .loader,
    .loading,
    .loading-circle,
    [class*="spinner"],
    [class*="loader"],
    [class*="loading"] {
        animation-duration: 1s !important; /* Keep normal speed */
        transition-duration: 0.3s !important;
    }

    /* Keep normal speed for banner/carousel animations */
    .banner,
    .carousel,
    .slider,
    [class*="carousel"],
    [class*="slider"],
    [class*="swiper"] {
        animation-duration: inherit !important; /* Use original speed */
        transition-duration: inherit !important;
    }

    /* Ensure marquee/scrolling banner always works */
    .marquee,
    [class*="marquee"],
    .bottom-banner .marquee {
        animation: marquee-scroll 25s linear infinite !important;
    }

    /* Lazy load indicators */
    img[loading="lazy"] {
        background: #f0f0f0;
    }

    /* Remove gray background from brand logos and banner images */
    .product-brand img[loading="lazy"],
    .banner-image img[loading="lazy"] {
        background: transparent;
    }

    /* Smooth scroll behavior */
    html {
        scroll-behavior: smooth;
    }
}


/* ============================================
   12. ACCESSIBILITY & TOUCH ENHANCEMENTS
   ============================================ */

@media (max-width: 767px) {

    /* Ensure focus states are visible */
    a:focus,
    button:focus,
    input:focus,
    select:focus,
    textarea:focus {
        outline: 2px solid #f6871f;
        outline-offset: 2px;
    }

    /* Remove tap highlight color on some browsers */
    * {
        -webkit-tap-highlight-color: rgba(246, 135, 31, 0.2);
    }

    /* Prevent text size adjust */
    html {
        -webkit-text-size-adjust: 100%;
        -ms-text-size-adjust: 100%;
    }

    /* Touch action optimization */
    a, button {
        touch-action: manipulation;
    }
}


/* ============================================
   13. FIXES FOR SPECIFIC ISSUES
   ============================================ */

@media (max-width: 767px) {

    /* Prevent horizontal scroll */
    body,
    html {
        overflow-x: hidden;
        max-width: 100vw;
    }

    /* Fix tables on mobile */
    table {
        width: 100%;
        display: block;
        overflow-x: auto;
    }

    /* Breadcrumbs - prevent overflow */
    .breadcrumb {
        flex-wrap: wrap;
        font-size: 14px;
    }

    .breadcrumb li {
        margin-bottom: 4px;
    }

    /* Fix sticky header spacing */
    body.has-sticky-header {
        padding-top: 70px;
    }

    /* Footer - stack columns */
    .footer-column {
        width: 100%;
        margin-bottom: 24px;
    }
}


/* ============================================
   14. PRODUCT VARIATIONS / SUB-PRODUCTS
   ============================================ */

/* Ensure consistent button color across ALL screen sizes */
[data-filter-row] .add-to-cart-block .btn,
[data-filter-row] .add-to-cart-block .btn-style-1,
[data-filter-row] .add-to-cart {
    background-color: #2e2e2e !important;
    color: #fff !important;
}

[data-filter-row] .add-to-cart-block .btn:hover,
[data-filter-row] .add-to-cart-block .btn-style-1:hover,
[data-filter-row] .add-to-cart:hover {
    background-color: #f6871f !important;
    color: #fff !important;
}

/* Consistent price styling across all sizes */
[data-filter-row] .money {
    color: #2e2e2e;
    font-weight: 700;
}

/* Base row styling for all sizes */
[data-filter-row] {
    padding: 16px 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid #e8e8e8;
}

/* Product dimensions display - clean CSS instead of inline styles */
.product-dimensions {
    font-weight: 600;
    font-size: 1.4rem;
    color: #2e2e2e;
    line-height: 1.4;
}

@media (max-width: 991px) {

    /* Tablet adjustments */
    .product-dimensions {
        font-size: 1.3rem;
    }

    [data-filter-row] .money {
        font-size: 18px;
    }

    /* Ensure cart button full width */
    [data-filter-row] .add-to-cart-block .btn {
        width: 100%;
        min-height: 50px;
    }
}

@media (max-width: 767px) {

    /* Product variation row spacing */
    [data-filter-row] {
        padding: 12px 8px !important;
        margin-bottom: 10px !important;
    }

    /* === FIRST ROW: Icon, Dimensions, Price - same as desktop (~1.5rem) === */

    /* Product dimensions - keep similar to desktop */
    .product-dimensions {
        font-size: 1.4rem;
        font-weight: 600;
        line-height: 1.3;
        color: #2e2e2e;
    }

    /* Icon column */
    [data-filter-row] .product-image {
        display: flex;
        align-items: center;
        justify-content: flex-start;
    }

    [data-filter-row] .product-image a {
        min-width: 40px;
        min-height: 40px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    [data-filter-row] .product-image .fa-picture-o {
        font-size: 20px;
        color: #2e2e2e;
    }

    /* Price display - same size as dimensions */
    [data-filter-row] .money {
        font-size: 1.4rem !important;
        font-weight: 600 !important;
        color: #2e2e2e !important;
        white-space: nowrap;
    }

    /* === ATTRIBUTES SECTION - similar to desktop (~14px) === */

    [data-filter-row] .col-md-5.product-name {
        font-size: 14px;
        line-height: 1.4;
    }

    /* Attribute title (Papildprodukti, etc) - smaller, gray like desktop */
    [data-filter-row] .small {
        font-size: 13px !important;
        margin-bottom: 6px;
        display: block;
        color: #888;
        font-weight: 500;
    }

    /* === PRETTIER RADIO BUTTONS - match desktop style === */

    [data-filter-row] .form-check {
        margin-bottom: 6px;
        padding-left: 0;
        display: flex;
        align-items: center;
    }

    [data-filter-row] .form-check-input[type="radio"] {
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        width: 18px;
        height: 18px;
        min-width: 18px;
        min-height: 18px;
        border: 2px solid #ccc;
        border-radius: 50%;
        background: #fff;
        cursor: pointer;
        margin: 0;
        margin-right: 10px;
        position: relative;
        flex-shrink: 0;
    }

    [data-filter-row] .form-check-input[type="radio"]:checked {
        border-color: #2e2e2e;
        background: #fff;
    }

    [data-filter-row] .form-check-input[type="radio"]:checked::after {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 10px;
        height: 10px;
        background: #2e2e2e;
        border-radius: 50%;
    }

    [data-filter-row] .form-check-label {
        font-size: 14px !important;
        line-height: 1.4;
        padding-left: 0;
        margin: 0;
        display: inline;
        color: #2e2e2e;
        cursor: pointer;
    }

    /* === TOGGLE SWITCHES (checkboxes) === */

    [data-filter-row] .custom-control-label {
        font-size: 14px !important;
        line-height: 1.4;
        color: #2e2e2e;
    }

    /* Add to cart button */
    [data-filter-row] .add-to-cart-block {
        margin-top: 12px;
    }

    [data-filter-row] .add-to-cart-block .btn {
        min-height: 48px !important;
        width: 100%;
        font-size: 16px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    [data-filter-row] .add-to-cart-block .btn i {
        font-size: 18px;
    }
}

@media (max-width: 575px) {

    /* First row - keep readable on very small screens */
    .product-dimensions {
        font-size: 1.25rem;
        font-weight: 600;
    }

    [data-filter-row] {
        padding: 10px 6px !important;
    }

    [data-filter-row] .money {
        font-size: 1.25rem !important;
    }

    [data-filter-row] .product-image .fa-picture-o {
        font-size: 18px;
    }

    /* Attributes - slightly smaller but still readable */
    [data-filter-row] .form-check-label,
    [data-filter-row] .custom-control-label {
        font-size: 13px !important;
    }

    [data-filter-row] .small {
        font-size: 12px !important;
    }

    [data-filter-row] .add-to-cart-block .btn {
        min-height: 46px !important;
        font-size: 15px;
    }
}


/* ============================================
   15. SMALL MOBILE DEVICES (≤375px)
   ============================================ */

@media (max-width: 375px) {

    /* Even more compact on very small screens */
    .container,
    .container-fluid {
        padding-left: 12px;
        padding-right: 12px;
    }

    h1, .h1 {
        font-size: 24px;
    }

    h2, .h2 {
        font-size: 20px;
    }

    /* Reduce padding */
    .btn {
        padding: 12px 16px;
        font-size: 15px;
    }

    /* Product grid - single column on very small screens */
    .product-grid {
        grid-template-columns: 1fr;
    }
}
