/* style.css - Mobile First & Comfort View (Final Version) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Kanit:wght@300;400;500;600&display=swap');

body { 
    font-family: 'Inter', 'Kanit', sans-serif; 
    background: #f8fafc; 
    color: #1e293b; 
    margin: 0; 
    padding: 10px; 
    line-height: 1.5;
}


/* คอนเทนเนอร์หลัก แต่งปุ่ม share*/
/* คอนเทนเนอร์หลัก: จัดหัวข้อและกลุ่มปุ่ม */
.share-container {
    display: flex;
    flex-direction: row; /* เริ่มต้นให้เรียงแนวนอน */
    align-items: center;
    justify-content: center; /* จัดกลางหน้าจอ */
    gap: 15px;
    margin: 20px 0;
    padding: 15px;
    background: #f8fafc;
    border-radius: 12px;
    flex-wrap: wrap; /* เผื่อกรณีจอแคบมากให้หัวข้ออยู่บน ปุ่มอยู่ล่างได้ */
}

/* หัวข้อคำแนะนำ */
.share-label {
    font-size: 14px;
    font-weight: 700;
    color: #475569;
    white-space: nowrap; /* ห้ามหัวข้อตัดบรรทัด */
}

/* กลุ่มปุ่ม: บังคับแถวนอนตลอดกาล */
.share-buttons {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important; /* ห้ามตกบรรทัด */
    gap: 10px;
    align-items: center;
    overflow-x: auto; /* สำหรับมือถือถ้าปุ่มยาวเกินให้ปัดซ้ายขวา */
    scrollbar-width: none; 
    -webkit-overflow-scrolling: touch;
}

.share-buttons::-webkit-scrollbar { display: none; }

