/* Custom colors for temperature ranges - used directly by JS and for styling */
:root {
    /* Default/Fallback colors (can be the Rainy Season theme) */
    --primary-bg: rgba(26, 26, 26, 0.9); /* Dark Grey */
    --secondary-bg: rgba(46, 46, 46, 0.95); /* Slightly Lighter Dark Grey */
    --secondary-bg-rgb: 46, 46, 46; /* RGB values for secondary-bg */
    --text-primary: #ffecb3; /* Light Yellow */
    --text-primary-rgb: 255, 236, 179; /* RGB values for text-primary */
    --text-secondary: #e0e0e0; /* Off-White */
    --accent-dark: #ffe082; /* Brighter Yellow */
    --border-color: rgba(255, 255, 255, 0.1); /* Light Border */
    --input-bg: rgba(58, 58, 58, 0.9); /* Darker Input Background */
    --button-bg: rgba(66, 66, 66, 0.9); /* Darker Button Background */
    
    /* Chart.js specific variables for colors */
    --chart-line: #81d4fa; /* Original blue for rainy */
    --chart-point: #81d4fa; 
    --chart-grid: rgba(255, 255, 255, 0.1); 
    --chart-text: #e0e0e0; 

    /* Temperature legend colors (common across themes, or can be themed too) */
    --temp-very-cold: #1a237e; /* หนาวจัด: Dark Blue */
    --temp-cold: #2196f3;    /* อากาศหนาว: Blue */
    --temp-cool: #81d4fa;    /* อากาศเย็น: Light Blue */
    --temp-normal: #4caf50;  /* อุณหภูมิปกติ: Green */
    --temp-hot: #ff9800;     /* อากาศร้อน: Orange */
    --temp-very-hot: #e53935; /* อากาศร้อนจัด: Red */
    --rain-marker-bg: #3498db; /* สีฟ้าสำหรับไอคอนฝนตก */

    /* Specific colors for forecast cards in Dark Theme (retaining some custom definitions) */
    --current-day-card-bg: #424242; /* Darker grey for current day card */
    --current-day-card-text: var(--text-primary); /* Light text on dark card */
    --future-day-card-bg: #3a3a3a; /* Slightly lighter dark grey for future day cards */
    --future-day-card-text: var(--text-primary); /* Light text on dark card */

    --current-day-highlight-bg: var(--primary-bg); /* Highlight for current day daily card */
    --current-day-highlight-border: var(--accent-dark);
}

/* --- Theme Definitions --- */

/* Rainy Season Theme (Default, as per :root) */
/* This class explicitly sets the variables to the default rainy values */
.theme-rainy {
    --primary-bg: rgba(26, 26, 26, 0.7); 
    --secondary-bg: rgba(46, 46, 46, 0.7);
    --secondary-bg-rgb: 46, 46, 46;
    --text-primary: #ffecb3; 
    --text-primary-rgb: 255, 236, 179;
    --text-secondary: #e0e0e0;
    --accent-dark: #ffe082; 
    --border-color: rgba(255, 255, 255, 0.1); 
    --input-bg: rgba(58, 58, 58, 0.9); 
    --button-bg: rgba(66, 66, 66, 0.9);
    
    --chart-line: #81d4fa; 
    --chart-point: #81d4fa; 
    --chart-grid: rgba(255, 255, 255, 0.1); 
    --chart-text: #e0e0e0; 

    --current-day-card-bg: #424242;
    --current-day-card-text: var(--text-primary);
    --future-day-card-bg: #3a3a3a;
    --future-day-card-text: var(--text-primary);
    --current-day-highlight-bg: var(--primary-bg);
    --current-day-highlight-border: var(--accent-dark);
}

