/* === Quay Thu Xo So Plugin === */

#qtxs-wrapper {
    max-width: 1100px;
    margin: 0 auto;
    padding: 15px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* --- Tabs --- */
.qtxs-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 0;
    border-radius: 8px 8px 0 0;
    overflow: hidden;
    background: #2c3e50;
}

.qtxs-tab {
    flex: 1;
    padding: 12px 20px;
    border: none;
    background: #34495e;
    color: #ccc;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
}

.qtxs-tab:hover {
    background: #3d566e;
    color: #fff;
}

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

.qtxs-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 3px;
    background: #fff;
    border-radius: 3px 3px 0 0;
}

/* --- Title --- */
.qtxs-title {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: #fff;
    margin: 0;
    padding: 14px 20px;
    font-size: 18px;
    font-weight: 700;
    text-align: center;
}

.qtxs-title i {
    margin-right: 8px;
    color: #e74c3c;
}

/* --- Province Select --- */
.qtxs-province-select {
    background: #f5f5f5;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid #e0e0e0;
}

.qtxs-province-select label {
    font-weight: 600;
    color: #2c3e50;
    white-space: nowrap;
    margin: 0;
}

.qtxs-province-select select {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
    color: #333;
    max-width: 300px;
}

/* --- Main Content --- */
.qtxs-main-content {
    display: flex;
    gap: 20px;
    margin-top: 20px;
}

