/* --- ธีมสีหลัก (Variables) --- */
:root {
    --color-primary: #D32F2F;        /* แดงเข้ม */
    --color-primary-dark: #B71C1C;   /* แดงเข้มกว่า */
    --color-background: #121212;     /* ดำสนิท / พื้นหลังหลัก */
    --color-secondary: #2C2C2C;      /* เทาเข้ม (สำหรับกล่อง/การ์ด) */
    --color-text-light: #E0E0E0;     /* สีตัวอักษรหลัก (สว่าง) */
    --color-text-dark: #616161;      /* สีตัวอักษรรอง (มืด) */
    --color-accent: #FFEB3B;         /* สีเน้น (เหลือง/ทอง สำหรับปุ่ม/ลิงก์) */
    --font-family: 'Inter', sans-serif;
}

/* --- Global & Base Styling --- */
body {
    font-family: var(--font-family);
    background-color: var(--color-background);
    color: var(--color-text-light);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* จัดกึ่งกลางองค์ประกอบทั้งหมดใน Body เพื่อความสวยงาม */
.content-wrapper {
    flex-grow: 1; 
    width: 100%;
    margin: 0 auto; 
    padding: 0; 
    box-sizing: border-box;
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color 0.3s;
}

a:hover {
    color: var(--color-primary-dark);
}

/* ******************************************************* */
/* --- 1. Header Styling (Responsive) --- */
/* ******************************************************* */
.main-header {
    background-color: #000000; 
    color: var(--color-text-light);
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.7);
    position: sticky;
    top: 0;
    z-index: 500;
    flex-wrap: wrap; 
}

/* --- การจัดวางเมื่อเมนูนำทางถูกซ่อน (ในหน้า Index) --- */
/* ให้ Header สามารถจัดวางโลโก้และปุ่ม action ได้ถูกต้องเมื่อไม่มี main-nav */
.main-header:has(.auth-buttons-group) {
    justify-content: space-between; 
}

.logo-area a {
    text-decoration: none;
}

.site-logo {
    max-height: 40px; 
    width: auto;
    border-radius: 0;
}

.site-name {
    font-size: 1.4em;
    font-weight: 900;
    color: var(--color-primary);
    margin: 0;
}

/* Navigation Links - บน Desktop */
.main-nav {
    display: flex;
    gap: 20px;
}

.main-nav .nav-item {
    color: var(--color-text-light);
    text-decoration: none;
    font-size: 1em;
    padding: 5px 0;
    transition: color 0.3s;
    white-space: nowrap;
}

.main-nav .nav-item:hover {
    color: var(--color-primary);
}

/* Header Actions (Contact & User Info) */
.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Contact Button */
.contact-btn {
    background-color: #424242; 
    color: var(--color-text-light);
    padding: 8px 15px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: bold;
    border: 1px solid #555;
    transition: background-color 0.3s;
    white-space: nowrap;
}

.contact-btn:hover {
    background-color: #555555;
}

/* Mobile Menu Toggle (ซ่อนบน Desktop) */
.mobile-menu-toggle {
    display: none; 
    background: none;
    border: none;
    color: var(--color-primary);
    font-size: 1.5em;
    cursor: pointer;
    padding: 5px;
}

/* ******************************************************* */
/* --- 2. User Info / Auth Buttons (includes/user_info.php) --- */
/* ******************************************************* */

/* ปุ่ม Login/Register ใน Header (เมื่อ Logout) */
.auth-buttons-group {
    display: flex;
    gap: 10px;
}

.btn-login-header, .btn-register-header {
    padding: 8px 15px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    transition: background-color 0.3s;
    white-space: nowrap;
}

.btn-login-header {
    background-color: var(--color-primary);
    color: white;
}
.btn-login-header:hover {
    background-color: var(--color-primary-dark);
}

.btn-register-header {
    background-color: #424242;
    color: var(--color-text-light);
    border: 1px solid #616161;
}
.btn-register-header:hover {
    background-color: #555;
}


/* Dropdown User Info (เมื่อ Login) */
.user-info-dropdown {
    position: relative;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 6px;
    background-color: var(--color-secondary);
    transition: background-color 0.3s;
}

.user-info-dropdown:hover {
    background-color: #3d3d3d;
}