/* Summer Season Theme (Orange-Yellow Pastel) */
.theme-summer {
    --primary-bg: rgba(255, 220, 180, 0.7); /* Light Peach/Orange */
    --secondary-bg: rgba(255, 235, 200, 0.7); /* Lighter Creamy Yellow */
    --secondary-bg-rgb: 255, 235, 200;
    --text-primary: #d47a00; /* Darker Orange */
    --text-primary-rgb: 212, 122, 0;
    --text-secondary: #8b5e00; /* Brownish Orange */
    --accent-dark: #ffa726; /* Vibrant Orange */
    --border-color: rgba(255, 193, 7, 0.3); /* Light Orange Border */
    --input-bg: rgba(255, 240, 210, 0.9);
    --button-bg: rgba(255, 193, 7, 0.9);

    --chart-line: #ff9800; /* Orange */
    --chart-point: #ff9800; /* Orange */
    --chart-grid: rgba(255, 193, 7, 0.1);
    --chart-text: #8b5e00;

    --current-day-card-bg: #ffcc80; /* Lighter orange for current day card */
    --current-day-card-text: #8b5e00;
    --future-day-card-bg: #ffe0b2; /* Even lighter orange for future day cards */
    --future-day-card-text: #8b5e00;
    --current-day-highlight-bg: var(--primary-bg);
    --current-day-highlight-border: var(--accent-dark);
}

/* Winter Season Theme (Blue-Green Pastel) */
.theme-winter {
    --primary-bg: rgba(180, 220, 255, 0.7); /* Light Sky Blue */
    --secondary-bg: rgba(200, 235, 255, 0.7); /* Lighter Pale Blue */
    --secondary-bg-rgb: 200, 235, 255;
    --text-primary: #0056b3; /* Darker Blue */
    --text-primary-rgb: 0, 86, 179;
    --text-secondary: #003f80; /* Even Darker Blue */
    --accent-dark: #64b5f6; /* Vibrant Blue */
    --border-color: rgba(100, 181, 246, 0.3); /* Light Blue Border */
    --input-bg: rgba(210, 240, 255, 0.9);
    --button-bg: rgba(100, 181, 246, 0.9);

    --chart-line: #2196f3; /* Blue */
    --chart-point: #2196f3; /* Blue */
    --chart-grid: rgba(100, 181, 246, 0.1);
    --chart-text: #003f80;

    --current-day-card-bg: #90caf9; /* Lighter blue for current day card */
    --current-day-card-text: #003f80;
    --future-day-card-bg: #bbdefb; /* Even lighter blue for future day cards */
    --future-day-card-text: #003f80;
    --current-day-highlight-bg: var(--primary-bg);
    --current-day-highlight-border: var(--accent-dark);
}


/* Basic resets and font */
html, body {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', 'Kanit', 'Sarabun', sans-serif;
    /* Background will be set by JS based on theme */
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center center;
    background-attachment: fixed;
    color: var(--text-secondary); /* Use theme variable */
    min-height: 100vh;
    overflow-x: hidden;
    font-size: 1rem; /* Base font size */
    transition: background-color 0.5s ease, color 0.5s ease; /* Smooth transition for theme change */
}

/* เพิ่มหรือแก้ไขส่วนนี้ใน style.css */
.container-xl {
    max-width: 1400px !important; /* หรือค่าที่คุณต้องการ เช่น 1600px */
}
/* หรือถ้าคุณต้องการให้กว้างขึ้นอีกสำหรับหน้าจอที่ใหญ่มากๆ */
@media (min-width: 1400px) { /* ตัวอย่าง: กำหนดที่ breakpoint 1400px */
    .container-xl {
        max-width: 1500px !important; /* หรือค่าที่กว้างขึ้น */
    }
}

/* Override Bootstrap dark theme to match custom colors */
.bg-dark { background-color: var(--primary-bg) !important; } /* Use theme variable */
.text-light { color: var(--text-secondary) !important; } /* Use theme variable */
.text-primary { color: var(--text-primary) !important; } /* For custom text-primary */
.bg-secondary { background-color: var(--secondary-bg) !important; } /* Use theme variable */
.border-secondary { border-color: var(--border-color) !important; } /* Use theme variable */
.gradient-fade{ background: var(--gradient-fade) }

