:root {
    --brand-gradient: linear-gradient(90deg, #00316C 0%, #004E9A 50%, #85B106 100%);
    --bg-white: #ffffff;
    --text-primary: #1F1F1F;
    --text-secondary: #5F6368;
    --border-color: #E0E0E0;
    --highlight-bg: #FFF9C4;
    --highlight-text: #F57F17;
}

* { box-sizing: border-box; outline: none; }

body {
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 0; /* Bỏ padding mặc định để căn giữa chuẩn hơn */
    min-height: 100vh; /* Bắt buộc chiều cao tối thiểu bằng màn hình */
    background: var(--brand-gradient);
    
    /* CĂN GIỮA TUYỆT ĐỐI */
    display: flex;
    justify-content: center;
    align-items: center; 
}

.main-card {
    background-color: var(--bg-white);
    width: 90%; /* Dùng % để responsive tốt hơn */
    max-width: 1100px;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
    animation: zoomIn 0.4s ease-out;
    margin: 20px; /* Cách lề một chút trên màn hình nhỏ */
}

@keyframes zoomIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.card-header {
    text-align: center;
    margin-bottom: 30px;
}

.app-title {
    margin: 0 0 20px 0;
    font-size: 28px;
    font-weight: 800;
    /*text-transform: uppercase;*/
    background: var(--brand-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.4; /* Tăng khoảng cách dòng */
    padding: 10px 0;  /* Tạo không gian cho dấu không bị cắt */
    display: block;   /* Đảm bảo padding có tác dụng */
}

/* --- MODE SWITCHER STYLES (Mới) --- */
.mode-switcher {
    display: inline-flex;
    background: #F0F2F5;
    padding: 4px;
    border-radius: 50px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}

.mode-option {
    position: relative;
    cursor: pointer;
}

.mode-option input {
    display: none; 
}

.mode-btn {
    display: block;
    padding: 8px 24px;
    border-radius: 40px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.mode-option input:checked + .mode-btn {
    background: var(--bg-white);
    color: #004E9A;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.mode-option:hover .mode-btn {
    color: #004E9A;
}
/* ----------------------------- */

.editor-section {
    display: flex;
    gap: 30px;
    margin-bottom: 30px;
}

.text-box-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.box-label {
    font-size: 13px;
    font-weight: 700;
    color: #004E9A;
    margin-bottom: 10px;
    text-transform: uppercase;
}

textarea {
    width: 100%;
    height: 200px;
    padding: 20px;
    font-size: 16px;
    line-height: 1.6;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    resize: none;
    font-family: inherit;
    background-color: #F8F9FA;
    transition: all 0.2s;
}

textarea:focus {
    background-color: #fff;
    border-color: #004E9A;
    box-shadow: 0 0 0 3px rgba(0, 78, 154, 0.1);
}

#outputText { background-color: #fff; }

.action-section {
    text-align: center;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

button#submitBtn {
    background: var(--brand-gradient);
    color: white;
    border: none;
    padding: 14px 60px;
    font-size: 15px;
    font-weight: 700;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(0, 78, 154, 0.25);
    transition: transform 0.2s, box-shadow 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

button#submitBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(0, 78, 154, 0.35);
}

button#submitBtn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

#loading {
    display: none;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
    font-size: 14px;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #004E9A;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.analysis-section {
    display: none;
    border-top: 1px dashed var(--border-color);
    padding-top: 30px;
    margin-top: 30px;
}

.section-title {
    text-align: center;
    color: #004E9A;
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 20px;
    text-transform: uppercase;
}

.highlight-box {
    text-align: center;
    font-size: 18px;
    line-height: 1.8;
    color: var(--text-primary);
    margin-bottom: 30px;
    background: #FAFAFA;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #eee;
}

.highlight-word {
    background-color: var(--highlight-bg);
    color: var(--highlight-text);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    border-bottom: 2px solid #FBC02D;
    cursor: help;
}

.table-wrapper {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid #eee;
}

table { width: 100%; border-collapse: collapse; background: #fff; }
thead { background: var(--brand-gradient); color: white; }
th, td { padding: 12px 20px; text-align: center; border-bottom: 1px solid #eee; }
th { font-weight: 600; text-transform: uppercase; font-size: 13px; }
tbody tr:hover { background-color: #f8fbff; }

@media (max-width: 768px) {
    .editor-section { flex-direction: column; }
    .main-card { padding: 20px; margin: 10px; width: 95%; }
}