/* =============================================================================
   IFY — Responsivité mobile : liste services + fiche détail
   ============================================================================= */

/* ---------- Liste services ---------- */
.all-services-area {
    overflow-x: clip;
}

.all-services-area .container {
    max-width: 100%;
}

/* Hero recherche + chips */
@media (max-width: 991px) {
    .ify-service-hero__search {
        flex-direction: column;
        align-items: stretch;
    }

    .ify-service-search {
        flex: 1 1 auto;
        width: 100%;
    }

    .ify-category-chips {
        flex: 1 1 auto;
        max-width: 100%;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 2px;
    }

    .ify-category-chips::-webkit-scrollbar {
        display: none;
    }
}

@media (max-width: 767px) {
    .ify-service-hero.breadcrumb__area {
        padding: 10px 0 !important;
    }

    .ify-service-hero__intro .title,
    .ify-service-hero .breadcrumb__content .title {
        font-size: 18px !important;
    }

    .ify-service-search {
        display: flex;
        flex-wrap: wrap;
        padding: 8px;
        gap: 8px;
    }

    .ify-service-search input {
        width: 100%;
        flex: 1 1 100%;
        height: 40px;
    }

    .ify-service-search button {
        width: 100%;
        padding: 10px 14px;
    }
}

/* Barre filtres mobile */
.services-mobile-filter-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin-bottom: 12px;
    padding: 12px 16px;
    border: 1px solid #d7deea;
    border-radius: 10px;
    background: #fff;
    color: #111827;
    font-weight: 700;
    font-size: 14px;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
}

.services-mobile-filter-btn i {
    color: var(--tg-theme-primary, #d32f2f);
}

/* Tiroir filtres (mobile) */
@media (max-width: 991.98px) {
    .all-services-area > .container > .row > .col-xl-3.col-lg-4 {
        position: static;
        flex: 0 0 100%;
        max-width: 100%;
        height: 0;
        overflow: visible;
        padding: 0 !important;
        margin: 0 !important;
        border: 0;
    }

    .all-services-area .services__sidebar_area {
        position: relative;
        margin-bottom: 0;
        height: 0;
        overflow: visible;
    }

    .all-services-area .services__sidebar_button {
        display: none !important;
    }

    .services__sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.45);
        z-index: 1040;
        opacity: 0;
        transition: opacity 0.25s ease;
    }

    .services__sidebar_area.show .services__sidebar-backdrop {
        display: block;
        opacity: 1;
    }

    .all-services-area .services__sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(92vw, 360px);
        max-width: 360px;
        margin: 0 !important;
        height: 100vh !important;
        height: 100dvh !important;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        background: #fff;
        z-index: 1050;
        padding: 16px 16px 88px;
        transform: translateX(-105%);
        transition: transform 0.28s ease;
        visibility: visible !important;
        opacity: 1 !important;
        box-shadow: 8px 0 32px rgba(0, 0, 0, 0.12);
    }

    .services__sidebar_area.show .services__sidebar {
        transform: translateX(0);
    }

    .services__sidebar-close {
        display: none;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1051;
        width: min(92vw, 360px);
        max-width: 360px;
        padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
        border: 0;
        border-top: 1px solid #e5e9f0;
        background: var(--tg-theme-primary, #d32f2f);
        color: #fff;
        font-weight: 700;
        font-size: 15px;
    }

    .services__sidebar_area.show .services__sidebar-close {
        display: block;
    }

    body.services-filter-open {
        overflow: hidden;
    }
}

/* Top bar + trust */
@media (max-width: 767px) {
    .services-top-wrap {
        margin-bottom: 8px;
    }

    .services-top-wrap .row {
        gap: 8px;
    }

    .services-top-left p {
        font-size: 13px;
        margin-bottom: 0;
    }

    .services-top-right {
        width: 100%;
        justify-content: space-between !important;
    }

    .services-top-right-select,
    .services-top-right-select select {
        width: 100%;
        max-width: 100%;
    }

    .ify-list-trust {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        font-size: 12px;
        padding: 10px 12px;
    }

    .service-holder.row {
        --bs-gutter-x: 12px;
    }

    .ify-service-card {
        margin-bottom: 4px;
    }

    .ify-service-card .services__item-content {
        padding: 0 4px 4px;
    }

    .ify-service-card .title a {
        font-size: 1rem;
        line-height: 1.35;
        word-break: break-word;
    }

    .ify-service-card__description {
        min-height: 0;
        margin-bottom: 10px;
    }

    .pagination-wrap .pagination {
        flex-wrap: wrap;
        justify-content: center;
        gap: 4px;
    }
}

/* ---------- Fiche service détail ---------- */
.sdp-page--detail {
    overflow-x: clip;
}

.sdp-primary {
    min-width: 0;
}

.sdp-gallery,
.sdp-content {
    min-width: 0;
}

