/* Reset CSS */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: linear-gradient(135deg, #1a2a6c, #b21f1f, #fdbb2d);
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
    padding: 10px; /* Giảm padding trên thiết bị di động */
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 10px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    padding: 15px; /* Giảm padding cho màn hình nhỏ */
}

/* Header style */
header {
    background: linear-gradient(to right, #3498db, #2c3e50);
    color: white;
    border-radius: 8px;
    padding: 15px 20px; /* Giảm padding */
    margin-bottom: 20px;
}

.header-content {
    display: flex;
    flex-direction: column; /* Chuyển sang cột trên di động */
    align-items: center;
    gap: 10px;
}

@media (min-width: 768px) {
    .header-content {
        flex-direction: row;
        justify-content: space-between;
    }
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem; /* Giảm kích thước font */
    font-weight: 700;
}

.logo i {
    font-size: 1.8rem; /* Giảm kích thước icon */
}

.nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
}

.nav-links a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    padding: 0.4rem 0.8rem;
    border-radius: 25px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-links a:hover,
.nav-links a.active {
    color: white;
    background: rgba(255, 255, 255, 0.15);
}

.subtitle {
    font-size: 0.95rem; /* Giảm kích thước font */
    opacity: 0.9;
    max-width: 90%;
    margin: 10px auto;
    text-align: center;
}

.api-key-container {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid #e9ecef;
}

.api-key-container h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 0.8rem;
    color: var(--primary-color);
    font-size: 1.2rem; /* Giảm kích thước font */
}

.api-key-input {
    display: flex;
    flex-direction: column; /* Chuyển sang cột trên di động */
    gap: 8px;
    margin-bottom: 8px;
}

@media (min-width: 768px) {
    .api-key-input {
        flex-direction: row;
    }
}

.api-key-input input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 0.9rem; /* Giảm kích thước font */
    transition: border-color 0.3s;
}

.api-key-input input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.api-key-input button {
    background: #3498db;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 10px 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.api-key-input button:hover {
    background: #2980b9;
}

.api-key-container small {
    display: block;
    color: #6c757d;
    margin-top: 5px;
    font-size: 0.85rem;
}

.api-key-container a {
    color: #3498db;
    text-decoration: none;
}

.api-key-container a:hover {
    text-decoration: underline;
}

#toggle-api-settings {
    background: #9b59b6;
    color: white;
}

#toggle-api-settings:hover {
    background: #8e44ad;
}

.error-message {
    color: #e74c3c;
    margin-top: 8px;
    font-weight: 500;
    font-size: 0.85rem;
    display: none;
}

.selection-section {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 25px;
}

@media (min-width: 768px) {
    .selection-section {
        grid-template-columns: 1fr 1fr;
    }
}

.selection-card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
}

