/**
 * IDK Mail - Main Stylesheet
 * Version: 2.2.0
 *
 * Complete stylesheet with all styles included.
 * Optimized for performance with minimal render-blocking.
 */

/* ============== ACCESSIBILITY IMPROVEMENTS ============== */
/* Focus visible for keyboard navigation */
:focus-visible {
    outline: 3px solid #667eea;
    outline-offset: 2px;
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .banner-scroll {
        animation: none !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --border-color: #000;
        --shadow-color: rgba(0, 0, 0, 0.3);
    }

    button, .action-btn {
        border: 2px solid currentColor;
    }
}

/* ============== PRINT STYLES ============== */
@media print {
    .main-header,
    .maintenance-banner,
    .action-buttons,
    .site-footer,
    .notification,
    .modal-overlay {
        display: none !important;
    }

    .container {
        box-shadow: none;
        border: none;
        max-width: 100%;
    }

    body {
        background: white;
        color: black;
    }
}

/* IDK Mail - Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ============== SELECTION STYLES ============== */
::selection {
    background: rgba(102, 126, 234, 0.3);
    color: inherit;
}

::-moz-selection {
    background: rgba(102, 126, 234, 0.3);
    color: inherit;
}

/* ============== SCROLLBAR STYLES ============== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #5a67d8, #6b46a0);
}

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: #667eea var(--bg-light);
}

/* ============== ANTI-RIGHT-CLICK & SELECT ============== */
body {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

/* Allow select on inputs */
input,
textarea,
[contenteditable="true"] {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* ============== CSS VARIABLES FOR THEMING ============== */
:root {
    --bg-gradient-1: #e0eafc;
    --bg-gradient-2: #cfdef3;
    --bg-white: #fff;
    --bg-light: #f7f9fc;
    --bg-input: #fff;
    --text-primary: #2c3e50;
    --text-secondary: #4a5568;
    --text-muted: #718096;
    --border-color: #e2e8f0;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --header-bg: white;
    --table-header: #334155;
    --table-row-hover: #e2e8f0;
    --table-row-unread: #f0f7ff;
    --table-row-read: #f8fafc;
    --email-detail-bg: #f8fafc;
}

/* ============== DARK MODE ============== */
[data-theme="dark"] {
    --bg-gradient-1: #1a1a2e;
    --bg-gradient-2: #16213e;
    --bg-white: #1e293b;
    --bg-light: #0f172a;
    --bg-input: #334155;
    --text-primary: #e2e8f0;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border-color: #475569;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --header-bg: #1e293b;
    --table-header: #0f172a;
    --table-row-hover: #334155;
    --table-row-unread: #1e3a5f;
    --table-row-read: #1e293b;
    --email-detail-bg: #0f172a;
}

/* Auto dark mode based on system preference */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg-gradient-1: #1a1a2e;
        --bg-gradient-2: #16213e;
        --bg-white: #1e293b;
        --bg-light: #0f172a;
        --bg-input: #334155;
        --text-primary: #e2e8f0;
        --text-secondary: #cbd5e1;
        --text-muted: #94a3b8;
        --border-color: #475569;
        --shadow-color: rgba(0, 0, 0, 0.3);
        --header-bg: #1e293b;
        --table-header: #0f172a;
        --table-row-hover: #334155;
        --table-row-unread: #1e3a5f;
        --table-row-read: #1e293b;
        --email-detail-bg: #0f172a;
    }
}

body {
    font-family: 'Roboto', sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-1), var(--bg-gradient-2));
    min-height: 100vh;
    color: var(--text-primary);
    transition: background 0.3s, color 0.3s;
}

/* ============== LOADING SKELETON ============== */
.skeleton {
    background: linear-gradient(90deg, var(--bg-light) 25%, var(--bg-white) 50%, var(--bg-light) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.skeleton-text {
    height: 1em;
    margin-bottom: 0.5em;
}

.skeleton-text:last-child {
    width: 60%;
}

/* ============== SMOOTH TRANSITIONS ============== */
.fade-enter {
    opacity: 0;
    transform: translateY(-10px);
}

.fade-enter-active {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.fade-exit {
    opacity: 1;
}

.fade-exit-active {
    opacity: 0;
    transition: opacity 0.2s ease;
}

/* Header */
.main-header {
    background: var(--header-bg);
    max-width: 1000px;
    margin: 0 auto 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 35px;
    box-shadow: 0 4px 20px var(--shadow-color);
    border-radius: 0 0 16px 16px;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
}

.logo {
    font-weight: 800;
    letter-spacing: -1px;
}

.logo .idk {
    color: #667eea;
    font-size: 1.8em;
    text-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
}

.logo .mail {
    color: #764ba2;
    font-size: 1.8em;
    text-shadow: 0 2px 4px rgba(118, 75, 162, 0.3);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9em;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border-radius: 10px;
    transition: all 0.3s ease;
    background: transparent;
}

.nav-links a:hover {
    color: #667eea;
    background: rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
}

.nav-links a img {
    width: 18px;
    height: 18px;
    opacity: 0.7;
    transition: opacity 0.3s;
}

.nav-links a:hover img {
    opacity: 1;
}

/* Banner */
.maintenance-banner {
    max-width: 1000px;
    margin: 0 auto 20px;
    border-radius: 10px;
    background: linear-gradient(90deg, #667eea, #764ba2, #f093fb, #667eea);
    background-size: 300% 100%;
    animation: gradientMove 6s ease-in-out infinite;
    color: white;
    padding: 10px 0;
    overflow: hidden;
    position: relative;
}

/* Banner scroll animation - replaces deprecated marquee */
.banner-scroll {
    display: inline-flex;
    white-space: nowrap;
    animation: banner-scroll 20s linear infinite !important;
    will-change: transform;
}

.banner-content {
    display: inline-block;
    padding: 0 50px;
    font-weight: 500;
}

.banner-content a {
    color: white;
    text-decoration: underline;
}

.banner-content a:hover {
    text-decoration: none;
}

@keyframes banner-scroll {
    from {
        transform: translateX(0%);
    }

    to {
        transform: translateX(-50%);
    }
}

/* Pause animation on hover for accessibility */
.maintenance-banner:hover .banner-scroll {
    animation-play-state: paused;
}

/* Legacy scrolling-text support */
.scrolling-text {
    display: inline-block;
    white-space: nowrap;
    font-weight: 500;
    padding-left: 100%;
    animation: marquee 18s linear infinite;
}

.scrolling-text a {
    color: white;
    text-decoration: underline;
}

@keyframes marquee {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-200%);
    }
}

@keyframes gradientMove {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

/* Container */
.container {
    max-width: 1000px;
    margin: 0 auto;
    background: var(--bg-white);
    padding: 35px;
    border-radius: 20px;
    box-shadow: 0 10px 40px var(--shadow-color);
    border: 1px solid var(--border-color);
}

/* Form */
.form-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
    background: var(--bg-light);
    padding: 20px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
}

.input-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
}

label {
    font-weight: 600;
    color: var(--text-secondary);
}

input:not([type="checkbox"]):not([type="radio"]),
select {
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 1em;
    transition: all 0.3s ease;
    background: var(--bg-input);
    color: var(--text-primary);
}

input:not([type="checkbox"]):not([type="radio"]) {
    flex: 1;
    min-width: 150px;
    background: var(--bg-input);
    color: var(--text-primary);
}

select {
    min-width: 180px;
    /* Fix CLS - consistent width for domain dropdown */
    width: 180px;
    cursor: pointer;
}

input:not([type="checkbox"]):not([type="radio"]):focus,
select:focus {
    border-color: #667eea;
    outline: none;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15);
}

