* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

header {
    margin-bottom: 30px;
    padding: 20px 0;
    text-align: center;
}

header h1 {
    font-size: 2.5rem;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.loading {
    text-align: center;
    padding: 40px;
}

.spinner {
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error {
    background: #fee2e2;
    color: #991b1b;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid var(--danger-color);
}

.error.success {
    background: #d1fae5;
    color: #065f46;
    border-left-color: var(--success-color);
}

.hidden {
    display: none !important;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state p {
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.empty-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
}

/* Table Styles */
.table-container {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
    overflow-x: auto;
    position: relative; 
}

.table-scroll-wrapper {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 60vh;
}

.review-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.review-table thead {
    background: var(--bg-color);
    position: sticky;
    top: 0;
    z-index: 10;
}

.review-table th {
    padding: 12px 8px;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.review-table td {
    padding: 12px 8px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: top;
}

.review-table tbody tr:hover {
    background: var(--bg-color);
}

.review-table tbody tr:last-child td {
    border-bottom: none;
}

.synonym-cell {
    min-width: 200px;
    max-width: 300px;
}

.synonym-text {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
    word-break: break-word;
}

.synonym-id {
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: var(--bg-color);
    padding: 2px 8px;
    border-radius: 12px;
    display: inline-block;
}

.code-cell {
    font-family: 'Courier New', monospace;
    font-weight: 600;
    color: var(--primary-color);
    white-space: nowrap;
}

.diagnosis-cell {
    min-width: 200px;
    max-width: 300px;
    word-break: break-word;
    color: var(--text-primary);
}

.action-cell {
    min-width: 100px;
    text-align: center;
}

.btn-action {
    padding: 8px 16px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    min-width: 80px;
}

.btn-correct {
    background: white;
    color: var(--success-color);
    border-color: #059669;
}

.btn-correct:hover {
    background: #059669;
    color: white;
}

.btn-correct.selected {
    background: #059669;
    color: white;
    border-color: #059669;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.3);
}

.btn-wrong {
    background: white;
    color: var(--danger-color);
    border-color: #dc2626;
}

.btn-wrong:hover {
    background: #dc2626;
    color: white;
}

.btn-wrong.selected {
    background: #dc2626;
    color: white;
    border-color: #dc2626;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.3);
}

.btn-action:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.table-actions {
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
    padding-top: 20px;
    border-top: 2px solid var(--border-color);
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary-color);
    color: white;

    position: fixed;
    bottom: 100px;
    right: 30px;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4); 
}

.btn-primary:hover:not(:disabled) {
    background: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--text-secondary);
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #475569;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Pagination */
.pagination-container {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    position: relative;
}

.pagination-info {
    font-weight: 500;
    color: var(--text-primary);
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1rem;
}

.pagination-btn-left {
    margin-right: auto;
    min-width: 120px;
}

.pagination-btn-right {
    margin-left: auto;
    min-width: 120px;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    animation: modalSlideIn 0.3s ease-out;
}

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

.modal-header {
    padding: 24px 24px 16px;
    border-bottom: 2px solid var(--border-color);
}

.modal-header h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin: 0;
}

.modal-body {
    padding: 24px;
}

.modal-body p {
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--text-primary);
    margin: 0;
}

.modal-footer {
    padding: 16px 24px 24px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.modal-footer .btn {
    min-width: 100px;
}

.btn-primary-static {
    background: var(--primary-color);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary-static:hover:not(:disabled) {
    background: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.btn-primary-static:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

@media (max-width: 1200px) {
    .review-table {
        font-size: 0.85rem;
    }
    
    .review-table th,
    .review-table td {
        padding: 10px 6px;
    }
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    .container {
        padding: 10px;
    }
    
    .table-container {
        padding: 10px;
        overflow-x: scroll;
    }
    
    .review-table {
        font-size: 0.8rem;
        min-width: 1000px;
    }
    
    .review-table th,
    .review-table td {
        padding: 8px 4px;
    }
    
    .pagination-container {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .pagination-info {
        position: static;
        transform: none;
        text-align: center;
        order: 2;
    }
    
    .pagination-btn-left,
    .pagination-btn-right {
        margin: 0;
        order: 1;
    }
    
    .pagination-btn-right {
        order: 3;
    }
    
    .btn {
        padding: 10px 16px;
        font-size: 0.9rem;
    }
}