.selection-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.selection-card h2 {
    background: #2c3e50;
    color: white;
    padding: 12px 15px;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.level-options, .type-options {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 15px;
}

@media (min-width: 768px) {
    .level-options, .type-options {
        grid-template-columns: 1fr 1fr;
    }
}

.option {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    cursor: pointer;
    transition: all 0.3s;
}

.option:hover {
    background: #e9f7fe;
    border-color: #3498db;
}

.option.selected {
    background: #d1ecf1;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.option-icon {
    width: 40px;
    height: 40px;
    background: #3498db;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.option-details {
    flex: 1;
}

.option-details h3 {
    font-size: 1rem;
    margin-bottom: 4px;
    color: #2c3e50;
}

.option-details p {
    color: #6c757d;
    font-size: 0.85rem;
    margin-bottom: 6px;
}

.time-indicator {
    display: inline-block;
    background: #e8f4fc;
    color: #3498db;
    padding: 2px 6px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 500;
}

.start-btn-container {
    text-align: center;
    margin: 25px 0;
}

.start-btn {
    background: linear-gradient(to right, #27ae60, #2ecc71);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 12px 30px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(46, 204, 113, 0.4);
}

.start-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(46, 204, 113, 0.6);
}

.start-btn:disabled {
    background: #95a5a6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

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

.exercises-section {
    display: none;
    margin-bottom: 25px;
}

.section-title {
    font-size: 1.2rem;
    color: #2c3e50;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid #3498db;
    display: flex;
    align-items: center;
    gap: 8px;
}

.exercises-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

@media (min-width: 768px) {
    .exercises-list {
        grid-template-columns: 1fr 1fr;
    }
}

@media (min-width: 992px) {
    .exercises-list {
        grid-template-columns: 1fr 1fr 1fr;
    }
}

.exercise-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: all 0.3s;
    cursor: pointer;
    border: 2px solid transparent;
}

.exercise-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.exercise-card.selected {
    border-color: #3498db;
    box-shadow: 0 0 12px rgba(52, 152, 219, 0.4);
}

.exercise-card h3 {
    background: #3498db;
    color: white;
    padding: 12px;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.exercise-card p {
    padding: 12px;
    color: #6c757d;
    min-height: 60px;
    font-size: 0.9rem;
}

.exercise-meta {
    display: flex;
    gap: 8px;
    padding: 0 12px 12px;
}

.exercise-tag {
    background: #e8f4fc;
    color: #3498db;
    padding: 4px 8px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 500;
}

.practice-section {
    display: none;
}

.practice-header {
    background: #2c3e50;
    color: white;
    padding: 15px;
    border-radius: 8px 8px 0 0;
}

.exercise-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.exercise-meta {
    display: flex;
    gap: 12px;
}

.ex）</exercise-tag {
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.85rem;
}

.practice-container {
    background: white;
    padding: 20px;
    border-radius: 0 0 8px 8px;
}

.original-section, .translation-section {
    margin-bottom: 25px;
}

.vietnamese-text {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 15px;
    min-height: 120px;
    font-size: 1rem;
    line-height: 1.6;
}

.vietnamese-text .current-sentence {
    background: #fff3cd;
    padding: 2px 4px;
    border-radius: 4px;
    font-weight: 500;
}

.progress-container {
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    margin: 20px 0;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(to right, #3498db, #2ecc71);
    width: 0%;
    transition: width 0.5s ease;
}

.progress-text {
    text-align: center;
    font-weight: 500;
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 0.9rem;
}

.current-sentence {
    background: #e8f4fc;
    border-left: 3px solid #3498db;
    padding: 12px;
    border-radius: 0 6px 6px 0;
    font-size: 1rem;
    margin-bottom: 15px;
}

.translation-container {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 15px;
}

.translation-input {
    width: 100%;
    min-height: 100px;
    padding: 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 0.9rem;
    line-height: 1.5;
    resize: vertical;
    transition: border-color 0.3s;
    margin-bottom: 12px;
}

.translation-input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.translation-actions {
    display: flex;
    flex-direction: column; /* Chuyển sang cột trên di động */
    gap: 10px;
    margin-bottom: 15px;
}

@media (min-width: 768px) {
    .translation-actions {
        flex-direction: row;
        flex-wrap: wrap;
    }
}

.translation-btn {
    flex: 1;
    min-width: 100px;
    padding: 10px 12px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.hint-btn {
    background: #f39c12;
    color: white;
}

.hint-btn:hover {
    background: #e67e22;
}

.submit-btn {
    background: #3498db;
    color: white;
}

.submit-btn:hover {
    background: #2980b9;
}

.next-btn {
    background: #27ae60;
    color: white;
}

.next-btn:hover {
    background: #2ecc71;
}

.feedback-section {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 15px;
    display: none;
}

.feedback-title {
    font-weight: 600;
    margin-bottom: 12px;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.1rem;
}

.feedback-content {
    line-height: 1.6;
    font-size: 0.9rem;
}

.feedback-content p {
    margin-bottom: 8px;
}

.overall-feedback-container {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-top: 25px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    display: none;
}

.overall-title {
    font-size: 1.2rem;
    color: #2c3e50;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.overall-feedback {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 20px;
    min-height: 120px;
    font-size: 0.9rem;
}

.overall-actions {
    display: flex;
    flex-direction: column; /* Chuyển sang cột trên di động */
    gap: 15px;
    justify-content: center;
}

@media (min-width: 768px) {
    .overall-actions {
        flex-direction: row;
    }
}

.action-btn {
    padding: 10px 25px;
    border: none;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.new-exercise-btn {
    background: #3498db;
    color: white;
}

.new-exercise-btn:hover {
    background: #2980b9;
}

.submit-all-btn {
    background: #27ae60;
    color: white;
}

.submit-all-btn:hover {
    background: #2ecc71;
}

.results-summary {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-top: 25px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    display: none;
}

.results-title {
    font-size: 1.2rem;
    color: #2c3e50;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid #3498db;
}

.results-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 25px;
}

@media (min-width: 768px) {
    .results-content {
        grid-template-columns: 1fr 1fr;
    }
}

.original-text, .translated-text {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 15px;
}

.original-text h3, .translated-text h3 {
    color: #2c3e50;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #dee2e6;
    font-size: 1.1rem;
}

.notification {
    position: fixed;
    top: 15px;
    right: 15px;
    padding: 12px 20px;
    border-radius: 6px;
    color: white;
    font-weight: 500;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    display: none;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-15px); }
    to { opacity: 1; transform: translateY(0); }
}

.shortcut-hint {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 12px;
    background: #e8f4fc;
    padding: 12px;
    border-radius: 6px;
    font-size: 0.85rem;
}

@media (min-width: 768px) {
    .shortcut-hint {
        grid-template-columns: repeat(2, 1fr);
    }
}

.shortcut-hint div {
    display: flex;
    align-items: center;
    gap: 6px;
}

.key {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 25px;
    height: 25px;
    background: #2c3e50;
    color: white;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.85rem;
}

.debug-panel {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 20px;
    display: none;
}

.debug-toggle {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 6px 12px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}

.debug-content {
    background: white;
    border: 1px solid #f5c6cb;
    border-radius: 6px;
    padding: 12px;
    margin-top: 12px;
    font-family: monospace;
    font-size: 0.85rem;
    white-space: pre-wrap;
    max-height: 250px;
    overflow-y: auto;
    display: none;
}

/* Phân trang */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 15px;
    padding: 8px;
}

.pagination-btn {
    padding: 6px 12px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.9rem;
}

.pagination-btn:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
}

