/* Gmail All Mailbox v2.0 - Professional Dark Theme */

:root {
    --bg: #0d1117;
    --sidebar: #161b22;
    --panel: #1c2128;
    --card: #21262d;
    --card-hover: #30363d;
    --accent: #58a6ff;
    --accent-hover: #79b8ff;
    --accent-light: #a5d6ff;
    --fg: #e6edf3;
    --fg-dim: #c9d1d9;
    --fg-muted: #8b949e;
    --entry-bg: #21262d;
    --red: #ff6b6b;
    --red-dark: #da3633;
    --green: #3fb950;
    --green-dark: #238636;
    --green-glow: #56d364;
    --yellow: #d29922;
    --yellow-dark: #9e6a03;
    --orange: #d76e15;
    --orange-dark: #a85500;
    --purple: #bc8cff;
    --purple-dark: #8957e5;
    --border: #30363d;
    --hover: #30363d;
    --glass: rgba(22, 27, 34, 0.92);
    --glass-border: rgba(88, 166, 255, 0.2);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    --transition-fast: 0.12s ease;
    --transition-normal: 0.2s ease;
    --transition-slow: 0.35s ease;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --text-primary: #e6edf3;
    --text-secondary: #c9d1d9;
    --text-tertiary: #8b949e;
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #1c2128;
    --border-color: #30363d;
    --border-light: #484f58;
    --avatar-size: 36px;
    --sidebar-width: 240px;
    --list-width: 420px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--fg);
    overflow: hidden;
    scroll-behavior: smooth;
}

/* Smooth scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
    transition: background var(--transition-fast);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--hover);
}

/* Enhanced animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

#app {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar - Gmail inspired compact */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 0;
    user-select: none;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 16px 0;
    margin-bottom: 4px;
}

.logo-icon {
    font-size: 24px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent), #6e40c9);
    border-radius: 8px;
    color: #fff;
    font-size: 16px;
}

.logo-text {
    line-height: 1.3;
}

.logo-title {
    font-weight: 700;
    font-size: 15px;
    color: var(--fg);
    letter-spacing: -0.3px;
}

.logo-subtitle {
    font-size: 11px;
    color: var(--fg-muted);
    font-weight: 400;
}

.version {
    color: var(--fg-muted);
    font-size: 11px;
    padding: 0 16px 12px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
}

.stats {
    padding: 8px 16px;
    margin-bottom: 4px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 3px 0;
}

.stat-label {
    color: var(--fg-muted);
    font-size: 12px;
}

.stat-value {
    color: var(--fg);
    font-weight: 600;
    font-size: 13px;
}

.section-title {
    color: var(--fg-muted);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 8px 16px 4px;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    padding: 0 8px;
    gap: 1px;
}

.nav-btn {
    background: transparent;
    border: none;
    color: var(--fg-dim);
    padding: 7px 10px;
    text-align: left;
    cursor: pointer;
    border-radius: 6px;
    font-size: 13px;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 400;
}

.nav-btn:hover {
    background: var(--hover);
    color: var(--fg);
}

.nav-btn.active {
    background: rgba(88, 166, 255, 0.15);
    color: var(--accent);
    font-weight: 500;
}

.nav-btn.action-btn {
    background: var(--accent);
    color: #fff;
    font-weight: 500;
    margin-top: 2px;
    justify-content: center;
}

.nav-btn.action-btn:hover {
    background: var(--accent-hover);
    color: #fff;
}

.status-bar {
    margin-top: auto;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

.status-indicator {
    font-size: 10px;
    color: var(--green);
}

.status-text {
    color: var(--fg-dim);
    font-weight: 400;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.auto-sync-status {
    font-size: 10px;
    color: var(--fg-muted);
    background: var(--entry-bg);
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Top Bar - Gmail inspired */
.top-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 20px;
    min-height: 52px;
    border-bottom: 1px solid var(--border);
}

.search-box {
    flex: 1;
    max-width: 600px;
    display: flex;
    align-items: center;
    background: var(--entry-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 12px;
    transition: all var(--transition-fast);
}

.search-box:focus-within {
    border-color: var(--accent);
    background: var(--card);
}

.search-icon {
    color: var(--fg-muted);
    margin-right: 8px;
    font-size: 14px;
}

.search-box input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--fg);
    font-size: 13px;
    outline: none;
}

.search-box input::placeholder {
    color: var(--fg-muted);
}

.top-actions {
    display: flex;
    gap: 6px;
}

/* Notification Bell & Dropdown */
.notif-bell {
    position: relative;
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

.notif-bell:hover {
    background: var(--hover);
}

.notif-icon {
    font-size: 16px;
    line-height: 1;
}

.notif-dot {
    position: absolute;
    top: 4px;
    right: 5px;
    width: 8px;
    height: 8px;
    background: var(--red);
    border-radius: 50%;
    border: 2px solid var(--panel);
}

.notif-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    width: 340px;
    max-height: 400px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: none;
    z-index: 100;
    overflow: hidden;
    animation: fadeIn 0.15s ease;
}

.notif-bell:hover .notif-dropdown,
.notif-bell:focus-within .notif-dropdown {
    display: block;
}

.notif-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    font-weight: 600;
    color: var(--fg);
}