.url-email {
    color: #3498db;
    text-align: center;
    width: 100%;
    font-size: 0.9em;
    padding: 8px;
    background: #f0f7ff;
    border-radius: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.url-email a {
    color: #3498db;
    text-decoration: none;
    word-break: break-all;
}

.url-email a:hover {
    text-decoration: underline;
}

@media (max-width: 768px) {
    .url-email {
        font-size: 0.8em;
        padding: 6px 10px;
    }
}

@media (max-width: 480px) {
    .url-email {
        font-size: 0.75em;
        padding: 5px 8px;
    }

    .url-email strong {
        font-size: 0.85em;
        margin-right: 3px;
    }
}

@media (max-width: 360px) {
    .url-email {
        font-size: 0.7em;
        padding: 4px 6px;
    }
}

/* Buttons */
button {
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

button:active {
    transform: translateY(0);
}

button:disabled {
    background: linear-gradient(135deg, #bdc3c7, #95a5a6);
    color: #7f8c8d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.action-btn {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 10px;
    border: none;
}

/* Copy Email - Soft Blue */
.copy-btn {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: #fff;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
}

.copy-btn:hover {
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
}

/* Check Inbox - Orange */
.fetch-btn {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: #fff;
    box-shadow: 0 4px 15px rgba(243, 156, 18, 0.3);
}

.fetch-btn:hover {
    box-shadow: 0 6px 20px rgba(243, 156, 18, 0.4);
}

/* Generate New Email - Green */
.generate-btn {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    color: #fff;
    box-shadow: 0 4px 15px rgba(46, 204, 113, 0.3);
}

.generate-btn:hover {
    box-shadow: 0 6px 20px rgba(46, 204, 113, 0.4);
}

/* Delete - Red */
.delete-btn,
.delete-all-btn {
    background: #e74c3c;
    color: #fff;
    border-color: #e74c3c;
}

.delete-btn:hover,
.delete-all-btn:hover {
    background: #c0392b;
    border-color: #c0392b;
}

/* Refresh animation */
.fetch-btn.refreshing {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* View - Blue */
.view-btn {
    background: #3498db;
    color: #fff;
    border-color: #3498db;
    margin-right: 5px;
}

.view-btn:hover {
    background: #2980b9;
    border-color: #2980b9;
}

/* Copy 2FA - Cyan */
.copy-2fa-btn {
    background: #17a2b8;
    color: #fff;
    border-color: #17a2b8;
}

.copy-2fa-btn:hover {
    background: #138496;
    border-color: #138496;
}

/* Add Domain - Purple */
.check-btn {
    background: #9b59b6;
    color: #fff;
    border-color: #9b59b6;
}

.check-btn:hover {
    background: #8e44ad;
    border-color: #8e44ad;
}

/* Status */
.status {
    padding: 8px 12px;
    border-radius: 5px;
    font-size: 0.9em;
    font-weight: 500;
}

.status.online {
    background: #2ecc71;
    color: #fff;
}

.status.Offline {
    background: #e74c3c;
    color: #fff;
}

/* WebSocket Status Indicator */
.ws-status {
    font-size: 0.8em;
    cursor: help;
    transition: all 0.3s;
}

.ws-status.connected {
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* Email List */
.email-list-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 20px 0 15px;
    gap: 15px;
}

.email-list-header h2 {
    text-align: center;
    width: 100%;
}

h2 {
    color: #2d3748;
    color: var(--text-primary);
    font-size: 1.4em;
    border-bottom: 2px solid #5a67d8;
    padding-bottom: 5px;
}

.email-count {
    font-size: 0.7em;
    color: #5a67d8;
    font-weight: 600;
    margin-left: 5px;
}

/* ============== ADD DOMAIN SECTION ============== */
.add-domain {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.add-domain input {
    width: 180px;
    padding: 12px 16px;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 25px;
    background: #fff;
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.add-domain input:focus {
    border-color: #999;
    outline: none;
}

.add-domain input::placeholder {
    color: #999;
    font-size: 14px;
}

.btn-gray {
    background: #6b7280 !important;
    color: #fff;
    border-radius: 25px !important;
    padding: 12px 20px !important;
    font-weight: 500;
    box-shadow: none;
}

.btn-gray:hover {
    background: #4b5563 !important;
}

.btn-add:hover {
    background: linear-gradient(135deg, #8e44ad, #7d3c98);
    transform: translateX(2px);
}

/* Table */
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-white);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px var(--shadow-color);
    table-layout: fixed;
}

th,
td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background: var(--table-header);
    color: #fff;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8em;
    letter-spacing: 0.5px;
    padding: 14px 15px;
}

/* Override cho cột ngày trong tất cả tables */
th:last-child,
td:last-child {
    text-align: center;
}

td {
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
}

tr {
    cursor: pointer;
    transition: background 0.2s;
}

tr:hover {
    background: var(--table-row-hover);
}

tr.unread {
    background: var(--table-row-unread);
    font-weight: 500;
}

tr.read {
    background: var(--table-row-read);
    color: var(--text-muted);
}

tr.new-email {
    animation: blink 1s infinite;
}

@keyframes blink {

    0%,
    100% {
        background: #e6f0fa;
    }

    50% {
        background: #a3befd;
    }
}

/* Email Detail */
.email-detail {
    margin: 10px 0;
    padding: 25px;
    background: var(--email-detail-bg);
    border-radius: 8px;
}

.email-detail h2 {
    font-size: 1.3em;
    color: var(--text-primary);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 3px solid #3b82f6;
    display: inline-block;
}

.email-detail p {
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
}

.email-detail strong {
    color: var(--text-primary);
    font-weight: 600;
    min-width: 70px;
    display: inline-block;
}

.sender-email {
    color: var(--text-muted);
    font-size: 0.9em;
    font-weight: normal;
}

@media (max-width: 480px) {
    .sender-email {
        display: block;
        font-size: 0.8em;
        margin-top: 2px;
        word-break: break-all;
    }
}

.email-detail #emailBody,
.email-detail .email-body-text {
    background: var(--bg-white);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    max-height: 400px;
    overflow-y: auto;
    word-wrap: break-word;
    margin-top: 5px;
    margin-bottom: 15px;
    line-height: 1.6;
    color: var(--text-primary);
}

.email-detail #emailBody img {
    max-width: 100%;
}

.email-detail #emailBody a {
    color: #3b82f6;
}

/* Email body iframe for HTML emails */
.email-body-container {
    margin-top: 5px;
    margin-bottom: 15px;
}

.email-body-frame {
    width: 100%;
    min-height: 200px;
    max-height: 800px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #fff;
}

.email-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

/* Notification */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    z-index: 1000;
    transition: opacity 0.5s;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.notification.success {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
}

.notification.error {
    background: linear-gradient(135deg, #c0392b, #e74c3c);
}

/* ============== RESPONSIVE - TABLET ============== */
@media (max-width: 768px) {
    body {
        background: linear-gradient(135deg, var(--bg-gradient-1), var(--bg-gradient-2));
    }

    .main-header {
        flex-direction: column;
        gap: 12px;
        text-align: center;
        padding: 12px 15px;
        margin: 0 10px 15px;
        border-radius: 0 0 12px 12px;
    }

    .logo .idk {
        font-size: 1.4em;
    }

    .logo .mail {
        font-size: 1.5em;
    }

    .nav-links {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }

    .nav-links a {
        margin: 0;
        font-size: 0.8em;
        padding: 6px 10px;
        background: var(--bg-light);
        border-radius: 6px;
    }

    .nav-links a img {
        width: 16px;
        height: 16px;
    }

    .maintenance-banner {
        margin: 0 10px 15px;
        border-radius: 8px;
        padding: 6px 0;
        font-size: 0.85em;
    }

    .container {
        padding: 15px;
        margin: 0 10px;
        border-radius: 12px;
    }

    .form-group {
        padding: 12px;
        gap: 12px;
    }

    .input-group {
        flex-direction: column;
        gap: 8px;
    }

    .input-group label {
        display: none;
    }

    input:not([type="checkbox"]):not([type="radio"]),
    select {
        width: 100%;
        padding: 14px 16px;
        font-size: 16px;
        border-radius: 10px;
    }

    .url-email {
        font-size: 0.85em;
        word-break: break-all;
    }

    /* Action buttons - 2 columns on tablet */
    .action-buttons {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 10px !important;
    }

    .action-btn {
        padding: 12px 14px;
        font-size: 13px;
        width: 100%;
        justify-content: center;
        border-radius: 10px;
    }

    .email-list-header {
        flex-direction: column;
        align-items: center;
        gap: 12px;
    }

    .email-list-header h2 {
        font-size: 1.2em;
        text-align: center;
    }

    .add-domain {
        flex-wrap: wrap;
        gap: 8px;
        justify-content: center;
    }

    .add-domain input {
        width: 130px;
        padding: 10px 12px;
        font-size: 14px;
    }

    .add-domain .action-btn {
        padding: 12px 16px;
        font-size: 13px;
    }

    .search-box input {
        padding: 14px 16px;
        font-size: 16px;
        border-radius: 10px;
    }

    /* Table responsive */
    table {
        font-size: 0.9em;
        border-radius: 10px;
    }

    th,
    td {
        padding: 12px 10px;
    }

    th {
        font-size: 0.7em;
        padding: 14px 10px;
    }

    /* Email detail */
    .email-detail {
        padding: 15px;
        border-radius: 12px;
    }

    .email-detail h2 {
        font-size: 1.1em;
    }

    .email-detail p {
        font-size: 13px;
    }

    .email-detail #emailBody {
        padding: 12px;
        font-size: 14px;
        border-radius: 10px;
    }

    .email-actions {
        flex-direction: column;
        gap: 8px;
    }

    .email-actions .action-btn {
        width: 100%;
        padding: 14px;
    }

    #paginationInfo {
        flex-direction: column;
        gap: 10px;
        text-align: center;
        padding: 12px;
        border-radius: 10px;
    }

    .notification {
        left: 10px;
        right: 10px;
        top: 10px;
        text-align: center;
        border-radius: 10px;
    }
}

/* ============== RESPONSIVE - MOBILE (iPhone, Android) ============== */
@media (max-width: 480px) {
    .main-header {
        padding: 10px 12px;
        margin: 0 6px 12px;
        border-radius: 0 0 14px 14px;
    }

    .logo .idk {
        font-size: 1.3em;
    }

    .logo .mail {
        font-size: 1.4em;
    }

    .nav-links {
        gap: 6px;
    }

    .nav-links a {
        font-size: 0.75em;
        padding: 6px 10px;
        border-radius: 8px;
    }

    .nav-links a img {
        display: none;
    }

    .maintenance-banner {
        margin: 0 6px 12px;
        font-size: 0.8em;
        border-radius: 10px;
    }

    .container {
        padding: 12px;
        margin: 0 6px;
        border-radius: 14px;
    }

    .form-group {
        padding: 12px;
        border-radius: 12px;
    }

    /* Action buttons - 2 columns on mobile for better UX */
    .action-buttons {
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
    }

    .action-btn {
        padding: 14px 10px;
        font-size: 12px;
        border-radius: 10px;
        min-height: 48px;
    }

    /* Table - hide date column on small screens */
    table th:nth-child(4),
    table td:nth-child(4) {
        display: none;
    }

    th,
    td {
        padding: 12px 8px;
        font-size: 0.85em;
    }

    th {
        font-size: 0.7em;
        padding: 14px 8px;
    }

    /* Checkbox column - mobile */
    #emailTable th:first-child,
    #emailTable td:first-child {
        width: 36px !important;
        min-width: 36px !important;
        max-width: 36px !important;
        padding: 10px 6px !important;
    }

    /* Sender column width - mobile */
    #emailTable th:nth-child(2),
    #emailTable td:nth-child(2) {
        width: 100px !important;
        min-width: 100px !important;
        max-width: 100px !important;
    }

    /* Subject column - mobile */
    #emailTable th:nth-child(3),
    #emailTable td:nth-child(3) {
        width: auto;
    }

    /* Date column - mobile */
    #emailTable th:nth-child(4),
    #emailTable td:nth-child(4) {
        width: 100px !important;
        min-width: 100px !important;
        max-width: 100px !important;
        text-align: center !important;
    }

    .email-detail {
        padding: 14px;
        margin: 10px 0;
        border-radius: 12px;
    }

    .email-detail h2 {
        font-size: 1.05em;
        margin-bottom: 12px;
    }

    .email-detail p {
        font-size: 13px;
        margin-bottom: 8px;
    }

    .email-detail strong {
        min-width: 60px;
        font-size: 13px;
    }

    .email-detail #emailBody {
        padding: 12px;
        font-size: 14px;
        max-height: 350px;
        border-radius: 10px;
    }

    .email-actions {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .email-actions .action-btn {
        padding: 14px;
        font-size: 12px;
    }

    .pagination-btn {
        padding: 10px 12px !important;
        font-size: 12px !important;
        min-height: 44px;
    }

    .pagination-page {
        padding: 8px 12px;
        font-size: 12px;
    }

    #paginationInfo {
        border-radius: 10px;
    }

    #paginationInfo select {
        padding: 10px;
        font-size: 15px;
        min-height: 44px;
    }

    /* Attachment */
    .attachment-item {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 12px;
    }

    .attachment-item button {
        width: 100%;
        min-height: 44px;
    }

    .attachment-list {
        border-radius: 10px;
    }

    /* Search box */
    .search-box input {
        padding: 14px 16px;
        font-size: 16px;
        border-radius: 10px;
    }

    /* Add domain section */
    .add-domain {
        flex-wrap: wrap;
        gap: 8px;
    }

    .add-domain input {
        width: 120px;
        font-size: 13px;
    }

    /* Bulk actions */
    .bulk-actions-bar {
        border-radius: 10px;
        padding: 12px;
    }

    .bulk-buttons .action-btn {
        padding: 12px;
        font-size: 12px;
    }
}

/* ============== RESPONSIVE - SMALL MOBILE ============== */
@media (max-width: 360px) {
    .main-header {
        padding: 8px 10px;
        margin: 0 4px 10px;
    }

    .logo .idk {
        font-size: 1.15em;
    }

    .logo .mail {
        font-size: 1.25em;
    }

    .nav-links {
        gap: 4px;
    }

    .nav-links a {
        font-size: 0.7em;
        padding: 5px 8px;
    }

    .maintenance-banner {
        margin: 0 4px 10px;
    }

    .container {
        padding: 10px;
        margin: 0 4px;
    }

    .form-group {
        padding: 10px;
    }

    /* Action buttons - still 2 columns but smaller */
    .action-buttons {
        gap: 6px !important;
    }

    .action-btn {
        padding: 12px 8px;
        font-size: 11px;
    }

    th,
    td {
        padding: 10px 6px;
        font-size: 0.8em;
    }

    th {
        font-size: 0.65em;
    }

    /* Checkbox column - small mobile */
    #emailTable th:first-child,
    #emailTable td:first-child {
        width: 30px !important;
        min-width: 30px !important;
        max-width: 30px !important;
        padding: 6px 4px !important;
    }

    /* Sender column - small mobile */
    #emailTable th:nth-child(2),
    #emailTable td:nth-child(2) {
        width: 70px !important;
        min-width: 70px !important;
        max-width: 80px !important;
    }

    /* Date column - small mobile */
    #emailTable th:nth-child(4),
    #emailTable td:nth-child(4) {
        width: 80px !important;
        min-width: 80px !important;
        max-width: 90px !important;
        text-align: center !important;
    }

    .email-detail {
        padding: 10px;
    }

    .email-detail h2 {
        font-size: 0.95em;
    }

    .email-detail p {
        font-size: 12px;
    }

    .email-detail #emailBody {
        font-size: 13px;
        padding: 10px;
    }

    .email-actions .action-btn {
        padding: 12px;
        font-size: 11px;
    }

    .search-box input {
        padding: 12px 14px;
        font-size: 15px;
    }

    .add-domain {
        gap: 6px;
    }

    .add-domain input {
        width: 100px;
        font-size: 12px;
        padding: 8px 10px;
    }

    #paginationInfo {
        padding: 10px;
    }

    .pagination-btn {
        padding: 8px 10px !important;
        font-size: 11px !important;
    }
}

/* ============== LANDSCAPE MODE ============== */
@media (max-width: 900px) and (orientation: landscape) {
    .container {
        margin: 0 15px;
    }

    .email-detail #emailBody {
        max-height: 200px;
    }

    .action-buttons {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 8px !important;
    }

    .main-header {
        flex-direction: row;
        padding: 8px 15px;
    }

    .nav-links {
        gap: 6px;
    }

    .email-actions {
        grid-template-columns: repeat(4, 1fr) !important;
    }
}

/* ============== LANDSCAPE MODE - MOBILE ============== */
@media (max-height: 500px) and (orientation: landscape) {
    .main-header {
        padding: 6px 12px;
        margin-bottom: 8px;
    }

    .logo .idk,
    .logo .mail {
        font-size: 1.2em;
    }

    .maintenance-banner {
        padding: 4px 0;
        margin-bottom: 8px;
    }

    .container {
        padding: 10px;
    }

    .form-group {
        padding: 10px;
        margin-bottom: 10px;
    }

    .email-detail #emailBody {
        max-height: 150px;
    }

    .action-btn {
        padding: 10px 12px;
        font-size: 12px;
    }
}

