/**
 * Correctifs mobile PWA Aliko Market.
 * Chargé après adaptive-fixer.css pour reprendre la main sur les tailles forcées.
 */

html,
body {
    overflow-x: hidden !important;
    max-width: 100%;
}

@media (min-width: 769px) {
    .navbar-mobile-top,
    .navbar-mobile-bottom {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .navbar-mobile-top {
        position: sticky;
        top: 0;
        z-index: 1000;
        display: flex !important;
        flex-direction: column;
        width: 100%;
        max-width: 100%;
        background: #ffffff;
        border-bottom: 1px solid #e2e8f0;
        box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
        padding: env(safe-area-inset-top, 0px) 0 8px;
        margin: 0;
        box-sizing: border-box;
        overflow: visible;
    }

    .mobile-top-container {
        display: grid;
        grid-template-columns: 44px 1fr 44px;
        align-items: center;
        height: 56px;
        min-height: 56px;
        max-height: 56px;
        width: 100%;
        padding: 0 8px;
        box-sizing: border-box;
    }

    .mobile-menu-toggle {
        width: 44px;
        height: 44px;
        min-width: 44px !important;
        min-height: 44px !important;
        max-width: 44px;
        padding: 0 !important;
        margin: 0;
        justify-self: start;
    }

    .mobile-logo {
        display: flex;
        justify-content: center;
        align-items: center;
        min-width: 0;
        padding: 0;
    }

    .mobile-logo-img {
        height: 32px !important;
        width: auto !important;
        max-height: 32px !important;
        max-width: 120px !important;
        object-fit: contain;
    }

    .mobile-top-spacer {
        width: 44px;
        height: 44px;
    }

    .header-search-mobile {
        display: flex !important;
        align-items: center;
        gap: 8px;
        height: 40px;
        min-height: 40px;
        max-height: 40px;
        width: calc(100% - 24px);
        max-width: calc(100% - 24px) !important;
        margin: 0 12px;
        padding: 0 12px;
        box-sizing: border-box;
        background: #f8fafc;
        border: 1px solid #e2e8f0;
        border-radius: 999px;
        flex: 0 0 auto;
    }

    .header-search-mobile .header-search-glyph {
        flex: 0 0 18px;
        width: 18px;
        height: 18px;
        color: #64748b;
    }

    .header-search-mobile input {
        flex: 1 1 auto;
        min-width: 0;
        width: auto;
        height: 38px;
        min-height: 0 !important;
        max-height: 38px;
        margin: 0;
        padding: 0 !important;
        border: 0 !important;
        border-radius: 0;
        background: transparent;
        box-shadow: none !important;
        font-size: 16px !important;
        transform: none !important;
    }

    .header-search-mobile input:focus {
        outline: none;
        transform: none !important;
    }

    .navbar-mobile-bottom {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 50;
        display: flex !important;
        align-items: flex-end;
        justify-content: space-around;
        height: 60px;
        min-height: 60px;
        padding: 0 4px env(safe-area-inset-bottom, 0px);
        background: #ffffff;
        border-top: 1px solid #e2e8f0;
        box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.06);
        box-sizing: content-box;
    }

    .mobile-bottom-link {
        flex: 1 1 0;
        min-width: 0 !important;
        min-height: 0 !important;
        height: 60px;
        padding: 6px 2px 4px !important;
        gap: 2px;
        color: #64748b;
        font-size: 0.68rem;
        font-weight: 600;
        line-height: 1.1;
    }

    .mobile-bottom-link svg {
        width: 22px;
        height: 22px;
    }

    .mobile-bottom-link > span:not(.icon-wrapper):not(.sell-fab) {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 0.62rem;
    }

    .mobile-bottom-sell {
        color: #0f172a;
    }

    .mobile-bottom-sell .sell-fab {
        width: 46px;
        height: 46px;
        margin-top: -18px;
        border-radius: 50%;
        background: #ff4e02;
        color: #ffffff;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.75rem !important;
        font-weight: 500;
        line-height: 1;
        box-shadow: 0 8px 18px rgba(255, 78, 2, 0.35);
    }

    body {
        padding-top: 0 !important;
        padding-bottom: 0 !important;
        overflow-x: hidden !important;
    }

    main.main-content {
        padding-top: 0 !important;
        padding-bottom: 70px !important;
        overflow-x: hidden;
    }
}