.notif-sound-btn {
    background: none;
    border: none;
    color: var(--fg-muted);
    cursor: pointer;
    font-size: 14px;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all var(--transition-fast);
}

.notif-sound-btn:hover {
    background: var(--hover);
    color: var(--fg);
}

.notif-dropdown-body {
    max-height: 340px;
    overflow-y: auto;
}

.notif-empty {
    padding: 24px 16px;
    text-align: center;
    color: var(--fg-muted);
    font-size: 13px;
}

.notif-item {
    display: flex;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    transition: background var(--transition-fast);
    cursor: default;
}

.notif-item:last-child {
    border-bottom: none;
}

.notif-item:hover {
    background: var(--hover);
}

.notif-item.new_message {
    border-left: 3px solid var(--red);
}

.notif-item.success {
    border-left: 3px solid var(--green);
}

.notif-item.error {
    border-left: 3px solid var(--red);
}

.notif-item.info {
    border-left: 3px solid var(--accent);
}

.notif-item-icon {
    font-size: 16px;
    flex-shrink: 0;
    margin-top: 2px;
}

.notif-item-content {
    flex: 1;
    min-width: 0;
}

.notif-item-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--fg);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notif-item-body {
    font-size: 12px;
    color: var(--fg-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notif-item-time {
    font-size: 11px;
    color: var(--fg-muted);
    white-space: nowrap;
    flex-shrink: 0;
    margin-top: 1px;
}

/* Buttons - clean and minimal */
.btn {
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--panel);
    color: var(--fg-dim);
    line-height: 1.4;
}

.btn:hover {
    background: var(--hover);
    color: var(--fg);
    border-color: var(--border-light);
}

.btn:active {
    transform: scale(0.97);
}

.btn-accent {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.btn-accent:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: #fff;
}

.btn-success {
    background: var(--green-dark);
    color: #fff;
    border-color: var(--green-dark);
}

.btn-success:hover {
    background: var(--green);
    border-color: var(--green);
    color: #fff;
}

.btn-danger {
    background: var(--red-dark);
    color: #fff;
    border-color: var(--red-dark);
}

.btn-danger:hover {
    background: var(--red);
    border-color: var(--red);
    color: #fff;
}

.btn-warning {
    background: var(--yellow-dark);
    color: #fff;
    border-color: var(--yellow-dark);
}

.btn-warning:hover {
    background: var(--yellow);
    border-color: var(--yellow);
    color: #fff;
}

.btn-purple {
    background: var(--purple-dark);
    color: #fff;
    border-color: var(--purple-dark);
}

.btn-purple:hover {
    background: var(--purple);
    border-color: var(--purple);
    color: #fff;
}

.btn-small {
    padding: 4px 10px;
    font-size: 11px;
}

.btn-panel {
    background: var(--panel);
    color: var(--fg-dim);
    border-color: var(--border);
}

.btn-panel:hover {
    background: var(--hover);
    color: var(--fg);
}

/* Progress Bar - subtle Gmail-style top bar */
.progress-bar {
    height: 2px;
    background: var(--border);
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: var(--accent);
    width: 0%;
    transition: width 0.25s ease;
    position: absolute;
    top: 0;
    left: 0;
}

.progress-bar.indeterminate .progress-fill {
    width: 30%;
    animation: progressIndeterminate 1.5s ease infinite;
}

@keyframes progressIndeterminate {
    0% { left: -30%; width: 30%; }
    50% { width: 50%; }
    100% { left: 100%; width: 30%; }
}

/* Content Area */
.content-area {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* Message List Panel - Gmail style */
.message-list-panel {
    width: var(--list-width);
    min-width: 320px;
    background: var(--panel);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.panel-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 44px;
}

.panel-header h2 {
    font-size: 14px;
    font-weight: 600;
    color: var(--fg);
}

.message-count {
    color: var(--fg-muted);
    font-size: 12px;
}

.message-list {
    flex: 1;
    overflow-y: auto;
}

/* Gmail-style message rows */
.message-item {
    display: flex;
    align-items: flex-start;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background var(--transition-fast);
    gap: 10px;
    position: relative;
}

.message-item:hover {
    background: var(--hover);
}

.message-item.selected {
    background: rgba(88, 166, 255, 0.12);
}

/* Unread messages */
.message-item.unread {
    background: rgba(88, 166, 255, 0.06);
}

.message-item.unread .msg-sender {
    font-weight: 600;
    color: var(--fg);
}

.message-item.unread .msg-subject {
    font-weight: 600;
    color: var(--fg);
}

/* Read messages */
.message-item:not(.unread) .msg-sender {
    color: var(--fg-dim);
    font-weight: 400;
}

.message-item:not(.unread) .msg-subject {
    color: var(--fg-muted);
    font-weight: 400;
}

/* Avatar circle with initials */
.msg-avatar {
    width: var(--avatar-size);
    height: var(--avatar-size);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    flex-shrink: 0;
    margin-top: 2px;
}

/* Message content area */
.msg-content {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.msg-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 2px;
}

.msg-sender {
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.msg-date {
    font-size: 11px;
    color: var(--fg-muted);
    white-space: nowrap;
    margin-left: 8px;
    flex-shrink: 0;
}

.msg-subject {
    font-size: 13px;
    margin-bottom: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.msg-preview {
    font-size: 12px;
    color: var(--fg-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 1px;
}

.msg-account {
    font-size: 11px;
    color: var(--fg-muted);
    opacity: 0.7;
}

/* Star button */
.msg-star {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    color: var(--fg-muted);
    opacity: 0;
    transition: opacity var(--transition-fast), color var(--transition-fast);
    border: none;
    background: none;
    padding: 0;
    margin-top: 2px;
}

.message-item:hover .msg-star {
    opacity: 0.5;
}

.msg-star:hover {
    opacity: 1 !important;
    color: var(--yellow) !important;
}

.msg-star.starred {
    opacity: 1;
    color: var(--yellow);
}

/* Message Detail Panel - Clean professional layout */
.message-detail-panel {
    flex: 1;
    background: var(--card);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--fg-dim);
    gap: 12px;
}

.empty-icon {
    font-size: 48px;
    opacity: 0.5;
}

.empty-text {
    font-size: 14px;
    color: var(--fg-muted);
}

.message-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.detail-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
}

.detail-actions-row {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.detail-subject {
    font-size: 18px;
    font-weight: 600;
    color: var(--fg);
    margin-bottom: 12px;
    line-height: 1.3;
}

.detail-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
    color: var(--fg-dim);
}

.detail-meta div {
    display: flex;
    gap: 6px;
    align-items: baseline;
}

.detail-meta strong {
    color: var(--fg-muted);
    font-weight: 500;
    min-width: 40px;
}

/* Email address display styling */
.email-name {
    color: var(--fg);
    font-weight: 500;
}

.email-address {
    color: var(--fg-dim);
    font-weight: 400;
    font-size: 0.95em;
}

.detail-body {
    flex: 1;
    padding: 20px 24px;
    overflow-y: auto;
    background: var(--bg-primary);
}

.detail-body #detail-body-text {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-primary);
    max-width: 800px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.detail-body #detail-body-text a {
    color: var(--accent);
    text-decoration: underline;
    word-break: break-all;
}

.detail-body #detail-body-text a:hover {
    color: var(--accent-hover);
}

.detail-body #detail-body-text strong {
    font-weight: 600;
}

