/* --- GENERAL STYLES --- */
.mail-wrapper {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #333;
    max-width: 1000px;
    margin: 0 auto;
    display: block; 
}

/* --- TOAST NOTIFICATION (Góc Phải Trên) --- */
.toast-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: #333; /* Mặc định màu tối */
    color: #fff;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 9999;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 10px;
    
    /* Animation */
    opacity: 0;
    transform: translateX(100%); /* Ẩn bên phải */
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

.toast-notification.show {
    opacity: 1;
    transform: translateX(0);
}

/* Màu sắc theo trạng thái */
.toast-notification.success {
    background-color: #28a745;
    border-left: 5px solid #1e7e34;
}
.toast-notification.error {
    background-color: #dc3545;
    border-left: 5px solid #bd2130;
}
.toast-notification.info {
    background-color: #17a2b8;
    border-left: 5px solid #117a8b;
}

/* --- TABS --- */
.tabs-nav {
    display: flex;
    border-bottom: 2px solid #e1e4e8;
    margin-bottom: 20px;
    gap: 5px;
}
.tab-btn {
    padding: 12px 25px;
    background: #f8f9fa;
    border: 1px solid #e1e4e8;
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    font-weight: 600;
    color: #6c757d;
    transition: all 0.2s;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}
.tab-btn:hover {
    background: #e9ecef;
    color: #333;
}
.tab-btn.active {
    background: #fff;
    color: #28a745;
    border-top: 3px solid #28a745;
    border-bottom: 2px solid #fff;
    margin-bottom: -2px;
    z-index: 1;
}
/* Tab Mail.tm Active Color */
.tab-btn.tab-mailtm.active {
    border-top-color: #007bff;
    color: #007bff;
}

.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.3s; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* --- PANELS --- */
.mail-panel {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    padding: 25px;
    border: 1px solid #e1e4e8;
    margin-bottom: 30px;
}

/* --- HEADER --- */
.mail-header-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    border-bottom: 2px solid #f0f2f5;
    padding-bottom: 15px;
}
.mail-header-section h2 {
    margin: 0;
    font-size: 1.5rem;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 10px;
}
.usage-badge {
    background: #e8f5e9;
    color: #2e7d32;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* --- CONFIG AREA --- */
.config-panel {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}
.config-title {
    font-weight: 700;
    margin-bottom: 15px;
    color: #495057;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.control-group {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
}
    
.input-wrapper {
    flex: 1;
    min-width: 150px;
}
.input-wrapper label {
    display: block;
    font-size: 0.85rem;
    color: #6c757d;
    margin-bottom: 5px;
    font-weight: 600;
}
.input-wrapper input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 0.95rem;
    transition: border-color 0.15s;
    box-sizing: border-box;
}
.input-wrapper input:focus {
    border-color: #28a745;
    outline: none;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.1);
}

/* --- BUTTONS --- */
.btn-group {
    display: flex;
    gap: 10px;
}
.btn {
    padding: 0 20px;
    height: 40px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
    font-size: 0.9rem;
    color: #fff;
    white-space: nowrap;
}
.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.7; cursor: not-allowed; }

