/* =========================================================
   LDP AM - page specific styles
   Header/Footer/Package cards dùng chung layout hệ thống.
   File này chỉ style: intro heading, ưu đãi, đăng ký, FAQ.
   ========================================================= */

/* Scoped, khong dùng ".container" chung vì header.css đã định nghĩa ".container" riêng cho header */
.ldp-am-container {
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 40px;
    box-sizing: border-box;
}

/* ---------- Intro heading ---------- */
/* Nền xám nhạt (giống .package-section) để khối card gói cước trắng bo góc nổi lên trên,
   không phải mảng trắng liền với section bên dưới. */
.ldp-am-intro-heading {
    padding: 40px 0 0;
    background: #F3F3F3;
}

.ldp-am-intro-heading h2 {
    margin: 0;
    text-align: center;
    font-size: 40px;
    font-weight: 700;
    line-height: 1.4;
    color: #3D3D3D;
}

.ldp-am-intro-heading__location {
    color: #4564ED;
    text-decoration: underline;
    cursor: pointer;
}

/* Chỉ xuống dòng ở mobile (xem override trong media query bên dưới) — desktop giữ 1 dòng
   như Figma vì text mặc định "Khu vực của bạn" đủ ngắn để không tràn. */
.ldp-am-intro-heading__break {
    display: none;
}

/* ---------- Banner: fallback ảnh mặc định khi ảnh CMS lỗi link ----------
   banner.blade.php dùng 2 thẻ <img> riêng (desktop/mobile) thay vì <picture><source> vì onerror
   không đáng tin cậy trên <source> ở nhiều trình duyệt mobile (đặc biệt Safari iOS không fire
   error khi source đã chọn tải lỗi) — ẩn/hiện bằng CSS theo breakpoint, mỗi ảnh tự onerror riêng. */
.swiper-banner-hero .banner-img-mobile {
    display: none;
}

@media (max-width: 767px) {
    .swiper-banner-hero .banner-img-desktop {
        display: none;
    }

    .swiper-banner-hero .banner-img-mobile {
        display: block;
    }
}

/* ---------- Package sections: dùng nguyên nền xám + white box của package-section.css,
   không override nữa (override cũ set trắng full-width làm mất lớp xám nền) ---------- */
/* Ẩn badge ưu đãi trên card gói của trang AM — badge_text hiện đang gán cứng 1 câu chung cho
   mọi gói (kể cả gói lấy từ API get-packages-by-sysname, API này không trả field badge riêng),
   không phản ánh đúng ưu đãi thật của từng gói nên ẩn hẳn thay vì hiển thị nội dung sai. */
.ldp-am-package-section .package-badge {
    display: none;
}

/* Khi ít hơn 4 gói (package_internet/package_combo trả về 1-3 gói, không chỉ riêng 2 gói) ở
   tablet/desktop: package-swiper.js dùng slidesPerView:'auto' nên .swiper-wrapper (flex, mặc định
   justify-content:flex-start) dồn card về trái thay vì căn giữa, để trống khoảng lớn bên phải chỗ
   lẽ ra là card thứ 4. .package-cards-grid đã có width tường minh (xem package-section.css) nên
   .package-card tính width theo % không còn bị bóp nữa — chỉ cần căn giữa.
   Giữ nguyên công thức width theo vw (khớp 100% chiều rộng khối trắng .package-cards, tối đa
   1440px - 80px padding) để không phụ thuộc lại vào width thực tế của .swiper-wrapper.
   Dùng :not(:has(...4)) thay vì :nth-child(2):last-child để áp dụng cho mọi số lượng < 4 (1, 2
   hoặc 3 gói), không riêng trường hợp đúng 2. Áp dụng từ 768px (giữ đến khi xuống mobile, mobile
   vẫn scroll ngang trái như carousel bình thường). */
@media (min-width: 768px) {
    .ldp-am-package-section .swiper-wrapper:not(:has(.package-card:nth-child(4))) {
        justify-content: center;
    }

    .ldp-am-package-section .swiper-wrapper:not(:has(.package-card:nth-child(4))) .package-card {
        flex: 0 0 calc((min(100vw - 80px, 1360px) - 72px) / 4);
        width: calc((min(100vw - 80px, 1360px) - 72px) / 4);
        max-width: 330px;
    }
}

/* .p-description không có CSS nào định nghĩa sẵn (package-section.css không có class này)
   nên trước giờ chạy theo mặc định trình duyệt (<p> căn trái, margin to) — bổ sung đúng theo Figma. */
.ldp-am-package-section .p-description {
    margin: 4px 0 24px;
    text-align: center;
    font-size: 16px;
    line-height: 24px;
    color: #000000;
}

