/**
 * Mobile-only responsive overrides for /package/details.
 * Scoped under .package-section so desktop and other pages are unaffected.
 */

/* ---- Shared helpers (safe at all sizes; desktop visual unchanged) ---- */
.package-section .pd-text-dynamic {
    overflow-wrap: anywhere;
    word-break: break-word;
    min-width: 0;
}

.package-section .pd-icon-text {
    display: flex;
    align-items: flex-start;
    min-width: 0;
}

    .package-section .pd-icon-text > i,
    .package-section .pd-icon-text > .avatar {
        flex-shrink: 0;
    }

.package-section .pd-summary-title,
.package-section .pd-section-title {
    min-width: 0;
}

.package-section .pd-summary-title,
.package-section .pd-section-title,
.package-section .flight-passenger-card .fs-14,
.package-section .form-label,
.package-section .form-check-label,
.package-section .alert,
.package-section .invalid-feedback,
.package-section .airline__name,
.package-section .fd-airport,
.package-section .fd-time {
    overflow-wrap: anywhere;
    word-break: break-word;
    width: 100% !important;
    max-width: 100% !important;
}

.package-section .fd-layover {
    max-width: 100%;
    white-space: normal;
    flex-wrap: wrap;
}

/* ---- Tablet / mobile (<= 991.98px) ---- */
@media (max-width: 991.98px) {
    .package-details-page .breadcrumb-title {
        font-size: clamp(1.25rem, 5vw, 1.75rem);
        padding-inline: 0.5rem;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .package-section .card-body {
        padding: 1rem;
    }

    .package-section .pd-hotel-summary {
        flex-direction: column;
        align-items: stretch !important;
    }

    .package-section .pd-hotel-img {
        max-width: 100%;
        width: 100%;
        height: auto;
        aspect-ratio: 22 / 10;
        object-fit: cover;
    }

    .package-section .pd-summary-body {
        width: 100%;
        min-width: 0;
    }

    .package-section .pd-summary-title,
    .package-section .pd-section-title {
        /*flex-wrap: wrap;*/
        gap: 0.25rem;
    }

    .package-section .pd-nav-actions .btn {
        flex: 1 1 auto;
        min-width: min(100%, 10rem);
        justify-content: center;
        text-align: center;
        white-space: normal;
    }

    .package-section .pd-confirm-btn,
    .package-section .pd-confirm-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .package-section .form-control,
    .package-section .form-select {
        max-width: 100%;
    }

    /* Sidebar route row: wrap long airport codes/names */
    .package-section .pd-route-row {
        flex-wrap: wrap;
        gap: 0.5rem;
        align-items: stretch !important;
    }

        .package-section .pd-route-row > .btn {
            flex: 1 1 calc(50% - 2rem);
            min-width: 0;
            white-space: normal;
            overflow-wrap: anywhere;
            word-break: break-word;
            line-height: 1.3;
            height: auto;
            padding-top: 0.5rem;
            padding-bottom: 0.5rem;
        }

        .package-section .pd-route-row .way-icon {
            flex: 0 0 auto;
            align-self: center;
        }

    .package-section .pd-price-box {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
    }

        .package-section .pd-price-box h5 {
            margin-bottom: 0;
            overflow-wrap: anywhere;
            word-break: break-word;
        }

    /* Flight itinerary summary on this page only */
    .package-section .fd-itinerary-summary-card .row.g-1 > [class*="col-3"],
    .package-section .fd-itinerary-summary-card .row.g-1 > [class*="col-4"] {
        width: 100%;
        max-width: 100%;
        flex: 0 0 100%;
        text-align: left !important;
        margin-bottom: 0.5rem;
    }

    .package-section .fd-itinerary-summary-card .airport-line {
        justify-content: flex-start;
        text-align: left;
        align-self: stretch !important;
    }

        .package-section .fd-itinerary-summary-card .airport-line.text-end {
            justify-content: flex-end;
            text-align: left;
            align-self: stretch !important;
        }

    /*.package-section .fd-itinerary-summary-card .center-pane {
        align-items: flex-start;
    }*/

    .package-section .fd-itinerary-summary-card .direct {
        width: 100%;
        max-width: 100%;
    }

    .package-section .fd-itinerary-summary-card .time-value,
    .package-section .fd-itinerary-summary-card .small,
    .package-section .fd-itinerary-summary-card .airline__name {
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .package-section .fd-itinerary-summary-card .airline__logo {
        max-width: 100%;
        height: auto;
    }

    .package-section .fd-itinerary-card .row > [class*="col-"] {
        min-width: 0;
    }

    .package-section .fd-itinerary-card img {
        max-width: 32px;
        height: auto;
        flex-shrink: 0;
    }

    .package-section .cancellation-rule-card {
        min-width: 0;
    }

        .package-section .cancellation-rule-card .d-flex {
            min-width: 0;
        }

    .package-section .accordion-button {
        white-space: normal;
        overflow-wrap: anywhere;
        word-break: break-word;
    }
}

/* ---- Phones (<= 767.98px) ---- */
@media (max-width: 767.98px) {
    .package-section {
        padding-bottom: 5.5rem;
    }

        .package-section .flight-passenger-card {
            padding: 0.75rem !important;
        }

            .package-section .flight-passenger-card .row > [class*="col-"] {
                width: 100%;
                max-width: 100%;
                flex: 0 0 100%;
            }

        .package-section .pd-route-row > .btn {
            flex: 1 1 100%;
        }

        .package-section .pd-route-row .way-icon {
            order: 0;
            margin-inline: auto !important;
        }

        .package-section .theiaStickySidebar {
            min-height: 0 !important;
            transform: none !important;
        }

    .package-details-fixed-price {
        padding: 0.75rem 1rem;
        box-sizing: border-box;
    }

        .package-details-fixed-price .row {
            --bs-gutter-x: 0.75rem;
            align-items: center;
            margin-left: 0;
            margin-right: 0;
        }

            .package-details-fixed-price .row > [class*="col-"] {
                padding-left: calc(var(--bs-gutter-x) * 0.5);
                padding-right: calc(var(--bs-gutter-x) * 0.5);
                min-width: 0;
            }

        .package-details-fixed-price p.small {
            margin-bottom: 0.15rem;
            overflow-wrap: anywhere;
            word-break: break-word;
        }

        .package-details-fixed-price h6 {
            font-size: clamp(1rem, 4.5vw, 1.25rem);
            margin-bottom: 0;
            overflow-wrap: anywhere;
            word-break: break-word;
            line-height: 1.25;
        }

        .package-details-fixed-price .btn {
            width: 100%;
            max-width: 100%;
            justify-content: center;
            white-space: normal;
            padding-left: 0.75rem;
            padding-right: 0.75rem;
            font-size: 0.9rem;
        }

            .package-details-fixed-price .btn i {
                flex-shrink: 0;
            }

    /* Flight card grid: stack timing columns cleanly */
    .package-section .fd-itinerary-summary-card {
        padding: 12px !important;
    }

        /*.package-section .fd-itinerary-summary-card .row.g-1 > [class*="col-3"] {
            width: 50%;
            max-width: 50%;
            flex: 0 0 50%;
        }*/

            .package-section .fd-itinerary-summary-card .row.g-1 > .center-pane,
            .package-section .fd-itinerary-summary-card .row.g-1 > [class*="col-3"]:nth-child(3) {
               /* width: 100%;
                max-width: 100%;
                flex: 0 0 100%;*/
                order: 3;
            }

            .package-section .fd-itinerary-summary-card .row.g-1 > [class*="col-3"]:nth-child(1) {
                order: 1;
            }

            .package-section .fd-itinerary-summary-card .row.g-1 > [class*="col-3"]:nth-child(2) {
                order: 2;
            }

            .package-section .fd-itinerary-summary-card .row.g-1 > [class*="col-3"]:nth-child(4) {
                order: 4;
               /* width: 50%;
                max-width: 50%;
                flex: 0 0 50%;*/
                margin-left: auto;
                text-align: right !important;
            }

                .package-section .fd-itinerary-summary-card .row.g-1 > [class*="col-3"]:nth-child(4) .airport-line {
                    justify-content: flex-end;
                    text-align: right;
                }
}

@media(min-width:375px) and (max-width: 992px) {
    .package-section .fd-itinerary-summary-card .row.g-1 > [class*="col-3"] {
        width: 25%;
        max-width: 25%;
        flex: 0 0 25%;
    }

        .package-section .fd-itinerary-summary-card .row.g-1 > .center-pane, .package-section .fd-itinerary-summary-card .row.g-1 > [class*="col-3"]:nth-child(3) {
            width: 25%;
            max-width: 25%;
            flex: 0 0 25%;
            order: 3;
        }

        .package-section .fd-itinerary-summary-card .row.g-1 > [class*="col-3"]:nth-child(4) {
            order: 4;
            width: 25%;
            max-width: 25%;
            flex: 0 0 25%;
            margin-left: auto;
            text-align: right !important;
        }
}


/* ---- Very small phones (<= 375px) ---- */
@media (max-width: 375px) {
    .package-section .card-body {
        padding: 0.75rem;
    }

    .package-section .fd-itinerary-summary-card .row.g-1 > [class*="col-3"],
    .package-section .fd-itinerary-summary-card .row.g-1 > [class*="col-4"] {
        /*width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;*/
        margin-left: 0 !important;
        text-align: left !important;
        order: initial !important;
    }

        .package-section .fd-itinerary-summary-card .row.g-1 > [class*="col-3"]:nth-child(4) .airport-line {
            justify-content: flex-start;
            text-align: left;
        }

    /*.package-details-fixed-price .col-7,
    .package-details-fixed-price .col-5 {
        width: 100%;
        max-width: 100%;
        flex: 0 0 100%;
        text-align: left !important;
    }*/

    .package-details-fixed-price .col-5 {
        margin-top: 0.5rem;
    }
}
