/* การตั้งค่าพื้นฐาน */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-image: url('pic/BGHometest.png');
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center center;
    background-attachment: fixed;
}

/* Styles for the main header element */
.header {
    background-image: linear-gradient(to right, #486288, #2a466d);
    padding: 1rem;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
}
.header-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0 20px;
}
.logo-and-title {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.logo {
    width: 60px;
    height: 60px;
}
.header-title {
    font-family: 'Athiti', serif;
    font-size: 1.5rem;
    font-weight: 700;
    text-decoration: none;
    color: rgb(242, 245, 248);
}
.header-right-side {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.header-links {
    display: flex;
    gap: 1rem;
}
.header-link {
    font-family: 'Athiti', serif;
    color: white;
    text-decoration: none;
    transition: color 0.3s;
}
.header-link:hover {
    color: #0a60c2;
}
.social-icons {
    display: flex;
    gap: 1rem;
}
.social-link {
    color: white;
    transition: color 0.3s;
}
.facebook-link:hover {
    color: #3b82f6;
}
.youtube-link:hover {
    color: #ef4444;
}

/* Styles for the main content section */
.main-content {
    max-width: 1280px;
    margin: 2rem auto;
    padding: 1rem;
    padding-top: 100px; /* เพิ่ม padding-top เพื่อกันเนื้อหาไม่ให้ทับ Header */
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Styles for the slideshow */
.slideshow-container {
    width: 100%;
    position: relative;
    overflow: hidden;
   aspect-ratio: 16 / 9; 
    margin-top: 100px;
}
.mySlides {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transition: opacity 1.5s ease-in-out;
    opacity: 0;
}
.mySlides img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* ทำให้ภาพเต็มพื้นที่ container */
    object-position: center;
    background-color: transparent;
}
.mySlides.active {
    opacity: 1;
}

/* Styles for the navigation buttons and dots */
.prev, .next {
    cursor: pointer;
    position: absolute;
    top: 50%;
    width: auto;
    padding: 16px;
    margin-top: -22px;
    color: rgb(9, 9, 9);
    font-weight: bold;
    font-size: 18px;
    transition: 0.6s ease;
    border-radius: 50%;
    user-select: none;
    border: 2px solid white;
    user-select: none;
    width: 50px; /* กำหนดความกว้างและความสูงให้เท่ากันเพื่อให้เป็นวงกลมที่สมบูรณ์ */
    height: 50px;
    display: flex; /* ใช้ flexbox เพื่อจัดไอคอนลูกศรให้อยู่ตรงกลาง */
    align-items: center;
    justify-content: center;
}

.next {
    right: 0;
    
}
.prev:hover, .next:hover {
    background-color: rgba(0,0,0,0.8);
    
}
.dot {
    cursor: pointer;
    height: 15px;
    width: 15px;
    margin: 0 2px;
    background-color: #bbb;
    border-radius: 50%;
    display: inline-block;
    transition: background-color 0.6s ease;
}
.active, .dot:hover {
    background-color: #717171;
}

/* Styles for the cards (no changes needed) */
.main-card {
    background-color: #f9f8f7;
    padding: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    width: 100%;
}
.media-logo {
    width: 150px;
    height: 150px;
    border-radius: 0.5rem;
}
.media-info {
    text-align: center;
}
.station-name {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}
.description {
    color: #4b5563;
    font-size: 0.875rem;
}
.audio-player-wrapper {
    margin-top: 1rem;
}
.audio-player-wrapper audio {
    width: 100%;
    height: 50px;
    margin-top: 20px;
}
.video-and-info-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    width: 100%;
}
.date-card {
    background-color: white;
    padding: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    text-align: center;
}
.date-card h3 {
    font-size: 1.25rem;
    font-weight: bold;
    color: #1f2937;
}
.video-player-card {
    background-color: rgb(248, 244, 244);
    padding: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    text-align: center;
}
.video-title {
    font-size: 1.00rem;
    font-weight: bold;
    margin-bottom: 1rem;
}
.video-wrapper {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
}
.video-wrapper video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 0.5rem;
}
.footer {
    background-color: #2a466d;
    color: white;
    padding: 2rem 1rem;
}
.footer-container {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 2rem;
}
.footer-column {
    flex: 1;
}
.footer-logo {
    max-width: 150px;
    margin-left: 180px;
}
.footer-title {
    font-weight: bold;
    margin-bottom: 0.5rem;
}
.footer-info-details p {
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}
.social-icons.footer-social-icons {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.0rem;
    margin-right: 200px; /* เพิ่ม margin ด้านขวาเพื่อผลักไปทางซ้าย */
}
.copyright {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.75rem;
    color: #9ca3af;
}
.about-card {
    background-color: white;
    padding: 2rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    max-width: 800px;
    margin: 2rem auto;
    line-height: 1.6;
}
.about-card h2 {
    font-size: 2rem;
    font-weight: bold;
    color: darkcyan;
    margin-bottom: 1rem;
    text-align: center;
}
.mobile-slide {
    display: none; /* ซ่อนรูปภาพสำหรับมือถือ */
}
.desktop-slide {
    display: block; /* แสดงรูปภาพสำหรับคอมพิวเตอร์ */
    width: 100%;
    height: 100%;
    object-fit: cover; /* หรือ cover หากต้องการให้เต็มจอ */
}