/* ============== TOUCH FRIENDLY ============== */
@media (hover: none) and (pointer: coarse) {

    button,
    .action-btn,
    .pagination-btn {
        min-height: 48px;
    }

    tr:active {
        background: rgba(102, 126, 234, 0.2) !important;
    }

    input:not([type="checkbox"]):not([type="radio"]),
    select {
        min-height: 48px;
    }

    /* Larger tap targets */
    .nav-links a {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }

    /* Better touch feedback */
    .action-btn:active {
        transform: scale(0.97);
        opacity: 0.9;
    }

    /* Swipe hint for table rows */
    #emailTable tbody tr {
        position: relative;
    }
}

/* ============== DESKTOP ENHANCEMENTS (Large screens) ============== */
@media (min-width: 1200px) {
    .main-header {
        max-width: 1100px;
        padding: 20px 40px;
    }

    .maintenance-banner {
        max-width: 1100px;
    }

    .container {
        max-width: 1100px;
        padding: 40px;
    }

    .form-group {
        padding: 25px;
    }

    .input-group {
        gap: 15px;
    }

    input:not([type="checkbox"]):not([type="radio"]),
    select {
        padding: 14px 18px;
        font-size: 1.05em;
    }

    .action-buttons {
        display: flex !important;
        flex-wrap: wrap;
        gap: 12px !important;
    }

    .action-btn {
        padding: 12px 24px;
        font-size: 14px;
    }

    table {
        font-size: 1em;
    }

    th,
    td {
        padding: 16px 18px;
    }

    th {
        font-size: 0.85em;
        padding: 18px;
    }

    .email-detail {
        padding: 30px;
    }

    .email-detail h2 {
        font-size: 1.4em;
    }

    .email-detail p {
        font-size: 15px;
    }

    .email-detail #emailBody {
        padding: 25px;
        font-size: 15px;
        max-height: 500px;
    }

    .email-actions {
        display: flex !important;
        flex-wrap: wrap;
        gap: 12px;
    }

    .email-actions .action-btn {
        width: auto;
        padding: 12px 24px;
    }

    .search-box input {
        padding: 16px 20px;
        font-size: 15px;
    }

    .site-footer {
        max-width: 1100px;
    }
}

/* ============== ULTRA WIDE SCREENS ============== */
@media (min-width: 1600px) {
    .main-header {
        max-width: 1300px;
    }

    .maintenance-banner {
        max-width: 1300px;
    }

    .container {
        max-width: 1300px;
        padding: 45px;
    }

    .site-footer {
        max-width: 1300px;
    }

    table {
        font-size: 1.05em;
    }

    th,
    td {
        padding: 18px 20px;
    }
}

/* ============== iOS SPECIFIC FIXES ============== */
@supports (-webkit-touch-callout: none) {

    input:not([type="checkbox"]):not([type="radio"]),
    select,
    button {
        -webkit-appearance: none;
        appearance: none;
        border-radius: 10px;
    }

    input:focus,
    select:focus {
        font-size: 16px;
    }

    /* Fix iOS scroll bounce */
    .email-detail #emailBody {
        -webkit-overflow-scrolling: touch;
    }

    /* Better iOS button styling */
    .action-btn {
        -webkit-tap-highlight-color: transparent;
    }

    /* Fix iOS input zoom */
    input[type="text"],
    input[type="email"],
    select {
        font-size: 16px;
    }
}

/* ============== ANDROID SPECIFIC FIXES ============== */
@media screen and (-webkit-min-device-pixel-ratio: 0) and (min-resolution: .001dpcm) {

    /* Better touch feedback for Android */
    .action-btn {
        -webkit-tap-highlight-color: rgba(102, 126, 234, 0.3);
    }

    /* Fix Android input styling */
    input:not([type="checkbox"]):not([type="radio"]),
    select {
        border-radius: 10px;
    }
}

/* ============== SAFE AREA (iPhone X, 11, 12, 13, 14, 15, 16) ============== */
@supports (padding: max(0px)) {
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }

    .container {
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
        margin-bottom: max(20px, env(safe-area-inset-bottom));
    }

    .main-header {
        padding-top: max(12px, env(safe-area-inset-top));
        padding-left: max(15px, env(safe-area-inset-left));
        padding-right: max(15px, env(safe-area-inset-right));
    }

    .notification {
        top: max(15px, env(safe-area-inset-top));
        left: max(10px, env(safe-area-inset-left));
        right: max(10px, env(safe-area-inset-right));
    }

    .site-footer {
        padding-bottom: max(20px, env(safe-area-inset-bottom));
        padding-left: max(15px, env(safe-area-inset-left));
        padding-right: max(15px, env(safe-area-inset-right));
    }

    /* TOTP popup safe area */
    .totp-popup {
        right: max(15px, env(safe-area-inset-right));
    }

    /* Modal safe area */
    .modal-content,
    .qr-modal-content {
        margin-left: max(10px, env(safe-area-inset-left));
        margin-right: max(10px, env(safe-area-inset-right));
    }
}

/* ============== HIGH DPI SCREENS (Retina) ============== */
@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {
    .container {
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    }

    table {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    }

    .action-btn {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }
}

/* ============== FOLDABLE DEVICES (Samsung Fold, etc.) ============== */
@media (min-width: 600px) and (max-width: 900px) and (min-height: 800px) {
    .container {
        max-width: 95%;
        margin: 0 auto;
    }

    .action-buttons {
        grid-template-columns: repeat(3, 1fr) !important;
    }

    .email-actions {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

/* ============== TABLET PORTRAIT (iPad, etc.) ============== */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: portrait) {
    .container {
        max-width: 95%;
        margin: 0 auto;
        padding: 25px;
    }

    .action-buttons {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr);
        gap: 10px !important;
    }

    .action-btn {
        padding: 14px 16px;
        font-size: 13px;
    }

    .email-actions {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr);
    }

    table {
        font-size: 0.95em;
    }

    th,
    td {
        padding: 14px 12px;
    }
}

/* ============== TABLET LANDSCAPE (iPad, etc.) ============== */
@media (min-width: 1024px) and (max-width: 1366px) and (orientation: landscape) {
    .container {
        max-width: 95%;
        padding: 30px;
    }

    .action-buttons {
        display: flex !important;
        flex-wrap: wrap;
        gap: 10px !important;
    }

    .action-btn {
        padding: 12px 20px;
    }
}

/* Pagination */
#paginationInfo {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 15px 0;
    padding: 10px 15px;
    background: #f7fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    font-size: 13px;
    color: #4a5568;
}

.pagination-btn {
    padding: 6px 12px !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 5px !important;
    font-weight: 500 !important;
    font-size: 12px !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
    background: #fff !important;
    color: #4a5568 !important;
}

.pagination-btn:hover:not(.disabled) {
    background: #5a67d8 !important;
    color: #fff !important;
    border-color: #5a67d8 !important;
}

.pagination-btn.disabled {
    background: #edf2f7 !important;
    color: #a0aec0 !important;
    cursor: not-allowed !important;
    border-color: #e2e8f0 !important;
}

.pagination-page {
    padding: 6px 14px;
    background: #5a67d8;
    color: #fff;
    border-radius: 5px;
    font-weight: 600;
    font-size: 12px;
}

#paginationInfo select {
    padding: 5px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 5px;
    font-size: 12px;
    cursor: pointer;
    background: #fff;
    color: #4a5568;
}

#paginationInfo select:focus {
    border-color: #5a67d8;
    outline: none;
}

/* Search Box */
.search-box {
    margin: 15px 0;
}

.search-box input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s;
}

.search-box input:focus {
    border-color: #5a67d8;
    box-shadow: 0 0 0 3px rgba(90, 103, 216, 0.1);
}

/* Loading Spinner */
.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #718096;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e2e8f0;
    border-top-color: #5a67d8;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 10px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Export Button */
.export-btn {
    background: #48bb78;
    color: #fff;
    border-color: #48bb78;
}

.export-btn:hover {
    background: #38a169;
    border-color: #38a169;
}

/* Attachment Badge */
.attachment-badge {
    display: inline-block;
    background: #edf2f7;
    color: #4a5568;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    margin-left: 5px;
}

.attachment-list {
    margin-top: 15px;
    padding: 10px;
    background: #f7fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.attachment-item {
    display: flex;
    align-items: center;
    padding: 8px;
    margin: 5px 0;
    background: #fff;
    border-radius: 5px;
    border: 1px solid #e2e8f0;
}

.attachment-item a {
    color: #3498db;
    text-decoration: none;
    margin-left: 8px;
}

.attachment-item a:hover {
    text-decoration: underline;
}

/* Download Button */
.download-btn {
    background: #667eea;
    color: #fff;
    border-color: #667eea;
    margin-left: 10px;
}

.download-btn:hover {
    background: #5a67d8;
    border-color: #5a67d8;
}

/* Attachment Preview Modal */
.attachment-preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.attachment-preview-content {
    background: #fff;
    padding: 20px;
    border-radius: 10px;
    max-width: 90%;
    max-height: 90%;
    overflow: auto;
    position: relative;
    text-align: center;
}

.attachment-preview-content img {
    max-width: 100%;
    max-height: 70vh;
    border-radius: 5px;
}

.attachment-preview-content p {
    margin-top: 10px;
    color: #4a5568;
    font-weight: 500;
}

.close-preview {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 28px;
    font-weight: bold;
    color: #718096;
    cursor: pointer;
    transition: color 0.2s;
}

.close-preview:hover {
    color: #e74c3c;
}

.attachment-list h3 {
    margin-bottom: 10px;
    color: #2d3748;
    font-size: 1em;
}

/* QR Code Button */
.qr-btn {
    background: #8b5cf6;
    color: #fff;
    border-color: #8b5cf6;
}

.qr-btn:hover {
    background: #7c3aed;
    border-color: #7c3aed;
}

/* QR Code Modal */
.qr-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    animation: fadeIn 0.2s ease;
}

