:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #dbeafe;
    --secondary: #64748b;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg: #f8fafc;
    --bg-white: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius: 8px;
    --radius-sm: 4px;
    --radius-lg: 12px;
    --transition: all 0.2s ease;
}

/* Dark Mode */
[data-theme="dark"] {
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --primary-light: #1e3a5f;
    --secondary: #94a3b8;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg: #0f172a;
    --bg-white: #1e293b;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --text-light: #64748b;
    --border: #334155;
    --border-light: #1e293b;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .login-container {
    background: linear-gradient(135deg, #1e3a5f 0%, #312e81 100%);
}

[data-theme="dark"] .email-view-body iframe {
    background: #1e293b;
    filter: invert(1) hue-rotate(180deg);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

/* Layout */
.app {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 220px;
    background: var(--bg-white);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* 3-Column Layout */
.content-area {
    flex: 1;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow: hidden;
}

.email-list-container {
    width: 350px;
    min-width: 300px;
    max-width: 400px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    background: var(--bg-white);
    overflow: hidden;
}

.email-view-container {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    background: var(--bg-white);
    min-width: 0;
    overflow: hidden;
}

/* Header */
.header {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.logo {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.logo svg {
    width: 28px;
    height: 28px;
}

/* Search */
.search-container {
    flex: 1;
    max-width: 600px;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 10px 16px 10px 44px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    font-size: 14px;
    background: var(--bg);
    transition: var(--transition);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-white);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.search-clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    display: none;
}

.search-input:not(:placeholder-shown) + .search-icon + .search-clear {
    display: block;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border-light);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    padding: 8px;
}

.btn-ghost:hover {
    background: var(--bg);
    color: var(--text);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-icon {
    padding: 8px;
    min-width: 36px;
    height: 36px;
}

.btn-compose {
    margin: 16px 20px;
    padding: 12px 24px;
    font-size: 15px;
}

/* Sidebar Navigation */
.nav-section {
    padding: 12px 0;
}

.nav-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 8px 20px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: var(--text);
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-size: 14px;
}

.nav-item:hover {
    background: var(--bg);
}

.nav-item.active {
    background: var(--primary-light);
    color: var(--primary);
}

.nav-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.nav-item-label {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-item-count {
    font-size: 12px;
    background: var(--bg);
    padding: 2px 8px;
    border-radius: 10px;
    color: var(--text-muted);
}

.nav-item.active .nav-item-count {
    background: var(--primary);
    color: white;
}

/* User section at bottom */
.sidebar-footer {
    margin-top: auto;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.user-email {
    flex: 1;
    font-size: 13px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Email List */
.email-list-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-white);
    flex-shrink: 0;
}

.email-list-title {
    font-weight: 600;
    color: var(--text);
    font-size: 14px;
}

.email-list-actions {
    display: flex;
    gap: 8px;
}

.email-list {
    flex: 1;
    overflow-y: auto;
    background: var(--bg-white);
}

.email-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: var(--transition);
}

.email-item:hover {
    background: var(--bg);
}

.email-item.active {
    background: var(--primary-light);
    border-left: 3px solid var(--primary);
    padding-left: 13px;
}

.email-item.unread {
    background: var(--bg-white);
}

.email-item.unread .email-sender {
    font-weight: 600;
    color: var(--text);
}

.email-item.unread .email-subject {
    font-weight: 600;
}

.email-checkbox {
    flex-shrink: 0;
    margin-top: 2px;
}

.email-star {
    flex-shrink: 0;
    color: var(--text-light);
    cursor: pointer;
    padding: 2px;
}

.email-star:hover,
.email-star.starred {
    color: var(--warning);
}

.email-content {
    flex: 1;
    min-width: 0;
}

.email-header {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 4px;
}

.email-sender {
    font-size: 14px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.email-date {
    font-size: 12px;
    color: var(--text-light);
    white-space: nowrap;
    margin-left: auto;
}

.email-subject {
    font-size: 14px;
    color: var(--text);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.email-preview {
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.email-attachments-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--text-muted);
    background: var(--bg);
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 8px;
}

/* Email View */
.email-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
}

.email-view-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    padding: 40px;
}

.email-view-empty svg {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.email-view-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.email-view-subject {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 16px;
}

.email-view-meta {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.email-view-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
    flex-shrink: 0;
}

.email-view-info {
    flex: 1;
}

.email-view-from {
    font-weight: 600;
    margin-bottom: 2px;
}

.email-view-to {
    font-size: 13px;
    color: var(--text-muted);
}

.email-view-date {
    font-size: 13px;
    color: var(--text-muted);
}

.email-view-actions {
    display: flex;
    gap: 8px;
}

.email-view-body {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

.email-view-body iframe {
    width: 100%;
    border: none;
    min-height: 400px;
}

.email-text-body {
    white-space: pre-wrap;
    font-family: inherit;
    line-height: 1.7;
}

.email-attachments {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    background: var(--bg);
}

.email-attachments-title {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 12px;
}

.attachment-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.attachment-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
}

.attachment-item:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.attachment-icon {
    color: var(--text-muted);
}

.attachment-size {
    color: var(--text-muted);
    font-size: 11px;
}

/* Compose Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    min-height: 600px;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 16px;
    font-weight: 600;
}

.modal-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-ghost {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.btn-ghost:hover {
    background: var(--border-light);
    color: var(--danger);
}

.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.compose-field {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    border-bottom: 1px solid var(--border-light);
}

.compose-label {
    width: 60px;
    font-size: 13px;
    color: var(--text-muted);
}

.compose-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 14px;
    background: transparent;
}

.compose-body {
    min-height: 300px;
    padding: 16px 20px;
    border: none;
    outline: none;
    font-size: 14px;
    resize: none;
    width: 100%;
    font-family: inherit;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.compose-attachments {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.compose-attachment {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    font-size: 12px;
}

.compose-attachment-remove {
    cursor: pointer;
    color: var(--text-muted);
}

/* Login Screen */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 440px;
    padding: 40px;
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.login-logo svg {
    width: 36px;
    height: 36px;
}

.login-subtitle {
    color: var(--text-muted);
    margin-top: 8px;
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text);
}

.form-input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    transition: var(--transition);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    background: var(--bg-white);
    cursor: pointer;
}

.form-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-muted);
}