/* สำหรับหน้าจอคอมพิวเตอร์ (768px ขึ้นไป) */
@media (min-width: 768px) {
    .header {
        height: 100px; /* เพิ่มความสูงที่แน่นอน */
        padding: 0; /* ลบ padding ที่อาจทำให้ความสูงไม่แน่นอน */
    }
    .header-container {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        height: 100%; /* ทำให้ container สูงเท่า header */
    }
    .main-content {
        flex-direction: row;
        justify-content: space-between;
        align-items: flex-start;
        padding-top: 100px; /* แก้ไขให้เท่ากับความสูงของ header */
    }
    .main-card {
        width: 40%;
    }
    .video-and-info-container {
        width: 60%;
    }
    .footer-container {
        flex-direction: row;
        justify-content: space-between;
        align-items: flex-start;
        text-align: left;
    }
    .footer-logo {
        /* ลบ margin-left ที่คุณเคยตั้งไว้สำหรับเดสก์ท็อปออก */
        margin-left: 180px;
    }
}
/* Styles for the hamburger menu */
.hamburger-menu {
    display: none; /* ซ่อนปุ่มบนหน้าจอคอมพิวเตอร์ */
    width: 30px;
    height: 30px;
    background: none;
    border: none;
    cursor: pointer;
    position: relative;
    z-index: 1001; /* ให้อยู่บนสุดเสมอ */
    flex-direction: column;
    justify-content: space-around;
}
.hamburger-menu span {
    display: block;
    width: 100%;
    height: 3px;
    background-color: white;
    transition: all 0.3s ease-in-out;
}

/* Styles for the navigation menu on mobile */
.header-right-side {
    display: flex; /* แสดงผลบนหน้าจอปกติ */
    transition: all 0.3s ease-in-out;
}

/* For mobile devices, hide the desktop menu and show the hamburger button */
@media (max-width: 768px) {
    .hamburger-menu {
        display: flex; /* แสดงปุ่มบนมือถือ */
    }
    .header-right-side {
        position: fixed;
        top: 60px; /* ปรับให้เท่ากับความสูงของ header */
        right: 0;
        width: 100%;
        max-width: 300px;
        height: 100vh;
        background-color: #2a466d;
        flex-direction: column;
        align-items: center;
        gap: 2rem;
        transform: translateX(100%); /* ซ่อนเมนูไว้ทางขวา */
        padding-top: 2rem;
        box-shadow: -2px 0 5px rgba(0,0,0,0.5);
    }
    .header-right-side.active {
        transform: translateX(0); /* เมื่อ active ให้แสดงเมนู */
    }
    /* Styles for the hamburger icon when active */
    .hamburger-menu.active span:nth-child(1) {
        transform: rotate(-45deg) translate(-5px, 6px);
    }
    .hamburger-menu.active span:nth-child(2) {
        opacity: 0;
    }
    .hamburger-menu.active span:nth-child(3) {
        transform: rotate(45deg) translate(-5px, -6px);
    }
}