.qr-modal-content {
    background: var(--bg-white);
    padding: 25px 30px;
    border-radius: 16px;
    text-align: center;
    position: relative;
    max-width: 320px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

.qr-modal-content h3 {
    color: var(--text-primary);
    margin-bottom: 10px;
    font-size: 1.3em;
}

.close-qr {
    position: absolute;
    top: 12px;
    right: 15px;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s;
}

.close-qr:hover {
    color: #e74c3c;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Notification Animation */
.notification {
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, var(--bg-light) 25%, var(--border-color) 50%, var(--bg-light) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}

.skeleton-row {
    display: flex;
    gap: 15px;
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
}

.skeleton-sender {
    width: 80px;
    height: 16px;
}

.skeleton-subject {
    flex: 1;
    height: 16px;
}

.skeleton-date {
    width: 60px;
    height: 16px;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

/* TOTP Popup - Professional Floating Card */
.totp-popup {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 2000;
    animation: slideInDown 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.totp-popup-header {
    display: flex;
    align-items: center;
    gap: 16px;
    background: linear-gradient(135deg, var(--bg-white) 0%, var(--bg-light) 100%);
    padding: 14px 18px;
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(90, 103, 216, 0.15);
    backdrop-filter: blur(10px);
}

.totp-popup .totp-code {
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-size: 1.6em;
    font-weight: 700;
    letter-spacing: 5px;
    color: #5a67d8;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: all 0.3s;
    min-width: 120px;
    text-align: center;
}

.totp-popup .totp-code.totp-refresh {
    animation: codePulse 0.4s ease;
}

@keyframes codePulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.08);
    }
}

.totp-timer-mini {
    position: relative;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.totp-ring {
    width: 40px;
    height: 40px;
    transform: rotate(-90deg);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.totp-ring-bg {
    fill: none;
    stroke: var(--border-color);
    stroke-width: 3.5;
    opacity: 0.4;
}

.totp-ring-progress {
    fill: none;
    stroke: #2ecc71;
    stroke-width: 3.5;
    stroke-linecap: round;
    stroke-dasharray: 100, 100;
    transition: stroke-dasharray 1s linear, stroke 0.3s ease;
}

.totp-popup .totp-seconds {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.85em;
    font-weight: 700;
    color: #2ecc71;
    transition: color 0.3s;
}

.totp-btn-group {
    display: flex;
    gap: 4px;
}

.totp-copy-btn,
.totp-close-btn {
    background: transparent;
    border: none;
    font-size: 1.1em;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 8px;
    transition: all 0.2s ease;
    color: var(--text-muted);
}

.totp-copy-btn:hover {
    background: rgba(90, 103, 216, 0.12);
    color: #5a67d8;
    transform: scale(1.05);
}

.totp-close-btn:hover {
    background: rgba(231, 76, 60, 0.12);
    color: #e74c3c;
    transform: scale(1.05);
}

@keyframes slideInDown {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Mobile responsive */
@media (max-width: 480px) {
    .totp-popup {
        top: auto;
        bottom: 15px;
        right: 15px;
        left: 15px;
    }

    .totp-popup-header {
        justify-content: space-between;
        padding: 12px 14px;
    }

    .totp-popup .totp-code {
        font-size: 1.4em;
        letter-spacing: 3px;
    }
}

/* ============== KEYBOARD NAVIGATION ============== */
tr.keyboard-selected {
    outline: 2px solid #5a67d8 !important;
    outline-offset: -2px;
    background: rgba(90, 103, 216, 0.15) !important;
}

tr:focus {
    outline: 2px solid #5a67d8;
    outline-offset: -2px;
}

/* ============== EMAIL PREVIEW TOOLTIP ============== */
.email-preview-tooltip {
    display: none !important; /* Ẩn tooltip - dùng preview snippet thay thế */
    position: fixed;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 15px;
    max-width: 300px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    z-index: 1500;
    animation: fadeInUp 0.2s ease;
}

.email-preview-tooltip .preview-sender {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.email-preview-tooltip .preview-subject {
    color: #5a67d8;
    font-weight: 500;
    margin-bottom: 8px;
    font-size: 0.95em;
}

.email-preview-tooltip .preview-body {
    color: var(--text-muted);
    font-size: 0.85em;
    line-height: 1.5;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============== FOOTER ============== */
.site-footer {
    max-width: 1000px;
    margin: 30px auto 0;
    padding: 25px 30px;
    background: var(--bg-white);
    border-radius: 10px 10px 0 0;
    box-shadow: 0 -2px 10px var(--shadow-color);
    text-align: center;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.footer-links {
    display: flex;
    gap: 20px;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 1em;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: #5a67d8;
}

.footer-copyright {
    color: var(--text-muted);
    font-size: 1em;
}

.footer-stats {
    display: flex;
    gap: 15px;
    font-size: 0.85em;
    color: var(--text-muted);
}

.footer-stats span {
    display: flex;
    align-items: center;
    gap: 5px;
}

@media (max-width: 768px) {
    .site-footer {
        margin: 15px 10px 0;
        padding: 15px;
    }

    .footer-content {
        flex-direction: column;
        text-align: center;
    }

    .footer-links {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* ============== ACCESSIBILITY ============== */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    /* Keep banner scrolling even with reduced motion */
    .banner-scroll {
        animation: banner-scroll 25s linear infinite !important;
        animation-duration: 25s !important;
        animation-iteration-count: infinite !important;
    }
}

/* Focus visible for keyboard users */
:focus-visible {
    outline: 2px solid #5a67d8;
    outline-offset: 2px;
}

/* Skip link for screen readers */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #5a67d8;
    color: white;
    padding: 8px 16px;
    z-index: 9999;
    transition: top 0.3s;
}

.skip-link:focus {
    top: 0;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --border-color: #000;
        --text-primary: #000;
        --bg-white: #fff;
    }

    button,
    .action-btn {
        border-width: 2px;
    }
}

/* ============== EMPTY STATE IMPROVED ============== */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.empty-state-icon {
    font-size: 4em;
    margin-bottom: 15px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.empty-state-title {
    color: var(--text-primary);
    font-size: 1.2em;
    font-weight: 600;
    margin-bottom: 8px;
}

.empty-state-desc {
    color: var(--text-muted);
    font-size: 0.95em;
}

/* ============== PULL TO REFRESH INDICATOR ============== */
.pull-indicator {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%) translateY(-100%);
    background: #5a67d8;
    color: white;
    padding: 10px 20px;
    border-radius: 0 0 10px 10px;
    font-size: 0.9em;
    z-index: 1000;
    transition: transform 0.3s;
}

.pull-indicator.visible {
    transform: translateX(-50%) translateY(0);
}

/* ============== KBD STYLE ============== */
kbd {
    display: inline-block;
    padding: 3px 8px;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-size: 0.85em;
    color: var(--text-primary);
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* ============== DARK MODE FIXES ============== */
[data-theme="dark"] .url-email {
    background: rgba(90, 103, 216, 0.15);
}

[data-theme="dark"] #paginationInfo {
    background: var(--bg-light);
    border-color: var(--border-color);
}

[data-theme="dark"] .pagination-btn {
    background: var(--bg-input) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

[data-theme="dark"] .pagination-btn:hover:not(.disabled) {
    background: #5a67d8 !important;
    color: #fff !important;
}

[data-theme="dark"] .search-box input {
    border-color: var(--border-color);
}

[data-theme="dark"] h2 {
    color: var(--text-primary);
}

[data-theme="dark"] .attachment-list,
[data-theme="dark"] .attachment-item {
    background: var(--bg-light);
    border-color: var(--border-color);
}

/*
============== MODAL OVERLAY ============== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    animation: fadeIn 0.2s ease;
}

.modal-content {
    background: var(--bg-white);
    padding: 25px;
    border-radius: 16px;
    max-width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-content h3 {
    color: var(--text-primary);
    margin-bottom: 15px;
}

/* ============== SAVED 2FA KEYS ============== */
.saved-keys-list {
    max-height: 300px;
    overflow-y: auto;
}

.saved-key-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    margin: 8px 0;
    background: var(--bg-light);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid var(--border-color);
}

.saved-key-item:hover {
    background: rgba(90, 103, 216, 0.1);
    border-color: #5a67d8;
}

.saved-key-item span {
    font-weight: 500;
    color: var(--text-primary);
}

.delete-key-btn {
    background: none;
    border: none;
    font-size: 1em;
    cursor: pointer;
    padding: 5px;
    border-radius: 5px;
    transition: background 0.2s;
}

.delete-key-btn:hover {
    background: rgba(231, 76, 60, 0.2);
}

/* ============== FAVORITE BUTTON ============== */
.email-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.email-detail-header h2 {
    margin-bottom: 0;
}

.favorite-btn {
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 8px;
    transition: all 0.2s;
    color: var(--text-muted);
}

.favorite-btn:hover {
    background: rgba(255, 193, 7, 0.2);
    transform: scale(1.1);
}

.favorite-btn.active {
    color: #f1c40f;
}

/* ============== PRINT & SHARE BUTTONS ============== */
.print-btn {
    background: #6c757d;
    color: #fff;
    border-color: #6c757d;
}

.print-btn:hover {
    background: #5a6268;
    border-color: #5a6268;
}

.share-btn {
    background: #17a2b8;
    color: #fff;
    border-color: #17a2b8;
}

.share-btn:hover {
    background: #138496;
    border-color: #138496;
}

/* ============== EMAIL ROW FAVORITE INDICATOR ============== */
tr.favorite td:first-child::before {
    content: '⭐ ';
}

@media (max-width: 768px) {

    .email-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .email-actions .action-btn {
        width: 100%;
        justify-content: center;
    }
}

/* ===
=========== BULK ACTIONS BAR ============== */
.bulk-actions-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 8px;
    margin: 10px 0;
    color: white;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.bulk-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

.bulk-info input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.bulk-buttons {
    display: flex;
    gap: 8px;
}

.bulk-buttons .action-btn {
    padding: 8px 16px;
    font-size: 13px;
}

/* Checkbox styling */
#emailTable th:first-child input[type="checkbox"],
#emailTable td:first-child input[type="checkbox"],
.email-checkbox,
#headerSelectAll,
#selectAllEmails {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #667eea;
    margin: 0;
    padding: 0;
}

/* Selected row highlight */
tr:has(.email-checkbox:checked) {
    background: rgba(102, 126, 234, 0.15) !important;
}

/* ============== IMPROVED LOADING STATES ============== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-card {
    background: var(--bg-white);
    padding: 30px 50px;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.loading-card .spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 15px;
}

.loading-card p {
    color: var(--text-primary);
    font-weight: 500;
    margin: 0;
}

/* Button loading state */
button.loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

button.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Reconnecting indicator */
.reconnecting-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: white;
    padding: 12px 24px;
    border-radius: 30px;
    font-weight: 500;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    animation: bounceIn 0.5s ease;
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: translateX(-50%) scale(0.8);
    }

    50% {
        transform: translateX(-50%) scale(1.05);
    }

    100% {
        opacity: 1;
        transform: translateX(-50%) scale(1);
    }
}

/* ============== KEYBOARD SELECTED ROW ============== */
tr.keyboard-selected {
    outline: 2px solid #667eea;
    outline-offset: -2px;
    background: rgba(102, 126, 234, 0.1) !important;
}

/* ============== EMAIL PREVIEW TOOLTIP ============== */
.email-preview-tooltip {
    position: fixed;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 15px;
    max-width: 300px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.preview-sender {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.preview-subject {
    color: #667eea;
    font-weight: 500;
    margin-bottom: 8px;
}

.preview-body {
    color: var(--text-muted);
    font-size: 0.85em;
    line-height: 1.4;
}

/* ============== EMPTY STATE IMPROVEMENTS ============== */
.empty-state {
    text-align: center;
    padding: 50px 20px;
}

.empty-state-icon {
    font-size: 4em;
    margin-bottom: 15px;
    animation: float 3s ease-in-out infinite;
}

.empty-state-title {
    font-size: 1.3em;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-state-desc {
    color: var(--text-muted);
    font-size: 0.95em;
}

.empty-state kbd {
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 2px 6px;
    font-family: monospace;
    font-size: 0.9em;
}

/* ============== RESPONSIVE BULK ACTIONS ============== */
@media (max-width: 768px) {
    .bulk-actions-bar {
        flex-direction: column;
        gap: 10px;
        padding: 10px;
    }

    .bulk-buttons {
        width: 100%;
    }

    .bulk-buttons .action-btn {
        flex: 1;
    }
}

@media (max-width: 480px) {
    /* Keep checkbox visible on mobile */
    .bulk-actions-bar {
        display: none !important;
    }
}

/*
============== MODERN UI IMPROVEMENTS ============== */

/* Glassmorphism effect */
.container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

[data-theme="dark"] .container {
    background: rgba(30, 41, 59, 0.95);
}

/* Smooth transitions for all interactive elements */
button,
.action-btn,
input,
select,
a,
tr {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Better button hover effects */
.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.action-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Simple focus for inputs */
input:not([type="checkbox"]):not([type="radio"]):focus,
select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
    outline: none;
}

/* Modern table row hover */
#emailTable tbody tr:hover {
    background: linear-gradient(90deg, rgba(102, 126, 234, 0.08), rgba(118, 75, 162, 0.08));
    transform: scale(1.005);
}

/* Pulse animation for new emails */
@keyframes newEmailPulse {

    0%,
    100% {
        background: rgba(102, 126, 234, 0.1);
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.4);
    }

    50% {
        background: rgba(102, 126, 234, 0.2);
        box-shadow: 0 0 0 10px rgba(102, 126, 234, 0);
    }
}

tr.new-email {
    animation: newEmailPulse 2s ease-in-out 3;
}

/* Better notification styling */
.notification {
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.notification.success {
    background: linear-gradient(135deg, rgba(39, 174, 96, 0.95), rgba(46, 204, 113, 0.95));
}

.notification.error {
    background: linear-gradient(135deg, rgba(192, 57, 43, 0.95), rgba(231, 76, 60, 0.95));
}

/* Modern scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #5a67d8, #6b46c1);
}

/* Logo animation */
.logo {
    transition: transform 0.3s ease;
}

.logo:hover {
    transform: scale(1.05);
}

.logo .idk {
    background: linear-gradient(135deg, #154360, #1a5276);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo .mail {
    background: linear-gradient(135deg, #5dade2, #3498db);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Better focus states for accessibility */
button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Card hover effect for email detail */
.email-detail {
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.email-detail:hover {
    border-color: rgba(102, 126, 234, 0.3);
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.1);
}

/* Floating label effect for inputs */
.input-group {
    position: relative;
}

/* Better status badges */
.status {
    position: relative;
    overflow: hidden;
}

.status::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 2s infinite;
}

.status.online::before {
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        left: -100%;
    }

    100% {
        left: 100%;
    }
}

/* Modern modal backdrop */
.modal-overlay,
.qr-modal,
.attachment-preview-modal {
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

/* Ripple effect for buttons */
.action-btn {
    position: relative;
    overflow: hidden;
}

.action-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
}

.action-btn:active::after {
    width: 200px;
    height: 200px;
}

/* Better empty state */
.empty-state {
    padding: 60px 20px;
}

.empty-state-icon {
    font-size: 5em;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

/* Typing indicator for search */
.search-box input {
    transition: all 0.3s ease;
}

.search-box input:focus {
    transform: scale(1.01);
}

/* Badge animations */
.attachment-badge,
.fav-badge {
    animation: badgePop 0.3s ease;
}

@keyframes badgePop {
    0% {
        transform: scale(0);
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

/* Header shadow on scroll */
.main-header {
    transition: box-shadow 0.3s ease;
}

.main-header.scrolled {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

/* Footer gradient */
.site-footer {
    background: linear-gradient(135deg, var(--bg-white), var(--bg-light));
    border-top: 1px solid var(--border-color);
}

/* Tooltip styles */
[title] {
    position: relative;
}

/* Better checkbox styling */
input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 16px !important;
    height: 16px !important;
    min-width: 16px !important;
    max-width: 16px !important;
    min-height: 16px !important;
    max-height: 16px !important;
    border: 2px solid var(--border-color) !important;
    border-radius: 4px !important;
    background: var(--bg-input) !important;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    flex-shrink: 0;
    box-sizing: border-box !important;
    padding: 0 !important;
    margin: 0 !important;
}

input[type="checkbox"]:checked {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-color: #667eea;
}

input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 10px;
    font-weight: bold;
    line-height: 1;
}

input[type="checkbox"]:hover {
    border-color: #667eea;
}

/* Loading dots animation */
@keyframes loadingDots {

    0%,
    20% {
        content: '.';
    }

    40% {
        content: '..';
    }

    60%,
    100% {
        content: '...';
    }
}

/* Smooth page transitions */
.container,
.main-header,
.site-footer {
    animation: fadeInUp 0.5s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.action-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.action-btn:hover::before {
    left: 100%;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.action-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Modern input focus effect */
input:focus,
select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
    outline: none;
}

/* Modern container with subtle shadow */
.container {
    background: var(--bg-white);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border-color);
}

/* Modern table styling */
#emailTable {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    min-height: 200px;
    width: 100%;
    table-layout: fixed;
}

/* Column widths - balanced layout */
#emailTable th,
#emailTable td {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
    padding: 12px 15px;
}

/* Cột 1: Checkbox - 40px cố định */
table#emailTable th:first-child,
table#emailTable td:first-child {
    width: 40px !important;
    min-width: 40px !important;
    max-width: 40px !important;
    text-align: center !important;
    padding: 12px 8px !important;
}

/* Cột 2: Người gửi - 130px cố định */
table#emailTable th:nth-child(2),
table#emailTable td:nth-child(2) {
    width: 130px !important;
    min-width: 130px !important;
    max-width: 130px !important;
    text-align: left !important;
}

/* Cột 3: Tiêu đề - tự động */
table#emailTable th:nth-child(3),
table#emailTable td:nth-child(3) {
    width: auto;
    text-align: left !important;
}

/* Cột 4: Ngày - 140px cố định, căn giữa */
table#emailTable th:last-child,
table#emailTable td:last-child {
    width: 140px !important;
    min-width: 140px !important;
    max-width: 140px !important;
    text-align: center !important;
}

table#emailTable thead th {
    background: linear-gradient(135deg, #334155, #1e293b);
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-size: 0.75em;
    color: #fff;
    padding: 14px 15px;
}

table#emailTable thead th:first-child {
    padding: 14px 8px !important;
}

#emailTable tbody tr {
    transition: all 0.2s ease;
    /* Fix CLS - consistent row height */
    min-height: 60px;
    height: auto;
}