.user-name, .user-balance {
    display: block;
    font-size: 0.9em;
    white-space: nowrap;
}

.user-balance {
    color: var(--color-accent); 
    font-weight: bold;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background-color: var(--color-secondary);
    border: 1px solid #444;
    border-radius: 8px;
    min-width: 180px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    padding: 10px 0;
    margin-top: 5px;
    display: none;
    z-index: 550;
}

.user-info-dropdown.open .dropdown-menu {
    display: block;
}

.dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    text-decoration: none;
    color: var(--color-text-light);
    transition: background-color 0.2s, color 0.2s;
}

.dropdown-menu a:hover {
    background-color: #3d3d3d;
    color: var(--color-primary);
}

.logout-link {
    border-top: 1px solid #444;
    margin-top: 5px;
    padding-top: 10px !important;
    color: var(--color-primary) !important;
}

/* ******************************************************* */
/* --- 3. Footer Styling (เรียบง่ายตามธีม) --- */
/* ******************************************************* */
.main-footer {
    background-color: #000000; 
    color: var(--color-text-dark); 
    padding: 15px 20px;
    text-align: center;
    margin-top: auto; 
    border-top: 1px solid #222;
    font-size: 0.85em;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
}

.site-footer-name {
    color: var(--color-text-light);
    font-weight: 600;
}

.footer-links {
    margin-top: 5px;
}

.footer-links a {
    color: var(--color-text-dark);
    text-decoration: none;
    padding: 0 5px;
    transition: color 0.3s;
}

.footer-links a:hover {
    color: var(--color-primary);
}

/* Floating Line Button */
.floating-line-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background-color: #00C300; 
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.8em;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    z-index: 900;
    text-decoration: none;
    transition: transform 0.2s;
}
.floating-line-btn:hover {
    transform: scale(1.05);
}

/* ******************************************************* */
/* --- 4. Login / Register Page Styling (index.php, register.php) --- */
/* ******************************************************* */
.login-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 50px 20px;
    width: 100%;
    min-height: calc(100vh - 120px); 
    justify-content: center;
}

.login-box {
    background-color: var(--color-secondary);
    padding: 40px; 
    border-radius: 12px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5); 
    text-align: center;
    width: 100%;
    max-width: 450px; 
    color: var(--color-text-light); 
    border: 1px solid #444; 
    box-shadow: 0 0 0 5px var(--color-primary), 0 8px 25px rgba(0, 0, 0, 0.7);
    transition: all 0.3s ease-in-out;
}

.login-heading {
    margin-bottom: 30px;
    font-size: 2em; 
    font-weight: 500; 
    color: var(--color-text-light);
    border-bottom: 2px solid var(--color-text-dark); 
    padding-bottom: 10px;
    letter-spacing: 0; 
    text-transform: none;
}

.input-group {
    margin-bottom: 15px;
    position: relative;
    text-align: left;
}

.input-group input,
.input-group select { 
    width: 100%; 
    box-sizing: border-box; 
    padding: 15px 15px 15px 15px; 
    border: none; 
    border-radius: 8px; 
    font-size: 16px;
    background-color: #383838; 
    color: var(--color-text-light);
    transition: background-color 0.3s;
}

.input-group input::placeholder {
    color: #999;
}

.input-group select:invalid { 
    color: #999;
}

.input-group input:focus,
.input-group select:focus {
    outline: 2px solid var(--color-primary); 
    background-color: #424242;
    box-shadow: none;
}

/* สไตล์เฉพาะสำหรับช่องกรอกที่มี Icon (เช่น เบอร์โทรศัพท์, รหัสผ่าน) */
.input-group.has-icon input {
     padding-left: 50px; 
}
.input-group.has-icon .icon {
    left: 15px; 
}

.input-group select {
    appearance: none;
    -webkit-appearance: none;
    /* Custom SVG Arrow (สีเทาเข้ม) */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23616161'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 14px;
    padding-right: 40px; 
}

.input-group .icon {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-dark); 
    font-size: 18px;
}

.forgot-pass {
    text-align: right;
    font-size: 0.9em;
    margin-top: -10px; 
    margin-bottom: 20px;
    width: 100%;
}

.forgot-pass a {
    color: var(--color-accent); 
    text-decoration: none;
}