/* ---------- Ưu đãi lắp mạng FPT ---------- */
.ldp-am-offers {
    position: relative;
    padding: 64px 0;
    background-color: #FF8204;
    background-image: var(--ldp-am-bg-desktop, url('../images/desktop_promo_banner.png'));
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* Ảnh nền desktop (desktop_promo_banner.png) có tỉ lệ rất dẹt (1920x570) trong khi chiều cao
   section chỉ do padding + nội dung quyết định (không đổi theo chiều rộng) — màn hình càng rộng,
   section càng rộng nhưng cao gần như không đổi, background-size:cover phải scale theo chiều rộng
   nên cắt mất phần trên/dưới ảnh (nhân vật). min-height theo đúng tỉ lệ ảnh gốc để cover scale
   theo chiều cao thay vì chiều rộng → không cắt dọc nữa; chỉ là "sàn" nên nội dung vẫn được ưu
   tiên nếu cần cao hơn, không giới hạn max. Chỉ áp dụng ở >=768px vì <768px dùng ảnh mobile
   (tỉ lệ khác hẳn, cao/hẹp — chiều cao vốn đã đủ do nội dung xếp 1 cột dài). */
@media (min-width: 768px) {
    .ldp-am-offers {
        min-height: calc(100vw * 570 / 1920);
    }
}

.ldp-am-offers__container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 40px;
}

.ldp-am-offers__heading {
    max-width: 600px;
}

.ldp-am-offers__heading h2 {
    margin: 0 0 8px;
    font-size: 40px;
    font-weight: 700;
    line-height: 1.22;
    color: #FFFFFF;
}

.ldp-am-offers__heading p {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
    line-height: 1.4;
    color: #FFFFFF;
}

.ldp-am-offers__grid {
    margin-top: 34px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 286px));
    gap: 18px;
    max-width: 894px;
}

.ldp-am-offer-card {
    position: relative;
    padding: 21px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.9);
    background: linear-gradient(109deg, rgba(248, 249, 255, 0.2) 0%, rgba(255, 255, 255, 0.2) 43%);
    backdrop-filter: blur(5px);
    box-shadow: inset 0 4px 10px 0 rgba(255, 255, 255, 0.4);
}

.ldp-am-offer-card h3 {
    margin: 0 0 14px;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.4;
    color: #FFFFFF;
}

.ldp-am-offer-card ul {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ldp-am-offer-card li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 14px;
    line-height: 1.4;
    color: #FFFFFF;
}

.ldp-am-offer-card li img {
    flex-shrink: 0;
    width: 8px;
    height: 8px;
    margin-top: 6px;
}

.ldp-am-offer-card li.is-highlight {
    color: #FFDF00;
    font-weight: 700;
}

/* ---------- Đăng ký nhận ưu đãi ---------- */
.ldp-am-register {
    padding: 40px;
    background: #F3F3F3;
}

