/* --- Reset & Global Styles --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
body {
    font-family: Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.5;
}

/* --- Header & Top Bar --- */
header {
    background-color: #fff;
    border-bottom: 2px solid #8b0000;
}
.header-top {
    max-width: 1250px;
    margin: 0 auto;
    padding: 15px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.logo-title {
    font-size: 24px;
    font-weight: bold;
    color: #8b0000;
}
.nav-bar {
    background-color: #8b0000;
    color: #fff;
    font-size: 13px;
    padding: 8px 0;
    text-align: center;
}
.nav-bar a {
    color: #fff;
    text-decoration: none;
    margin: 0 8px;
    font-weight: bold;
}

/* --- Main Layout (3 Columns) --- */
.wrapper {
    max-width: 1250px; /* ขยายความกว้างรวมเพื่อรองรับรูปแบนเนอร์ซ้าย-ขวา */
    margin: 15px auto;
    display: flex;
    gap: 12px;
    padding: 0 10px;
}

/* Sidebar Styles (ปรับขนาดแถบซ้าย-ขวาให้พอดีรูป) */
.sidebar {
    width: 260px; /* ขยายจาก 200px เป็น 260px เพื่อไม่ให้รูปโดนตัดขอบ */
    flex-shrink: 0;
}
.sidebar-box {
    background: #fff;
    border: 1px solid #ccc;
    margin-bottom: 15px;
    padding: 8px 5px; /* ปรับลดระยะขอบในเพื่อให้รูปภาพแสดงผลเต็มพื้นที่ */
    text-align: center;
    overflow: hidden;
}

/* จัดขนาดรูปภาพ/แบนเนอร์ใน Sidebar ทุกตัวให้ขยายพอดีกล่อง */
.sidebar-banner {
    width: 100%;
    max-width: 100%;
    height: auto;
    display: block;
    margin: 5px auto;
    border: 0;
}

/* Center Content Area (ส่วนเนื้อหาตรงกลาง) */
.main-content {
    flex-grow: 1;
    background: #fff;
    padding: 15px;
    border: 1px solid #ddd;
    min-width: 0; /* ป้องกันตารางดันขอบ */
}

/* --- Notice Box --- */
.notice-box {
    background-color: #f9f9f9;
    border: 1px dashed #bbb;
    padding: 10px 15px;
    font-size: 13px;
    margin-bottom: 15px;
    border-radius: 4px;
}
.notice-box a {
    color: #0066cc;
}

/* --- Table Styling --- */
.table-title-header {
    background-color: #000;
    color: #fff;
    text-align: center;
    font-weight: bold;
    padding: 8px;
    font-size: 18px;
}

.lottery-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 20px;
    color: #000;
    margin-bottom: 15px;
}
.lottery-table th, 
.lottery-table td {
    border: 1px solid #000000;
    padding: 8px;
    text-align: center;
    background-color: #fff;
    font-weight: bold;
}
.lottery-table th {
    background-color: #f2f2f2;
    color: #333;
}
.lottery-table td {
    width: 100px;
}
.hide-header thead {
    display: none;
}

/* Highlight Results */
#resultDB, #resultG7_1, #resultG7_2, #resultG7_3, #resultG7_4,
#resultDNew, #resultG7_1New, #resultG7_2New, #resultG7_3New, #resultG7_4New {
    color: red;
    font-weight: 900;
    font-size: 32px;
}
#resultG1, #resultG1New {
    color: #000000;
    font-weight: 800;
    font-size: 28px;
}

/* Date Picker Styling */
#datePickerNew {
    padding: 8px;
    font-size: 16px;
    border-radius: 4px;
    border: 1px solid #000;
    background-color: #fff;
    color: #333;
    width: 100%;
    margin-bottom: 10px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

/* Loading Spinner */
.loading, .loading-new {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #ccc;
    border-radius: 50%;
    border-top: 3px solid red;
    animation: spin 1s linear infinite;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Footer Message & Support */
.sub-message {
    text-align: center;
    font-size: 13px;
    margin: 15px 0;
}
.sub-message strong {
    color: red;
    font-size: 16px;
}
.support-section {
    text-align: center;
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}
.phone-number {
    font-size: 36px;
    font-weight: 900;
    color: #0022b3;
    margin: 5px 0;
}

/* Responsive Layout Adjustments */
@media (max-width: 992px) {
    .wrapper {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
    }
}
@media (max-width: 600px) {
    .lottery-table td {
        padding: 4px;
        font-size: 16px;
    }
    #resultDB, #resultDNew { font-size: 24px; }
    #resultG1, #resultG1New { font-size: 22px; }
}