/* ===== WRAPPER ===== */
.qtxs-wrapper {
    max-width: 750px;
    margin: 30px auto;
    font-family: 'Segoe UI', Arial, sans-serif;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
    overflow: hidden;
}

/* ===== HEADER ===== */
.qtxs-header {
    background: linear-gradient(135deg, #d32f2f, #b71c1c);
    padding: 20px 25px 0;
    text-align: center;
}

.qtxs-title {
    color: #FFD700;
    font-size: 26px;
    margin: 0 0 18px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    letter-spacing: 2px;
}

/* ===== TABS ===== */
.qtxs-tabs {
    display: flex;
    gap: 4px;
}

.qtxs-tab {
    flex: 1;
    padding: 12px 16px;
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: none;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 10px 10px 0 0;
    transition: all 0.3s ease;
}

.qtxs-tab:hover {
    background: rgba(255,255,255,0.3);
}

.qtxs-tab.active {
    background: #fff;
    color: #d32f2f;
}

/* ===== BẢNG KẾT QUẢ ===== */
.qtxs-result-table {
    padding: 10px 20px;
}

.qtxs-result-table table {
    width: 100%;
    border-collapse: collapse;
}

.qtxs-row {
    border-bottom: 1px solid #eee;
    transition: background 0.3s;
}

.qtxs-row:hover {
    background: #FFF8E1;
}

.qtxs-row.giai_db {
    background: linear-gradient(90deg, #FFF9C4, #FFF176, #FFF9C4);
}

.qtxs-prize-name {
    width: 110px;
    padding: 12px 10px;
    font-weight: 700;
    color: #d32f2f;
    font-size: 14px;
    text-align: center;
    vertical-align: middle;
    border-right: 2px solid #eee;
    white-space: nowrap;
}

.qtxs-numbers {
    padding: 12px 15px;
    text-align: center;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    align-items: center;
}

/* ===== SỐ ===== */
.qtxs-number {
    display: inline-block;
    font-size: 20px;
    font-weight: 700;
    color: #333;
    font-family: 'Courier New', monospace;
    letter-spacing: 3px;
    padding: 4px 10px;
    border-radius: 6px;
    background: #f5f5f5;
    min-width: 60px;
    transition: all 0.3s;
}

.qtxs-number.qtxs-db {
    font-size: 32px;
    color: #d32f2f;
    background: transparent;
    letter-spacing: 6px;
    font-weight: 900;
}

/* Hiệu ứng quay số */
.qtxs-number.rolling {
    animation: qtxs-roll 0.1s infinite;
    color: #999;
    background: #e8e8e8;
}

.qtxs-number.revealed {
    animation: qtxs-reveal 0.5s ease-out;
    color: #333;
}

.qtxs-number.qtxs-db.revealed {
    color: #d32f2f;
    text-shadow: 0 0 10px rgba(211, 47, 47, 0.3);
}

@keyframes qtxs-roll {
    0%   { opacity: 0.6; transform: translateY(-2px); }
    50%  { opacity: 1;   transform: translateY(2px); }
    100% { opacity: 0.6; transform: translateY(-2px); }
}

@keyframes qtxs-reveal {
    0%   { transform: scale(1.4); opacity: 0; }
    50%  { transform: scale(0.9); }
    100% { transform: scale(1);   opacity: 1; }
}

@keyframes qtxs-glow {
    0%, 100% { box-shadow: 0 0 5px rgba(211,47,47,0.3); }
    50%      { box-shadow: 0 0 20px rgba(211,47,47,0.6); }
}

/* ===== NÚT BẤM ===== */
.qtxs-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    padding: 20px;
    background: #fafafa;
    border-top: 1px solid #eee;
}

.qtxs-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 32px;
    border: none;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.qtxs-btn-quay {
    background: linear-gradient(135deg, #d32f2f, #f44336);
    color: #fff;
    box-shadow: 0 4px 15px rgba(211, 47, 47, 0.4);
}

.qtxs-btn-quay:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(211, 47, 47, 0.5);
}

.qtxs-btn-quay:active {
    transform: translateY(0);
}

.qtxs-btn-quay.spinning {
    pointer-events: none;
    opacity: 0.7;
}

.qtxs-btn-quay.spinning .qtxs-btn-icon {
    animation: qtxs-spin 0.5s linear infinite;
}

@keyframes qtxs-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.qtxs-btn-reset {
    background: linear-gradient(135deg, #757575, #616161);
    color: #fff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.qtxs-btn-reset:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.3);
}

.qtxs-btn-icon {
    font-size: 20px;
}

/* ========================================
   BẢNG ĐẦU ĐUÔI
   ======================================== */
.qtxs-dau-duoi-section {
    border-top: 3px solid #d32f2f;
    padding: 0;
    background: #fafafa;
}

.qtxs-dd-header {
    background: linear-gradient(135deg, #1565C0, #0D47A1);
    padding: 14px 20px;
    text-align: center;
}

.qtxs-dd-header h3 {
    margin: 0;
    color: #FFD700;
    font-size: 18px;
    letter-spacing: 2px;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.3);
}

.qtxs-dd-container {
    display: flex;
    gap: 0;
    padding: 0;
}

.qtxs-dd-table-wrap {
    flex: 1;
    overflow: hidden;
}

.qtxs-dd-table-wrap:first-child {
    border-right: 2px solid #ddd;
}

/* Bảng Đầu Đuôi */
.qtxs-dd-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.qtxs-dd-table thead tr {
    background: linear-gradient(135deg, #E53935, #C62828);
}

.qtxs-dd-table thead th {
    padding: 10px 12px;
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.qtxs-dd-table thead th.qtxs-dd-values {
    text-align: left;
    padding-left: 15px;
}

.qtxs-dd-table tbody tr {
    border-bottom: 1px solid #e0e0e0;
    transition: background 0.2s;
}

.qtxs-dd-table tbody tr:nth-child(even) {
    background: #f5f5f5;
}

.qtxs-dd-table tbody tr:hover {
    background: #FFF8E1;
}

.qtxs-dd-table td {
    padding: 9px 12px;
    vertical-align: middle;
}

td.qtxs-dd-label {
    width: 50px;
    text-align: center;
    font-weight: 800;
    font-size: 18px;
    color: #d32f2f;
    background: rgba(211,47,47,0.05);
    border-right: 2px solid #e0e0e0;
}

th.qtxs-dd-label {
    width: 50px;
}

td.qtxs-dd-values {
    text-align: left;
    padding-left: 15px;
    font-family: 'Courier New', monospace;
    font-weight: 700;
    font-size: 15px;
    color: #333;
    letter-spacing: 1px;
    line-height: 1.8;
}

/* Số loto trong bảng đầu đuôi */
.qtxs-dd-num {
    display: inline-block;
    background: linear-gradient(135deg, #fff, #f0f0f0);
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 2px 8px;
    margin: 2px 3px;
    font-size: 14px;
    font-weight: 700;
    color: #1565C0;
    transition: all 0.3s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.qtxs-dd-num:hover {
    background: #FFD700;
    color: #d32f2f;
    transform: scale(1.1);
    box-shadow: 0 3px 8px rgba(0,0,0,0.15);
}

/* Highlight hàng có nhiều số */
.qtxs-dd-hot td.qtxs-dd-values {
    background: rgba(255, 235, 59, 0.15);
}

.qtxs-dd-hot td.qtxs-dd-label {
    background: rgba(211, 47, 47, 0.12);
    position: relative;
}

.qtxs-dd-hot td.qtxs-dd-label::after {
    content: '🔥';
    position: absolute;
    top: -2px;
    right: -2px;
    font-size: 12px;
}

/* Trống */
.qtxs-dd-empty {
    color: #bbb;
    font-style: italic;
    font-weight: 400;
    font-size: 13px;
}

/* Hiệu ứng xuất hiện bảng đầu đuôi */
.qtxs-dau-duoi-section.qtxs-dd-show {
    display: block !important;
    animation: qtxs-dd-fadein 0.6s ease-out;
}

@keyframes qtxs-dd-fadein {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Hiệu ứng số xuất hiện trong bảng đầu đuôi */
@keyframes qtxs-dd-num-pop {
    0%   { transform: scale(0); opacity: 0; }
    60%  { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

.qtxs-dd-num.qtxs-dd-animate {
    animation: qtxs-dd-num-pop 0.4s ease-out forwards;
}

/* ===== LỊCH SỬ ===== */
.qtxs-history {
    padding: 20px;
    border-top: 2px solid #eee;
}

.qtxs-history h3 {
    margin: 0 0 15px;
    color: #333;
    font-size: 18px;
}

.qtxs-history-item {
    background: #f9f9f9;
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 10px;
    border-left: 4px solid #d32f2f;
}

.qtxs-history-item .time {
    font-size: 12px;
    color: #999;
    margin-bottom: 5px;
}

.qtxs-history-item .prize-name {
    font-weight: 700;
    color: #d32f2f;
    font-size: 13px;
}

.qtxs-history-item .prize-numbers {
    font-family: 'Courier New', monospace;
    font-weight: 700;
    font-size: 16px;
    color: #333;
    letter-spacing: 2px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
    .qtxs-wrapper {
        margin: 15px 10px;
        border-radius: 12px;
    }

    .qtxs-title {
        font-size: 20px;
    }

    .qtxs-tab {
        font-size: 13px;
        padding: 10px 8px;
    }

    .qtxs-prize-name {
        width: 70px;
        font-size: 12px;
        padding: 8px 5px;
    }

    .qtxs-number {
        font-size: 16px;
        letter-spacing: 1px;
        padding: 3px 6px;
        min-width: 40px;
    }

    .qtxs-number.qtxs-db {
        font-size: 24px;
        letter-spacing: 3px;
    }

    .qtxs-numbers {
        gap: 4px;
        padding: 8px 5px;
    }

    .qtxs-btn {
        padding: 12px 20px;
        font-size: 14px;
    }

    .qtxs-controls {
        gap: 10px;
        padding: 15px;
    }

    /* Đầu đuôi responsive */
    .qtxs-dd-container {
        flex-direction: column;
    }

    .qtxs-dd-table-wrap:first-child {
        border-right: none;
        border-bottom: 2px solid #ddd;
    }

    .qtxs-dd-num {
        font-size: 13px;
        padding: 2px 6px;
    }

    td.qtxs-dd-label {
        width: 40px;
        font-size: 16px;
    }

    td.qtxs-dd-values {
        font-size: 13px;
        padding-left: 10px;
    }
}