.ldp-am-register__box {
    position: relative;
    max-width: 1440px;
    margin: 0 auto;
    padding: 64px 40px;
    border-radius: 16px;
    overflow: hidden;
    background-color: #FF8400;
    background-image: var(--ldp-am-bg-desktop, url('../images/desktop_register_bg.png'));
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.ldp-am-register__box h2 {
    margin: 0 0 24px;
    text-align: center;
    font-size: 40px;
    font-weight: 700;
    line-height: 1.22;
    color: #FFFFFF;
}

.ldp-am-register__form {
    max-width: 798px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ldp-am-register__row {
    display: flex;
    gap: 16px;
}

.ldp-am-register__field {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.ldp-am-register__field label {
    font-size: 14px;
    font-weight: 500;
    color: #FFFFFF;
}

.ldp-am-register__field label sup {
    color: #FFFFFF;
}

.ldp-am-register__field input,
.ldp-am-register__field select {
    width: 100%;
    height: 50px;
    padding: 0 13px;
    box-sizing: border-box;
    border: 1px solid #D1D1D1;
    border-radius: 8px;
    background: #FFFFFF;
    font-size: 15px;
    color: #3D3D3D;
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.08);
    appearance: none;
    -webkit-appearance: none;
}

.ldp-am-register__field input::placeholder {
    color: #888888;
}

.ldp-am-register__field select {
    background-image: url('../../../../frontend_layout_2025_vibecode/assets/images/arrow-down.svg');
    background-repeat: no-repeat;
    background-position: right 13px center;
    background-size: 20px;
    color: #888888;
}

.ldp-am-register__field select:valid {
    color: #3D3D3D;
}

.ldp-am-register__captcha {
    align-self: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.ldp-am-register .text-error {
    font-size: 12px;
    color: #C62828;
}

.ldp-am-register__message {
    align-self: center;
    font-size: 14px;
    font-weight: 500;
}

.ldp-am-register__message.text-success {
    color: #006400;
    font-weight: 700;
}

.ldp-am-register__message.text-error {
    color: #C62828;
}

.ldp-am-register__submit {
    margin: 8px auto 0;
    width: 100%;
    max-width: 500px;
    padding: 13px 24px;
    border: none;
    border-radius: 7px;
    background: linear-gradient(90deg, #4564ED 0%, #4564ED 100%);
    font-size: 18px;
    font-weight: 500;
    line-height: 1;
    color: #FFFFFF;
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.ldp-am-register__submit:hover {
    opacity: 0.9;
}

.ldp-am-register__submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ---------- FAQ ---------- */
.ldp-am-faq {
    padding: 40px 0 80px;
    background: linear-gradient(180deg, #FFF9F0 0%, #FFFFFF 40%);
}

.ldp-am-faq__container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 40px;
}

.ldp-am-faq__container>h2 {
    margin: 0 0 40px;
    text-align: center;
    font-size: 48px;
    font-weight: 900;
    line-height: 1.17;
    color: #000000;
    text-transform: uppercase;
}

.ldp-am-faq__list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ldp-am-faq__item {
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.12);
    overflow: hidden;
}

.ldp-am-faq__question {
    width: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 13px 36px 13px 24px;
    border: none;
    border-radius: 24px;
    background: linear-gradient(220deg, rgba(255, 235, 207, 0.3) 0%, rgba(255, 195, 94, 0.3) 45%);
    font-size: 16px;
    font-weight: 700;
    line-height: 1.75;
    color: #000000;
    text-align: left;
    cursor: pointer;
}

.ldp-am-faq__icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin-top: 4px;
    opacity: 0.8;
    transform: rotate(180deg);
    transition: transform 0.25s ease;
}

.ldp-am-faq__item.is-open .ldp-am-faq__icon {
    transform: rotate(0deg);
}

.ldp-am-faq__answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.ldp-am-faq__answer p {
    margin: 0;
    padding: 24px 24px 16px;
    font-size: 16px;
    line-height: 1.375;
    color: #000000;
}

.ldp-am-faq__item.is-open .ldp-am-faq__answer {
    max-height: 500px;
}

/* =========================================================
   RESPONSIVE - Mobile ( <= 767px )
   ========================================================= */
@media (max-width: 767px) {
    .ldp-am-container {
        padding: 0 16px;
    }

    .ldp-am-intro-heading {
        padding: 24px 0 0;
    }

    .ldp-am-intro-heading h2 {
        font-size: 24px;
        padding: 0 16px;
        overflow-wrap: break-word;
    }

    /* Ép "Khu vực của bạn"/tên tỉnh thành luôn xuống dòng riêng thay vì trông cậy vào wrap
       tự nhiên — tên tỉnh thành thực tế dài (vd "Thành phố Hồ Chí Minh") nối liền câu trên
       dễ bị tràn/cắt chữ ở màn hẹp. */
    .ldp-am-intro-heading__break {
        display: inline;
    }

    .ldp-am-package-section .p-description {
        margin: 6px 0 12px;
        font-size: 14px;
        line-height: 19px;
        padding: 0 16px;
    }

    .ldp-am-offers {
        padding: 40px 0;
        background-image: var(--ldp-am-bg-mobile, url('../images/mobile_promo_banner.png'));
    }

    .ldp-am-offers__container {
        padding: 0 16px;
    }

    .ldp-am-offers__heading h2 {
        font-size: 24px;
    }

    .ldp-am-offers__heading p {
        font-size: 14px;
    }

    .ldp-am-offers__grid {
        margin-top: 24px;
        grid-template-columns: 1fr;
        max-width: 100%;
        gap: 16px;
    }

    .ldp-am-register {
        padding: 16px;
    }

    .ldp-am-register__box {
        padding: 32px 16px;
        background-image: var(--ldp-am-bg-mobile, url('../images/mobile_register_bg.png'));
    }

    .ldp-am-register__box h2 {
        font-size: 24px;
        margin-bottom: 16px;
    }

    .ldp-am-register__row {
        flex-direction: column;
        gap: 16px;
    }

    .ldp-am-faq {
        padding: 32px 0 56px;
    }

    .ldp-am-faq__container {
        padding: 0 16px;
    }

    .ldp-am-faq__container>h2 {
        font-size: 28px;
        margin-bottom: 24px;
    }

    .ldp-am-faq__question {
        padding: 16px 40px 16px 16px;
        font-size: 15px;
    }

    .ldp-am-faq__answer p {
        padding: 0 16px 16px;
    }
}

/* Chỉ áp dụng cho tablet (768-900px); thiếu min-width sẽ đè cả rule 1 cột của mobile ở trên
   vì khối này đứng sau trong file và cùng match ở mobile width. */
@media (min-width: 768px) and (max-width: 900px) {
    .ldp-am-offers__grid {
        grid-template-columns: repeat(2, 1fr);
        max-width: 100%;
    }
}
