/* ----- Reset & Base ----- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    background-color: #f4f7f9;
    color: #343a40;
    display: flex;
    justify-content: center;
    padding: 20px;
    min-height: 100vh;
}

/* ----- Container ----- */
.container {
    background-color: #ffffff;
    padding: 30px 40px;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
    width: 100%;
    max-width: 900px;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* ----- Header ----- */
.header {
    text-align: center;
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 20px;
}

.header h1 {
    color: #0056b3;
    margin-bottom: 8px;
    font-size: 2em;
}

#progress {
    color: #6c757d;
    font-size: 0.95em;
}

/* ----- Main Content (Câu hỏi & Nhập liệu) ----- */
.main-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.sentence-feedback {
    font-size: 1.2em;
    font-weight: 500;
    text-align: center;
    min-height: 30px;
    padding: 10px;
    border-radius: 6px;
    width: 100%;
}

.input-area {
    width: 100%;
}

.sentence-input-box {
    width: 100%;
    padding: 12px 15px;
    font-size: 1.1em;
    border: 1px solid #ced4da;
    border-radius: 6px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.sentence-input-box:focus {
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.sentence-input-box:disabled {
    background-color: #e9ecef;
    cursor: not-allowed;
}

/* ----- Controls ----- */
.controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 10px;
}

.controls button {
    background-color: #007bff;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 500;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.controls button:hover:not(:disabled) {
    background-color: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.controls button:disabled {
    background-color: #adb5bd;
    cursor: not-allowed;
    opacity: 0.7;
}

/* ----- Quick Stats ----- */
.quick-stats {
    text-align: center;
    margin-top: 15px;
    font-size: 1em;
    color: #495057;
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.quick-stats span {
    font-weight: 500;
}

#correctCount, #totalCount {
    font-weight: 700;
    color: #343a40;
}

#correctPercentage {
    font-weight: 700;
    color: #28a745;
}

#result {
    font-weight: bold;
}

/* ----- Statistics Section ----- */
.statistics-section {
    margin-top: 20px;
    border-top: 1px solid #e9ecef;
    padding-top: 30px;
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.statistics-section h2,
.statistics-section h3 {
    text-align: center;
    color: #0056b3;
    margin-bottom: 15px;
}

.statistics-section h3 {
    font-size: 1.2em;
    color: #495057;
}

.average-scores {
    display: flex;
    justify-content: space-around;
    background-color: #e9f5ff;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.average-scores span {
    font-weight: 600;
    color: #0056b3;
    font-size: 1em;
}

/* ----- Charts ----- */
.chart-container {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

#chart, #spiderChart {
    max-width: 100%;
    background-color: #fff;
    border-radius: 6px;
    padding: 10px;
}

/* ----- Tables ----- */
.table-wrapper {
    overflow-x: auto;
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95em;
}

th, td {
    padding: 12px 15px;
    text-align: center;
    border-bottom: 1px solid #dee2e6;
    white-space: nowrap;
}

thead th {
    background-color: #e9ecef;
    color: #495057;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

tbody tr:hover {
    background-color: #e9f5ff;
}

#history-list table td:nth-child(2),
#history-list table td:nth-child(3) {
    text-align: left;
    white-space: normal;
    word-break: break-word;
}

/* ----- Responsive ----- */
@media (max-width: 768px) {
    .container {
        padding: 20px;
    }
    .header h1 {
        font-size: 1.8em;
    }
    .controls button {
        padding: 8px 15px;
        font-size: 0.9em;
    }
    .average-scores span {
        font-size: 0.9em;
    }
    th, td {
        padding: 8px 10px;
        font-size: 0.9em;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    .container {
        padding: 15px;
    }
    .header h1 {
        font-size: 1.5em;
    }
    .controls {
        flex-direction: column;
        gap: 10px;
    }
    .controls button {
       width: 100%;
    }
    .average-scores {
        flex-direction: column;
        gap: 5px;
        align-items: center;
    }
    .quick-stats {
        flex-direction: column;
        gap: 5px;
    }
}
/* --- Backup & Restore Section --- */
.backup-restore {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #dee2e6;
}

.backup-restore h3 {
    margin-bottom: 1rem;
}

.backup-restore button,
.restore-label {
    display: inline-block;
    margin-right: 1rem;
    margin-bottom: 0.5rem;
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid #007bff;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
    background-color: #fff;
    color: #007bff;
    text-align: center;
}

.backup-restore button:hover,
.restore-label:hover {
    background-color: #e7f3ff;
}

.backup-restore .restore-label {
    background-color: #28a745;
    border-color: #28a745;
    color: white;
}
.backup-restore .restore-label:hover {
     background-color: #218838;
     border-color: #1e7e34;
}

.backup-restore .note {
    font-size: 0.85rem;
    color: #6c757d;
    margin-top: 0.5rem;
}
.logo-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding-top: 20px;
}

.logo {
    max-width: 150px; /* KĂ­ch thÆ°á»›c gá»‘c */
    height: auto;
    display: block;
}