#emailTable tbody td {
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
}

#emailTable tbody tr:hover {
    background: var(--table-row-hover);
    transform: scale(1.005);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

/* Modern email row with left border indicator - dùng box-shadow thay vì border để không làm lệch cột */
#emailTable tbody tr.unread {
    box-shadow: inset 4px 0 0 #667eea;
}

#emailTable tbody tr.read {
    box-shadow: none;
}

/* Modern notification toast */
.notification {
    border-radius: 12px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.notification.success {
    background: linear-gradient(135deg, rgba(39, 174, 96, 0.95), rgba(46, 204, 113, 0.95));
}

.notification.error {
    background: linear-gradient(135deg, rgba(192, 57, 43, 0.95), rgba(231, 76, 60, 0.95));
}

/* Modern search box */
.search-box input {
    border-radius: 12px;
    padding: 14px 20px;
    font-size: 15px;
    border: 2px solid var(--border-color);
    background: var(--bg-input);
}

.search-box input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

/* Modern pagination */
.pagination-btn {
    border-radius: 8px !important;
    font-weight: 600 !important;
    transition: all 0.2s ease !important;
}

.pagination-btn:hover:not(.disabled) {
    transform: translateY(-1px);
}

.pagination-page {
    background: linear-gradient(135deg, #667eea, #764ba2) !important;
    border-radius: 8px;
    font-weight: 700;
}

/* Modern email detail card */
.email-detail {
    border-radius: 16px;
    background: var(--email-detail-bg);
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.email-detail h2 {
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    border-bottom: 3px solid #667eea;
}

/* Modern modal overlay */
.modal-overlay,
.qr-modal {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    background: rgba(0, 0, 0, 0.6);
}

.modal-content,
.qr-modal-content {
    border-radius: 20px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Modern footer */
.site-footer {
    background: linear-gradient(135deg, var(--bg-white), var(--bg-light));
    border-top: 1px solid var(--border-color);
    margin-top: 30px;
}

.footer-content {
    max-width: 1000px;
    margin: 0 auto;
    padding: 25px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    margin: 0 15px;
    font-weight: 500;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: #667eea;
}

.footer-copyright {
    color: var(--text-muted);
    font-size: 0.9em;
}

.footer-stats {
    color: var(--text-muted);
    font-size: 0.85em;
}

/* Modern form group */
.form-group {
    background: linear-gradient(135deg, var(--bg-light), var(--bg-white));
    border-radius: 16px;
    padding: 20px;
    border: 1px solid var(--border-color);
}

/* Modern status badge */
.status {
    border-radius: 20px;
    font-size: 0.8em;
    font-weight: 600;
    padding: 6px 14px;
}

.status.online {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    box-shadow: 0 2px 10px rgba(46, 204, 113, 0.3);
}

.status.Offline {
    background: linear-gradient(135deg, #c0392b, #e74c3c);
    box-shadow: 0 2px 10px rgba(231, 76, 60, 0.3);
}

/* Modern WebSocket status */
.ws-status {
    font-size: 0.9em;
    transition: all 0.3s ease;
}

.ws-status.connected {
    animation: pulse-green 2s infinite;
}

@keyframes pulse-green {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }
}

/* Modern bulk actions bar */
.bulk-actions-bar {
    border-radius: 12px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3);
}

/* Modern TOTP popup */
.totp-popup {
    border-radius: 16px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.2);
}

/* Smooth page load animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.container {
    animation: fadeInUp 0.5s ease-out;
}

.main-header {
    animation: fadeInUp 0.4s ease-out;
}

.maintenance-banner {
    animation: fadeInUp 0.45s ease-out;
}

/* Modern scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #5a67d8, #6b46c1);
}

/* Modern selection color */
::selection {
    background: rgba(102, 126, 234, 0.3);
    color: var(--text-primary);
}

/* Add subtle hover effect to nav links */
.nav-links a {
    position: relative;
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.nav-links a:hover {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
}

/* Modern URL email display */
.url-email {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 10px;
}

.url-email a {
    color: #667eea;
    font-weight: 500;
}



/* Email count badge */
.email-count {
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
}

/* Modern attachment badge */
.attachment-badge {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.75em;
    margin-left: 8px;
}

/* Favorite badge */
.fav-badge {
    margin-right: 5px;
    font-size: 0.9em;
}

/* Skip link for accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #667eea;
    color: white;
    padding: 8px 16px;
    border-radius: 0 0 8px 0;
    z-index: 100;
    transition: top 0.3s;
}

.skip-link:focus {
    top: 0;
}

/* Better dark mode transitions */
* {
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}


/* Modern action buttons container */
.action-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin: 20px 0;
}

.action-buttons .action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 10px;
}

.btn-icon {
    font-size: 1.1em;
}

/* Responsive action buttons */
@media (max-width: 768px) {
    .action-buttons {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .action-buttons .action-btn {
        padding: 12px 10px;
        font-size: 12px;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .action-buttons {
        grid-template-columns: repeat(2, 1fr);
    }

    .action-buttons .action-btn:last-child {
        grid-column: span 2;
    }
}


/* Simple footer */
.site-footer {
    background: var(--bg-white);
    border-top: 1px solid var(--border-color);
    margin-top: 30px;
    padding: 20px 0;
}

.footer-content {
    max-width: 1000px;
    margin: 0 auto;
    padding: 15px 30px;
    text-align: center;
}

.footer-links {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: #667eea;
}

.footer-copyright {
    color: var(--text-muted);
    font-size: 0.9em;
}

.footer-copyright a {
    color: #667eea;
    text-decoration: none;
}

.footer-shortcuts {
    color: var(--text-muted);
    font-size: 0.85em;
}


/* ============== NEW FEATURES STYLES ============== */

/* More Options Modal */
.more-options-modal {
    max-width: 400px;
}

.options-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
}

.option-btn {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    width: 100%;
}

.option-btn:hover {
    background: rgba(102, 126, 234, 0.1);
    border-color: #667eea;
    transform: translateX(5px);
}

.option-icon {
    font-size: 1.5em;
}

.option-text {
    display: flex;
    flex-direction: column;
}

.option-text strong {
    color: var(--text-primary);
}

.option-text small {
    color: var(--text-muted);
    font-size: 0.85em;
}

/* Input Row */
.input-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.input-row input {
    flex: 1;
}

/* Forwarding & Aliases Lists */
.forwarding-list,
.aliases-list,
.webhooks-list {
    margin-top: 15px;
    max-height: 200px;
    overflow-y: auto;
}

.forwarding-item,
.alias-item,
.webhook-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--bg-light);
    border-radius: 8px;
    margin-bottom: 8px;
    border: 1px solid var(--border-color);
}

.webhook-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.webhook-url {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.webhook-info small {
    color: var(--text-muted);
    font-size: 0.8em;
}

.delete-btn-small,
.copy-btn-small {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px 8px;
    border-radius: 6px;
    transition: background 0.2s;
}

.delete-btn-small:hover {
    background: rgba(231, 76, 60, 0.2);
}

.copy-btn-small:hover {
    background: rgba(102, 126, 234, 0.2);
}

/* Templates List */
.templates-list {
    margin-top: 15px;
    max-height: 250px;
    overflow-y: auto;
}

.template-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: var(--bg-light);
    border-radius: 10px;
    margin-bottom: 8px;
    cursor: pointer;
    border: 1px solid var(--border-color);
    transition: all 0.2s;
}

.template-item:hover {
    background: rgba(102, 126, 234, 0.1);
    border-color: #667eea;
}

.template-info {
    display: flex;
    flex-direction: column;
}

.template-info strong {
    color: var(--text-primary);
}

.template-info small {
    color: var(--text-muted);
    font-size: 0.8em;
}

.template-item code {
    background: rgba(102, 126, 234, 0.15);
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.8em;
    color: #667eea;
}

.custom-template {
    padding: 15px;
    background: var(--bg-light);
    border-radius: 10px;
    border: 1px solid var(--border-color);
}



/* More Button */
.more-btn {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d) !important;
}

.more-btn:hover {
    box-shadow: 0 6px 20px rgba(149, 165, 166, 0.4) !important;
}

/* Email Expiry Timer in email list */
.email-expiry {
    font-size: 0.75em;
    color: var(--text-muted);
    display: block;
    margin-top: 3px;
}

.email-expiry.expiring-soon {
    color: #e74c3c;
}

/* Export button in email detail */
.export-btn {
    background: linear-gradient(135deg, #1abc9c, #16a085) !important;
}

.export-btn:hover {
    box-shadow: 0 6px 20px rgba(26, 188, 156, 0.4) !important;
}


/* ============== OTP CODE HIGHLIGHT ============== */
.otp-code {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 4px 12px;
    border-radius: 6px;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-size: 1.1em;
    font-weight: 600;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 2px 4px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    user-select: none;
    -webkit-user-select: none;
}

.otp-code:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.5);
}

.otp-code:active {
    transform: scale(0.98);
}

/* Dark mode OTP */
[data-theme="dark"] .otp-code {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.4);
}

[data-theme="dark"] .otp-code:hover {
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.6);
}

/* Animation when copied */
.otp-code.copied {
    animation: otpCopied 0.3s ease;
}

