* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: #fffafa;
    color: #171717;
    font-family: "Noto Sans Lao", "Phetsarath OT", Arial, sans-serif;
    font-size: 14px;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    display: block;
    max-width: 100%;
}

button, input { font-family: inherit; }

.site-container {
    width: 1160px;
    max-width: calc(100% - 30px);
    margin-left: auto;
    margin-right: auto;
}

.top-area {
    padding: 10px 0 8px;
    background: #670000;
}

.main-banner { overflow: hidden; }

.main-banner img {
    width: 100%;
    height: auto;
}

.main-nav {
    margin-top: 19px;
    background: rgba(20, 0, 0, 0.85);
}

.nav-links {
    min-height: 54px;
    display: flex;
    align-items: stretch;
    justify-content: space-around;
}

.nav-links a {
    min-height: 54px;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.nav-links a:hover { background: rgba(255, 255, 255, 0.08); }

.mobile-menu-btn {
    display: none;
    width: 100%;
    height: 52px;
    padding: 0 15px;
    border: 0;
    background: #250000;
    color: white;
    text-align: left;
    font-size: 15px;
    cursor: pointer;
}

.main-layout {
    display: grid;
    grid-template-columns: 280px minmax(0, 470px) 260px;
    justify-content: space-between;
    align-items: start;
    gap: 25px;
    padding: 30px 10px 45px;
}

.left-sidebar, .center-column, .right-sidebar { min-width: 0; }

.left-logo-ad {
    padding-top: 10px;
    text-align: center;
}

.left-logo-ad img {
    width: 100%;
    height: auto;
    object-fit: contain;
}

.custom-container {
    width: 100%;
    overflow: hidden;
    border-radius: 24px;
    background: #ffffff;
    box-shadow: 0 4px 20px rgba(145, 0, 0, 0.05);
}

.custom-header {
    min-height: 105px;
    padding: 18px 22px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-bottom: 4px solid #f37b19;
    background: linear-gradient(90deg, #ad0618, #5d0015);
    color: white;
}

.custom-flag-wrapper {
    width: 50px;
    flex-shrink: 0;
}

.custom-flag {
    width: 48px;
    height: 48px;
    display: block;
}

.custom-title-block {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.custom-title-block strong {
    font-size: 17px;
    line-height: 1.35;
}

.custom-title-block span {
    color: #eee;
    font-size: 11px;
}

.custom-body { padding: 22px 23px 28px; }

.custom-section-title {
    margin-bottom: 18px;
    color: #cf5037;
    text-align: center;
    font-size: 12px;
    font-weight: 700;
}

.custom-numbers {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-bottom: 25px;
}

.custom-numbers > div {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #ff7c2b;
    border-radius: 50%;
    background: #fff;
    color: #a60a14;
    font-size: 24px;
    font-weight: 700;
    box-shadow: 0 3px 10px rgba(255, 102, 0, 0.12);
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    overflow: hidden;
    border-radius: 5px;
}

.custom-table thead th {
    height: 49px;
    padding: 10px 14px;
    background: #580015;
    color: white;
    font-size: 11px;
}

.custom-table thead th:first-child {
    text-align: left;
    padding-left: 20px;
}

.custom-table thead th:last-child {
    text-align: right;
    padding-right: 20px;
}

.custom-table tbody td {
    height: 57px;
    padding: 8px 20px;
    border-bottom: 1px solid #eceef1;
    color: #172238;
    font-size: 12px;
    font-weight: 600;
}

.custom-table tbody td:first-child {
    color: #627087;
    text-align: left;
}

.custom-table tbody td:last-child {
    text-align: right;
    font-weight: 700;
}

.custom-table tbody tr:last-child td { border-bottom: 0; }

.highlight-prize { font-size: 15px !important; }

.check-card {
    padding: 17px 18px 19px;
    border: 1px solid #cc6900;
    border-radius: 7px;
    background: white;
    text-align: center;
}

.check-card h2 {
    margin: 0 0 16px;
    color: #222;
    font-size: 20px;
    line-height: 1.35;
    font-weight: 500;
}

.check-card p {
    margin: 0 0 4px;
    color: #777;
    font-size: 11px;
}

.check-date {
    margin-bottom: 13px;
    color: #777;
    font-size: 12px;
}

.check-card input {
    width: 100%;
    height: 37px;
    margin-bottom: 12px;
    padding: 0 10px;
    border: 1px solid #520000;
    outline: none;
}

.check-card button {
    width: 100%;
    min-height: 42px;
    border: 0;
    border-radius: 3px;
    background: linear-gradient(#7a0000, #a60000);
    color: white;
    cursor: pointer;
}

.check-message {
    margin-top: 10px;
    font-size: 11px;
    font-weight: 700;
}

.check-message.success { color: green; }

.check-message.error { color: red; }

.right-ad { margin-top: 20px; }

.right-ad img {
    width: 100%;
    height: auto;
}

.products-section {
    margin-bottom: 20px;
    padding: 16px 18px 19px;
    border: 1px solid #b3b3b3;
    border-radius: 8px;
    background: #efefef;
    box-shadow: 0 0 7px rgba(0, 0, 0, 0.25);
}

.products-header {
    margin-bottom: 17px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.products-header h2 {
    margin: 0;
    font-size: 38px;
    font-weight: 400;
}

.products-header a {
    color: #ff7800;
    font-size: 11px;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
}

.product-card {
    padding: 9px 8px 13px;
    border: 1px solid #bfbfbf;
    border-radius: 7px;
    background: white;
    text-align: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.product-card img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    border-radius: 4px;
}

.product-card h3 {
    margin: 24px 0 8px;
    min-height: 62px;
    color: #222;
    font-family: Arial, sans-serif;
    font-size: 28px;
    line-height: 1.08;
    overflow: hidden;
}

.price {
    margin-bottom: 19px;
    color: #ff2727;
    font-size: 18px;
}

.product-card button {
    min-width: 95px;
    padding: 8px 16px;
    border: 0;
    border-radius: 7px;
    background: #ff880d;
    color: white;
    cursor: pointer;
}

.history-red-bar {
    min-height: 34px;
    margin: 20px 0 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(#180000, #b90000);
    border-radius: 3px;
    color: white;
    font-size: 12px;
    font-weight: 600;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.35);
}

#history-container {
    margin-bottom: 45px;
    padding: 20px 23px 26px;
    border-radius: 18px;
    background: white;
    box-shadow: 0 2px 12px rgba(110, 0, 0, 0.04);
}

.history-title-text {
    margin-bottom: 17px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #600014;
    font-size: 13px;
    font-weight: 700;
}

.history-title-text span {
    width: 3px;
    height: 23px;
    display: block;
    background: #ff6a00;
}

.table-responsive-wrapper {
    width: 100%;
    overflow-x: auto;
    border: 1px solid #f5c2c2;
    border-radius: 10px;
}

#history-table {
    width: 100%;
    min-width: 850px;
    border-collapse: collapse;
    table-layout: fixed;
}

#history-table thead th {
    height: 56px;
    padding: 10px 8px;
    background: linear-gradient(90deg, #6b0017, #8b071d);
    color: white;
    text-align: center;
    font-size: 12px;
    font-weight: 700;
}

#history-table thead th:first-child { border-radius: 8px 0 0 0; }

#history-table thead th:last-child { border-radius: 0 8px 0 0; }

#history-table tbody td {
    height: 56px;
    padding: 9px 7px;
    border-bottom: 1px solid #f1e6e6;
    color: #263247;
    text-align: center;
    font-size: 11px;
}

#history-table tbody tr:nth-child(even) { background: #fffafa; }

#history-table tbody td:first-child {
    color: #620012;
    font-weight: 700;
}

#history-table tbody td:nth-child(2) {
    color: #ef2f2f;
    font-weight: 700;
}