.navbar {
    /* Changed to linear gradient using theme variables */
    background: linear-gradient(to bottom, var(--primary-bg), var(--secondary-bg)) !important;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
    position: sticky;
    top: 0;
    z-index: 50;
}
.navbar .nav-link {
    color: var(--text-primary) !important; /* Use theme variable */
    font-weight: 500;
    font-size: 1.125rem;
}
.navbar .nav-link:hover {
    color: var(--accent-dark) !important; /* Use theme variable */
}

/* Map specific styling */
#map, #detail-map { /* Apply to both maps */
    width: 100%;
    height: 100%;
    border-radius: 0.75rem; /* rounded-xl */
}

/* Styling for temperature indicators (circles on map and in table) */
.temp-indicator {
    display: inline-block;
    width: 0.875rem; /* w-3.5 */
    height: 0.875rem; /* h-3.5 */
    border-radius: 50%; /* rounded-full */
    margin-right: 0.5rem; /* mr-2 */
    border: 2px solid var(--secondary-bg); /* Use card background color for border */
    box-shadow: 0 1px 2px rgba(255, 255, 255, 0.1); /* shadow-sm */
}

/* Specific classes for temperature colors */
.temp-color-very-cold { background-color: var(--temp-very-cold); }
.temp-color-cold { background-color: var(--temp-cold); }
.temp-color-cool { background-color: var(--temp-cool); }
.temp-color-normal { background-color: var(--temp-normal); }
.temp-color-hot { background-color: var(--temp-hot); }
.temp-color-very-hot { background-color: var(--temp-very-hot); }

/* text classes for temperature colors */
.text-color-very-cold { color: var(--temp-very-cold); }
.text-color-cold { color: var(--temp-cold); }
.text-color-cool { color: var(--temp-cool); }
.text-color-normal { color: var(--temp-normal); }
.text-color-hot { color: var(--temp-hot); }
.text-color-very-hot { color: var(--temp-very-hot); }

/* Animation for sections on scroll */
.section-animate {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}
.section-animate.animate-in {
    opacity: 1;
    transform: translateY(0);
}

/* Styling for the dropdown with search functionality */
.searchable-dropdown-wrapper {
    position: relative;
    width: 100%;
    max-width: 400px;
    margin-bottom: 0;
    z-index: 10;
}

#dropdown-input-container, #dropdown-input-container-home { /* Apply to both dropdown containers */
    position: relative;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem; /* rounded-md in Tailwind */
    background-color: var(--input-bg);
}

.searchable-dropdown-input {
    width: 100%;
    background-color: transparent;
    color: var(--text-primary);
    padding-left: 1rem; /* pl-4 */
    padding-right: 2.5rem; /* pr-10, to make space for icon */
    padding-top: 0.5rem; /* py-2 */
    padding-bottom: 0.5rem; /* py-2 */
    border: none;
    outline: none;
    border-radius: 0.375rem; /* rounded-md */
}

/* Focus state for the entire dropdown container */
#dropdown-input-container:focus-within, #dropdown-input-container-home:focus-within { /* Apply to both dropdown containers */
    border-color: transparent !important; /* Remove border on focus */
    box-shadow: 0 0 0 0.25rem rgba(255, 224, 130, 0.4) !important; /* Yellow glow */
}