.detail-body #detail-body-text br {
    content: '';
    display: block;
    margin: 4px 0;
}

.detail-body #detail-body-text pre {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-primary);
    background: transparent;
    padding: 0;
    margin: 0;
}

.detail-body #detail-body-text table {
    max-width: 100%;
    border-collapse: collapse;
}

.detail-body #detail-body-text img {
    max-width: 100%;
    height: auto;
}

.detail-body #detail-body-text p {
    margin: 0 0 12px 0;
}

.detail-body #detail-body-text h1,
.detail-body #detail-body-text h2,
.detail-body #detail-body-text h3,
.detail-body #detail-body-text h4 {
    margin: 16px 0 8px 0;
    color: var(--text-primary);
}

.detail-body #detail-body-text ul,
.detail-body #detail-body-text ol {
    margin: 0 0 12px 0;
    padding-left: 24px;
}

.detail-body #detail-body-text blockquote {
    margin: 12px 0;
    padding: 8px 16px;
    border-left: 3px solid var(--border-color);
    color: var(--text-secondary);
}

/* Toast Notifications - Clean and minimal */
#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    background: var(--card);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    min-width: 280px;
    max-width: 380px;
    box-shadow: var(--shadow-md);
    animation: slideIn 0.25s ease;
    pointer-events: auto;
}