.advanced-toggle {
    text-align: center;
    margin: 16px 0;
}

.advanced-toggle button {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 13px;
    cursor: pointer;
}

.advanced-settings {
    display: none;
    border-top: 1px solid var(--border);
    padding-top: 20px;
    margin-top: 8px;
}

.advanced-settings.show {
    display: block;
}

.login-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: var(--danger);
    padding: 12px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 16px;
    display: none;
}

.login-error.show {
    display: block;
}

.btn-login {
    width: 100%;
    padding: 14px;
    font-size: 15px;
}

/* Loading States */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--text-muted);
}

.spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 12px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-muted);
    text-align: center;
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 16px;
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px;
    border-top: 1px solid var(--border);
    background: var(--bg-white);
}

.pagination-info {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0 16px;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--text);
    color: white;
    padding: 12px 20px;
    border-radius: var(--radius);
    font-size: 14px;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
}

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--danger);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        position: fixed;
        left: -220px;
        top: 0;
        bottom: 0;
        z-index: 100;
        transition: var(--transition);
    }
    
    .sidebar.open {
        left: 0;
    }
    
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 99;
    }
    
    .sidebar.open + .sidebar-overlay {
        display: block;
    }
    
    .menu-toggle {
        display: block !important;
    }
    
    .email-list-container {
        width: 100%;
        max-width: none;
    }
    
    .email-view-container {
        position: fixed;
        inset: 0;
        z-index: 50;
        display: none;
    }
    
    .email-view-container.active {
        display: flex;
    }
}

/* Mobile back button - hidden on desktop */
.mobile-back-btn {
    display: none !important;
    margin-right: 8px;
}