/* --- Frames --- */
.qtxs-frame {
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.qtxs-result-frame {
    flex: 1.2;
    min-width: 0;
}

.qtxs-stats-frame {
    flex: 1;
    min-width: 0;
}

.qtxs-frame-header {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: #fff;
    padding: 10px 16px;
    font-size: 15px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* --- Result Table --- */
.qtxs-table {
    width: 100%;
    border-collapse: collapse;
}

.qtxs-table thead th {
    background: #2c3e50;
    color: #fff;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
}

.qtxs-table thead th.qtxs-prize-label {
    width: 60px;
    text-align: center;
}

.qtxs-table tbody td {
    padding: 8px 10px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}

.qtxs-table tbody td.qtxs-prize-label {
    background: #f5f5f5;
    font-weight: 700;
    color: #2c3e50;
    text-align: center;
    width: 60px;
    font-size: 13px;
}

.qtxs-table tbody td.qtxs-numbers {
    text-align: center;
    min-height: 36px;
}

.qtxs-row-db td.qtxs-prize-label {
    background: #e74c3c;
    color: #fff;
    font-size: 14px;
}

.qtxs-row-db td.qtxs-numbers {
    background: #ffeaea;
}

/* --- Number Spans --- */
.qtxs-num-group {
    display: inline-block;
    margin: 2px 6px;
}

.qtxs-digit {
    display: inline-block;
    width: 26px;
    height: 34px;
    line-height: 34px;
    text-align: center;
    font-family: 'Courier New', 'Lucida Console', monospace;
    font-size: 18px;
    font-weight: 700;
    color: #2c3e50;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin: 0 1px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.qtxs-digit.spinning {
    color: #e74c3c;
    border-color: #e74c3c;
    background: #ffeaea;
    animation: qtxs-glow 0.15s ease-in-out infinite alternate;
}

.qtxs-digit.revealed {
    color: #e74c3c;
    border-color: #e74c3c;
    background: #ffeaea;
    animation: qtxs-pop 0.3s ease-out;
}

.qtxs-row-db .qtxs-digit {
    width: 30px;
    height: 38px;
    line-height: 38px;
    font-size: 22px;
}

.qtxs-row-db .qtxs-digit.revealed {
    color: #fff;
    background: #e74c3c;
    border-color: #e74c3c;
    font-weight: 900;
}

@keyframes qtxs-glow {
    from { box-shadow: 0 0 4px rgba(231,76,60,0.3); }
    to { box-shadow: 0 0 12px rgba(231,76,60,0.6); }
}

@keyframes qtxs-pop {
    0% { transform: scale(1.3); }
    50% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

/* --- Spin Button --- */
.qtxs-btn-wrapper {
    padding: 16px;
    text-align: center;
}

.qtxs-btn-top {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    padding: 18px 20px;
    border-radius: 0 0 8px 8px;
    margin-bottom: 20px;
}

.qtxs-btn-spin {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 36px;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 4px 12px rgba(231,76,60,0.35);
}

.qtxs-btn-spin:hover {
    background: linear-gradient(135deg, #c0392b, #a93226);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(231,76,60,0.45);
}

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

.qtxs-btn-spin:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.qtxs-btn-spin.spinning i {
    animation: qtxs-rotate 0.6s linear infinite;
}

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

/* --- Stats Frame --- */
.qtxs-stats-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.qtxs-stat-box {
    border-bottom: 1px solid #f0f0f0;
}

.qtxs-stat-box:last-child {
    border-bottom: none;
}

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

.qtxs-stat-table thead th {
    background: #2c3e50;
    color: #fff;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 600;
}

.qtxs-stat-table tbody td {
    padding: 6px 10px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
}

.qtxs-dau-num {
    background: #f5f5f5;
    font-weight: 700;
    color: #2c3e50;
    text-align: center;
    width: 45px;
}

.qtxs-dau-val {
    color: #e74c3c;
    font-weight: 600;
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
}

/* --- Probability Bars --- */
.qtxs-stat-sub-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}

.qtxs-stat-sub-grid > div {
    padding: 10px 14px;
}

.qtxs-stat-sub-grid > div:first-child {
    border-right: 1px solid #f0f0f0;
}

.qtxs-stat-sub-title {
    font-size: 13px;
    font-weight: 700;
    color: #2c3e50;
    margin: 0 0 8px 0;
    text-align: center;
}

.qtxs-prob-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.qtxs-prob-list li {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 0;
    font-size: 12px;
}

.qtxs-prob-label {
    width: 48px;
    font-weight: 600;
    color: #666;
    white-space: nowrap;
    flex-shrink: 0;
}

.qtxs-prob-bar {
    flex: 1;
    height: 14px;
    background: #f0f0f0;
    border-radius: 7px;
    overflow: hidden;
    position: relative;
}

.qtxs-prob-fill {
    display: block;
    height: 100%;
    border-radius: 7px;
    background: linear-gradient(90deg, #e74c3c, #e95e4f);
    transition: width 0.6s ease-out;
    min-width: 0;
}

.qtxs-prob-value {
    width: 40px;
    text-align: right;
    font-weight: 700;
    color: #2c3e50;
    flex-shrink: 0;
    font-size: 11px;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .qtxs-main-content {
        flex-direction: column;
    }

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

    .qtxs-title {
        font-size: 15px;
        padding: 12px 14px;
    }

    .qtxs-digit {
        width: 22px;
        height: 28px;
        line-height: 28px;
        font-size: 14px;
    }

    .qtxs-row-db .qtxs-digit {
        width: 26px;
        height: 32px;
        line-height: 32px;
        font-size: 18px;
    }

    .qtxs-num-group {
        margin: 2px 3px;
    }

    .qtxs-stat-sub-grid {
        grid-template-columns: 1fr;
    }

    .qtxs-stat-sub-grid > div:first-child {
        border-right: none;
        border-bottom: 1px solid #f0f0f0;
    }

    .qtxs-province-select {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .qtxs-province-select select {
        max-width: 100%;
        width: 100%;
    }
}

@media (max-width: 480px) {
    #qtxs-wrapper {
        padding: 8px;
    }

    .qtxs-digit {
        width: 18px;
        height: 24px;
        line-height: 24px;
        font-size: 12px;
        margin: 0;
    }

    .qtxs-row-db .qtxs-digit {
        width: 22px;
        height: 28px;
        line-height: 28px;
        font-size: 15px;
    }

    .qtxs-num-group {
        margin: 1px 2px;
    }

    .qtxs-btn-spin {
        padding: 10px 24px;
        font-size: 14px;
    }

    .qtxs-prob-list li {
        font-size: 11px;
    }

    .qtxs-prob-label {
        width: 42px;
    }
}