@keyframes otpCopied {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
        background: #10b981;
    }

    100% {
        transform: scale(1);
    }
}


/* ============== ADMIN AUTH MODAL ANIMATIONS ============== */
@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-5px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(5px);
    }
}

.admin-auth-modal {
    animation: fadeIn 0.3s ease-out;
}

.admin-auth-content {
    animation: slideUp 0.3s ease-out;
}

/* Block screen for admin auth */
.admin-blocked-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100001;
    backdrop-filter: blur(10px);
}

.admin-blocked-content {
    text-align: center;
    color: #fff;
    padding: 40px;
}

.admin-blocked-content .icon {
    font-size: 80px;
    margin-bottom: 20px;
    animation: pulse 2s infinite;
}

.admin-blocked-content h2 {
    color: #e74c3c;
    margin-bottom: 15px;
}

.admin-blocked-content .countdown {
    font-size: 3em;
    font-family: monospace;
    color: #3498db;
    margin: 20px 0;
}


/* ============== ENHANCED MOBILE OPTIMIZATIONS ============== */

/* Better mobile email list */
@media (max-width: 480px) {

    /* Email row - card style on mobile */
    #emailTable tbody tr {
        display: block;
        margin-bottom: 8px;
        border-radius: 10px;
        border: 1px solid var(--border-color);
        overflow: hidden;
    }

    #emailTable tbody tr td {
        display: block;
        padding: 8px 12px;
        border-bottom: none;
    }

    #emailTable tbody tr td:first-child {
        display: none;
    }

    #emailTable tbody tr td:nth-child(2) {
        font-weight: 600;
        padding-top: 12px;
        max-width: none;
    }

    #emailTable tbody tr td:nth-child(3) {
        color: var(--text-muted);
        font-size: 0.9em;
        padding-bottom: 12px;
        max-width: none;
    }

    #emailTable thead {
        display: none;
    }

    /* Better touch targets */
    #emailTable tbody tr {
        min-height: 60px;
    }
}

/* Better desktop table */
@media (min-width: 769px) {
    #emailTable tbody tr:hover {
        background: linear-gradient(90deg, rgba(102, 126, 234, 0.05), rgba(118, 75, 162, 0.05));
    }

    #emailTable tbody tr.unread:hover {
        background: linear-gradient(90deg, rgba(102, 126, 234, 0.12), rgba(118, 75, 162, 0.08));
    }
}

/* Smooth scrolling for mobile */
@media (max-width: 768px) {
    html {
        scroll-behavior: smooth;
    }

    .container {
        overflow-x: hidden;
    }

    /* Better modal on mobile */
    .modal-content,
    .qr-modal-content {
        width: 95%;
        max-width: 350px;
        margin: 0 auto;
        max-height: 85vh;
        overflow-y: auto;
    }

    /* Better notification position on mobile */
    .notification {
        bottom: auto;
        top: 10px;
        left: 10px;
        right: 10px;
        max-width: none;
    }
}

/* Better form elements on all devices */
input:not([type="checkbox"]):not([type="radio"]),
select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23667eea' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

/* Dark mode select arrow */
[data-theme="dark"] select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23a78bfa' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
}

/* Better focus states for accessibility */
@media (max-width: 768px) {

    button:focus,
    input:focus,
    select:focus,
    a:focus {
        outline: 2px solid #667eea;
        outline-offset: 2px;
    }
}

/* Prevent horizontal scroll */
body {
    overflow-x: hidden;
}

/* Better loading states on mobile */
@media (max-width: 480px) {
    .loading-spinner {
        padding: 30px;
    }

    .spinner {
        width: 35px;
        height: 35px;
    }

    .loading-spinner span {
        font-size: 0.9em;
    }
}

/* PWA standalone mode optimizations */
@media (display-mode: standalone) {
    .main-header {
        padding-top: 10px;
    }

    body {
        padding-top: 0;
    }
}

/* Print styles */
@media print {

    .main-header,
    .maintenance-banner,
    .action-buttons,
    .add-domain,
    .search-box,
    .bulk-actions-bar,
    #paginationInfo,
    .site-footer,
    .notification,
    .totp-popup {
        display: none !important;
    }

    .container {
        box-shadow: none;
        border: none;
        max-width: 100%;
        padding: 0;
        margin: 0;
    }

    .email-detail {
        box-shadow: none;
        border: 1px solid #ddd;
    }

    .email-detail #emailBody {
        max-height: none;
        overflow: visible;
    }
}


/* =============================================================================
   ADVANCED FEATURES STYLES
   ============================================================================= */

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    backdrop-filter: blur(5px);
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content {
    background: var(--bg-white);
    border-radius: 16px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    color: var(--text-muted);
    padding: 5px 10px;
    border-radius: 8px;
    transition: all 0.2s;
}

.close-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    color: var(--text-primary);
}

/* Compose Modal */
.compose-content {
    max-width: 600px;
}

.compose-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.compose-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.2em;
}

.compose-form {
    padding: 20px;
}

.compose-field {
    margin-bottom: 15px;
}

.compose-field label {
    display: block;
    margin-bottom: 5px;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9em;
}

.compose-field input,
.compose-field textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 14px;
    background: var(--bg-input);
    color: var(--text-primary);
    transition: border-color 0.2s;
}

.compose-field input:focus,
.compose-field textarea:focus {
    border-color: #667eea;
    outline: none;
}

.compose-field textarea {
    resize: vertical;
    min-height: 150px;
    font-family: inherit;
}

.compose-actions {
    display: flex;
    gap: 10px;
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    justify-content: flex-end;
}

.send-btn {
    background: linear-gradient(135deg, #2ecc71, #27ae60) !important;
}

/* Search Modal */
.search-content {
    max-width: 550px;
}

.search-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.search-header h3 {
    margin: 0;
    color: var(--text-primary);
}

.search-form {
    padding: 20px;
}

.search-field {
    margin-bottom: 15px;
}

.search-field label {
    display: block;
    margin-bottom: 5px;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9em;
}

.search-field input {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 14px;
    background: var(--bg-input);
    color: var(--text-primary);
}

.search-row {
    display: flex;
    gap: 15px;
}

.search-row .search-field {
    flex: 1;
}

.checkbox-field label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.checkbox-field input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.search-actions {
    display: flex;
    gap: 10px;
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    justify-content: flex-end;
}

.search-results {
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    max-height: 300px;
    overflow-y: auto;
}

.results-header {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.result-item {
    padding: 12px;
    border-radius: 8px;
    background: var(--bg-light);
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.result-item:hover {
    background: var(--table-row-hover);
    transform: translateX(5px);
}

.result-sender {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9em;
}

.result-subject {
    color: var(--text-secondary);
    font-size: 0.85em;
    margin-top: 3px;
}

.result-date {
    color: var(--text-muted);
    font-size: 0.8em;
    margin-top: 3px;
}

.no-results,
.no-data,
.no-labels,
.no-favorites,
.no-rules {
    text-align: center;
    color: var(--text-muted);
    padding: 30px;
    font-size: 0.95em;
}

/* Labels Modal */
.labels-content {
    max-width: 400px;
}

.labels-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.labels-header h3 {
    margin: 0;
    color: var(--text-primary);
}

.labels-form {
    padding: 20px;
}

.labels-input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.labels-input-group input {
    flex: 1;
    padding: 10px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-input);
    color: var(--text-primary);
}

.current-labels {
    margin-top: 15px;
}

.label-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: var(--bg-light);
    border-radius: 8px;
    margin-bottom: 8px;
}

.label-name {
    font-weight: 500;
    color: var(--text-primary);
}

.label-count {
    color: var(--text-muted);
    font-size: 0.85em;
}

.preset-labels {
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.preset-labels span {
    color: var(--text-muted);
    font-size: 0.85em;
}

.preset-labels button {
    padding: 6px 12px;
    font-size: 0.8em;
    border-radius: 20px;
    background: var(--bg-light);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.preset-labels button:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* Favorites Modal */
.favorites-content {
    max-width: 500px;
}

.favorites-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.favorites-header h3 {
    margin: 0;
    color: var(--text-primary);
}

.favorites-list {
    padding: 15px 20px;
    max-height: 400px;
    overflow-y: auto;
}

.favorite-item {
    padding: 12px;
    border-radius: 8px;
    background: var(--bg-light);
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.favorite-item:hover {
    background: var(--table-row-hover);
}

.fav-sender {
    font-weight: 500;
    color: var(--text-primary);
}

.fav-subject {
    color: var(--text-secondary);
    font-size: 0.9em;
    margin-top: 3px;
}

.fav-date {
    color: var(--text-muted);
    font-size: 0.8em;
    margin-top: 3px;
}

/* Export Modal */
.export-content {
    max-width: 400px;
}

.export-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.export-header h3 {
    margin: 0;
    color: var(--text-primary);
}

.export-options {
    padding: 20px;
}

.export-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    padding: 20px;
    margin-bottom: 10px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-light);
    cursor: pointer;
    transition: all 0.2s;
}

.export-option:hover {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.05);
}

.export-icon {
    font-size: 2em;
    margin-bottom: 8px;
}

.export-label {
    font-weight: 600;
    color: var(--text-primary);
}

.export-desc {
    font-size: 0.8em;
    color: var(--text-muted);
    margin-top: 5px;
}

/* Statistics Modal */
.stats-content {
    max-width: 500px;
}

.stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.stats-header h3 {
    margin: 0;
    color: var(--text-primary);
}

.stats-body {
    padding: 20px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.stat-card {
    text-align: center;
    padding: 20px 15px;
    background: var(--bg-light);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.stat-icon {
    font-size: 1.8em;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 1.8em;
    font-weight: 700;
    color: #667eea;
}

.stat-label {
    font-size: 0.8em;
    color: var(--text-muted);
    margin-top: 5px;
}

.stats-section {
    margin-top: 20px;
}

.stats-section h4 {
    color: var(--text-primary);
    margin-bottom: 12px;
    font-size: 1em;
}

.top-senders {
    background: var(--bg-light);
    border-radius: 10px;
    padding: 10px;
}

.sender-item {
    display: flex;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
}

.sender-item:last-child {
    border-bottom: none;
}

.sender-rank {
    font-weight: 700;
    color: #667eea;
    width: 30px;
}

.sender-email {
    flex: 1;
    color: var(--text-primary);
    font-size: 0.9em;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sender-count {
    color: var(--text-muted);
    font-size: 0.85em;
}

.timeline-info {
    background: var(--bg-light);
    border-radius: 10px;
    padding: 15px;
}

.timeline-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.timeline-item:last-child {
    border-bottom: none;
}

.timeline-item span:first-child {
    color: var(--text-secondary);
}

.timeline-item span:last-child {
    color: var(--text-primary);
    font-weight: 500;
}


/* Forwarding Modal */
.forwarding-content {
    max-width: 450px;
}

.forwarding-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.forwarding-header h3 {
    margin: 0;
    color: var(--text-primary);
}

.forwarding-form {
    padding: 20px;
}

.forwarding-desc {
    color: var(--text-muted);
    font-size: 0.9em;
    margin-bottom: 15px;
}

.forwarding-input-group {
    display: flex;
    gap: 10px;
}

.forwarding-input-group input {
    flex: 1;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-input);
    color: var(--text-primary);
}

.forwarding-rules {
    margin-top: 20px;
}

.rule-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: var(--bg-light);
    border-radius: 8px;
    margin-bottom: 8px;
}

.rule-target {
    flex: 1;
    color: var(--text-primary);
    font-size: 0.9em;
}

.rule-status {
    font-size: 0.9em;
}

.delete-rule-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1em;
    padding: 5px;
    border-radius: 5px;
    transition: background 0.2s;
}

.delete-rule-btn:hover {
    background: rgba(231, 76, 60, 0.1);
}

/* Auto-refresh Modal */
.refresh-content {
    max-width: 350px;
}

.refresh-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.refresh-header h3 {
    margin: 0;
    color: var(--text-primary);
}

.refresh-form {
    padding: 20px;
}

.refresh-field {
    margin-bottom: 15px;
}

.refresh-field label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-weight: 500;
}

.refresh-field input {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 16px;
    background: var(--bg-input);
    color: var(--text-primary);
}

.refresh-presets {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.refresh-presets button {
    padding: 8px 16px;
    border-radius: 20px;
    background: var(--bg-light);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    font-size: 0.9em;
}

.refresh-presets button:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.refresh-actions {
    display: flex;
    gap: 10px;
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
}

.refresh-actions button {
    flex: 1;
}

/* Themes Modal */
.themes-content {
    max-width: 450px;
}

.themes-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.themes-header h3 {
    margin: 0;
    color: var(--text-primary);
}

.themes-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 20px;
}