@media (max-width: 1024px) {
    .mobile-back-btn {
        display: flex !important;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 12px 16px;
    }
    
    .email-item {
        padding: 12px 16px;
    }
    
    .email-view-header,
    .email-view-body {
        padding: 16px;
    }
    
    .email-sender {
        max-width: 120px;
    }
    
    .modal {
        max-width: 100%;
        max-height: 100%;
        border-radius: 0;
    }
    
    .login-card {
        padding: 24px;
    }
}

.menu-toggle {
    display: none;
}

/* Dark Mode Toggle */
.theme-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 13px;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    transition: var(--transition);
}

.theme-toggle:hover {
    background: var(--bg);
    color: var(--text);
}

.theme-toggle-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.theme-toggle .sun-icon {
    display: none !important;
}

.theme-toggle .moon-icon {
    display: block !important;
}

[data-theme="dark"] .theme-toggle .sun-icon {
    display: block !important;
}

[data-theme="dark"] .theme-toggle .moon-icon {
    display: none !important;
}

/* Connection Info & Debug Log */
.connection-info {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
}

.connection-info-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
}

.connection-info-item:last-child {
    border-bottom: none;
}

.connection-info-label {
    color: var(--text-muted);
}

.connection-info-value {
    font-weight: 500;
    word-break: break-all;
}

.connection-info-value.success {
    color: var(--success);
}

.connection-info-value.error {
    color: var(--danger);
}

/* Settings Sections */
.settings-section {
    margin-bottom: 24px;
}

.settings-section-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text);
}

.settings-section-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

/* Folder Visibility Settings */
.folder-visibility-settings {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 12px;
}

.folder-visibility-header {
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 12px;
}

.folder-visibility-list {
    max-height: 200px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.folder-visibility-list.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    transition: var(--transition);
}

.checkbox-label:hover {
    background: var(--border-light);
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary);
}

.folder-checkbox {
    padding: 4px 8px;
}

.debug-log {
    background: #1e1e1e;
    color: #d4d4d4;
    border-radius: var(--radius);
    padding: 16px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 12px;
    max-height: 300px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

.debug-log-entry {
    padding: 4px 0;
    border-bottom: 1px solid #333;
}

.debug-log-entry.error {
    color: #f44747;
}

.debug-log-entry.success {
    color: #4ec9b0;
}

.debug-log-entry.info {
    color: #9cdcfe;
}

.debug-log-time {
    color: #6a9955;
    margin-right: 8px;
}

/* Status indicators */
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}

.status-dot.connected {
    background: var(--success);
}

.status-dot.disconnected {
    background: var(--danger);
}

.status-dot.loading {
    background: var(--warning);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

/* Quick server buttons */
.quick-servers {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.quick-server-btn {
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-white);
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}

.quick-server-btn:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.quick-server-btn.active {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
}

.quick-server-btn img {
    width: 16px;
    height: 16px;
}
/* ========== ACCOUNTS SECTION ========== */
.accounts-section {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
}

.accounts-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.accounts-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.accounts-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.account-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.account-item:hover {
    background: var(--bg);
}

.account-item.active {
    background: var(--primary-light);
}

.account-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px;
    color: var(--text-muted);
    font-size: 12px;
}

.account-empty .btn {
    font-size: 12px;
}

.account-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.account-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.account-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.account-email {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.account-badge {
    background: var(--primary);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

.account-edit-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    opacity: 0;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.account-item:hover .account-edit-btn {
    opacity: 1;
}

.account-edit-btn:hover {
    background: var(--bg);
    color: var(--primary);
}

/* ========== AUTH TABS ========== */
.auth-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.auth-tab {
    flex: 1;
    padding: 12px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: var(--transition);
}

.auth-tab:hover {
    color: var(--text);
}

.auth-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ========== AUTOCOMPLETE DROPDOWN ========== */
.autocomplete-wrapper {
    position: relative;
}

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 60px;
    right: 0;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    max-height: 200px;
    overflow-y: auto;
    display: none;
}

.autocomplete-dropdown.show {
    display: block;
}

.autocomplete-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    cursor: pointer;
    transition: var(--transition);
}

.autocomplete-item:hover,
.autocomplete-item.selected {
    background: var(--primary-light);
}

.autocomplete-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--secondary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    flex-shrink: 0;
}