.history-loading {
    min-height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.loader {
    width: 20px;
    height: 20px;
    border: 3px solid #eee;
    border-top-color: #8b0015;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.bottom-banner {
    padding: 9px 0;
    background: #740000;
}

.bottom-banner img {
    width: 100%;
    height: auto;
}

@media (max-width: 1000px) {
    .main-layout {
        grid-template-columns: 220px minmax(0, 1fr) 220px;
        gap: 15px;
    }
    .custom-numbers { gap: 6px; }
    .custom-numbers > div {
        width: 45px;
        height: 45px;
    }
    .products-header h2 { font-size: 30px; }
    .product-card h3 { font-size: 21px; }
}

@media (max-width: 800px) {
    .mobile-menu-btn { display: block; }
    .nav-links {
        display: none;
        flex-direction: column;
    }
    .nav-links.active { display: flex; }
    .nav-links a {
        min-height: 45px;
        justify-content: flex-start;
        border-top: 1px solid rgba(255, 255, 255, 0.08);
    }
    .main-layout {
        grid-template-columns: 1fr 1fr;
        gap: 18px;
    }
    .left-sidebar { display: none; }
    .center-column { min-width: 0; }
    .product-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
    .site-container { max-width: calc(100% - 12px); }
    .main-layout {
        display: block;
        padding: 15px 0 30px;
    }
    .right-sidebar { margin-top: 20px; }
    .custom-container { border-radius: 15px; }
    .custom-header {
        min-height: 85px;
        padding: 13px 14px;
    }
    .custom-flag-wrapper { width: 43px; }
    .custom-flag {
        width: 40px;
        height: 40px;
    }
    .custom-title-block strong { font-size: 14px; }
    .custom-body { padding: 18px 12px; }
    .custom-numbers { gap: 5px; }
    .custom-numbers > div {
        width: 46px;
        height: 46px;
        font-size: 20px;
    }
    .custom-table tbody td { padding: 8px 12px; }
    .right-ad {
        max-width: 320px;
        margin: 20px auto 0;
    }
    .products-header h2 { font-size: 22px; }
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 9px;
    }
    .product-card { padding: 6px; }
    .product-card img { height: 110px; }
    .product-card h3 {
        min-height: 45px;
        margin: 14px 0 6px;
        font-size: 16px;
    }
    .price { font-size: 13px; }
    #history-container { padding: 15px 8px; }
    #history-table { min-width: 750px; }
}