/* /static/style.css (Hoàn chỉnh + Thêm CSS cho Modal HTML) */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap');

:root {
    --primary-color: #2e5cb4; /* Màu xanh đậm chủ đạo */
    --secondary-color: #0078d4; /* Màu xanh Microsoft/nút */
    --background-light: #f4f7f9; /* Nền nhẹ nhàng */
    --card-bg: #ffffff;
    --border-color: #e0e0e0;
    --navbar-height: 50px; /* Chiều cao Navbar */
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--background-light);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
    padding-top: var(--navbar-height); 
}

/* --- NavBar Góc trên bên phải --- */
.top-navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--navbar-height);
    background-color: #2e5cb4; /* Màu nền tối cho navbar */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 1030;
    display: flex;
    justify-content: flex-end; /* Đẩy nội dung sang phải */
    align-items: center;
    padding: 0 20px;
}
.lang-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}
.lang-selector label {
    font-weight: 500;
    color: #ffffff; /* Chữ trắng trên nền tối */
}
.lang-selector .form-select {
    width: auto;
    background-color: #fff;
    color: #000;
    box-shadow: none;
    transition: border-color 0.2s;
}
.lang-selector .form-select:focus {
    border-color: var(--secondary-color);
}
/* --- End NavBar --- */


.main-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    padding-bottom: 70px; 
    max-width: 1200px;
    width: 100%;
    margin: 20px auto;
}

.card {
    background-color: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
    margin-bottom: 25px;
    width: 100%;
    border: none;
}

.card-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #1d5cb4 100%);
    color: white;
    padding: 25px 30px;
    text-align: center;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}

.card-header h1 {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}


.card-body {
    padding: 25px;
}

#data {
    min-height: 150px;
    resize: vertical;
    font-family: 'Consolas', 'Courier New', monospace;
    border: 1px solid var(--border-color);
}

/* Mode Selector Styling */
.mode-selector {
    display: flex;
    gap: 10px;
}

.mode-option input[type="radio"] {
    display: none; 
    -webkit-appearance: none; 
    -moz-appearance: none;
    appearance: none;
    margin: 0;
}

.mode-option label {
    cursor: pointer;
    padding: 10px 18px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    font-weight: 500;
    user-select: none;
}

.mode-option input[type="radio"]:checked + label {
    border-color: var(--primary-color);
    background-color: var(--primary-color);
    color: #fff;
    box-shadow: 0 0 8px rgba(46, 92, 180, 0.4);
}

.count-badge {
    background-color: var(--background-light);
    color: #333;
    padding: 10px 15px;
    border-radius: 8px;
    font-weight: 500;
    border: 1px solid var(--border-color);
    min-width: 150px;
}

/* Button Styling */
#btnFetch {
    background-color: #2e5cb4;
    border-color: #2e5cb4;
    transition: background-color 0.3s, transform 0.1s;
}

#btnFetch:hover {
    background-color: #005a9e;
    border-color: #005a9e;
    transform: translateY(-1px);
}

/* Result Styling */
.result-container {
    display: none;
}

/* --- HIỂN THỊ THƯ --- */
.account-result {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 15px;
    overflow: hidden;
    background-color: var(--card-bg);
}

.account-header {
    background-color: #e9ecef;
    padding: 15px 20px;
    font-size: 1.1rem;
    font-weight: 700;
    color: #343a40;
    border-bottom: 1px solid var(--border-color);
}
.account-header.header-error {
    background-color: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

.account-content {
    padding: 10px 20px 20px;
}

/* Table styling */
.message-table {
    width: 100%;
    margin-top: 10px;
    border-collapse: separate;
    border-spacing: 0 5px;
}
.message-table th {
    padding: 10px 12px;
    background-color: #f1f1f1;
    border-bottom: 2px solid #ddd;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
    color: #555;
}
.message-table td {
    padding: 12px;
    border-bottom: 1px solid #eee;
    background-color: var(--card-bg);
    vertical-align: middle;
}

/* Tối ưu cột */
.message-table tr:hover td {
    background-color: #f9f9f9;
}
.message-subject {
    max-width: 250px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.code-container {
    display: flex;
    align-items: center;
    gap: 8px;
}
.code-text {
    font-family: monospace;
    font-size: 1em;
    font-weight: 600;
    color: var(--primary-color);
}
.copy-btn {
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    padding: 0;
    font-size: 0.9em;
    transition: color 0.2s;
}
.copy-btn:hover {
    color: var(--secondary-color);
}
.message-date {
    font-size: 0.9em;
    color: #888;
    white-space: nowrap;
}

/* Message Modal Content (CSS cho HTML của thư) */
#modalBodyContent {
    white-space: normal; /* Đã thay đổi */
    font-family: 'Roboto', sans-serif; /* Đã thay đổi */
    padding: 0; /* Đã thay đổi */
    background-color: #f8f9fa;
    border: none;
    /* Loại bỏ max-height và overflow ở đây */
}

.email-content-wrapper {
    /* Container cô lập nội dung HTML của thư */
    padding: 20px; 
    border: 1px solid #ddd;
    background-color: #fff;
    max-height: 70vh; /* Giới hạn chiều cao */
    overflow-y: auto; /* Thêm thanh cuộn nếu cần */
}

/* Đảm bảo nội dung HTML bên trong không bị tràn ra ngoài */
.email-content-wrapper * {
    max-width: 100% !important; 
    height: auto !important;
}


/* Footer Styling */
.footer {
    width: 100%;
    background-color: #333;
    color: #bbb;
    padding: 15px 0;
    text-align: center;
    margin-top: auto;
}

.footer-content {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
}

.copyright {
    font-size: 15px;
    color:#fff;
}

.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive adjustments */
@media (max-width: 992px) {
    .main-container {
        padding: 10px;
        margin: 10px auto;
    }
    .card-header h1 {
        font-size: 1.8rem;
    }
    .message-table th, .message-table td {
        padding: 8px;
    }
    .message-subject {
        max-width: 150px;
    }
}
@media (max-width: 768px) {
    body {
        padding-top: calc(var(--navbar-height) + 10px); 
    }
    .top-navbar {
        justify-content: center;
        height: auto;
        padding: 10px 20px;
    }
    .lang-selector {
        width: 100%;
        justify-content: center;
    }

    /* Responsive Table */
    .responsive-table table, 
    .responsive-table thead, 
    .responsive-table tbody, 
    .responsive-table th, 
    .responsive-table td, 
    .responsive-table tr {
        display: block;
    }
    .responsive-table thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    .responsive-table tr { 
        border: 1px solid #ccc; 
        margin-bottom: 10px;
        border-radius: 8px;
    }
    .responsive-table td {
        border: none;
        border-bottom: 1px solid #eee;
        position: relative;
        padding-left: 50%;
        text-align: right;
    }
    .responsive-table td:before {
        position: absolute;
        top: 50%;
        left: 10px;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        text-align: left;
        font-weight: bold;
        color: #333;
        transform: translateY(-50%);
        content: attr(data-label);
    }
    .message-subject, .message-date, .code-text, .copy-btn {
        max-width: none;
        white-space: normal;
        text-overflow: clip;
    }
    .code-container {
        justify-content: flex-end;
    }
    .message-table td:last-child {
        text-align: center;
    }
    .footer-content {
        flex-direction: column;
        gap: 10px;
    }
    .mode-selector {
        width: 100%;
        justify-content: center;
    }
}