.btn-generate { background: linear-gradient(135deg, #28a745 0%, #218838 100%); }
.btn-mailtm { background: linear-gradient(135deg, #007bff 0%, #0056b3 100%); }
.btn-random-tm { background: linear-gradient(135deg, #6c757d 0%, #495057 100%); }
.btn-refresh { background: #fff; border: 1px solid #ced4da; color: #555; }
.btn-refresh:hover { border-color: #333; color: #333; }
.btn-copy { background: #343a40; color: #fff; }
    
.btn-use-mail { background-color: #17a2b8; width: 30px; height: 30px; padding: 0; }
.btn-delete-mail { background-color: #dc3545; width: 30px; height: 30px; padding: 0; }

/* --- CURRENT MAIL BOX --- */
.current-mail-box {
    background: #f1f8e9;
    border: 2px dashed #28a745;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    margin-bottom: 30px;
    position: relative;
    transition: background-color 0.3s;
}
.current-mail-label {
    color: #558b2f;
    font-size: 0.85rem;
    margin-bottom: 8px;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 1px;
}
.current-mail-address {
    font-size: 1.8rem;
    font-weight: 700;
    color: #2e7d32;
    word-break: break-all;
    font-family: 'Consolas', monospace;
}

/* --- INBOX TABLE --- */
.inbox-container {
    border: 1px solid #e1e4e8;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 10px;
}
.inbox-header {
    background: #f8f9fa;
    padding: 12px 15px;
    border-bottom: 1px solid #e1e4e8;
    font-weight: 700;
    color: #495057;
    font-size: 0.9rem;
    text-transform: uppercase;
}
.otp-table {
    width: 100%;
    border-collapse: collapse;
}
.otp-table th, .otp-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.95rem;
}
.otp-table th {
    background-color: #fff;
    color: #6c757d;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
}
.otp-table tbody tr:last-child td { border-bottom: none; }
.otp-code {
    font-weight: 700;
    color: #d63384;
    background: #fff0f6;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: 'Consolas', monospace;
    font-size: 1.1rem;
    display: inline-block;
}

/* --- HISTORY HEADER (SEARCH) --- */
.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}
.history-header h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.1rem;
}
.search-box {
    display: flex;
    gap: 5px;
}
.search-box input {
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.9rem;
    width: 200px;
}
.search-box button {
    padding: 8px 12px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}
.search-box button:hover { background: #0056b3; }

/* --- HISTORY TABLE --- */
.history-panel {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    padding: 25px;
    border: 1px solid #e1e4e8;
    width: 100%;
    box-sizing: border-box;
}
.history-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}
.history-table th, .history-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
    font-size: 0.9rem;
}
.history-table th {
    background-color: #f8f9fa;
    color: #555;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
}
.history-table tbody tr:hover {
    background-color: #f8f9fa;
}
.copyable {
    cursor: pointer;
    transition: color 0.2s;
    position: relative;
}
.copyable:hover {
    color: #007bff;
    text-decoration: underline;
}
.copyable:active {
    color: #0056b3;
}

/* --- PAGINATION --- */
.pagination-container {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-top: 20px;
    flex-wrap: wrap;
}
.page-btn {
    padding: 6px 12px;
    border: 1px solid #dee2e6;
    background-color: #fff;
    color: #007bff;
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: all 0.2s;
}
.page-btn:hover {
    background-color: #e9ecef;
    border-color: #dee2e6;
    color: #0056b3;
}
.page-btn.active {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}
.page-btn.disabled {
    color: #6c757d;
    pointer-events: none;
    background-color: #fff;
    border-color: #dee2e6;
}
.page-dots {
    padding: 6px 8px;
    color: #6c757d;
}

/* --- RESPONSIVE --- */
@media (max-width: 768px) {
    .control-group {
        flex-direction: column;
        align-items: stretch;
    }
    .input-wrapper {
        width: 100%;
    }
    .btn-group {
        width: 100%;
        flex-direction: column;
    }
    .btn {
        width: 100%;
    }
    .tabs-nav {
        flex-direction: column;
        gap: 0;
    }
    .tab-btn {
        border-radius: 0;
        border-bottom: 1px solid #e1e4e8;
    }
    .tab-btn.active {
        border-left: 4px solid #28a745;
        border-top: 1px solid #e1e4e8;
        border-bottom: 1px solid #e1e4e8;
    }
    .tab-btn.tab-mailtm.active {
        border-left-color: #007bff;
    }
    
    /* Toast trên mobile thì hiện ở giữa trên cùng */
    .toast-notification {
        top: 10px;
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        width: 90%;
        text-align: center;
        justify-content: center;
    }
    .toast-notification.show {
        transform: translateX(-50%);
    }
}