.searchable-dropdown-results {
    position: absolute;
    width: 100%;
    /* พื้นหลังของ Dropdown (สีดำ/เข้ม) */
    background-color: var(--primary-bg) !important; /* ใช้สีพื้นหลังหลักของธีมที่เข้มที่สุด */
    border-radius: 0.375rem; /* มุมโค้งมน */
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.175); /* เงา */
    z-index: 50; /* วางไว้ด้านหน้า */
    max-height: 15rem; /* จำกัดความสูง */
    overflow-y: auto; /* ทำให้สามารถเลื่อนได้ */
    border: 1px solid var(--border-color); /* เส้นขอบ */
    top: calc(100% + 0.5rem); /* ตำแหน่งใต้ช่อง input */
}
.searchable-dropdown-item {
    padding: 0.5rem 1rem; /* ระยะห่างภายใน */
    cursor: pointer; /* เปลี่ยนเคอร์เซอร์เมื่อวางเมาส์ */
    /* สีข้อความในรายการ Dropdown (สีเหลืองอ่อน) */
    color: var(--text-primary) !important; /* ใช้สีข้อความหลักของธีม */
    transition: background-color 0.2s ease, color 0.2s ease; /* แอนิเมชันเมื่อเปลี่ยนสี */
    background-color: transparent !important; /* ให้แน่ใจว่าไม่มีสีพื้นหลังเริ่มต้น */
}
.searchable-dropdown-item:hover {
    /* พื้นหลังเมื่อโฮเวอร์ (สีเทาเข้มขึ้นเล็กน้อยจากพื้นหลังหลัก) */
    background-color: var(--secondary-bg) !important; /* ใช้สีพื้นหลังรองของธีม */
    /* สีข้อความเมื่อโฮเวอร์ (ยังคงเป็นสีเหลือง) */
    color: var(--text-primary) !important;
}
.searchable-dropdown-item.selected {
    /* พื้นหลังเมื่อถูกเลือก (สีปุ่ม) */
    background-color: var(--button-bg) !important; /* ใช้สีพื้นหลังปุ่มของธีม */
    /* สีข้อความเมื่อถูกเลือก (ยังคงเป็นสีเหลือง) */
    color: var(--text-primary) !important;
}

/* Custom scrollbar styles */
/* CSS สำหรับแถบ Scrollbar (Webkit browsers like Chrome, Safari) */
.hourly-forecast-grid, 
#daily-14-day-forecast-grid, 
#daily-14-day-forecast-grid-home, /* Added for home page */
.searchable-dropdown-results, 
/* เพิ่ม class dataTables_scrollBody ที่นี่สำหรับ Scrollbar ของตาราง */
.dataTables_scrollBody,
.table-scroll-container { /* Added for custom table scroll */
    /* Standard properties for Firefox and IE/Edge */
    scrollbar-width: thin; /* "auto" or "thin" */
    /* สีของ thumb (แถบเลื่อน) และ track (พื้นหลังของแถบเลื่อน) */
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent !important; 
    
    /* Webkit (Chrome, Safari) */
    &::-webkit-scrollbar {
        width: 8px; /* ความกว้างของ Scrollbar แนวตั้ง */
        height: 8px; /* ความสูงของ Scrollbar แนวนอน */
    }

    &::-webkit-scrollbar-track {
        background: transparent !important; /* พื้นหลังของแทร็ก Scrollbar เป็นโปร่งใส */
        border-radius: 10px; /* มุมโค้งมนของแทร็ก */
    }

    &::-webkit-scrollbar-thumb {
        background-color: rgba(255, 255, 255, 0.3); /* สีของแถบเลื่อน (สีขาวโปร่งแสง) */
        border-radius: 10px; /* มุมโค้งมนของแถบเลื่อน */
        border: 2px solid transparent !important; /* เส้นขอบโปร่งใสเพื่อรักษามิติ */
        background-clip: padding-box; /* ทำให้ border อยู่ด้านนอกพื้นที่สี */
    }

    /* On hover, make the thumb more visible */
    &::-webkit-scrollbar-thumb:hover {
        background-color: rgba(255, 255, 255, 0.5); /* แถบเลื่อนจะทึบขึ้นเมื่อวางเมาส์ */
    }
}