@media (max-width: 640px) {
    .slider-controls,
    .slider-btn {
        display: none !important;
    }

    .hero-slider {
        display: flex;
        flex-direction: column;
        height: 190px;
        min-height: 180px;
        max-height: 200px;
        margin-bottom: 0.75rem;
        overflow: hidden;
    }

    .hero-slider .slider-container {
        flex: 1 1 auto;
        min-height: 0;
        height: auto;
    }

    .slide:not(.active) {
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
        z-index: 0 !important;
    }

    .slide.active {
        visibility: visible !important;
        opacity: 1 !important;
        z-index: 2 !important;
    }

    .slide-title,
    .slide-description,
    .slide-content .btn {
        animation: none !important;
        text-shadow: none !important;
    }

    .slide-content .btn::before,
    .slide-content .btn::after {
        content: none !important;
        display: none !important;
    }

    .slide-content {
        align-items: center;
        justify-content: center;
        padding: 8px 12px 22px;
        box-sizing: border-box;
    }

    .slide-content .container {
        display: flex;
        flex-direction: column;
        align-items: center;
        width: 100%;
    }

    .slide-title {
        font-size: 1.15rem;
        line-height: 1.2;
        margin: 0 0 4px;
        padding: 0;
    }

    .slide-description {
        font-size: 0.8rem;
        line-height: 1.3;
        margin: 0 0 8px;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .slide-content .btn,
    .slide-content .btn-lg,
    .slide-content .btn-primary {
        width: auto !important;
        min-height: 36px !important;
        min-width: 0 !important;
        padding: 8px 16px !important;
        margin: 0;
        font-size: 0.9rem;
        line-height: 1.2;
        position: static;
        background: #FF4E02 !important;
        border-color: #FF4E02 !important;
        color: #fff !important;
    }

    .hero-slider .slider-indicators {
        position: absolute !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 6px !important;
        top: auto !important;
        transform: none !important;
        height: 8px;
        display: flex !important;
        justify-content: center;
        align-items: center;
        gap: 6px;
        z-index: 5;
        margin: 0;
        width: 100%;
        pointer-events: none;
    }

    .hero-slider .slider-indicators .indicator {
        pointer-events: auto;
    }

    .hero-slider .indicator {
        width: 8px !important;
        height: 8px !important;
        min-width: 8px !important;
        min-height: 8px !important;
        padding: 0 !important;
        border-width: 1px;
        box-sizing: border-box;
        transform: none;
    }

    .hero-slider .indicator.active {
        transform: none;
        background: #ffffff;
    }
}

/* Drawer mobile : bandeau, liens alignés, action Vendre, pied de menu */
.mobile-menu-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 100%;
    overflow: hidden;
}

.mobile-menu-header {
    flex-shrink: 0;
    gap: 12px;
    padding: 14px 12px 14px 16px;
}

.mobile-menu-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    color: #ffffff;
    text-decoration: none;
    font-weight: 700;
    font-size: 1rem;
    line-height: 1.2;
}

.mobile-menu-brand-logo {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    background: #ffffff;
}

.mobile-menu-close {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    min-height: 40px !important;
    padding: 0 !important;
    border: none;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    flex-shrink: 0;
}

.mobile-menu-close:active {
    background: rgba(255, 255, 255, 0.22);
    transform: none;
}

.mobile-menu-nav {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 8px 0;
}

.mobile-menu-nav .mobile-menu-link,
.mobile-menu-nav .mobile-menu-link-primary {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 48px;
    margin: 0;
    padding: 12px 16px;
    border-radius: 0;
    border-left: 3px solid transparent;
    background: transparent;
    color: #111827;
    font-weight: 500;
    box-sizing: border-box;
}

.mobile-menu-nav .mobile-menu-link svg,
.mobile-menu-nav .mobile-menu-link-primary svg {
    width: 20px;
    height: 20px;
    min-width: 20px;
    margin: 0;
    color: #4A90E2;
    flex-shrink: 0;
}

.mobile-menu-nav .mobile-menu-link-danger {
    color: #EF4444;
}

.mobile-menu-nav .mobile-menu-link-danger svg {
    color: #EF4444;
}

.mobile-menu-sell {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: auto;
    margin: 8px 16px 16px;
    padding: 12px 16px;
    min-height: 48px;
    background: #FF4E02;
    color: #ffffff !important;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.95rem;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
}

.mobile-menu-sell:active {
    background: #e64600;
    color: #ffffff !important;
}

.mobile-menu-footer {
    flex-shrink: 0;
    margin-top: auto;
    border-top: 1px solid #f3f4f6;
    padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
}

.mobile-menu-footer-links {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

.mobile-menu-footer-links a {
    display: flex;
    align-items: center;
    min-height: 32px;
    min-width: 0;
    color: #6b7280;
    text-decoration: none;
    font-size: 0.8125rem;
    line-height: 1.3;
}

.mobile-menu-langs {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
}

.mobile-menu-footer .mobile-language-option {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    min-width: 44px;
    height: 32px;
    margin: 0;
    padding: 0 12px;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    background: #ffffff;
    color: #374151;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1;
    cursor: pointer;
    transform: none;
}

.mobile-menu-footer .mobile-language-option.is-active {
    background: #111827;
    border-color: #111827;
    color: #ffffff;
}

.mobile-menu-footer .mobile-language-option:hover,
.mobile-menu-footer .mobile-language-option:active {
    transform: none;
    background: #f3f4f6;
}

.mobile-menu-footer .mobile-language-option.is-active:hover,
.mobile-menu-footer .mobile-language-option.is-active:active {
    background: #111827;
    color: #ffffff;
}

.mobile-menu-version {
    margin: 14px 0 0;
    color: #9ca3af;
    font-size: 0.6875rem;
    line-height: 1.3;
}