.pagination-btn:not(:disabled):hover {
    background-color: #2980b9;
}

#page-info {
    font-weight: bold;
    min-width: 60px;
    text-align: center;
    font-size: 0.9rem;
}

/* Điều chỉnh cho màn hình nhỏ hơn */
@media (max-width: 576px) {
    body {
        padding: 8px;
    }

    .container {
        padding: 10px;
        border-radius: 8px;
    }

    .logo {
        font-size: 1.3rem;
    }

    .logo i {
        font-size: 1.5rem;
    }

    .nav-links {
        gap: 0.8rem;
    }

    .nav-links a {
        font-size: 0.9rem;
        padding: 0.3rem 0.6rem;
    }

    .subtitle {
        font-size: 0.85rem;
    }

    .api-key-container {
        padding: 12px;
    }

    .api-key-container h2 {
        font-size: 1.1rem;
    }

    .api-key-input input {
        font-size: 0.85rem;
        padding: 8px;
    }

    .api-key-input button {
        padding: 8px 12px;
        font-size: 0.9rem;
    }

    .selection-card h2 {
        font-size: 1rem;
    }

    .option {
        padding: 10px;
    }

    .option-icon {
        width: 35px;
        height: 35px;
        font-size: 1.1rem;
    }

    .option-details h3 {
        font-size: 0.95rem;
    }

    .option-details p {
        font-size: 0.8rem;
    }

    .start-btn {
        padding: 10px 25px;
        font-size: 0.9rem;
    }

    .section-title {
        font-size: 1.1rem;
    }

    .exercise-card h3 {
        font-size: 0.95rem;
    }

    .exercise-card p {
        font-size: 0.85rem;
    }

    .practice-header {
        padding: 12px;
    }

    .exercise-title {
        font-size: 1.1rem;
    }

    .vietnamese-text {
        font-size: 0.95rem;
    }

    .translation-input {
        font-size: 0.85rem;
        min-height: 80px;
    }

    .translation-btn {
        font-size: 0.9rem;
        padding: 8px 10px;
    }

    .feedback-title {
        font-size: 1rem;
    }

    .overall-title {
        font-size: 1.1rem;
    }

    .action-btn {
        font-size: 0.9rem;
        padding: 8px 20px;
    }

    .results-title {
        font-size: 1.1rem;
    }

    .notification {
        padding: 10px 15px;
        font-size: 0.85rem;
    }

    .shortcut-hint {
        font-size: 0.8rem;
    }

    .key {
        min-width: 22px;
        height: 22px;
        font-size: 0.8rem;
    }
}