/* New styles for the image-matching forecast display */
.hourly-forecast-grid-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    border-radius: 0.375rem; /* rounded-lg */
    background-color: var(--future-day-card-bg);
    color: var(--future-day-card-text);
    flex-shrink: 0;
    width: 120px; /* Adjusted width for better fit, adjust as needed */
}
.hourly-forecast-grid-item .wind-speed {
    font-size: 0.875rem; /* text-sm */
    font-weight: 700; /* font-bold */
    margin-bottom: 0.25rem; /* mb-1 */
    color: var(--text-primary);
}
.hourly-forecast-grid-item .wind-direction-icon {
    font-size: 1rem; /* text-base */
    margin-bottom: 0.25rem; /* mb-1 */
    color: var(--text-secondary);
    transition: transform 0.3s ease-in-out; /* Smooth rotation */
}
.hourly-forecast-grid-item .time-day {
    font-size: 0.75rem; /* text-xs */
    font-weight: 600; /* font-semibold */
    margin-bottom: 0.25rem; /* mb-1 */
    color: var(--text-secondary);
}
.hourly-forecast-grid-item .weather-icon {
    width: 3rem; /* w-12 */
    height: 3rem; /* h-12 */
    margin-top: 0.25rem; /* my-1 */
    margin-bottom: 0.25rem; /* my-1 */
    filter: drop-shadow(0 0 2px rgba(255,255,255,0.2));
}
.hourly-forecast-grid-item .temp-range {
    font-size: 0.875rem; /* text-sm */
    font-weight: 700; /* font-bold */
    color: var(--text-primary);
}

/* Adjustments for the new main forecast summary */
#new-forecast-display {
    display: none; /* Will be toggled by JS */
}
#current-weather-summary {
    background-color: var(--current-day-card-bg);
    color: var(--current-day-card-text);
    border-radius: 0.75rem; /* rounded-xl */
    padding: 1.5rem; /* p-6 */
    margin-bottom: 2rem; /* mb-8 */
    display: flex;
    flex-direction: column;
    align-items: center; /* Center items for small screens */
    text-align: center; /* Center text for small screens */
}
@media (min-width: 768px) { /* md breakpoint */
    #current-weather-summary {
        flex-direction: row;
        justify-content: space-between;
        text-align: left;
    }
}

#current-weather-summary .temp-icon-group {
    display: flex;
    align-items: center;
    gap: 1rem; /* gap-4 */
    margin-bottom: 1rem; /* mb-4 */
}
@media (min-width: 768px) {
    #current-weather-summary .temp-icon-group {
        margin-bottom: 0;
    }
}

#current-weather-summary .current-temp-display {
    display: flex;
    align-items: flex-start;
}
#current-weather-summary .current-temp-display .main-temp {
    font-size: 3.75rem; /* text-6xl */
    font-weight: 700; /* font-bold */
    line-height: 1; /* leading-none */
}
#current-weather-summary .current-temp-display .unit-temp {
    font-size: 1.875rem; /* text-3xl */
    font-weight: 500; /* font-medium */
    line-height: 1; /* leading-none */
    margin-left: 0.25rem; /* ml-1 */
}

#current-weather-summary .info-text {
    margin-left: 1rem; /* ml-4 */
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    font-size: 1rem; /* text-base */
}
#current-weather-summary .right-summary {
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end; /* Align right for text */
}
#current-weather-summary .right-summary h3 {
    font-size: 1.5rem; /* text-2xl */
    font-weight: 600; /* font-semibold */
    color: var(--text-primary);
}
#current-weather-summary .right-summary span {
    font-size: 1.125rem; /* text-lg */
    font-weight: 500; /* font-medium */
}

/* Chart container styling */
#hourly-chart-container {
    background-color: var(--secondary-bg);
    border-radius: 0.75rem; /* rounded-xl */
    border: 1px solid var(--border-color);
    padding: 1.5rem; /* p-5 */
    margin-top: 2rem; /* mt-8 */
}
#hourlyChart {
    height: 250px !important; /* fixed height for the chart */
/* width: 100%;*/
}