.forgot-pass a:hover {
    color: var(--color-text-light);
}

.auth-buttons-container {
    display: flex;
    justify-content: space-between;
    align-items: flex-end; 
    gap: 15px;
    width: 100%;
}

.btn-login, .btn-register {
    padding: 12px 15px; 
    border-radius: 8px; 
    font-size: 1em; 
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.1s;
    text-align: center;
    border: none;
}

.btn-login {
    flex: 1; 
    max-width: 60%; 
    background-color: var(--color-primary); 
    color: white;
    box-shadow: 0 4px 10px rgba(211, 47, 47, 0.4);
}

.btn-login:hover {
    background-color: var(--color-primary-dark);
}

.btn-register {
    flex: 1; 
    max-width: 40%;
    background-color: #424242; 
    color: var(--color-text-light);
    border: 1px solid #616161; 
    text-decoration: none; 
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: none;
}

.btn-register:hover {
    background-color: #555555;
}

/* --- Promotion Banner --- */
.promo-banner {
    margin-top: 25px; 
    padding: 20px;
    background-color: var(--color-secondary); 
    border: 1px solid #444; 
    border-radius: 12px;
    width: 100%;
    max-width: 450px; 
    text-align: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    color: var(--color-text-light);
}

.promo-banner h3 {
    color: var(--color-accent); 
    margin: 0 0 10px 0;
    font-size: 1.1em;
    font-weight: bold;
}

.promo-banner p {
    font-size: 0.95em;
    margin-bottom: 0;
}


/* ******************************************************* */
/* --- 5. Modal Styling (สำหรับ Announcement) --- */
/* ******************************************************* */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    display: none; 
}

.modal-content {
    background-color: var(--color-secondary); 
    border-radius: 15px;
    max-width: 90%; 
    width: 450px; 
    padding: 20px;
    text-align: center;
    position: relative;
    box-shadow: 0 10px 40px rgba(211, 47, 47, 0.5); 
    border: 3px solid var(--color-primary);
    transform: scale(0.95);
    transition: transform 0.3s ease-out;
}

.modal-content.show {
    transform: scale(1);
}

.close-modal-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.3s;
}

.close-modal-btn:hover {
    background-color: var(--color-primary-dark);
}

.modal-title {
    color: var(--color-primary);
    font-size: 1.8em;
    font-weight: bold;
    margin-bottom: 15px;
}

.announcement-image {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    margin-bottom: 15px;
    border: 1px solid #444;
}

.modal-text {
    font-size: 1em;
    color: var(--color-text-light);
    margin-bottom: 20px;
}