/* Thêm vào cuối file */
#back-to-selection {
    background: linear-gradient(to right, #e74c3c, #c0392b);
    margin: 0 auto 20px;
    display: block;
}

#back-to-selection:hover {
    background: linear-gradient(to right, #c0392b, #a93226);
}
/* THÊM VÀO CUỐI FILE */
#back-to-selection, #back-to-exercises {
    background: linear-gradient(to right, #e74c3c, #c0392b);
    margin-bottom: 20px;
}

#back-to-selection:hover, #back-to-exercises:hover {
    background: linear-gradient(to right, #c0392b, #a93226);
}

/* Thêm vào cuối file CSS */

.practice-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 25px;
}

@media (min-width: 992px) {
    .practice-container {
        grid-template-columns: 1fr 1fr;
    }
}

.left-column, .right-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Hiển thị nổi bật câu đang dịch trong bài viết */
.vietnamese-text .current-sentence {
    background-color: #fff3cd;
    padding: 2px 4px;
    border-radius: 4px;
    font-weight: 500;
    display: inline-block;
}

/* Phần câu đang dịch riêng */
#current-sentence-container {
    background: #e8f4fc;
    border-left: 3px solid #3498db;
    padding: 15px;
    border-radius: 0 6px 6px 0;
    margin-bottom: 15px;
}

#current-sentence {
    font-size: 1.1rem;
    line-height: 1.6;
}

/* Điều chỉnh kích thước các phần tử */
.vietnamese-text {
    min-height: 250px;
}

.translation-input {
    min-height: 150px;
}

/* Responsive cho mobile */
@media (max-width: 991px) {
    .left-column, .right-column {
        gap: 15px;
    }
    
    .vietnamese-text {
        min-height: 200px;
    }
}

/* Thêm vào cuối file CSS */

/* Highlight câu đang dịch trong bài viết mẫu */
.vietnamese-text .current-sentence {
    background-color: #fff3cd !important;
    padding: 3px 6px;
    border-radius: 4px;
    font-weight: 600;
    display: inline;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
    color: #d35400;
    border: 1px solid #ffc107;
}

/* Hiệu ứng khi di chuột qua câu */
.vietnamese-text .current-sentence:hover {
    background-color: #ffecb3 !important;
    cursor: pointer;
    transform: scale(1.01);
    transition: all 0.2s ease;
}

/* Làm nổi bật hơn phần câu đang dịch riêng */
#current-sentence-container {
    background: #e8f4fc;
    border-left: 4px solid #3498db;
    padding: 15px;
    border-radius: 0 8px 8px 0;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#current-sentence {
    font-size: 1.15rem;
    line-height: 1.7;
    font-weight: 500;
    color: #2c3e50;
    padding: 8px;
    background: #ffffff;
    border-radius: 6px;
}