/* Daily 14-day forecast grid styling */
#daily-14-day-forecast-grid-wrapper, #daily-14-day-forecast-grid-wrapper-home,
#hourly-forecast-grid-wrapper { /* Apply to both wrappers and hourly wrapper */
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center; /* Center the entire scrollable area */
    align-items: center;
    margin-top: 1rem;
    /*max-width: 1200px; /* Optional: limit max width of the scrollable area */
    margin-left: auto;
    margin-right: auto;
    /* Add padding to make space for buttons */
    padding-left: 2.5rem; /* Adjust based on button width + desired spacing */
    padding-right: 2.5rem; /* Adjust based on button width + desired spacing */
}

#daily-14-day-forecast-grid, #daily-14-day-forecast-grid-home,
#hourly-forecast-grid { /* Apply to both grids */
    display: flex;
    flex-wrap: nowrap; /* Forces items into a single line */
    overflow-x: auto;   /* Enables horizontal scrolling */
    scroll-behavior: smooth; /* Smooth scrolling */
    gap: 1rem; /* gap-4 */
    padding: 0.5rem; /* py-2 */
    -webkit-overflow-scrolling: touch; /* iOS smooth scrolling */
    width: 100%; /* Ensure it takes full width of its wrapper */
    background-color: transparent; /* Make slide bar background transparent */
}

/* Styling for individual daily forecast cards within the horizontal scroll */
.daily-forecast-card {
    background-color: var(--future-day-card-bg);
    color: var(--future-day-card-text);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem; /* rounded-lg */
    padding: 0.75rem; /* p-3 */
    text-align: center;
    flex-shrink: 0; /* Prevent cards from shrinking */
    width: 150px; /* Fixed width for each card */
    transition: background-color 0.3s ease; /* Smooth transition for current day highlight */
}

.daily-forecast-card.current-day {
    background-color: var(--current-day-highlight-bg); /* Distinct color for current day */
    border-color: var(--current-day-highlight-border);
    box-shadow: 0 0 15px rgba(255, 224, 130, 0.2); /* Subtle glow */
}

.daily-forecast-card .day-date {
    font-size: 0.9rem; /* Slightly larger for daily card date */
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}
.daily-forecast-card .weather-icon {
    width: 4rem; /* Larger icon for daily summary */
    height: 4rem;
}
.daily-forecast-card .temp-avg { /* New class for average temp */
    font-size: 1.2rem; /* Slightly larger than min/max */
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}
.daily-forecast-card .temp-range {
    font-size: 1.1rem; /* Larger temp range for daily summary */
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 0.5rem;
}
.daily-forecast-card .description {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Brighter color for sunrise/sunset text */
.daily-forecast-card .sunrise-sunset-info {
    color: var(--text-primary); /* Brighter yellow/light color */
    font-size: 0.85rem;
}

/* Styling for scroll buttons (similar to hourly) */
.scroll-button {
    position: absolute;
    z-index: 10;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.2);
    border-radius: 50%;
    width: 36px; /* Adjust size if needed */
    height: 36px; /* Adjust size if needed */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
    cursor: pointer; /* Indicate it's clickable */
    color: var(--text-primary); /* Icon color */
}

.scroll-button:hover {
    background-color: rgba(255,255,255,0.2);
}

#hourlyScrollLeftBtn, #dailyScrollLeftBtn, #hourlyScrollLeftBtnHome, #dailyScrollLeftBtnHome { 
    left: 0; /* Position at the start of the padded wrapper */
}
#hourlyScrollRightBtn, #dailyScrollRightBtn, #hourlyScrollRightBtnHome, #dailyScrollRightBtnHome { 
    right: 0; /* Position at the end of the padded wrapper */
}

.d-none {
    display: none !important;
}