.btn-confirm-modal {
    padding: 10px 25px;
    background-color: var(--color-primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.05em;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.1s;
}

.btn-confirm-modal:hover {
    background-color: var(--color-primary-dark);
    transform: translateY(-1px);
}


/* ******************************************************* */
/* --- Media Queries (Responsive Adjustments) --- */
/* ******************************************************* */

@media (max-width: 900px) {
    /* Header Responsive */
    /* ซ่อนเมนูนำทางหลักบนมือถือ (ถ้าผู้ใช้ล็อกอินอยู่) */
    .main-nav {
        display: none; 
        flex-direction: column;
        width: 100%;
        text-align: center;
        margin-top: 10px;
        order: 4; 
        background-color: var(--color-secondary);
        border-radius: 8px;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    }

    .main-nav.active {
        display: flex;
    }
    
    .main-nav .nav-item {
        padding: 12px 15px;
        border-bottom: 1px solid #333;
    }
    
    .main-nav .nav-item:last-child {
        border-bottom: none;
    }
    
    .mobile-menu-toggle {
        display: block; 
        order: 3;
    }
    
    .header-actions {
        order: 2;
        gap: 10px;
    }

    .main-header {
        flex-wrap: wrap;
        gap: 10px 0;
    }

    .logo-area {
        order: 1;
    }
}

@media (max-width: 480px) {
    /* Login Page Responsive */
    .login-box {
        padding: 30px;
    }
    .auth-buttons-container {
        flex-direction: column;
        gap: 10px;
    }
    .btn-login, .btn-register {
        max-width: 100%;
        width: 100%;
    }

    /* Floating Button Adjustment */
    .floating-line-btn {
        width: 45px;
        height: 45px;
        font-size: 1.5em;
    }
    
    /* Dropdown User Info compact view */
    .user-info-dropdown {
        padding: 8px;
    }
    .user-name {
        display: none; 
    }
    
    .contact-btn {
        padding: 8px 12px;
        font-size: 0.9em;
    }
    .contact-btn i {
        display: none;
    }
}
/* ******************************************************* */
/* --- 5. Dashboard (Logged In) Styling --- */
/* ******************************************************* */

.dashboard-container {
    padding: 20px 0;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

/* แถบข้อความวิ่ง (Announcement Marquee) */
.marquee-bar {
    background-color: var(--color-secondary);
    color: var(--color-text-light);
    padding: 10px 20px;
    margin-bottom: 20px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    overflow: hidden;
    border-left: 5px solid var(--color-primary);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.marquee-bar i {
    color: var(--color-accent);
    margin-right: 10px;
    font-size: 1.2em;
}

.marquee-content {
    white-space: nowrap;
    animation: marquee 30s linear infinite;
    padding-left: 100%; /* เริ่มต้นนอกจอ */
}

@keyframes marquee {
    0% { transform: translateX(0%); }
    100% { transform: translateX(-100%); }
}

/* Swiper Slider */
.promo-slider {
    width: 100%;
    height: auto;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 30px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    border: 1px solid #444;
}

.swiper-slide img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

/* Swiper Controls Customization */
.swiper-pagination-bullet-active {
    background: var(--color-primary) !important;
}

.swiper-button-next, .swiper-button-prev {
    color: var(--color-accent) !important;
    opacity: 0.8;
    transition: opacity 0.3s;
}

.swiper-button-next:hover, .swiper-button-prev:hover {
    opacity: 1;
}

/* เมนูลัด 6 ปุ่ม (Quick Links Grid) */
.quick-links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); /* 6 คอลัมน์บน Desktop */
    gap: 15px;
    padding: 10px;
    background-color: var(--color-secondary);
    border-radius: 12px;
}

.quick-link-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    background-color: #383838;
    padding: 15px 10px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--color-text-light);
    transition: background-color 0.3s, transform 0.2s;
}

.quick-link-item:hover {
    background-color: var(--color-primary-dark);
    transform: translateY(-3px);
}

.quick-link-icon {
    font-size: 2em;
    color: var(--color-primary);
    margin-bottom: 8px;
}

.quick-link-text {
    font-size: 0.9em;
    font-weight: 600;
    white-space: nowrap;
}

/* Media Query สำหรับ Mobile */
@media (max-width: 768px) {
    .quick-links-grid {
        grid-template-columns: repeat(3, 1fr); /* 3 คอลัมน์บน Tablet/Mobile */
        gap: 10px;
    }
}
@media (max-width: 480px) {
    .quick-links-grid {
        grid-template-columns: repeat(2, 1fr); /* 2 คอลัมน์บน Mobile จอเล็ก */
    }
    .quick-link-item {
        padding: 12px 5px;
    }
}
/* ******************************************************* */
/* --- 7. Yikee Lotto Page Styling (yikee.php) --- */
/* ******************************************************* */

.yikee-page-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.yikee-page-container .page-heading {
    display: flex;
    align-items: center;
}

.yikee-page-container .back-link {
    color: var(--color-text-light);
    margin-right: 15px;
    font-size: 1.2em;
}
.yikee-page-container .back-link:hover {
    color: var(--color-primary);
}

.yikee-info-bar {
    background-color: var(--color-secondary);
    color: var(--color-text-light);
    padding: 10px 15px;
    margin-top: 15px;
    margin-bottom: 25px;
    border-radius: 8px;
    font-size: 1em;
}

/* Grid สำหรับ Card รอบหวยยี่กี่ (หลายรอบต่อแถว) */
.yikee-rounds-grid {
    display: grid;
    /* 6 คอลัมน์บน Desktop */
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); 
    gap: 15px;
    padding-bottom: 50px;
}

.yikee-round-card {
    display: flex;
    flex-direction: column;
    text-align: center;
    text-decoration: none;
    background-color: var(--color-secondary);
    padding: 15px 10px;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
    transition: transform 0.2s;
    border: 2px solid var(--color-secondary); /* ขอบเริ่มต้นสีเทา */
}