.theme-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 15px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-light);
    cursor: pointer;
    transition: all 0.2s;
}

.theme-option:hover {
    border-color: #667eea;
    transform: translateY(-2px);
}

.theme-option.active {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.1);
}

.theme-icon {
    font-size: 2em;
    margin-bottom: 8px;
}

.theme-name {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9em;
}

.custom-css-section {
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

.custom-css-section h4 {
    color: var(--text-primary);
    margin-bottom: 10px;
}

.custom-css-section textarea {
    width: 100%;
    height: 100px;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-family: monospace;
    font-size: 12px;
    background: var(--bg-input);
    color: var(--text-primary);
    resize: vertical;
    margin-bottom: 10px;
}

/* More Options Modal */
.more-options-content {
    max-width: 400px;
}

.more-options-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.more-options-header h3 {
    margin: 0;
    color: var(--text-primary);
}

.more-options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 20px;
}

.option-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 15px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-light);
    cursor: pointer;
    transition: all 0.2s;
}

.option-item:hover {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.05);
    transform: translateY(-2px);
}

.option-icon {
    font-size: 1.8em;
    margin-bottom: 8px;
}

.option-label {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.85em;
    text-align: center;
}

/* Custom Theme Colors */
.theme-blue {
    --bg-gradient-1: #0c2461;
    --bg-gradient-2: #1e3799;
}

.theme-purple {
    --bg-gradient-1: #2c003e;
    --bg-gradient-2: #512b58;
}

.theme-green {
    --bg-gradient-1: #0a3d2e;
    --bg-gradient-2: #145a32;
}

.theme-orange {
    --bg-gradient-1: #4a1c00;
    --bg-gradient-2: #7d3200;
}

/* Loading Spinner Small */
.loading-spinner-small {
    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 linear infinite;
}

/* Loading State */
.loading {
    text-align: center;
    padding: 30px;
    color: var(--text-muted);
}

.error {
    text-align: center;
    padding: 30px;
    color: #e74c3c;
}

/* Email Row Favorite */
tr.favorite {
    background: linear-gradient(90deg, rgba(241, 196, 15, 0.1), transparent) !important;
}

.fav-badge {
    margin-right: 5px;
}

/* Attachment Badge */
.attachment-badge {
    margin-left: 8px;
    font-size: 0.9em;
}

/* Email Expiry */
.email-expiry {
    display: block;
    font-size: 0.75em;
    color: var(--text-muted);
    margin-top: 2px;
}

.email-expiry.expiring-soon {
    color: #e74c3c;
    font-weight: 500;
}

/* Shake Animation */
@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-5px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(5px);
    }
}

/* Responsive Modals */
@media (max-width: 480px) {
    .modal-content {
        width: 95%;
        max-height: 95vh;
        border-radius: 12px;
    }

    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .stat-card {
        padding: 12px 8px;
    }

    .stat-value {
        font-size: 1.4em;
    }

    .stat-label {
        font-size: 0.7em;
    }

    .themes-grid,
    .more-options-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .theme-option,
    .option-item {
        padding: 15px 10px;
    }

    .theme-icon,
    .option-icon {
        font-size: 1.5em;
    }

    .compose-field textarea {
        min-height: 120px;
    }

    .search-row {
        flex-direction: column;
        gap: 0;
    }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 50px 20px;
}

.empty-state-icon {
    font-size: 4em;
    margin-bottom: 15px;
}

.empty-state-title {
    font-size: 1.3em;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-state-desc {
    color: var(--text-muted);
    font-size: 0.95em;
}

/* Keyboard Shortcut Style */
kbd {
    display: inline-block;
    padding: 3px 8px;
    font-size: 0.85em;
    font-family: monospace;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}


/* Compose Button */
.compose-btn {
    background: linear-gradient(135deg, #9b59b6, #8e44ad) !important;
    color: #fff;
    box-shadow: 0 4px 15px rgba(155, 89, 182, 0.3);
}

.compose-btn:hover {
    box-shadow: 0 6px 20px rgba(155, 89, 182, 0.4);
}

/* Reply Button */
.reply-btn {
    background: linear-gradient(135deg, #3498db, #2980b9) !important;
}

/* Labels Button */
.labels-btn {
    background: linear-gradient(135deg, #e67e22, #d35400) !important;
}

/* Favorite Button in Email Detail */
.email-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.favorite-btn {
    background: none;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.3em;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.favorite-btn:hover {
    border-color: #f1c40f;
    background: rgba(241, 196, 15, 0.1);
}

.favorite-btn.active {
    border-color: #f1c40f;
    background: rgba(241, 196, 15, 0.2);
}

/* Action Buttons Grid */
.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
}

/* Notification Toggle Active */
#notificationToggle.active {
    color: #2ecc71;
}

/* Auto Refresh Button */
#autoRefreshBtn {
    transition: all 0.2s;
}

#autoRefreshBtn:hover {
    transform: scale(1.1);
}


/* Options List in More Options */
.options-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 15px 0;
}