@media (max-width: 768px) {
    /* Styles for the header on mobile */
    .header {
        height: 60px; /* กำหนดความสูงที่แน่นอนสำหรับมือถือ */
        padding: 0; /* ลบ padding เพื่อให้ความสูงคงที่ */
    }

    .header-container {
        flex-direction: row; /* *** แก้ไข: ปรับเป็น row เพื่อจัดเรียงองค์ประกอบในแนวนอน *** */
        justify-content: space-between;
        align-items: center;
        height: 100%; /* ทำให้ container สูงเท่า header */
    }
    .header-title {
        font-size: 1rem; /* *** แก้ไข: ปรับขนาดตัวอักษรให้เล็กลง *** */
    }
    .header-link {
        font-size: 0.9rem; /* *** แก้ไข: ปรับขนาดตัวอักษรของลิงก์ให้เล็กลง *** */
    }

    .logo-and-title {
        flex: 1;
        justify-content: flex-start; /* จัดโลโก้ไปทางซ้าย */
    }

    /* Styles for the main content on mobile */
    .main-content {
        padding-top: 0;
        
    }

   .slideshow-container {
        height: 0;
        padding-top: 80%; /* แก้ไขจาก 56.25% เป็น 125% */
        margin-top: 60px; /* หรือค่าที่คุณต้องการ */
        width: 100%;
        position: relative;
    }

    .mySlides img {
        width: 100%;
        height: 100%;
        object-fit: cover; /* ต้องใช้ 'cover' เพื่อให้รูปเต็ม */
    }
     .desktop-slide {
        display: none; /* ซ่อนรูปภาพสำหรับคอมพิวเตอร์บนมือถือ */
    }
    .mobile-slide {
        display: block; /* แสดงรูปภาพสำหรับมือถือ */
        width: 100%;
        height: 100%;
        object-fit: cover; /* ทำให้รูปเต็มพื้นที่ */
    }

    .footer-container {
        flex-direction: column; /* จัดเรียงเป็นแนวตั้ง */
        align-items: center; /* จัดให้อยู่กึ่งกลางในแนวนอน */
        text-align: center; /* จัดข้อความให้อยู่กึ่งกลาง */
    }

    .footer-logo {
        /* ลบ margin-left ที่คุณเคยตั้งไว้ เพื่อให้โลโก้อยู่ตรงกลาง */
        margin-left: 0;
        margin-right: 0;
        /* หากขนาดใหญ่เกินไป สามารถปรับขนาดได้ที่นี่ */
        max-width: 100px;
    }

    .social-icons.footer-social-icons {
        margin-right: 0;
        justify-content: center; /* จัดไอคอนโซเชียลให้อยู่กึ่งกลาง */
    }
}
/* คอนเทนเนอร์หลักของตัวเล่น */
.custom-player-container {
    display: flex;
    align-items: center;
    background: #fdfdfd;
    border: 1px solid #eee;
    border-radius: 15px;
    padding: 12px 18px;
    gap: 15px;
    margin-top: 10px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}


.custom-player-container {
    display: flex;
    align-items: center;
    background: #ffffff; /* เปลี่ยนเป็นสีขาวให้ตัดกับพื้นหลัง card */
    border: 1px solid #e0e0e0;
    border-radius: 15px;
    padding: 15px 20px;
    gap: 20px;
    margin-top: 20px;
    max-width: 500px !important; /* ขยายให้ยาวขึ้นตามต้องการ */
    margin-left: auto;
    margin-right: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05); /* เพิ่มเงาจางๆ ให้ดูมีมิติ */
}

/* ปุ่ม Play/Pause วงกลม */
.play-btn-circle {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: #003366; /* สีน้ำเงินเข้ม อ.ส. */
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.play-btn-circle:hover {
    transform: scale(1.1);
    background: #004488;
    box-shadow: 0 0 10px rgba(0,51,102,0.3);
}

/* ส่วนควบคุมฝั่งขวา */
.player-controls-right {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 8px; /* เพิ่มระยะห่างระหว่างแถว */
}

/* แถบสถานะ LIVE และ เวลา */
.live-status-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: bold;
    color: #333;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #ff0000;
    border-radius: 50%;
    animation: blink-red 1.2s infinite;
}