.toast.success {
    border-left-color: var(--green);
}

.toast.error {
    border-left-color: var(--red);
}

.toast.warning {
    border-left-color: var(--yellow);
}

.toast.info {
    border-left-color: var(--accent);
}

.toast-title {
    font-weight: 600;
    font-size: 13px;
    color: var(--fg);
    margin-bottom: 3px;
}

.toast-message {
    font-size: 12px;
    color: var(--fg-muted);
    line-height: 1.4;
}

.toast-progress {
    height: 2px;
    background: var(--accent);
    margin-top: 8px;
    border-radius: 1px;
    animation: toastProgress 4s linear;
}

@keyframes toastProgress {
    from { width: 100%; }
    to { width: 0%; }
}

/* Modals - Clean and minimal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 500px;
    max-height: 85%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}

.modal-content.modal-large {
    max-width: 680px;
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--fg);
}

.modal-close {
    background: none;
    border: none;
    color: var(--fg-muted);
    font-size: 22px;
    cursor: pointer;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--hover);
    color: var(--fg);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* Forms */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    font-size: 13px;
    color: var(--fg-dim);
    margin-bottom: 5px;
}

.form-group input {
    width: 100%;
    padding: 10px 12px;
    background: var(--entry-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--fg);
    font-size: 14px;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent);
}

.file-input {
    display: flex;
    gap: 10px;
}

.file-input input {
    flex: 1;
}

/* Account List */
.account-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.account-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: var(--panel);
    border-radius: 8px;
}

.account-info h4 {
    font-size: 14px;
    margin-bottom: 3px;
}

.account-info div {
    font-size: 12px;
    color: var(--fg-muted);
}

.account-status {
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.status-badge.online {
    background: rgba(34, 197, 94, 0.2);
    color: var(--green);
}

.status-badge.offline {
    background: rgba(239, 68, 68, 0.2);
    color: var(--red);
}

/* Discovered List */
.discovered-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.discovered-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--panel);
    border-radius: 6px;
}

.discovered-item label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    flex: 1;
}

.discovered-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
}

/* Reply Textarea */
.reply-meta {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}

.reply-meta div {
    font-size: 13px;
    color: var(--fg-dim);
    margin-bottom: 5px;
}

.reply-textarea {
    width: 100%;
    min-height: 200px;
    padding: 15px;
    background: var(--entry-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--fg);
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
}

.reply-textarea:focus {
    outline: none;
    border-color: var(--accent);
}

/* 120 FPS Performance Optimizations */
.message-list {
    will-change: transform;
    contain: layout style paint;
}



/* GPU Accelerated animations */
.modal {
    will-change: opacity;
}

.modal-content {
    will-change: transform;
    transform: translateZ(0);
}

/* Optimize paint operations */
.sidebar, .main-content, .message-detail {
    contain: layout style paint;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Advanced Filter Modal */
.filter-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 15px;
    background: var(--panel);
    padding: 5px;
    border-radius: 8px;
}

.filter-tab {
    padding: 8px 16px;
    background: transparent;
    border: none;
    color: var(--fg);
    font-size: 13px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}

.filter-tab:hover {
    background: var(--hover);
}

.filter-tab.active {
    background: var(--accent);
    color: white;
}

.filter-input-area {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.filter-input {
    flex: 1;
    padding: 10px 12px;
    background: var(--entry-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--fg);
    font-size: 14px;
}

.filter-input:focus {
    outline: none;
    border-color: var(--accent);
}

.filter-results-info {
    color: var(--fg-dim);
    font-size: 13px;
    margin-bottom: 10px;
}

.filter-message-list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--panel);
}

.filter-message-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.2s;
}

.filter-message-item:hover {
    background: var(--hover);
}

.filter-message-item.selected {
    background: rgba(99, 102, 241, 0.2);
}

.filter-message-checkbox {
    width: 18px;
    height: 18px;
    margin-right: 12px;
    accent-color: var(--accent);
    cursor: pointer;
}

.filter-message-content {
    flex: 1;
    min-width: 0;
}