.yikee-round-card:hover {
    transform: translateY(-3px);
    border-color: var(--color-primary); /* ขอบสีแดงเมื่อโฮเวอร์ */
}

.card-round-number {
    font-size: 2em;
    font-weight: bold;
    color: var(--color-accent); /* สีทอง */
    margin-bottom: 5px;
}

.card-name {
    font-size: 0.9em;
    color: var(--color-text-light);
    font-weight: 600;
}

.card-closing-time {
    font-size: 0.8em;
    color: #9E9E9E;
    margin-bottom: 10px;
}

.card-countdown {
    font-size: 1.2em;
    font-weight: bold;
    color: var(--color-primary); /* สีแดงสำหรับ Countdown */
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 5px;
}
.card-countdown i {
    font-size: 0.8em;
    margin-right: 5px;
}

/* สถานะปิดรับแทง */
.yikee-round-card.closed {
    opacity: 0.6;
    pointer-events: none; /* ปิดการคลิก */
    border-color: var(--color-danger);
}
.yikee-round-card.closed .card-countdown {
    color: var(--color-danger); 
    font-size: 1em;
}
.yikee-round-card.closed .card-countdown span {
    font-style: italic;
}
/* ******************************************************* */
/* --- 6. Bet Lotto Page Styling (bet_lotto.php) --- */
/* ******************************************************* */

.betting-page-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header ของหน้า */
.page-heading {
    color: var(--color-primary);
    margin-bottom: 25px;
    font-size: 1.8em;
}

/* แถบหวยพิเศษ (เช่น หวยยี่กี่) */
.special-lottery-bar {
    background-color: var(--color-secondary);
    color: var(--color-text-light);
    padding: 12px 20px;
    margin-bottom: 30px;
    border-radius: 8px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    font-size: 1.1em;
}

/* ส่วนหัวประเภทหวย (เช่น หวยไทย, หวย 4D) */
.lottery-type-heading {
    color: var(--color-text-light);
    font-size: 1.4em;
    padding-left: 10px;
    border-left: 5px solid var(--color-primary);
    margin: 30px 0 15px 0;
}

/* Grid สำหรับ Card หวย */
.lottery-card-grid {
    display: grid;
    /* 3 คอลัมน์บน Desktop, 4 คอลัมน์สำหรับหวย 4D */
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); 
    gap: 20px;
    margin-bottom: 40px;
}

/* ************ สไตล์ Card หวย (หัวใจของ UI) ************ */
.lottery-card {
    display: block;
    text-decoration: none;
    background-color: var(--color-secondary);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s, box-shadow 0.3s;
    border: 1px solid #444;
    position: relative;
    min-height: 150px; /* กำหนดความสูงขั้นต่ำ */
}

/* เอฟเฟกต์สีทองบน Card (ตามรูปอ้างอิง) */
.lottery-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(211, 47, 47, 0.4);
    /* ใช้ขอบสีทอง (accent color) เมื่อ hover */
    border-color: var(--color-accent); 
}