/* Custom Rain Marker style */
.rain-marker {
    background-color: var(--rain-marker-bg); /* Use the defined rain color */
    color: white; /* White text for contrast */
    border-radius: 0.5rem; /* Rounded corners */
    padding: 0.3rem 0.6rem; /* Padding to make it a pill shape */
    font-size: 0.9rem; /* Adjust font size */
    font-weight: 600;
    white-space: nowrap; /* Prevent text wrapping */
    text-align: center;
    display: flex;
    align-items: center;
    gap: 0.25rem; /* Small gap between icon and text */
    min-width: 70px; /* Minimum width to contain content */
    border: 1px solid rgba(255, 255, 255, 0.3); /* Slight white border */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); /* Subtle shadow */
}

.rain-marker i {
    font-size: 1.1rem; /* Icon size */
    margin-right: 0.2rem; /* Space between icon and text */
}

/* New style for temperature display in the table to match the image */
.table-temp-display {
    padding: 0.2rem 0.4rem;
    border-radius: 0.3rem;
    display: inline-block; /* To apply padding and border-radius */
    color: var(--primary-bg); /* Default dark text on colored background */
}
/* Override text color for table temp display to ensure visibility on colored backgrounds */
.temp-color-very-cold.table-temp-display,
.temp-color-cold.table-temp-display,
.temp-color-cool.table-temp-display,
.temp-color-normal.table-temp-display,
.temp-color-hot.table-temp-display,
.temp-color-very-hot.table-temp-display {
     color: white !important; /* Ensure white text on colored backgrounds */
}

/* Custom Table Specific Styles */
#weather-table {
    /* Base background for the table, ensure it picks up theme primary-bg */
    background-color: var(--primary-bg); 
    color: var(--text-secondary); /* Default text color for table */
}

/* Apply background and text color to all table cells */
#weather-table th,
#weather-table td {
    background-color: var(--secondary-bg); /* Use secondary-bg for cells */
    color: var(--text-secondary); /* Use secondary text color for cell content */
    border-color: var(--border-color) !important; /* Ensure borders also change */
}

#weather-table thead {
    background-color: var(--primary-bg); /* Header background */
    color: var(--text-primary); /* Header text color */
}

#weather-table tbody tr {
    background-color: var(--secondary-bg); /* Row background */
    color: var(--text-secondary); /* Row text color */
}

/* Ensure no alternating black for weather-table */
/* Targeting specific table ID and then its rows with !important */
#weather-table tbody tr:nth-child(odd),
#weather-table tbody tr:nth-child(even) {
    background-color: var(--secondary-bg) !important; /* Explicitly set for all rows with !important */
}

#weather-table tbody tr:hover {
    background-color: rgba(var(--text-primary-rgb), 0.1); /* Lighter hover effect using RGB variable */
}

#weather-table thead th {
    cursor: pointer;
    vertical-align: middle; /* Align text and sort icon vertically */
    padding-right: 2rem; /* Give space for sort icon */
    position: relative;

    /* Sticky header styles */
    position: sticky;
    top: 0; /* Stick to the top of its scrolling container */
    background-color: var(--primary-bg); /* Ensure background color is set for sticky effect */
    z-index: 20; /* Ensure it stays above table body content */
    box-shadow: 0 2px 5px rgba(0,0,0,0.2); /* Optional: Add a subtle shadow */
}

#weather-table thead th i.fas {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary); /* Dimmed sort icon */
    transition: color 0.2s ease;
}

#weather-table thead th.sorted-asc i.fas {
    color: var(--accent-dark); /* Highlight active sort icon */
}

#weather-table thead th.sorted-desc i.fas {
    color: var(--accent-dark); /* Highlight active active sort icon */
}

.table-scroll-container {
    max-height: 450px; /* Example fixed height for scrollability */
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
}

/* Leaflet Popup Custom Styling */
/* Apply the custom font to the Leaflet popup content */
.leaflet-popup-content {
    font-family: 'Inter', 'Kanit', 'Sarabun', sans-serif !important;
    color: #333333; /* Dark text for better readability on light popup background */
    font-size: 0.9rem; /* Adjust font size if needed */
}