@keyframes blink-red {
    0% { opacity: 1; } 50% { opacity: 0.3; } 100% { opacity: 1; }
}

/* แถบบัฟเฟอร์ (Progress Bar) */
.buffer-container {
    width: 100%;
    height: 6px; /* หนาขึ้นเล็กน้อยให้เห็นชัด */
    background: #eee;
    border-radius: 10px;
    overflow: hidden;
}

#bufferBar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #003366, #00aaff); /* ไล่เฉดสีน้ำเงิน */
    transition: width 0.4s linear;
}

/* แถบปรับระดับเสียง */
.volume-bar-wrapper {
    display: flex;
    align-items: center;
}
/* แถบพยากรณ์อากาศใต้สไลด์ */
/* --- แถบพยากรณ์อากาศและค่าฝุ่น (Weather & Air Bar) --- */
/* คุมแถบข้อมูลทั้งหมด */
.weather-info-section {
    width: 100%;
    margin-top: 25px;    /* ระยะห่างจากจุดสไลด์ */
    margin-bottom: 5px;  /* ชิดตัวเล่นวิทยุมากขึ้น */
    font-family: 'Athiti', sans-serif;
}

/* แถวที่ 1: 6 ภาคเรียงหน้ากระดาน */
#weather-display {
    display: flex;
    justify-content: center;
    gap: 10px;
    max-width: 1200px;
    margin: 0 auto;
    flex-wrap: nowrap;
}

/* แถวที่ 2: ค่าฝุ่น แยกบรรทัดและอยู่ตรงกลาง */
#air-display {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 12px; /* เว้นระยะจากแถวพยากรณ์อากาศ */
}

/* สไตล์กล่องข้อมูล (Card) */
.region-card {
    background: #ffffff;
    border: 1px solid #eee;
    border-radius: 10px;
    padding: 8px 10px;
    text-align: center;
    min-width: 110px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    transition: transform 0.2s;
}

.region-card:hover {
    transform: translateY(-2px);
    border-color: #2a466d;
}

.region-name {
    font-size: 0.8rem;
    font-weight: bold;
    color: #2a466d;
    margin-bottom: 5px;
    border-bottom: 1px solid #f9f9f9;
}

.weather-info-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.temp {
    font-size: 1.1rem;
    font-weight: bold;
}

.status {
    font-size: 0.7rem;
    color: #666;
}

/* พิเศษสำหรับกล่องฝุ่น */
.aqi-card {
    min-width: 140px;
    background-color: #fcfcfc;
}

/* สำหรับมือถือ */
@media (max-width: 768px) {
    #weather-display {
        justify-content: flex-start;
        overflow-x: auto;
        padding: 10px;
    }
}
/* แถบอากาศบรรทัดใหม่ */
#air-display {
    display: flex;
    justify-content: center;
    margin-top: 15px;
    margin-bottom: 10px;
    padding: 0 15px;
}

/* จัดการ Icon ท้องฟ้าใน 6 ภาค */
.weather-info-row i {
    margin-right: 5px;
}

/* จัดการ Icon ท้องฟ้าในแถบ กทม. */
.sky-icon-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 35px;
    height: 35px;
    background: #fff9e6; /* พื้นหลังเหลืองอ่อน */
    border-radius: 50%;
    font-size: 20px;
}

.air-bar-clean {
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 1px solid #f0f0f0;
    border-radius: 50px;
    padding: 12px 30px; /* เพิ่ม padding ให้ดูโปร่ง */
    gap: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    min-width: 350px;
}

.air-icon-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* ส่วนข้อมูลตัวหนังสือ */
.air-content {
    display: flex;
    flex-direction: column;
}

.air-header {
    font-size: 11px;
    color: #999; /* สีเทาอ่อนให้ดูคลีน */
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: -2px;
}

.air-main-info {
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.air-status-text {
    font-weight: bold;
}

.air-sep {
    color: #eee; /* เส้นแบ่งจางๆ */
}

.air-pm-value {
    font-size: 14px;
    color: #666;
}

/* สำหรับมือถือ */
@media (max-width: 480px) {
    .air-bar-clean {
        min-width: 100%;
        padding: 8px 20px;
    }
}
html {
    -webkit-filter: grayscale(80%);
    filter: grayscale(80%);
}