/* ส่วน Header ของ Card (ชื่อหวยและโลโก้ธง) */
.card-header {
    /* ใช้สีทองไล่ระดับ หรือสีดำ/เทาเข้ม */
    background: linear-gradient(180deg, #424242 0%, #212121 100%); 
    color: var(--color-text-light);
    padding: 15px 15px 5px 15px;
    font-weight: 700;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    position: relative;
    min-height: 50px;
}

/* โลโก้หวย (ต้องดึงมาเอง) */
.lottery-logo {
    position: absolute;
    top: 5px;
    right: 15px;
    width: 40px; /* ขนาดโลโก้ธงชาติ */
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    background-color: white; /* เพื่อให้ธงชัดเจน */
    border: 1px solid #555;
}

.card-header .type-name {
    font-size: 1.1em;
    font-weight: 900;
    color: var(--color-primary);
}
.card-header .round-name {
    display: block;
    font-weight: 400;
    font-size: 0.8em;
    color: #9E9E9E;
}

/* Body ของ Card (เวลาปิดรับแทงและ Countdown) */
.card-body {
    padding: 15px;
    display: flex;
    flex-direction: column;
    color: var(--color-text-light);
}

.closing-time-label {
    font-size: 0.9em;
    color: #BDBDBD;
    margin-bottom: 5px;
}

/* Countdown Display */
.countdown-display {
    font-size: 1.3em;
    font-weight: bold;
    color: var(--color-accent); /* สีทอง/เหลือง */
    display: flex;
    align-items: center;
    margin-top: 5px;
}

.countdown-display i {
    font-size: 0.8em;
    margin-right: 8px;
    color: var(--color-primary);
}

.countdown-display span {
    color: var(--color-text-light); /* ตัวเลขเวลาเป็นสีขาว/เทาอ่อน */
}
.countdown-display span:first-child {
    font-size: 0.8em;
    font-weight: normal;
    color: var(--color-accent); /* ตัวเลขวันเป็นสีทอง */
    margin-right: 5px;
}

/* สถานะปิดรับแทง */
.lottery-card.closed {
    opacity: 0.6;
    pointer-events: none; 
}
.lottery-card.closed .countdown-display {
    color: var(--color-danger);
}
/* ******************************************************* */
/* --- 7. Betting Form UI (bet.php / form_standard_thai.php) --- */
/* ******************************************************* */

.betting-form-container {
    max-width: 1300px;
    margin: 20px auto;
    padding: 0;
}

/* Header ของหน้าแทงหวย (รวมรายละเอียดรอบและ Countdown) */
.betting-header {
    background-color: var(--color-secondary);
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid #444;
}

.betting-header .round-info {
    color: var(--color-text-light);
    font-size: 1em;
}
.countdown-display-lg {
    font-size: 1.4em;
    color: var(--color-accent);
}

.balance-info {
    font-size: 1em;
    color: var(--color-text-light);
    text-align: right;
}
.balance-amount {
    font-size: 1.2em;
    font-weight: bold;
    color: var(--color-accent);
}

/* --- MAIN 2-Column Layout (ตามรูปแนบ) --- */
.betting-main-interface {
    display: flex;
    gap: 20px;
    min-height: 70vh;
}

/* --- 3.1 Left Panel (Bet Slip & Actions) --- */
.bet-slip-panel {
    flex: 0 0 280px; /* ความกว้างคงที่สำหรับแถบด้านซ้าย */
    background-color: var(--color-secondary);
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
}

.slip-status-box {
    background-color: var(--color-primary-dark);
    color: white;
    padding: 10px;
    border-radius: 6px;
    text-align: center;
    font-weight: 600;
    margin-bottom: 10px;
}
.slip-status-box .slip-count {
    color: var(--color-accent);
    margin-left: 5px;
}

.slip-list-summary {
    flex-grow: 1;
    overflow-y: auto;
    margin-bottom: 15px;
    padding: 10px 0;
    border-bottom: 1px dashed #444;
}
.bet-slip-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.bet-slip-item {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px dotted #333;
    font-size: 0.9em;
}
.bet-info { color: var(--color-text-light); }
.bet-amount { color: var(--color-accent); font-weight: bold; }
.btn-remove-item { background: none; border: none; color: var(--color-danger); cursor: pointer; }

.total-summary-row {
    font-size: 1.1em;
    font-weight: bold;
    text-align: right;
    margin-top: 10px;
}
.slip-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
}
.btn-block {
    width: 100%;
    padding: 12px;
}
.btn-submit-slip {
    background-color: var(--color-success);
    font-size: 1.2em;
    font-weight: bold;
    width: 100%;
    padding: 15px;
}
.btn-submit-slip:hover {
    background-color: #388E3C;
}

/* --- 3.2 Right Panel (Input & Keypad) --- */
.bet-input-panel {
    flex-grow: 1;
    background-color: var(--color-secondary);
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.3);
}

/* Tab Menu ด้านบน */
.bet-mode-tabs {
    display: flex;
    margin-bottom: 25px;
    border-radius: 8px;
    overflow: hidden;
}
.bet-mode-tabs .tab-btn {
    flex: 1;
    padding: 12px 15px;
    background-color: #3d3d3d;
    color: var(--color-text-light);
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
    font-weight: 500;
}
.bet-mode-tabs .tab-btn.active {
    background-color: var(--color-accent);
    color: var(--color-background);
    font-weight: bold;
    box-shadow: 0 0 10px rgba(255, 235, 59, 0.5);
}