.filter-message-sender {
    font-weight: 600;
    font-size: 14px;
    color: var(--fg);
    margin-bottom: 3px;
}

.filter-message-subject {
    font-size: 13px;
    color: var(--fg-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.filter-message-meta {
    font-size: 12px;
    color: var(--fg-muted);
    margin-top: 3px;
}

.bulk-actions {
    display: flex;
    gap: 8px;
    flex: 1;
}

/* Compose Email & Reply Styles */
.compose-fields {
    margin-bottom: 15px;
}

.compose-fields .form-group {
    margin-bottom: 12px;
}

.compose-fields label {
    display: block;
    font-size: 12px;
    color: var(--fg-dim);
    margin-bottom: 5px;
    font-weight: 600;
}

.compose-fields input[type="text"],
.compose-fields input[type="email"] {
    width: 100%;
    padding: 10px 12px;
    background: var(--entry-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--fg);
    font-size: 14px;
}

.compose-fields input:focus {
    outline: none;
    border-color: var(--accent);
}

.compose-select {
    width: 100%;
    padding: 10px 12px;
    background: var(--entry-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--fg);
    font-size: 14px;
    cursor: pointer;
}

.compose-select:focus {
    outline: none;
    border-color: var(--accent);
}

.compose-textarea {
    width: 100%;
    min-height: 250px;
    padding: 15px;
    background: var(--entry-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--fg);
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
}

.compose-textarea:focus {
    outline: none;
    border-color: var(--accent);
}

/* Smart Reply Section */
.smart-reply-section {
    background: var(--panel);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    border: 1px solid var(--border);
}

.smart-reply-title {
    font-size: 13px;
    color: var(--accent);
    font-weight: 600;
    margin-bottom: 10px;
}

.smart-reply-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Account Name Edit */
.account-name-edit {
    display: flex;
    align-items: center;
    gap: 8px;
}

.account-name-input {
    flex: 1;
    padding: 6px 10px;
    background: var(--entry-bg);
    border: 1px solid var(--accent);
    border-radius: 4px;
    color: var(--fg);
    font-size: 14px;
}

.account-name-input:focus {
    outline: none;
}

.edit-btn {
    padding: 4px 10px;
    font-size: 12px;
    background: var(--panel);
    border: 1px solid var(--border);
    color: var(--fg-dim);
    cursor: pointer;
    border-radius: 4px;
}

.edit-btn:hover {
    background: var(--hover);
    color: var(--fg);
}

/* Performance: Virtual scroll container */
.virtual-scroll-container {
    position: relative;
    overflow-y: auto;
    height: 100%;
}

/* Disabled button state */
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Loading spinner */
.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--fg-muted);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, var(--card) 25%, var(--hover) 50%, var(--card) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

.skeleton-text {
    height: 12px;
    margin-bottom: 6px;
}

.skeleton-text.short {
    width: 60%;
}

.skeleton-text.long {
    width: 90%;
}

.skeleton-circle {
    width: var(--avatar-size);
    height: var(--avatar-size);
    border-radius: 50%;
}

.skeleton-item {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 10px;
    align-items: center;
}

.message-item::after {
    content: '';
    position: absolute;
    left: 0;
    top: 2px;
    height: calc(100% - 4px);
    width: 3px;
    background: var(--accent);
    border-radius: 0 2px 2px 0;
    transform: scaleY(0);
    transition: transform var(--transition-fast);
}

.message-item.selected::after {
    transform: scaleY(1);
}

.message-item.selected.unread::after {
    background: var(--green);
}

/* Keyboard shortcuts hint */
.shortcut-hint {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: var(--glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 15px 20px;
    font-size: 12px;
    color: var(--fg-dim);
    z-index: 100;
    opacity: 0;
    transition: opacity var(--transition-normal);
    pointer-events: none;
}

.shortcut-hint.visible {
    opacity: 1;
}

.shortcut-hint kbd {
    background: var(--panel);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    border: 1px solid var(--border);
    margin: 0 2px;
}

/* Focus styles for accessibility */
.btn:focus-visible,
.filter-btn:focus-visible,
.category-btn:focus-visible,
.message-item:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Selection highlight */
::selection {
    background: var(--accent);
    color: white;
}

/* Improved modal animations */
.modal {
    animation: fadeIn 0.2s ease;
}

.modal-content {
    animation: fadeInUp 0.3s ease;
}

/* Empty state enhancement */
.empty-state {
    animation: fadeInUp 0.5s ease;
}