.autocomplete-info {
    flex: 1;
    min-width: 0;
}

.autocomplete-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.autocomplete-email {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.autocomplete-empty {
    padding: 12px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

/* ========== ENHANCED UNREAD STYLING ========== */
.email-item {
    position: relative;
}

.email-item.unread {
    background: linear-gradient(to right, var(--primary-light) 0%, var(--bg-white) 100%);
}

.email-item.unread::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--primary);
    border-radius: 0 2px 2px 0;
}

.email-item.unread .email-sender {
    font-weight: 700;
    color: var(--text);
}

.email-item.unread .email-subject {
    font-weight: 700;
    color: var(--text);
}

.email-item.unread .email-date {
    font-weight: 600;
    color: var(--primary);
}

/* Dark mode unread adjustments */
[data-theme="dark"] .email-item.unread {
    background: linear-gradient(to right, rgba(59, 130, 246, 0.15) 0%, var(--bg-white) 100%);
}

/* ========== FOLDER UNREAD BADGES ========== */
.nav-item-count {
    background: var(--primary);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
    margin-left: auto;
}

/* ========== BUTTON DANGER ========== */
.btn-danger {
    background: var(--danger);
    color: white;
    border: none;
}

.btn-danger:hover {
    background: #dc2626;
}

/* ========== EMAIL THREADING ========== */
.thread-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--secondary);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 8px;
    margin-left: 6px;
    min-width: 16px;
}

.email-item.email-thread {
    border-left: 3px solid var(--secondary);
}

.email-item.email-thread.unread {
    border-left-color: var(--primary);
}

.email-item.thread-expanded {
    background: var(--primary-light) !important;
    border-left: 3px solid var(--primary);
}

.thread-sub-item {
    position: relative;
    padding-left: 28px !important;
    background: var(--bg-secondary);
    border-left: none !important;
    margin-left: 12px;
    border-bottom: 1px solid var(--border-light);
}

.thread-sub-item:hover {
    background: var(--hover) !important;
}

.thread-sub-item.active {
    background: var(--primary-light) !important;
}

.thread-connector {
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 50%;
    width: 12px;
    border-left: 2px solid var(--border);
    border-bottom: 2px solid var(--border);
    border-bottom-left-radius: 6px;
}

.thread-sub-item .email-content {
    flex: 1;
}

.attachment-indicator {
    color: var(--text-muted);
    margin-left: 6px;
    flex-shrink: 0;
}

/* ========== SETTINGS OPTIONS ========== */
.settings-option {
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
}

.settings-option:last-child {
    border-bottom: none;
}

.settings-option-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
    margin-left: 28px;
}

/* ========== INLINE REPLY ========== */
.inline-reply-container {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
}

.inline-reply {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-white);
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.inline-reply-header {
    background: var(--bg-secondary);
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.inline-reply-header span {
    font-weight: 500;
    color: var(--text-primary);
}

.inline-reply-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}

.inline-reply-close:hover {
    color: var(--danger);
}

.inline-reply-fields {
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-bottom: 1px solid var(--border-light);
}

.inline-reply-fields input {
    font-size: 13px;
    padding: 8px 12px;
}

.inline-reply-fields input[readonly] {
    background: var(--bg-secondary);
    color: var(--text-muted);
}

.inline-reply-body {
    width: 100%;
    min-height: 120px;
    border: none;
    border-bottom: 1px solid var(--border-light);
    padding: 16px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    background: var(--bg-white);
    color: var(--text-primary);
}

.inline-reply-body:focus {
    outline: none;
    background: var(--bg);
}



.inline-reply-attachments {
    margin-top: 12px;
}

.inline-reply-attachments input[type="file"] {
    display: none;
}

.inline-reply-attachment-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-secondary);
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    color: var(--text-muted);
    transition: all 0.15s;
}

.inline-reply-attachment-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.inline-reply-attachment-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.inline-reply-attachment-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-secondary);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 12px;
}

.inline-reply-attachment-item button {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.inline-reply-attachment-item button:hover {
    color: var(--danger);
}

.inline-reply-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}