/* ── หน้า Landing Page เมือง/สถานี (city-landing) ────────────────────────────
   ยกมาจาก <style> ของ city-landingpage.php บน production (ใหม่กว่าสำเนาบนเครื่อง)
   เทียบพิกัดแล้วต่างกันจริง: .p-t-title padding-bottom 10px (สำเนาเก่าเป็น 20px)
   และ .text-title ไม่มี padding-bottom (สำเนาเก่ามี 5px) */

    /* ═══════════════════════════════════════════════════════════
       STATION DETAIL LANDING PAGE
       Bobby Style · variable-first · nested CSS · breakpoints 1200/992/768/576
       โครง/คลาสอ้างอิงจาก carrier_landing_page.php (.carrier-lp) เพื่อให้ธีม
       และ interaction (gallery modal / tab แบบ 2 คอลัมน์) สอดคล้องกันทั้งเว็บ
    ═══════════════════════════════════════════════════════════ */

    /* ── Hero — overlay สีดำผ่าน ::before ──
       หมายเหตุ: nest ทุก class ของ hero ไว้ใต้ .bg-header-content (เพิ่ม specificity)
       เพราะ header.inc.php (ที่ include ทุกหน้าทั่วเว็บ) มี .p-t-title / .text-title
       กำหนดซ้ำแบบ global อยู่แล้ว (ใน media query) ถ้าไม่ nest จะชนกันและค่า
       padding/font-size จะถูก override โดยไม่ตั้งใจ (ปัญหาที่เจอจริงตอนขึ้น prod) */
    .bg-header-content {
        position: relative;
        background-size: cover;
        /* รูปแบนเนอร์ของแต่ละสถานีมาจาก DB — component ใส่เป็น inline style ให้ */
        background-position: center;

        &::before {
            content: '';
            position: absolute;
            inset: 0;
            background: rgba(0, 0, 0, 0.55);
            pointer-events: none;
        }

        .p-t-title {
            padding-top: 80px;
            padding-bottom: 10px;
            position: relative;
            z-index: 1;
        }

        .station-type-badge {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            background: rgba(255, 255, 255, 0.16);
            color: #fff;
            font-size: 12px;
            font-weight: 700;
            padding: 5px 14px;
            border-radius: 20px;
            margin-bottom: 14px;
        }

        .text-title {
            font-size: 26px;
            font-weight: 800;
            color: #fff;
            line-height: 1.4;
            text-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
            padding-top: 18px;
            padding-bottom: 0px;
        }

        .text-subtitle {
            color: rgba(255, 255, 255, 0.85);
            font-size: 14px;
            margin-bottom: 20px;
        }
    }

    /* ── Form ค้นหา/จองตั๋ว — widget busx-search-form เดียวกับหน้าอื่นทั้งเว็บ (single source of truth) ── */
    #busx-search-form {
        padding-bottom: 10px;
        min-height: 230px;
    }

    .breadcrumb-bar-hero ul {
        list-style: none;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-wrap: wrap;
        gap: 4px;
        padding: 0;
        margin: 0 0 16px;

        li a {
            color: rgba(255, 255, 255, 0.75);
            text-decoration: none;
            font-size: 12.5px;
            transition: color 0.15s;

            &:hover {
                color: #fff;
            }
        }

        .separator span,
        .link-none span {
            color: rgba(255, 255, 255, 0.4);
            font-size: 12.5px;
        }
    }

    @media (max-width: 576px) {
        .bg-header-content {
            .p-t-title {
                padding-top: 70px;
                padding-bottom: 20px;
            }

            .text-title {
                font-size: 19px;
            }
        }
    }

    /* ── Station LP wrapper — ใช้ชุดสีเดียวกับธีมหลักของ busandvan.com (single source of truth) ── */
    .station-lp {
        --site-orange: #ff6701;
        --site-orange-dark: #d95700;
        --site-blue: #017acc;
        --site-bg: #f4f5f7;
        --site-text: #1a1a2e;
        --site-text-muted: #999999;
        --site-border: #eaecf0;
        --site-white: #ffffff;

        padding-top: 0;
        background: var(--site-bg);
        min-height: 100vh;

        /* ── Shared section ── */
        .lp-section {
            max-width: 1240px;
            margin: 0 auto;
            padding: 0 20px;
        }

        .section-header {
            padding-top: 20px;
            margin-bottom: 18px;
            padding-bottom: 12px;
            border-bottom: 1px solid var(--site-border);
            display: flex;
            align-items: flex-end;
            justify-content: space-between;
            flex-wrap: wrap;
            gap: 8px;

            .title-section {
                h2 {
                    font-size: 18px;
                    font-weight: 700;
                    color: var(--site-text);
                    margin: 0;
                    display: flex;
                    align-items: center;
                    gap: 10px;
                }

                p {
                    font-size: 12.5px;
                    color: var(--site-text-muted);
                    margin: 6px 0 0 14px;
                }
            }
        }

        /* ── เส้นทางยอดนิยม — โครงเดียวกับ carrier_landing_page.php ── */
        .lp-routes {
            padding: 36px 0 0;

            .route-grid {
                display: grid;
                grid-template-columns: repeat(4, 1fr);
                gap: 16px;
            }

            .route-card {
                background: var(--site-white);
                border: 1px solid var(--site-border);
                border-radius: 14px;
                overflow: hidden;
                transition: transform 0.2s, box-shadow 0.2s;

                &:hover {
                    transform: translateY(-4px);
                    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.10);
                }

                .route-img-wrap {
                    position: relative;
                    height: 140px;
                    overflow: hidden;

                    img {
                        width: 100%;
                        height: 100%;
                        object-fit: cover;
                        display: block;
                        transition: transform 0.35s;
                    }

                    &:hover img {
                        transform: scale(1.05);
                    }

                    &::after {
                        content: '';
                        position: absolute;
                        inset: 0;
                        background: linear-gradient(to top, rgba(0, 0, 0, 0.40) 0%, transparent 55%);
                        pointer-events: none;
                    }

                    .route-label {
                        position: absolute;
                        bottom: 10px;
                        left: 10px;
                        z-index: 1;
                        display: flex;
                        align-items: center;
                        gap: 5px;
                        background: rgba(255, 255, 255, 0.88);
                        backdrop-filter: blur(6px);
                        -webkit-backdrop-filter: blur(6px);
                        border-radius: 8px;
                        padding: 5px 10px;
                        font-size: 12px;
                        font-weight: 700;
                        color: var(--site-text);

                        i {
                            color: var(--site-orange);
                            font-size: 10px;
                        }
                    }
                }

                .route-body {
                    padding: 12px 14px;
                    display: flex;
                    align-items: center;
                    justify-content: space-between;

                    .route-price {
                        font-size: 11.5px;
                        color: var(--site-text-muted);

                        strong {
                            display: block;
                            font-size: 17px;
                            font-weight: 800;
                            color: var(--site-orange);
                            line-height: 1.2;
                        }
                    }

                    .route-btn {
                        font-size: 12px;
                        font-weight: 700;
                        color: #fff;
                        background: var(--site-orange);
                        border-radius: 20px;
                        padding: 6px 16px;
                        text-decoration: none;
                        white-space: nowrap;

                        &:hover {
                            background: var(--site-orange-dark);
                        }
                    }
                }
            }
        }

        /* ── ผู้ให้บริการที่จอดรับ-ส่งผู้โดยสารที่สถานีนี้ — โครงเดียวกับ .card-carrier ของ timetable.php ── */
        .lp-carriers {
            padding: 36px 0 0;

            .carrier-grid {
                display: grid;
                grid-template-columns: repeat(5, 1fr);
                gap: 16px;
            }

            .carrier-card {
                background: var(--site-white);
                border: 1px solid var(--site-border);
                border-radius: 14px;
                overflow: hidden;
                text-decoration: none;
                transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;

                &:hover {
                    transform: translateY(-4px);
                    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.10);
                    border-color: var(--site-orange);
                }

                .carrier-card-logo {
                    background: #f9fafb;
                    padding: 16px;
                    display: flex;
                    align-items: center;
                    justify-content: center;
                    height: 88px;
                    border-bottom: 1px solid var(--site-border);

                    img {
                        max-width: 100%;
                        max-height: 60px;
                        width: auto;
                        height: auto;
                        object-fit: contain;
                    }
                }

                .carrier-card-name {
                    padding: 10px 12px;
                    font-size: 12.5px;
                    font-weight: 600;
                    color: var(--site-text);
                    text-align: center;
                    line-height: 1.4;
                    display: -webkit-box;
                    -webkit-line-clamp: 2;
                    -webkit-box-orient: vertical;
                    overflow: hidden;
                }

                &:hover .carrier-card-name {
                    color: var(--site-orange);
                }
            }
        }

        /* ── รายละเอียดสถานี — 2 คอลัมน์ (รายละเอียด / ที่อยู่+แผนที่) ── */
        .lp-station-info {
            padding: 36px 0 0;

            .st-wrap {
                background: var(--site-white);
                border: 1px solid var(--site-border);
                border-radius: 16px;
                overflow: hidden;
                display: grid;
                grid-template-columns: 1fr 1fr;
                min-height: 300px;
            }

            .st-nav {
                display: none;
                border-right: 1px solid var(--site-border);
                background: #fafbfc;
                padding: 16px 0;
                flex-direction: column;
                gap: 2px;
            }

            .st-nav-item {
                padding: 13px 18px;
                font-size: 13.5px;
                font-weight: 500;
                color: var(--site-text);
                cursor: pointer;
                border-left: 3px solid transparent;
                transition: background 0.15s, border-color 0.15s, color 0.15s;
                display: flex;
                align-items: center;
                gap: 10px;
                user-select: none;

                i {
                    font-size: 14px;
                    color: var(--site-text-muted);
                    flex-shrink: 0;
                    transition: color 0.15s;
                }

                &:hover {
                    background: rgba(255, 103, 1, 0.05);
                    border-left-color: var(--site-orange);

                    i {
                        color: var(--site-orange);
                    }
                }

                &.active {
                    background: rgba(255, 103, 1, 0.08);
                    border-left-color: var(--site-orange);
                    font-weight: 700;
                    color: var(--site-orange);

                    i {
                        color: var(--site-orange);
                    }
                }
            }

            .st-panel {
                display: flex;
                flex-direction: column;
                padding: 24px 28px;

                &:first-child {
                    border-right: 1px solid var(--site-border);
                }
            }

            .st-panel-title {
                font-size: 16px;
                font-weight: 700;
                color: var(--site-text);
                margin-bottom: 18px;
                display: flex;
                align-items: center;
                gap: 8px;

                i {
                    color: var(--site-orange);
                }
            }

            .st-description {
                font-size: 13.5px;
                color: var(--site-text);
                line-height: 1.9;
                white-space: pre-line;

                /* บังคับฟอนต์ธีมเว็บเสมอ แม้เนื้อหาเก่าจะมี <font face="..."> / style="font-family:..."
                   ติดมาจาก Summernote ก่อนหน้านี้ (ตอนนี้ตัดปุ่มเลือกฟอนต์ออกจากแอดมินแล้ว แต่
                   ข้อมูลเก่าที่เคยบันทึกไว้อาจยังมีอยู่) — กัน font ที่ inline มาจากบดบังฟอนต์เว็บ */
                * {
                    font-family: inherit !important;
                }
            }

            .st-map-wrap {
                border-radius: 12px;
                overflow: hidden;
                border: 1px solid var(--site-border);
                margin-bottom: 16px;

                iframe {
                    width: 100%;
                    height: 260px;
                    display: block;
                    border: 0;
                }
            }

            .st-address-line {
                display: flex;
                align-items: flex-start;
                gap: 10px;
                font-size: 13.5px;
                color: var(--site-text);
                line-height: 1.7;
                text-decoration: none;
                transition: color 0.15s;

                i {
                    font-size: 16px;
                    color: var(--site-orange);
                    margin-top: 2px;
                    flex-shrink: 0;
                }

                &:hover {
                    color: var(--site-orange);
                    text-decoration: underline;
                }
            }
        }

        /* ── รูปภาพบรรยากาศ (1-4 ภาพ) ── */
        .lp-gallery {
            padding: 36px 0 0;

            .gallery-grid {
                display: grid;
                grid-template-columns: repeat(4, 1fr);
                gap: 14px;
            }

            .gallery-item {
                aspect-ratio: 4 / 3;
                border-radius: 12px;
                overflow: hidden;
                border: 1px solid var(--site-border);
                cursor: pointer;
                position: relative;

                img {
                    width: 100%;
                    height: 100%;
                    object-fit: cover;
                    display: block;
                    transition: transform 0.25s;
                }

                &::after {
                    content: '\f52a';
                    font-family: 'bootstrap-icons';
                    position: absolute;
                    inset: 0;
                    display: flex;
                    align-items: center;
                    justify-content: center;
                    font-size: 22px;
                    color: #fff;
                    background: rgba(0, 0, 0, 0.28);
                    opacity: 0;
                    transition: opacity 0.2s;
                }

                &:hover {
                    img {
                        transform: scale(1.05);
                    }

                    &::after {
                        opacity: 1;
                    }
                }
            }
        }

        /* ── Modal แกลอรี่ — vanilla JS ไม่พึ่ง library ── */
        .gallery-modal {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(20, 15, 10, 0.92);
            z-index: 3000;
            align-items: center;
            justify-content: center;

            &.active {
                display: flex;
            }

            .gm-stage {
                max-width: 88vw;
                max-height: 82vh;
                display: flex;
                align-items: center;
                justify-content: center;

                img {
                    max-width: 88vw;
                    max-height: 82vh;
                    object-fit: contain;
                    border-radius: 8px;
                    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
                }
            }

            .gm-close {
                position: absolute;
                top: 20px;
                right: 24px;
                background: rgba(255, 255, 255, 0.12);
                border: none;
                color: #fff;
                width: 42px;
                height: 42px;
                border-radius: 50%;
                font-size: 18px;
                cursor: pointer;
                transition: background 0.15s;

                &:hover {
                    background: var(--site-orange);
                }
            }

            .gm-nav {
                position: absolute;
                top: 50%;
                transform: translateY(-50%);
                background: rgba(255, 255, 255, 0.12);
                border: none;
                color: #fff;
                width: 46px;
                height: 46px;
                border-radius: 50%;
                font-size: 20px;
                cursor: pointer;
                transition: background 0.15s;

                &:hover {
                    background: var(--site-orange);
                }
            }

            .gm-prev {
                left: 20px;
            }

            .gm-next {
                right: 20px;
            }

            .gm-counter {
                position: absolute;
                bottom: 20px;
                left: 50%;
                transform: translateX(-50%);
                color: rgba(255, 255, 255, 0.85);
                font-size: 13px;
                background: rgba(255, 255, 255, 0.12);
                padding: 6px 16px;
                border-radius: 20px;
            }
        }

        /* ── สถานีใกล้เคียง (1-2 แห่ง) — การ์ดขนาดใหญ่กว่า route/gallery เพราะมีจำนวนน้อย ── */
        .lp-nearby {
            padding: 36px 0 0;

            .nearby-grid {
                display: grid;
                grid-template-columns: repeat(2, 1fr);
                gap: 16px;
            }

            .nearby-card {
                display: flex;
                align-items: center;
                gap: 16px;
                background: var(--site-white);
                border: 1px solid var(--site-border);
                border-radius: 14px;
                padding: 20px;
                text-decoration: none;
                transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;

                &:hover {
                    transform: translateY(-3px);
                    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.09);
                    border-color: var(--site-orange);

                    .nearby-icon {
                        background: var(--site-orange);
                        color: #fff;
                    }
                }

                .nearby-icon {
                    flex-shrink: 0;
                    width: 52px;
                    height: 52px;
                    border-radius: 12px;
                    background: rgba(255, 103, 1, 0.08);
                    color: var(--site-orange);
                    display: flex;
                    align-items: center;
                    justify-content: center;
                    font-size: 22px;
                    transition: background 0.2s, color 0.2s;
                }

                .nearby-body {
                    flex: 1;
                    min-width: 0;

                    .nearby-type {
                        font-size: 11px;
                        font-weight: 700;
                        color: var(--site-blue);
                        text-transform: uppercase;
                        letter-spacing: 0.04em;
                        margin-bottom: 4px;
                    }

                    .nearby-name {
                        font-size: 14px;
                        font-weight: 700;
                        color: var(--site-text);
                        line-height: 1.4;
                        margin-bottom: 4px;
                    }

                    .nearby-province {
                        font-size: 12px;
                        color: var(--site-text-muted);
                        display: flex;
                        align-items: center;
                        gap: 4px;
                    }
                }

                .nearby-arrow {
                    flex-shrink: 0;
                    color: var(--site-text-muted);
                    font-size: 15px;
                    transition: color 0.2s, transform 0.2s;
                }

                &:hover .nearby-arrow {
                    color: var(--site-orange);
                    transform: translateX(3px);
                }
            }
        }

        /* ── เส้นทางจากสถานี — ลิงก์ข้อความล้วน จัดวาง 4 คอลัมน์ (section สุดท้าย) ── */
        .lp-destinations {
            padding: 36px 0 0;

            .destinations-grid {
                display: grid;
                grid-template-columns: repeat(4, 1fr);
                gap: 10px 20px;
            }

            .destination-link {
                display: flex;
                align-items: center;
                gap: 6px;
                font-size: 14px;
                color: var(--site-text);
                text-decoration: none;
                padding: 9px 4px;
                transition: color 0.15s;
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;
                border-radius: 15px;
                background: #ffffff;
                padding: 8px 12px;
                box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);

                i {
                    color: var(--site-orange);
                    flex-shrink: 0;
                    font-size: 12px;
                }

                &:hover {
                    color: var(--site-orange);
                    text-decoration: underline;
                }
            }
        }

        /* ── Back button ── */
        .lp-back {
            padding: 36px 0 52px;

            .btn-back {
                display: inline-flex;
                align-items: center;
                gap: 8px;
                color: var(--site-orange);
                border: 1px solid var(--site-orange);
                background: #fff;
                font-size: 14px;
                font-weight: 600;
                padding: 10px 22px;
                border-radius: 8px;
                text-decoration: none;
                transition: background 0.2s, color 0.2s;

                &:hover {
                    background: var(--site-orange);
                    color: #fff;
                }
            }
        }

        /* ── Responsive ── */
        @media (max-width: 992px) {
            & {
                .lp-routes .route-grid {
                    grid-template-columns: repeat(2, 1fr);
                }

                .lp-gallery .gallery-grid {
                    grid-template-columns: repeat(2, 1fr);
                }

                .lp-carriers .carrier-grid {
                    grid-template-columns: repeat(3, 1fr);
                }

                .lp-station-info .st-wrap {
                    grid-template-columns: 220px 1fr;
                }

                .lp-station-info .st-nav {
                    display: flex;
                }

                .lp-station-info .st-panel {
                    display: none;
                    border-right: none;

                    &.active {
                        display: flex;
                    }
                }

                .lp-destinations .destinations-grid {
                    grid-template-columns: repeat(3, 1fr);
                }
            }
        }

        @media (max-width: 768px) {
            & {
                .section-header .title-section h2 {
                    font-size: 16px;
                }

                .lp-routes .route-grid {
                    grid-template-columns: repeat(2, 1fr);
                }

                .lp-routes .route-card .route-img-wrap {
                    height: 250px;
                }

                .lp-gallery .gallery-grid {
                    grid-template-columns: repeat(2, 1fr);
                    gap: 10px;
                }

                .lp-carriers .carrier-grid {
                    grid-template-columns: repeat(2, 1fr);
                }

                .lp-station-info .st-wrap {
                    grid-template-columns: 1fr;
                }

                .lp-station-info .st-nav {
                    flex-direction: row;
                    border-right: none;
                    border-bottom: 1px solid var(--site-border);
                    overflow-x: auto;
                    padding: 10px 12px;
                }

                .lp-station-info .st-nav-item {
                    border-left: none;
                    border-bottom: 3px solid transparent;
                    white-space: nowrap;

                    &.active {
                        border-bottom-color: var(--site-orange);
                    }
                }

                .lp-nearby .nearby-grid {
                    grid-template-columns: 1fr;
                }

                .lp-destinations .destinations-grid {
                    grid-template-columns: repeat(2, 1fr);
                }
            }
        }

        @media (max-width: 576px) {
            & {
                .lp-routes .route-grid {
                    grid-template-columns: 1fr;
                }

                .lp-gallery .gallery-grid {
                    grid-template-columns: 1fr 1fr;
                    gap: 8px;
                }

                .lp-carriers .carrier-grid {
                    grid-template-columns: 1fr 1fr;
                    gap: 10px;
                }

                .lp-section {
                    padding: 0 12px;
                }

                .nearby-card {
                    padding: 16px;
                }

                .lp-destinations .destinations-grid {
                    grid-template-columns: 1fr;
                }
            }
        }
    }

    /* ── หน้าแจ้งเตือน "ไม่พบข้อมูล" (ใช้ตอน $lpReady = false — เอกสาร HTML เดียวกัน ไม่แยกไฟล์) ── */
    .lp-not-ready {
        max-width: 560px;
        margin: 80px auto;
        padding: 40px 32px;
        text-align: center;
    }

    .lp-not-ready i {
        font-size: 48px;
        color: #d2d6de;
        display: block;
        margin-bottom: 16px;
    }

    .lp-not-ready h1 {
        font-size: 22px;
        margin-bottom: 8px;
    }

    .lp-not-ready p {
        color: #777;
        margin-bottom: 24px;
    }

    .lp-not-ready a.btn-back {
        display: inline-block;
        padding: 10px 24px;
        border-radius: 6px;
        background: #ff6701;
        color: #fff;
        text-decoration: none;
        font-weight: 600;
    }

/* กล่องเนื้อหาในแบนเนอร์ — เดิมเป็น inline style บน .container ของ hero */
    .lp-hero-container {
        max-width: 1100px;
        padding-top: 15px;
        padding-bottom: 15px;
        position: relative;
    }

/* ── หน้าอังกฤษ — <style> ของ en/city-landingpage.php ยังเป็นชุดเก่า ต่างจากฝั่งไทย 4 ค่า
      (padding หัวข้อ hero · ระยะใต้คำโปรย · ความสูงรูปการ์ดเส้นทางบนจอ ≤768px) ── */
html[lang="en"] {
    .bg-header-content {
        .p-t-title {
            padding-bottom: 20px;
        }

        .text-title {
            padding-bottom: 5px;
        }

        .text-subtitle {
            margin-bottom: 10px;
        }
    }

    @media (max-width: 768px) {
        .station-lp .lp-routes .route-card .route-img-wrap {
            height: 120px;
        }
    }
}