@media (max-width: 991.98px) {
    .sdp-page--detail {
        padding-bottom: calc(80px + env(safe-area-inset-bottom));
    }

    .sdp-layout {
        display: flex;
        flex-direction: column;
        gap: 16px;
    }

    .sdp-primary {
        display: contents;
    }

    .sdp-gallery {
        order: 1;
    }

    .sdp-sidebar {
        order: 2;
    }

    .sdp-content {
        order: 3;
    }

    .sdp-crumb {
        font-size: 12px;
        gap: 4px;
        line-height: 1.4;
        word-break: break-word;
    }

    .sdp-crumb span:last-child {
        flex: 1 1 100%;
    }

    .sdp-hero img {
        height: min(52vw, 240px);
        min-height: 180px;
    }

    .sdp-hero-overlay {
        background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.75) 100%);
        justify-content: flex-end;
        padding: 14px;
    }

    .sdp-hero-overlay h1 {
        font-size: 18px !important;
        line-height: 1.25;
        margin-bottom: 6px;
    }

    .sdp-hero-overlay li {
        font-size: 12px;
    }

    .sdp-hero-overlay ul {
        max-height: 72px;
        overflow: hidden;
    }

    .sdp-sidebar {
        position: static;
        top: auto;
        padding: 14px;
        border-radius: 12px;
    }

    .sdp-sidebar h2 {
        font-size: 18px;
    }

    .sdp-price {
        font-size: 24px;
    }

    .sdp-trust {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .sdp-trust span {
        text-align: left;
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 10px 12px;
    }

    .sdp-trust i {
        display: inline-block;
        margin-bottom: 0;
    }

    /* Masquer CTAs dupliqués dans la sidebar — barre fixe en bas */
    .sdp-sidebar .sdp-btn,
    .sdp-sidebar .sdp-btn-ghost,
    .sdp-sidebar .add-to-cart,
    .sdp-sidebar .buy-now {
        display: none !important;
    }

    .sdp-tabs {
        margin-top: 0;
        gap: 0;
        padding-bottom: 2px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .sdp-tabs::-webkit-scrollbar {
        display: none;
    }

    .sdp-tabs button {
        font-size: 12px;
        padding: 10px 12px;
        flex-shrink: 0;
    }

    .sdp-panel {
        padding: 14px 12px;
        overflow-x: clip;
        max-width: 100%;
    }

    .sdp-panel > p:first-child {
        font-size: 13px;
        line-height: 1.55;
    }

    #tab-desc .sdp-desc-details {
        margin-top: 12px;
    }

    #tab-desc .sdp-desc-full ul,
    #tab-desc .sdp-desc-full ol {
        padding-left: 1.1rem;
    }

    #tab-desc .sdp-features {
        margin-top: 14px;
    }

    .sdp-panel img,
    .sdp-panel table {
        max-width: 100%;
        height: auto;
    }

    .sdp-panel .table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .sdp-links {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .sdp-mobile-cta {
        display: flex;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1035;
        background: #fff;
        padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
        gap: 8px;
        box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.1);
        border-top: 1px solid #e8ecf2;
    }

    .sdp-mobile-cta .sdp-btn {
        flex: 1;
        margin: 0;
        min-height: 46px;
        font-size: 13px;
        padding: 10px 8px;
    }

    /* WhatsApp flottant au-dessus de la barre CTA */
    .ify-whatsapp-float {
        bottom: calc(72px + env(safe-area-inset-bottom)) !important;
    }
}

@media (max-width: 575.98px) {
    .sdp-page {
        padding-top: 8px;
    }

    .sdp-content {
        min-width: 0;
        width: 100%;
    }

    #tab-desc .sdp-feature span {
        display: block;
        overflow-wrap: anywhere;
    }

    .services__order-options .title {
        font-size: 15px;
    }

    .service-package-swatches {
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .service-package-swatch {
        min-width: 0;
        width: 100%;
        text-align: left;
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
        padding: 12px;
    }

    .service-package-swatch .swatch-dot,
    .service-package-swatch .swatch-img {
        margin: 0;
        flex-shrink: 0;
    }

    .service-package-swatch .swatch-label,
    .service-package-swatch .swatch-price {
        display: inline;
        margin: 0;
    }

    .service-package-swatch .swatch-price {
        margin-left: auto;
        font-weight: 700;
        color: var(--tg-theme-primary, #d32f2f);
    }

    .service-extra-item {
        flex-direction: column;
        align-items: stretch !important;
        gap: 6px;
    }

    .service-extra-item strong {
        align-self: flex-end;
    }

    .services__order-options {
        margin-bottom: 12px !important;
    }

    /* Services suggérés */
    .services-area .services__item-thumb img {
        height: auto;
        min-height: 160px;
        max-height: 200px;
    }
}