/* Ensure strong tags inside popup also use the correct font and are readable */
.leaflet-popup-content strong {
    font-family: 'Inter', 'Kanit', 'Sarabun', sans-serif !important;
    color: #1a1a1a; /* Even darker for emphasis */
    font-weight: 600;
}

/* Adjust button styles within popup if needed for consistency */
.leaflet-popup-content .btn {
    font-family: 'Inter', 'Kanit', 'Sarabun', sans-serif !important;
    font-size: 0.8rem;
}

/* Additional details styling for current weather summary */
/* Removed flex properties that conflict with Bootstrap row/col */
#current-weather-details {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    width: 100%;
    /* Removed justify-content for the container, let col handle spacing */
}

#current-weather-details .col-12 { /* Target the column divs */
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    color: var(--text-secondary);
    /* min-width removed as col classes handle width */
}

#current-weather-details .col-12 i {
    color: var(--accent-dark); /* Accent color for icons */
    font-size: 1.1rem;
}

#current-weather-details .col-12 span {
    font-weight: 500;
    color: var(--text-primary);
}

/* Styles for tables in heat-index-section, wind-speed-section, rainfall-criteria-section */
/* Targeting these specific section IDs and their tables */
#heat-index-section table,
#wind-speed-section table,
#rainfall-criteria-section table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    background-color: var(--secondary-bg); /* Base background for these tables */
    color: var(--text-secondary);
    border-radius: 0.5rem;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

#heat-index-section table th,
#wind-speed-section table th,
#rainfall-criteria-section table th {
    background-color: var(--primary-bg); /* Header background */
    color: var(--text-primary);
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

#heat-index-section table td,
#wind-speed-section table td,
#rainfall-criteria-section table td {
    background-color: var(--secondary-bg); /* Cell background */
    color: var(--text-secondary);
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

/* Explicitly set background for tbody tr in these tables to prevent alternating colors */
#heat-index-section table tbody tr:nth-child(odd),
#heat-index-section table tbody tr:nth-child(even),
#wind-speed-section table tbody tr:nth-child(odd),
#wind-speed-section table tbody tr:nth-child(even),
#rainfall-criteria-section table tbody tr:nth-child(odd),
#rainfall-criteria-section table tbody tr:nth-child(even) {
    background-color: var(--secondary-bg) !important; /* Use secondary-bg for all rows with !important */
}


/* Remove last row bottom border for cleaner look */
#heat-index-section table tbody tr:last-child td,
#wind-speed-section table tbody tr:last-child td,
#rainfall-criteria-section table tbody tr:last-child td {
    border-bottom: none;
}

/* Optional: Add hover effect for these tables too */
#heat-index-section table tbody tr:hover,
#wind-speed-section table tbody tr:hover,
#rainfall-criteria-section table tbody tr:hover {
    background-color: rgba(var(--text-primary-rgb), 0.1); /* Subtle hover effect */
}


/* เพิ่มสไตล์สำหรับ hover effect ที่นี่ */
    .hover-up {
        transition: transform 0.3s ease-in-out, box-shadow 0.3s ease-in-out; /* เพิ่ม transition เพื่อให้การขยับเป็นไปอย่างนุ่มนวล */
        cursor: pointer; /* เปลี่ยน cursor เพื่อบ่งบอกว่าคลิกได้ */
    }

    .hover-up:hover {
        transform: translateY(-5px); /* ขยับขึ้น 5px เมื่อ hover */
/*        box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2); /* เพิ่มเงาเล็กน้อยเพื่อความโดดเด่น */*/
    }


.menu-glass {
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
  backdrop-filter: blur(10px);
/*  border-radius: 16px;*/
/*  border: 1px solid rgba(255, 255, 255, 0.3);*/
/*  padding: 16px 32px;*/
  color: #fff;
/*  font-weight: 600;*/
/*  transition: background 0.3s;*/
}
.menu-glass:hover {
  background: rgba(255,255,255,0.25);
}