/* ตัวปุ่ม: ปรับให้เป็นวงกลมหรือมนยาวที่สมดุล */
.share-btn {
    flex: 0 0 auto; /* ห้ามปุ่มโดนบีบจนแบน */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 42px;
    height: 42px;
    padding: 0 15px;
    border-radius: 50px;
    text-decoration: none !important;
    color: white !important;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* สีแต่ละปุ่ม */
.fb { background: #1877F2; }
.line { background: #06C755; }
.x { background: #000000; }
.copy { background: #64748b; }

/* เมื่อดูในมือถือที่จอเล็กมากๆ (ต่ำกว่า 600px) */
@media (max-width: 600px) {
    .share-container {
        flex-direction: column; /* บนมือถือให้หัวข้ออยู่ข้างบน */
        gap: 8px;
    }
    
    .share-buttons {
        width: 100%;
        justify-content: center; /* จัดปุ่มให้อยู่กลางแถว */
    }

    /* ซ่อนข้อความในปุ่มโซเชียลเหลือแต่ไอคอนเพื่อให้ประหยัดพื้นที่บนมือถือ */
    .share-btn span { display: none; }
    .share-btn { padding: 0; width: 42px; }
    
    /* ยกเว้นปุ่มก๊อปปี้ให้มีข้อความไว้ */
    .share-btn.copy { width: auto; padding: 0 15px; }
    .share-btn.copy span { display: inline; }
}

/* --- Header Style --- */
/* =========================================
   HEADER & FOOTER (Fixed for PC & Mobile)
   ลบของเดิมตั้งแต่บรรทัดนี้ลงไป แล้ววางชุดนี้แทน
   ========================================= */
.site-header {
    background: #ffffff !important;
    padding: 0 !important;
    box-shadow: 0 2px 15px rgba(0,0,0,0.08);
    position: sticky;
    top: 0;
    z-index: 9999;
    width: 100%;
    display: block !important; /* บังคับให้แสดงผล */
}

.header-container {
    max-width: 1000px;
    margin: 0 auto;
    display: flex !important; /* บังคับ Flex บนคอม */
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    height: 70px;
}

.logo a { text-decoration: none; display: flex; align-items: center; }
.logo-main { font-size: 24px; font-weight: 800; color: #1e293b; }
.logo-sub { font-size: 24px; font-weight: 800; color: #ef4444; }

.main-nav { 
    display: flex !important; 
    align-items: center; 
    gap: 25px; 
}

.nav-link { 
    text-decoration: none; 
    color: #475569; 
    font-weight: 600; 
    font-size: 15px; 
    transition: color 0.2s;
}

.lang-btn { 
    background: #f1f5f9; 
    padding: 8px 16px; 
    border-radius: 50px; 
    text-decoration: none; 
    color: #1e293b; 
    font-size: 13px; 
    font-weight: 700;
    border: 1px solid #e2e8f0;
}

/* 2. ส่วน Footer - แสดงผลทุกหน้าจอ */
.site-footer {
    background: #1e293b !important;
    color: #f1f5f9 !important;
    padding: 60px 0 30px 0 !important;
    margin-top: 60px;
    display: block !important;
}

.footer-container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.footer-grid { 
    display: grid; 
    grid-template-columns: 2fr 1fr 1fr; 
    gap: 40px; 
}
.footer-grid h4, .footer-grid h5 { color: #ffffff; margin-bottom: 20px; }
.footer-links ul { list-style: none; padding: 0; }
.footer-links li { margin-bottom: 10px; font-size: 14px; color: #94a3b8; }
.footer-bottom { 
    margin-top: 40px;
    border-top: 1px solid #334155; 
    padding-top: 25px; 
    text-align: center; 
    font-size: 13px; 
    color: #64748b; 
}

/* 3. ส่วนปรับแต่งเฉพาะมือถือ (Media Query) */
@media (max-width: 850px) {
    .header-container { 
        height: auto; 
        padding: 15px; 
        flex-direction: column !important; 
        gap: 12px; 
    }
    .main-nav {
        gap: 15px;
    }
    .footer-grid { 
        grid-template-columns: 1fr !important; 
        gap: 30px; 
    }
    .logo-main, .logo-sub { font-size: 20px; }
}
// จบ header และ footer


/* ข้อความพาดหัวเหนือกล่องค้นหา */
.search-main-title {
    font-size: 22px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 15px;
    margin-top: 10px;
    text-align: left;
}






.container { max-width: 1100px; margin: 0 auto; padding-bottom: 80px; }

/* Search Form */
.search-container { 
    background: #f0f7ff; /* สีฟ้าอ่อนแบบสะอาดตา */
    padding: 25px; 
    border-radius: 20px; 
    margin-bottom: 30px; 
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.08); /* เงาสีฟ้าจางๆ */
    border: 1px solid #e0eeff; /* ขอบสีฟ้าที่เข้มกว่าพื้นหลังนิดหน่อย */
}
.search-form { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 12px; align-items: flex-end; }
.input-group label { font-size: 11px; font-weight: 600; color: #94a3b8; margin-bottom: 6px; display: block; text-transform: uppercase; letter-spacing: 0.5px; }
.input-group input { 
    padding: 12px 14px; 
    border: 1px solid #e2e8f0; 
    border-radius: 10px; 
    width: 100%; 
    box-sizing: border-box; 
    font-size: 14px;
    background: #fcfdfe;
}
.btn-search { 
    background: #1e293b; 
    color: #fff; 
    border: none; 
    border-radius: 10px; 
    height: 45px; 
    padding: 0 25px; 
    cursor: pointer; 
    font-weight: 600;
}
/* ปรับให้ช่อง Input ดูลอยเด่นขึ้นบนพื้นสีฟ้า */
.input-group input {
    background: #ffffff;
    border: 1px solid #d1e4ff;
}

/* ปรับแต่งสำหรับมือถือ */
@media (max-width: 850px) {
    .search-main-title {
        font-size: 18px;
        text-align: center;
        margin-bottom: 12px;
    }
    .search-container {
        padding: 15px;
    }
}




/* Route Header */
.route-header { 
    padding: 0 5px 15px 5px; 
    display: flex; 
    flex-direction: column; 
    gap: 4px;
}
.route-title { font-size: 12px; color: #64748b; font-weight: 500; }
.route-path { font-size: 18px; font-weight: 700; color: #0f172a; display: flex; align-items: center; gap: 10px; }
.route-sep { color: #cbd5e1; font-weight: 300; font-size: 14px; }

.search-date-display {
    font-size: 18px;
    font-weight: 700;
    color: #334155; /* สีข้อความปกติ */
}

.date-highlight {
    color: #ef4444; /* สีแดงเข้มตามภาพตัวอย่าง */
    margin: 0 5px;
}

/* ปรับแต่งสำหรับมือถือให้ตัวหนังสือเล็กลงและขึ้นบรรทัดใหม่สวยๆ */
@media (max-width: 850px) {
    .search-date-display {
        font-size: 15px;
        width: 100%;
        margin-top: 5px;
    }
    .route-header {
        margin-bottom: 10px;
    }
}

/* Layout */
.main-layout { display: grid; grid-template-columns: 280px 1fr; gap: 24px; }
.sidebar { 
    background: #fff; 
    padding: 24px; 
    border-radius: 16px; 
    height: fit-content; 
    border: 1px solid #e2e8f0; 
}
.filter-title { font-weight: bold; font-size: 14px; margin-bottom: 12px; display: block; color: #1e293b; }
.filter-item { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 13px; cursor: pointer; }

/* Card Design */
.card { 
    background: #fff; 
    border-radius: 16px; 
    padding: 20px; 
    margin-bottom: 16px; 
    border: 1px solid #e2e8f0; 
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02);
    position: relative;
    overflow: hidden;
}

/* แถบสีด้านซ้าย */
.card::before {
    content: "";
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 5px;
}
.type-train::before { background: #0369a1; }
.type-bus::before { background: #ef4444; }
.type-boat::before { background: #0d9488; }
.type-plane::before { background: #7c3aed; }

.card-header { margin-bottom: 18px; }
.op-name { font-weight: 700; font-size: 15px; color: #1e293b; }
.class-badge { color: #64748b; font-weight: 500; font-size: 12px; margin-top: 2px; }

.ticket-body { 
    display: grid; 
    grid-template-columns: 1fr 80px 1fr; 
    align-items: center; 
    text-align: center; 
    padding: 15px 0;
    border-top: 1px dashed #f1f5f9;
    border-bottom: 1px dashed #f1f5f9;
}
.time { font-size: 24px; font-weight: 800; color: #0f172a; }
.station-name { font-size: 13px; font-weight: 600; margin: 4px 0; color: #334155; }
.station-sub { font-size: 11px; color: #3b82f6; text-decoration: underline; cursor: pointer; }

.duration-info { font-size: 10px; color: #94a3b8; font-weight: 600; margin-bottom: 5px; }
.btn-st-info { border: 1px solid #e2e8f0; background: #f8fafc; border-radius: 6px; font-size: 9px; font-weight: 700; cursor: pointer; padding: 4px 8px; }

.footer { display: flex; justify-content: space-between; align-items: center; margin-top: 18px; }
.price { font-size: 22px; font-weight: 800; color: #ef4444; }
.btn-select { background: #ef4444; color: #fff; padding: 12px 24px; border-radius: 12px; text-decoration: none; font-weight: 700; font-size: 14px; }

/* Modal Styles */
.modal { display: none; position: fixed; z-index: 9999; left: 0; top: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); }
.modal-content { background: #fff; margin: 5% auto; padding: 25px; border-radius: 24px; width: 90%; max-width: 480px; position: relative; }
.map-frame { width: 100%; height: 180px; border-radius: 12px; margin-top: 12px; border: 0; background: #f1f5f9; }
/* เพิ่ม Scroll ให้ Modal และ Sidebar */


/* Mobile View Adjustment */
@media (max-width: 850px) { 
    .main-layout { grid-template-columns: 1fr; }
    .sidebar { 
        position: fixed; top: 100%; left: 0; width: 100%; height: 90%; 
        z-index: 10000; transition: top 0.3s ease; border-radius: 24px 24px 0 0;
    }
    .sidebar.active { top: 10%; }
    .mobile-filter-btn { 
        display: flex !important; position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
        z-index: 999; background: #1e293b; color: #fff; padding: 12px 25px; border-radius: 30px; border: none; font-weight: bold; gap: 8px; box-shadow: 0 10px 20px rgba(0,0,0,0.2);
    }
    .search-form { grid-template-columns: 1fr; }
    .ticket-body { grid-template-columns: 1fr 65px 1fr; }
    .time { font-size: 20px; }

    /* --- 1. แก้ไข Modal (แผนที่/สถานี) --- */
/* --- ปรับแต่ง Modal ให้กึ่งกลางและสวยงามบนจอคอม --- */
.modal { 
    display: none; 
    position: fixed; 
    z-index: 9999; 
    left: 0; 
    top: 0; 
    width: 100%; 
    height: 100%; 
    background: rgba(15, 23, 42, 0.6); /* สีเข้มขึ้นนิดหน่วยเพื่อให้ดู Premium */
    backdrop-filter: blur(4px); /* พื้นหลังเบลอ */
}

.modal-content { 
    background: #fff; 
    position: absolute; /* เปลี่ยนเป็น absolute */
    top: 50%; 
    left: 50%; 
    transform: translate(-50%, -50%); /* สั่งให้เด้งมาอยู่กึ่งกลางหน้าจอเป๊ะๆ */
    padding: 24px; 
    border-radius: 24px; 
    width: 90%; 
    max-width: 500px; 
    
    /* แก้ไขปัญหาหลุดขอบจอ */
    max-height: 85vh; /* สูงสุดไม่เกิน 85% ของความสูงหน้าจอ */
    overflow-y: auto; /* ถ้าเนื้อหายาวกว่า 85vh ให้เลื่อนดูข้างในได้ */
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border: 1px solid #f1f5f9;
}

.vessel-tag {
    background: #f1f5f9; /* สีเทาอ่อน */
    color: #475569; /* สีข้อความเทาเข้ม */
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
    display: inline-block;
}

/* ปรับระยะห่างบนมือถือ */
@media (max-width: 850px) {
    .vessel-tag {
        font-size: 10px;
        padding: 1px 6px;
    }
}

/* ปรับระยะขอบภายใน Modal ให้ดูไม่ตัน */
.modal-content h3 {
    margin-top: 0;
    color: #0f172a;
    font-size: 1.25rem;
}

/* ปรับแต่ง Scrollbar ใน Modal ให้ดูมินิมอล (สำหรับ Chrome/Safari) */
.modal-content::-webkit-scrollbar {
    width: 6px;
}
.modal-content::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 10px;
}
.modal-content::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}


/* ปรับขนาดแผนที่ให้เล็กลงหน่อยในมือถือเพื่อประหยัดพื้นที่ */
.map-frame {
    width: 100%;
    height: 200px; /* ลดความสูงลงเล็กน้อย */
    border-radius: 12px;
    margin-top: 12px;
    border: 0;
    background: #f1f5f9;
}

/* --- 2. แก้ไข Sidebar (Filter บนมือถือ) --- */
@media (max-width: 850px) {
    .sidebar {
        position: fixed;
        bottom: -100%; /* ซ่อนไว้ด้านล่าง */
        left: 0;
        width: 90%;
        height: auto;
        max-height: 85vh; /* สูงสุดไม่เกิน 85% ของจอ */
        z-index: 10000;
        transition: bottom 0.3s ease; /* เปลี่ยนจาก top เป็น bottom จะสมูทกว่า */
        border-radius: 24px 24px 0 0;
        padding: 24px 20px 40px 20px; /* เพิ่ม padding ล่างกันปุ่มบัง */
        
        /* สำคัญ: ทำให้เลื่อนขึ้นลงได้ภายใน */
        overflow-y: auto; 
        box-shadow: 0 -10px 25px rgba(0,0,0,0.1);
    }
    
    .sidebar.active {
        bottom: 0; /* เลื่อนขึ้นมาติดขอบล่าง */
    }

    .date-label {
    font-size: 11px;
    color: #64748b; /* สีเทาเข้ม */
    font-weight: 500;
    margin-top: -2px; /* ดึงขึ้นไปใกล้เวลาอีกนิด */
    margin-bottom: 8px; /* เว้นระยะห่างจากชื่อสถานี */
    letter-spacing: 0.2px;
}

/* ปรับความสูงของ ticket-body เพิ่มเล็กน้อยเพื่อให้ไม่เบียดกัน */
.ticket-body {
    padding: 20px 0 !important;
}

    /* เพิ่มปุ่มปิด X เฉพาะบนมือถือให้ Sidebar (ถ้ายังไม่มีใน HTML) */
    .close-sidebar-btn {
        display: block;
        text-align: right;
        font-weight: bold;
        color: #64748b;
        cursor: pointer;
        margin-bottom: 15px;
    }
}



#myBtn {
  display: none; /* Hidden by default */
  position: fixed; /* Fixed/sticky position */
  bottom: 20px; /* Place the button at the bottom of the page */
  right: 30px; /* Place the button 30px from the right */
  z-index: 99; /* Make sure it does not overlap */
  border: none; /* Remove borders */
  outline: none; /* Remove outline */
  background-color: red; /* Set a background color */
  color: white; /* Text color */
  cursor: pointer; /* Add a mouse pointer on hover */
  padding: 15px; /* Some padding */
  border-radius: 10px; /* Rounded corners */
  font-size: 18px; /* Increase font size */
}

#myBtn:hover {
  background-color: #555; /* Add a dark-grey background on hover */
}

.logo a {
    display: flex;
    align-items: center;
}

/* ปรับขนาดโลโก้ในมือถือ */
@media (max-width: 768px) {
    .logo img {
        height: 30px; /* ย่อขนาดรูปลงหน่อยเมื่ออยู่บนมือถือ */
    }
    .logo-main, .logo-sub {
        font-size: 16px; /* ปรับขนาดตัวอักษรลงเล็กน้อย */
    }
}

.logo-main {
    font-weight: bold;
    color: #ef4444; /* สีแดงหลักของคุณ */
}

.logo-sub {
    font-weight: 300;
    color: #1e293b; /* สีเทาเข้ม */
}

//ผปแผปแ
.share-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 25px 0;
    padding: 15px;
    background: #f8fafc;
    border-radius: 12px;
}

.share-label {
    font-size: 14px;
    font-weight: 600;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.share-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 40px;
    padding: 0 16px;
    border-radius: 50px; /* ทรงมนยาวแบบ iPhone/Modern Web */
    text-decoration: none !important; /* ลบเส้นใต้ */
    color: white !important;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.share-btn svg {
    width: 18px;
    height: 18px;
}

/* Colors */
.fb { background: #1877F2; }
.line { background: #06C755; }
.x { background: #000000; }
.copy { background: #64748b; }

/* Hover Effects */
.share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    filter: brightness(1.1);
}

.share-btn:active {
    transform: translateY(0);
}

/* สำหรับปุ่ม Copy ให้มีสไตล์ต่างออกไปนิดหน่อย */
.copy span {
    font-size: 13px;
}

@media (max-width: 480px) {
    .share-btn span { display: none; } /* บนมือถือซ่อนตัวอักษร Copy Link ให้เหลือแต่ไอคอน */
    .share-btn { padding: 0 12px; width: 40px; }
    .copy { width: auto; padding: 0 16px; }
    .copy span { display: inline; }
}



.share-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 25px 0;
    padding: 15px;
    background: #f8fafc;
    border-radius: 12px;
}

.share-label {
    font-size: 14px;
    font-weight: 600;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.share-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 40px;
    padding: 0 16px;
    border-radius: 50px; /* ทรงมนยาวแบบ iPhone/Modern Web */
    text-decoration: none !important; /* ลบเส้นใต้ */
    color: white !important;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.share-btn svg {
    width: 18px;
    height: 18px;
}

/* Colors */
.fb { background: #1877F2; }
.line { background: #06C755; }
.x { background: #000000; }
.copy { background: #64748b; }

/* Hover Effects */
.share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    filter: brightness(1.1);
}

.share-btn:active {
    transform: translateY(0);
}

/* สำหรับปุ่ม Copy ให้มีสไตล์ต่างออกไปนิดหน่อย */
.copy span {
    font-size: 13px;
}

@media (max-width: 480px) {
    .share-btn span { display: none; } /* บนมือถือซ่อนตัวอักษร Copy Link ให้เหลือแต่ไอคอน */
    .share-btn { padding: 0 12px; width: 40px; }
    .copy { width: auto; padding: 0 16px; }
    .copy span { display: inline; }
}