/* Payout Info Bar */
.category-panel-wrapper {
    background-color: #212121;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #444;
}
.current-cat-payout {
    font-size: 0.9em;
    color: var(--color-text-light);
    margin-bottom: 15px;
}
.payout-ratio-display {
    color: var(--color-accent);
    font-weight: bold;
}

/* --- Category Buttons Grid (อัตราจ่าย/ส่วนลด) --- */
.category-buttons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 10px;
    margin-top: 15px;
}

.cat-btn {
    background-color: #333;
    color: var(--color-text-light);
    padding: 10px 5px;
    border: 1px solid var(--color-accent); /* ขอบสีทอง */
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    font-size: 0.85em;
    display: flex;
    flex-direction: column;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
}
.cat-btn:hover {
    background-color: #424242;
    transform: translateY(-2px);
}
.cat-btn.active {
    background-color: var(--color-accent);
    color: var(--color-background);
    font-weight: bold;
}
.cat-max-payout {
    font-size: 0.9em;
    font-weight: bold;
    color: var(--color-accent); 
}
.cat-btn.active .cat-max-payout {
    color: var(--color-primary-dark);
}

/* --- Number Input Area & Keypad --- */
.number-input-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 0;
    background-color: #212121;
    border-radius: 8px;
}

.input-display-area {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
}
.digit-box {
    width: 65px;
    height: 85px;
    background-color: white; /* พื้นหลังสีขาวตามรูป */
    border: 1px solid var(--color-accent);
    border-radius: 8px;
    color: var(--color-background);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2.5em;
    font-weight: bold;
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.3);
}

.keypad-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.keypad-grid {
    display: grid;
    grid-template-columns: repeat(3, 80px);
    gap: 10px;
    margin-bottom: 10px;
}

.keypad-grid button {
    padding: 15px 0;
    background: linear-gradient(180deg, #444 0%, #222 100%);
    color: var(--color-text-light);
    border: 1px solid #333;
    border-radius: 8px;
    font-size: 1.3em;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}
.num-key {
    background: linear-gradient(180deg, #FFEB3B 0%, #FFA500 100%); /* ปุ่มตัวเลขเป็นสีทอง */
    color: var(--color-background); /* ตัวเลขสีดำ */
    font-weight: bold;
}
.key-backspace {
    background-color: #333 !important;
    color: var(--color-text-light) !important;
    font-size: 1em !important;
}
.key-enter {
    background-color: var(--color-primary) !important;
    color: white !important;
    font-size: 1em !important;
}

/* --- Toggle Switch --- */
.toggle-reverse {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}
.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
}
.switch input { 
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: .4s;
}
.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 4px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
}
input:checked + .slider {
  background-color: var(--color-primary);
}
input:checked + .slider:before {
  transform: translateX(26px);
}
.slider.round {
  border-radius: 34px;
}
.slider.round:before {
  border-radius: 50%;
}


/* --- Confirmation Area --- */
.bet-confirmation-area {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 20px;
}
.bet-confirmation-area .form-control {
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #555;
    background-color: #333;
    color: var(--color-text-light);
    flex-grow: 1;
}
.btn-add-slip-large {
    background-color: var(--color-primary);
    color: white;
    padding: 10px 20px;
    font-weight: bold;
    border-radius: 6px;
}
.btn-add-slip-large:hover {
    background-color: var(--color-primary-dark);
}


/* --- Responsive Layout --- */
@media (max-width: 992px) {
    .betting-main-interface {
        flex-direction: column;
    }
    .bet-slip-panel {
        flex: auto;
        order: 2; /* ย้ายบิลไปด้านล่าง */
    }
    .bet-input-panel {
        order: 1;
        padding: 15px;
    }
    .category-buttons-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 576px) {
    .keypad-grid {
        grid-template-columns: repeat(3, 1fr);
        width: 100%;
    }
    .digit-box {
        width: 40px;
        height: 60px;
    }
    .betting-form-container {
        padding: 0 10px;
    }
    .bet-slip-panel {
        margin-top: 15px;
    }
}