/* KQXS Lottery Results Styles - Complete Version */

/* Reset Box Model */
* {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}

/* Basic Table Styles */
.tbldata {
    background: #FFFFFF;
    border-right: 1px solid #cccccc;
    border-top: 1px solid #dedede;
    width: 100%;
    border-collapse: collapse;
}

.tbldata th {
    background-color: #e6e6e6;
    border-left: 1px solid #cccccc;
    color: #000000;
    font-weight: bold;
    padding: 8px;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid #dedede;
}

.tbldata tbody tr:hover {
    background: #ffffcf;
}

.tbldata tr td {
    border-left: 1px solid #cccccc;
    color: #000000;
    padding: 8px;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid #cccccc;
}

/* Table Result Lottery Specific */
.table-result-lottery {
    border-right: none;
    width: 100%;
    background: #fff;
}

.table-result-lottery h2 {
    display: inline-block;
    font-size: 20px;
}

.table-result-lottery tr.prize-pool td {
    padding: 5px !important;
}

.table-result-lottery td.prize {
    width: 70px;
    background-color: #f9f9f9;
    font-weight: bold;
}

.table-result-lottery td {
    text-align: center !important;
    padding: 0px !important;
    border: 1px solid #cccccc;
}

/* Number Display with Grid */
.table-result-lottery td.results span {
    display: inline-block;
    padding-top: 6px;
    padding-bottom: 6px;
    border-right: 1px solid #cccccc;
    font-size: 22px;
    font-weight: bold;
}

.table-result-lottery td.results span:last-child {
    border-right: none;
}

/* Special Prize Colors */
.table-result-lottery td.results span[data-prize="1"],
.table-result-lottery td.results span[data-prize="9"],
.table-result-lottery td.results span.special-prize {
    color: #c63c2c;
}

.table-result-lottery td.results span.wrap-text {
    white-space: initial;
}

.table-result-lottery td.results span.header {
    padding: 10px 6px;
    font-size: 15px;
    color: #FFFFFF;
    background-color: #6F7677;
}

/* Grid Layout for Numbers */
.table-result-lottery td.results .quantity-of-number {
    display: grid;
}

.table-result-lottery td.results .quantity-of-number[data-quantity="1"] {
    grid-template-columns: minmax(0, 1fr);
}

.table-result-lottery td.results .quantity-of-number[data-quantity="2"] {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.table-result-lottery td.results .quantity-of-number[data-quantity="3"] {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
}

.table-result-lottery td.results .quantity-of-number[data-quantity="4"] {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
}

.table-result-lottery td.results .quantity-of-number[data-quantity="6"] {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
}

.table-result-lottery td.results .quantity-of-number[data-quantity="7"] {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
}

.table-result-lottery td.results .quantity-of-number[data-quantity="8"] {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
}

.table-result-lottery td.results .quantity-of-number[data-quantity="9"] {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
}

.table-result-lottery td.results .quantity-of-number.specs[data-quantity="4"] {
    grid-template-columns: minmax(0, 1fr) minmax(0, 2.5fr) minmax(0, 1fr) minmax(0, 2.5fr);
}

/* Number Display Style */
.table-result-lottery .number {
    display: inline-block;
    padding: 3px 8px;
    margin: 2px;
    font-weight: bold;
    font-size: 18px;
}

.table-result-lottery .number.special-prize {
    background-color: #ffeb3b;
    color: #d32f2f;
}

/* Block Lottery Today */
.block-lottery-today {
    background: #fff;
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.block-lottery-today .caption {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    margin-bottom: 15px;
    text-align: center;
    background: #de4245;
    color: #fff;
    padding: 10px;
    border-radius: 3px;
}

.block-lottery-today .tbldata {
    width: 100%;
}

.block-lottery-today .tr-header td {
    background: #f5f5f5;
    font-weight: bold;
    padding: 10px;
    border: 1px solid #ddd;
}

.block-lottery-today td {
    padding: 10px;
    border: 1px solid #ddd;
    vertical-align: top;
}

.block-lottery-today a {
    display: block;
    padding: 5px;
    color: #1967d2;
    text-decoration: none;
}

.block-lottery-today a:hover {
    color: #de4245;
    text-decoration: underline;
}

/* Tabs */
.tabs {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
}

.tabs li {
    padding: 10px 20px;
    background-color: #6F7677;
    color: #FFFFFF;
    cursor: pointer;
    border-radius: 5px 5px 0 0;
    margin-right: 2px;
}

.tabs li.active {
    background-color: #FFFFFF;
    color: #000000;
    border: 1px solid #ddd;
    border-bottom: none;
}

.tabs-contents {
    background-color: #FFFFFF;
    border: 1px solid #ddd;
    border-top: none;
    padding: 15px;
}

.tabs-contents > div {
    display: none;
}

.tabs-contents > div.active {
    display: block;
}

/* Display Control */
.result-display-control {
    padding: 10px;
    background: #f5f5f5;
    margin-bottom: 10px;
    border-radius: 5px;
}

.digits-form {
    display: flex;
    gap: 20px;
    align-items: center;
}

.digits-form label.radio {
    position: relative;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
}

.digits-form input[type="radio"] {
    margin-right: 5px;
}

.digits-form .label-text {
    font-weight: normal;
}

/* Real-time Update Indicators */
.table-result-lottery-wrapper {
    position: relative;
    transition: opacity 0.3s ease;
}

.table-result-lottery-wrapper.updating {
    opacity: 0.6;
}

.table-result-lottery-wrapper.updating::before {
    content: "Đang cập nhật...";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255,255,255,0.95);
    padding: 10px 20px;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    z-index: 10;
    font-weight: bold;
    color: #e74c3c;
}

.update-time {
    text-align: right;
    font-size: 12px;
    color: #666;
    margin-top: 5px;
    font-style: italic;
}

.live-indicator {
    display: inline-block;
    background: #e74c3c;
    color: white;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: bold;
    animation: pulse 2s infinite;
    margin-left: 10px;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* Wrapper Classes */
.kqxs-wrapper {
    margin-bottom: 30px;
}

.kqxs-mienbac-wrapper,
.kqxs-mientrung-wrapper,
.kqxs-miennam-wrapper {
    padding: 15px;
    background: #fff;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* Responsive Design */
@media (max-width: 991px) {
    .table-result-lottery td.results span {
        font-size: 18px;
        padding-top: 5px;
        padding-bottom: 5px;
    }
    
    .table-result-lottery td.results span[data-prize="1"],
    .table-result-lottery td.results span[data-prize="9"] {
        font-size: 20px;
    }
    
    .table-result-lottery td.results span.wrap-text {
        font-size: 15px;
    }
    
    .table-result-lottery h2 {
        font-size: 16px;
    }
    
    .table-result-lottery tr.prize-pool td {
        padding: 3px 4px !important;
    }
}

@media (max-width: 768px) {
    .table-result-lottery {
        font-size: 14px;
    }
    
    .table-result-lottery td.prize {
        width: 60px;
        font-size: 12px;
    }
    
    .table-result-lottery td.results span {
        font-size: 14px;
        padding: 2px 4px;
    }
    
    .tabs {
        flex-wrap: wrap;
    }
    
    .tabs li {
        padding: 8px 15px;
        font-size: 14px;
    }
    
    .block-lottery-today a {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .digits-form {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .table-result-lottery td.results span {
        font-size: 12px;
        padding: 2px;
        margin: 1px;
    }
}