.option-btn {



    /* ============== LANGUAGE BUTTON ============== */
    .lang-btn {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 8px 14px !important;
        background: linear-gradient(135deg, #667eea, #764ba2) !important;
        border: none !important;
        border-radius: 20px !important;
        color: #fff !important;
        font-size: 13px !important;
        font-weight: 600 !important;
        cursor: pointer;
        transition: all 0.3s ease;
        box-shadow: 0 3px 12px rgba(102, 126, 234, 0.35);
    }

    .lang-btn:hover {
        transform: translateY(-2px) scale(1.02);
        box-shadow: 0 5px 20px rgba(102, 126, 234, 0.5);
    }

    .lang-btn:active {
        transform: translateY(0) scale(0.98);
    }

    .lang-flag {
        font-size: 16px;
    }

    .lang-text {
        letter-spacing: 0.5px;
    }

    @media (max-width: 480px) {
        .lang-btn {
            padding: 6px 12px !important;
            font-size: 12px !important;
        }

        .lang-flag {
            font-size: 14px;
        }
    }


    /* ============== DONATE LINK ============== */
    .donate-link {
        display: inline-flex;
        align-items: center;
        gap: 5px;
        padding: 8px 16px !important;
        background: linear-gradient(135deg, #27ae60, #2ecc71) !important;
        color: #fff !important;
        border-radius: 20px !important;
        font-weight: 600 !important;
        font-size: 0.9em !important;
        text-decoration: none !important;
        transition: all 0.3s ease;
        box-shadow: 0 3px 12px rgba(39, 174, 96, 0.35);
    }

    .donate-link:hover {
        transform: translateY(-2px) scale(1.02);
        box-shadow: 0 5px 20px rgba(39, 174, 96, 0.5);
        color: #fff !important;
        background: linear-gradient(135deg, #2ecc71, #27ae60) !important;
    }

    @media (max-width: 480px) {
        .donate-link {
            padding: 6px 12px !important;
            font-size: 0.8em !important;
        }
    }
}


/* =============================================================================
   FEATURES MODULE STYLES - Added for js/features.js components
   ============================================================================= */

/* More Options Menu */
.more-options-menu {
    position: fixed;
    background: var(--bg-white);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    min-width: 200px;
    z-index: 3000;
    overflow: hidden;
    animation: slideDown 0.2s ease;
}

.more-options-menu .menu-item {
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
}

.more-options-menu .menu-item:hover {
    background: var(--bg-light);
}

.more-options-menu .menu-divider {
    height: 1px;
    background: var(--border-color);
    margin: 5px 0;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Compose Modal */
.compose-modal .compose-content {
    max-width: 600px;
    width: 95%;
}

.compose-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.compose-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.compose-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.compose-field label {
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.9em;
}

.compose-field input,
.compose-field textarea {
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1em;
    background: var(--bg-light);
    color: var(--text-primary);
    transition: border-color 0.2s;
}

.compose-field input:focus,
.compose-field textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.compose-field textarea {
    resize: vertical;
    min-height: 150px;
}

.compose-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

/* Favorites Modal */
.favorites-modal .favorites-content {
    max-width: 500px;
    width: 95%;
}

.favorites-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.favorites-list {
    max-height: 400px;
    overflow-y: auto;
}

.favorite-item {
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.favorite-item:hover {
    background: var(--bg-light);
    border-color: var(--primary-color);
}

.fav-sender {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.fav-subject {
    color: var(--text-secondary);
    font-size: 0.9em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fav-date {
    color: var(--text-muted);
    font-size: 0.8em;
    margin-top: 4px;
}

.no-favorites {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

/* Labels Modal */
.labels-modal .labels-content {
    max-width: 450px;
    width: 95%;
}

.labels-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.labels-form {
    margin-bottom: 20px;
}

.labels-input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.labels-input-group input {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-light);
    color: var(--text-primary);
}

.preset-labels {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.preset-labels span {
    color: var(--text-muted);
    font-size: 0.9em;
}

.label-preset {
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: var(--bg-light);
    cursor: pointer;
    font-size: 0.85em;
    transition: all 0.2s;
}

.label-preset:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.current-labels {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.label-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    background: var(--primary-color);
    color: white;
    border-radius: 15px;
    font-size: 0.85em;
}

.label-tag .remove-label {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0;
    font-size: 1.1em;
    line-height: 1;
    opacity: 0.7;
}

.label-tag .remove-label:hover {
    opacity: 1;
}

.no-labels {
    color: var(--text-muted);
    font-style: italic;
}

/* Search Modal */
.search-modal .search-content {
    max-width: 550px;
    width: 95%;
}

.search-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.search-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.search-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.search-field label {
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.9em;
}

.search-field input[type="text"],
.search-field input[type="date"] {
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-light);
    color: var(--text-primary);
}

.search-row {
    display: flex;
    gap: 15px;
}

.search-row .search-field {
    flex: 1;
}

.checkbox-field {
    flex-direction: row !important;
    align-items: center;
}

.checkbox-field label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.search-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 15px;
}

.search-results {
    margin-top: 20px;
    border-top: 1px solid var(--border-color);
    padding-top: 15px;
}

.results-header {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.results-list {
    max-height: 300px;
    overflow-y: auto;
}

.result-item {
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.result-item:hover {
    background: var(--bg-light);
    border-color: var(--primary-color);
}

.result-sender {
    font-weight: 600;
    color: var(--text-primary);
}

.result-subject {
    color: var(--text-secondary);
    font-size: 0.9em;
}

.result-date {
    color: var(--text-muted);
    font-size: 0.8em;
}

.no-results {
    text-align: center;
    padding: 30px;
    color: var(--text-muted);
}

/* Statistics Modal */
.stats-modal .stats-content {
    max-width: 500px;
    width: 95%;
}

.stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--bg-light);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
}

.stat-icon {
    font-size: 2em;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 1.8em;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.9em;
    margin-top: 5px;
}

.stats-info {
    background: var(--bg-light);
    padding: 15px;
    border-radius: 8px;
}

.stats-info p {
    margin: 8px 0;
    color: var(--text-secondary);
}

/* Export Modal */
.export-modal .export-content {
    max-width: 400px;
    width: 95%;
}

.export-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.export-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.export-option {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 15px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-light);
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.export-option:hover {
    border-color: var(--primary-color);
    background: rgba(102, 126, 234, 0.05);
}

.export-icon {
    font-size: 1.5em;
    margin-bottom: 5px;
}

.export-label {
    font-weight: 600;
    color: var(--text-primary);
}

.export-desc {
    font-size: 0.85em;
    color: var(--text-muted);
    margin-top: 3px;
}

/* Shortcuts Modal */
.shortcuts-modal .shortcuts-content {
    max-width: 350px;
    width: 95%;
}

.shortcuts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.shortcuts-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.shortcut-item {
    display: flex;
    align-items: center;
    gap: 15px;
}

.shortcut-item kbd {
    display: inline-block;
    padding: 5px 10px;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-family: monospace;
    font-size: 0.9em;
    min-width: 40px;
    text-align: center;
}

.shortcut-item span {
    color: var(--text-secondary);
}

/* Close button for modals */
.close-btn {
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    color: var(--text-muted);
    padding: 5px;
    line-height: 1;
    transition: color 0.2s;
}

.close-btn:hover {
    color: var(--text-primary);
}

/* Loading state */
.loading {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
}

.loading-spinner-small {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Icon button styles */
.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2em;
    padding: 5px;
    transition: transform 0.2s;
}

.icon-btn:hover {
    transform: scale(1.1);
}

/* Admin button */
.admin-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1em;
    padding: 5px;
    color: var(--primary-color);
    font-weight: bold;
    transition: color 0.2s;
}

.admin-btn:hover {
    color: var(--primary-dark);
}

/* Cancel button */
.cancel-btn {
    background: #95a5a6 !important;
}

.cancel-btn:hover {
    background: #7f8c8d !important;
}

/* Pagination info */
.pagination-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 15px 0;
    padding: 10px;
    background: var(--bg-light);
    border-radius: 8px;
    flex-wrap: wrap;
    gap: 10px;
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .search-row {
        flex-direction: column;
    }

    .compose-actions,
    .search-actions {
        flex-direction: column;
    }

    .compose-actions button,
    .search-actions button {
        width: 100%;
    }
}


/* ============== EMAIL DETAIL COMPACT ============== */
.email-header-compact {
    margin-bottom: 15px;
    padding-bottom: 12px;
    border-bottom: 2px solid #3b82f6;
}

.email-header-compact h2 {
    font-size: 1.2em;
    color: var(--text-primary);
    margin: 0 0 6px 0;
    padding: 0;
    border: none;
    display: block;
}

.email-meta {
    font-size: 0.85em;
    color: var(--text-muted);
}

/* Email actions compact */
.email-detail .email-actions {
    display: flex;
    gap: 8px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.email-detail .email-actions .action-btn {
    padding: 10px 16px;
    font-size: 13px;
}

@media (max-width: 480px) {
    .email-header-compact h2 {
        font-size: 1em;
    }

    .email-meta {
        font-size: 0.8em;
    }

    .email-detail .email-actions {
        display: grid;
        grid-template-columns: 1fr auto auto;
        gap: 8px;
    }

    .email-detail .email-actions .action-btn:first-child {
        grid-column: 1;
    }
}


/* ============== EMPTY STATE ============== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state .empty-icon {
    font-size: 4em;
    margin-bottom: 20px;
    opacity: 0.7;
}

.empty-state h3 {
    font-size: 1.5em;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.empty-state p {
    font-size: 1em;
    margin-bottom: 8px;
}

.empty-state .empty-tip {
    font-size: 0.9em;
    color: var(--text-muted);
    margin-top: 20px;
    padding: 10px;
    background: var(--bg-light);
    border-radius: 8px;
    display: inline-block;
}

/* ============== LOADING SKELETON ============== */
.skeleton {
    background: linear-gradient(90deg, var(--bg-light) 25%, var(--border-color) 50%, var(--bg-light) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.skeleton-row {
    display: flex;
    gap: 15px;
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
}

.skeleton-checkbox {
    width: 20px;
    height: 20px;
}

.skeleton-sender {
    width: 120px;
    height: 20px;
}

.skeleton-subject {
    flex: 1;
    height: 20px;
}

.skeleton-date {
    width: 80px;
    height: 20px;
}

/* ============== IMPROVED FOCUS STATES ============== */
button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

/* ============== IMPROVED TRANSITIONS ============== */
.action-btn {
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

tr {
    transition: background 0.15s ease;
}

/* ============== PRINT STYLES ============== */
@media print {
    .main-header,
    .maintenance-banner,
    .action-buttons,
    .bulk-actions-bar,
    .search-box,
    .site-footer,
    .notification,
    .modal-overlay {
        display: none !important;
    }

    .container {
        box-shadow: none;
        border: none;
        max-width: 100%;
    }

    table {
        box-shadow: none;
    }

    body {
        background: white;
        color: black;
    }
}

/* ============== HIGH CONTRAST MODE ============== */
@media (prefers-contrast: high) {
    :root {
        --border-color: #000;
        --text-primary: #000;
        --text-secondary: #333;
    }

    button,
    .action-btn {
        border: 2px solid currentColor;
    }

    input,
    select {
        border-width: 2px;
    }
}

/* ============== REDUCED MOTION ============== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .banner-scroll {
        animation: none !important;
    }
}


/* ======== MORE OPTIONS MENU ============== */
.more-options-menu {
    background: var(--bg-white);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    min-width: 200px;
    z-index: 1000;
    overflow: hidden;
    animation: slideUp 0.2s ease;
}

.menu-item {
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
    font-size: 14px;
}

.menu-item:hover {
    background: var(--bg-light);
}

.menu-divider {
    height: 1px;
    background: var(--border-color);
    margin: 5px 0;
}

/* ============== STATISTICS MODAL ============== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--bg-light);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    border: 1px solid var(--border-color);
}

.stat-icon {
    font-size: 2em;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 2em;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    font-size: 0.85em;
    color: var(--text-muted);
    margin-top: 5px;
}

.stats-info {
    background: var(--bg-light);
    padding: 15px;
    border-radius: 10px;
}

.stats-info p {
    margin: 8px 0;
    font-size: 14px;
}

/* ============== SHORTCUTS MODAL ============== */
.shortcuts-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.shortcut-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px;
    background: var(--bg-light);
    border-radius: 8px;
}

.shortcut-item kbd {
    min-width: 50px;
    text-align: center;
}

/* ============== EXPORT MODAL ============== */
.export-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.export-option {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 15px;
    background: var(--bg-light);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.export-option:hover {
    border-color: var(--primary);
    background: rgba(102, 126, 234, 0.05);
}

.export-icon {
    font-size: 1.5em;
    margin-bottom: 5px;
}

.export-label {
    font-weight: 600;
    color: var(--text-primary);
}

.export-desc {
    font-size: 0.85em;
    color: var(--text-muted);
}

/* ============== FAVORITES MODAL ============== */
.favorites-list {
    max-height: 400px;
    overflow-y: auto;
}

.favorite-item,
.result-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s;
}

.favorite-item:hover,
.result-item:hover {
    background: var(--bg-light);
}

.fav-sender,
.result-sender {
    font-weight: 600;
    min-width: 100px;
    color: var(--text-primary);
}

.fav-subject,
.result-subject {
    flex: 1;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fav-date,
.result-date {
    font-size: 0.85em;
    color: var(--text-muted);
}

.no-favorites,
.no-results {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

/* ============== LABELS MODAL ============== */
.labels-input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.labels-input-group input {
    flex: 1;
}

.preset-labels {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 20px;
}

.label-preset {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 20px;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s;
}

.label-preset:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.current-labels {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.label-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    background: var(--primary);
    color: white;
    border-radius: 15px;
    font-size: 12px;
}

.remove-label {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0;
    font-size: 14px;
    opacity: 0.7;
    box-shadow: none;
}

.remove-label:hover {
    opacity: 1;
    transform: none;
}

.no-labels {
    color: var(--text-muted);
    font-style: italic;
}

/* ============== COMPOSE MODAL ============== */
.compose-content {
    max-width: 600px;
}

.compose-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.compose-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.compose-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.compose-field label {
    font-weight: 600;
    font-size: 14px;
}

.compose-field input,
.compose-field textarea {
    width: 100%;
}

.compose-field textarea {
    min-height: 200px;
    resize: vertical;
    font-family: inherit;
}

.compose-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.send-btn {
    flex: 2;
    background: linear-gradient(135deg, #2ecc71, #27ae60) !important;
}

/* ============== SEARCH MODAL ============== */
.search-content {
    max-width: 550px;
}

.search-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.search-row {
    display: flex;
    gap: 15px;
}

.search-row .search-field {
    flex: 1;
}

.search-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.search-field label {
    font-weight: 600;
    font-size: 14px;
}

.checkbox-field {
    flex-direction: row;
    align-items: center;
}

.checkbox-field label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.search-actions {
    display: flex;
    gap: 10px;
}

.search-results {
    margin-top: 20px;
    border-top: 1px solid var(--border-color);
    padding-top: 15px;
}

.results-header {
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.results-list {
    max-height: 300px;
    overflow-y: auto;
}

/* ============== TOTP POPUP ============== */
.totp-popup {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: linear-gradient(145deg, #1e1e2e, #2d2d44);
    border-radius: 16px;
    padding: 15px 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    z-index: 10000;
    animation: slideUp 0.3s ease;
}

.totp-popup-header {
    display: flex;
    align-items: center;
    gap: 15px;
}

.totp-timer-mini {
    position: relative;
    width: 40px;
    height: 40px;
}

.totp-ring {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.totp-ring-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: 3;
}

.totp-ring-progress {
    fill: none;
    stroke: #2ecc71;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-dasharray: 100, 100;
    transition: stroke-dasharray 0.3s, stroke 0.3s;
}

.totp-seconds {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    font-weight: 700;
    color: #2ecc71;
}

.totp-code {
    font-size: 1.8em;
    font-weight: 700;
    font-family: monospace;
    color: white;
    letter-spacing: 3px;
}

.totp-code.totp-refresh {
    animation: pulse 0.3s;
}

.totp-btn-group {
    display: flex;
    gap: 8px;
}

.totp-copy-btn,
.totp-close-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
}

.totp-copy-btn:hover,
.totp-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: none;
}

/* ============== SAVED 2FA KEYS ============== */
.saved-keys-list {
    max-height: 300px;
    overflow-y: auto;
}

.saved-key-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s;
}

.saved-key-item:hover {
    background: var(--bg-light);
}

.delete-key-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    opacity: 0.6;
    box-shadow: none;
}

.delete-key-btn:hover {
    opacity: 1;
    transform: none;
}

/* ============== ADMIN AUTH MODAL ANIMATION ============== */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ============== RESPONSIVE MODALS ============== */
@media (max-width: 600px) {
    .modal-content {
        width: 95%;
        max-width: none;
        margin: 10px;
        max-height: 90vh;
    }

    .compose-content,
    .search-content {
        max-width: none;
    }

    .search-row {
        flex-direction: column;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .totp-popup {
        left: 10px;
        right: 10px;
        bottom: 10px;
    }

    .totp-code {
        font-size: 1.5em;
    }
}

/* ============== PERFORMANCE OPTIMIZATIONS ============== */
/* Content visibility for off-screen elements */
.site-footer,
.email-detail {
    content-visibility: auto;
    contain-intrinsic-size: 0 200px;
}

/* Optimize paint for fixed elements */
.notification,
.totp-popup,
.modal-overlay {
    will-change: opacity, transform;
    contain: layout style paint;
}

/* Reduce layout thrashing */
.email-list-header,
.action-buttons,
.form-group {
    contain: layout style;
}

/* GPU acceleration for animations */
.banner-scroll,
.spinner,
.skeleton {
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Optimize table rendering */
#emailTable {
    contain: layout style;
}

#emailList tr {
    contain: layout style paint;
}

/* Lazy render for email body */
.email-body-frame,
#emailBody {
    content-visibility: auto;
    contain-intrinsic-size: 0 300px;
}

/* Reduce motion for performance */
@media (prefers-reduced-motion: reduce) {
    .banner-scroll,
    .skeleton,
    .spinner {
        animation: none !important;
    }

    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Disable hover effects on touch */
    button:hover,
    .action-btn:hover,
    tr:hover {
        transform: none;
        box-shadow: inherit;
    }

    /* Larger touch targets */
    button,
    .action-btn,
    input,
    select {
        min-height: 44px;
    }
}




/* =============================================================================
   AUTH0 LOGIN STYLES
   ============================================================================= */

.auth-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.auth-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 100;
}

.auth-btn.login-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.35);
}

.auth-btn.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.45);
}

.auth-btn.login-btn:active {
    transform: translateY(0);
}

.auth-btn.logout-btn {
    background: #f1f5f9;
    color: #64748b;
    padding: 8px 12px;
}

.auth-btn.logout-btn:hover {
    background: #fee2e2;
    color: #dc2626;
}

.auth-user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px 6px 6px;
    background: #fff;
    border-radius: 50px;
    border: 2px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.auth-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.auth-user-name {
    font-size: 14px;
    font-weight: 600;
    color: #334155;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .auth-btn.login-btn .auth-text {
        display: none;
    }

    .auth-btn.login-btn {
        padding: 10px 12px;
    }

    .auth-user-name {
        display: none;
    }

    .auth-user-info {
        padding: 4px;
    }
}


/* =============================================================================
   OTP COPY BUTTON
   ============================================================================= */

.otp-copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    margin-left: 8px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    font-family: 'Monaco', 'Consolas', monospace;
    cursor: pointer;
    transition: all 0.2s ease;
    vertical-align: middle;
}

.otp-copy-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.otp-copy-btn:active {
    transform: translateY(0);
}

/* Animation khi copy thành công */
.otp-copy-btn.copied {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    animation: otpCopied 0.3s ease;
}

@keyframes otpCopied {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}
