/**
 * Email Page Styles - 2 Column Layout
 * Matches Figma design with responsive breakpoints
 * VERSION: 2025-12-19-v7 (Simplified filters + sync time)
 */

/* ============================================
   PAGE LAYOUT - 2 COLUMNS
   ============================================ */

.email-page {
    flex: 1;
    min-height: 0; /* Critical for flexbox scrolling */
    padding: 0;
    overflow: hidden;
    background: #F9FAFB;
}

.email-layout {
    display: grid;
    grid-template-columns: 384px 4px 1fr;
    height: 100%;
}

/* Resize Handle */
.email-resize-handle {
    width: 4px;
    background: #E5E7EB;
    cursor: col-resize;
    position: relative;
    transition: background 0.15s ease;
}

.email-resize-handle:hover,
.email-resize-handle.dragging {
    background: #155DFC;
}

.email-resize-handle::before {
    content: '';
    position: absolute;
    left: -4px;
    right: -4px;
    top: 0;
    bottom: 0;
}

/* ============================================
   LEFT PANEL - FILTERS & EMAIL LIST
   ============================================ */

.email-list-panel {
    background: #FFFFFF;
    border-right: 1px solid #E5E7EB;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0; /* Critical for flexbox scrolling in grid */
}

/* Search */
.email-search {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px;
    border-bottom: 1px solid #E5E7EB;
}

.email-search img {
    opacity: 0.5;
    flex-shrink: 0;
}

.email-search-input {
    flex: 1;
    border: 1px solid #D1D5DB;
    border-radius: 10px;
    padding: 8px 16px 8px 8px;
    font-size: 14px;
    color: #111827;
    background: transparent;
}

.email-search-input:focus {
    outline: none;
    border-color: #155DFC;
}

.email-search-input::placeholder {
    color: rgba(10, 10, 10, 0.5);
}

/* Filters Section */
.email-filters-section {
    padding: 16px;
    border-bottom: 1px solid #E5E7EB;
}

.email-filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.email-filters-title {
    font-size: 12px;
    font-weight: 500;
    color: #6A7282;
    text-transform: uppercase;
    margin: 0;
}

.email-sync-time {
    font-size: 11px;
    color: #9CA3AF;
    font-weight: 400;
}

/* Status Filters */
.email-status-filters {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.email-status-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: left;
}

.email-status-btn:hover {
    background: #F3F4F6;
}

.email-status-btn.active {
    background: #EFF6FF;
}

.email-status-btn.active .email-status-label {
    color: #1447E6;
    font-weight: 500;
}

.email-status-indicator {
    width: 8px;
    height: 8px;
    background: #155DFC;
    border-radius: 50%;
    margin-right: 8px;
}

.email-status-label {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: #364153;
}

.email-status-count {
    font-size: 12px;
    font-weight: 500;
    color: #364153;
    background: #E5E7EB;
    padding: 2px 8px;
    border-radius: 9999px;
    min-width: 24px;
    text-align: center;
}

.email-status-count-blue {
    background: #BEDBFF;
    color: #1447E6;
}

/* Priority Filters */
.email-priority-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.email-priority-btn {
    padding: 4px 12px;
    font-size: 14px;
    font-weight: 500;
    text-transform: capitalize;
    border: none;
    border-radius: 10px;
    background: #F3F4F6;
    color: #364153;
    cursor: pointer;
    transition: all 0.15s ease;
}

.email-priority-btn:hover {
    background: #E5E7EB;
}

.email-priority-btn.active {
    background: #155DFC;
    color: #FFFFFF;
}

/* Email List */
.email-item-list {
    flex: 1;
    overflow-y: auto;
}

/* Email Item - Override ai-dashboard.css flex layout */
.email-item {
    display: block;  /* Override flex from ai-dashboard.css */
    padding: 16px;
    border-bottom: 1px solid #E5E7EB;
    cursor: pointer;
    transition: background 0.15s ease;
}

.email-item:hover {
    background: #F9FAFB;
}

.email-item.selected {
    background: #EFF6FF;
}

.email-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 4px;
}

.email-item-sender-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.email-item-sender {
    font-size: 14px;
    font-weight: 600;
    color: #101828;
}

.email-item-email {
    font-size: 13px;
    color: #6A7282;
}

.email-item-time {
    font-size: 12px;
    color: #6A7282;
    white-space: nowrap;
}

.email-item-subject {
    font-size: 14px;
    font-weight: 500;
    color: #101828;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.email-item-preview {
    font-size: 13px;
    color: #6A7282;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 12px;
}

.email-item-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.email-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 8px;
}

.email-tag-agent {
    background: #F3F4F6;
    color: #364153;
}

.email-tag-agent svg {
    width: 12px;
    height: 12px;
}

.email-tag-ai-draft {
    background: #EEF2FF;
    color: #4338CA;
}

.email-tag-priority-high {
    background: #FEE2E2;
    color: #991B1B;
}

.email-tag-priority-medium {
    background: #FEF3C7;
    color: #92400E;
}

.email-tag-priority-low {
    background: #D1FAE5;
    color: #065F46;
}

/* ============================================
   RIGHT PANEL - EMAIL DETAIL
   ============================================ */

.email-detail-panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #F9FAFB;
    padding: 24px;
    gap: 16px;
    min-height: 0; /* Critical for flexbox scrolling in grid */
}

/* Combined Header Card - per Figma design */
.email-header-card {
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 10px;
    padding: 16px 20px;
    flex-shrink: 0;
}

.email-header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.email-header-title-section {
    flex: 1;
    min-width: 0;
}

.email-detail-subject {
    font-size: 18px;
    font-weight: 600;
    color: #101828;
    margin: 0 0 4px 0;
    line-height: 1.4;
}

.email-header-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 13px;
    color: #6A7282;
}

.email-meta-from {
    color: #6A7282;
}

.email-meta-separator {
    color: #D1D5DB;
}

.email-meta-time {
    color: #6A7282;
}

.email-header-divider {
    height: 1px;
    background: #E5E7EB;
    margin: 12px 0;
}

.email-header-tags {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* Legacy - keeping for backwards compatibility */
.email-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 10px;
}

/* Tags Section - Legacy */
.email-tags-section {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 10px;
    flex-wrap: wrap;
}

.email-tags-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.email-tags-label {
    font-size: 13px;
    color: #6A7282;
}

/* Assignee Dropdown */
.email-assignee-dropdown {
    position: relative;
}

.email-assignee-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: #F3F4F6;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    color: #364153;
    cursor: pointer;
}

.email-assignee-btn:hover {
    background: #E5E7EB;
}

.email-assignee-menu {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    min-width: 150px;
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 100;
    display: none;
}

.email-assignee-menu.open {
    display: block;
}

.email-assignee-option {
    display: block;
    width: 100%;
    padding: 8px 12px;
    background: none;
    border: none;
    text-align: left;
    font-size: 13px;
    color: #364153;
    cursor: pointer;
}

.email-assignee-option:hover {
    background: #F3F4F6;
}

.email-assignee-option.active {
    background: #EFF6FF;
    color: #1447E6;
}

/* Priority Dropdown */
.email-priority-dropdown {
    position: relative;
}

.email-priority-select {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
}

.email-priority-select.high {
    background: #FEE2E2;
    color: #991B1B;
}

.email-priority-select.medium {
    background: #FEF3C7;
    color: #92400E;
}

.email-priority-select.low {
    background: #D1FAE5;
    color: #065F46;
}

.email-priority-select:hover {
    filter: brightness(0.95);
}

.email-priority-menu {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    min-width: 100px;
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 100;
    display: none;
}

.email-priority-menu.open {
    display: block;
}

.email-priority-option {
    display: block;
    width: 100%;
    padding: 8px 12px;
    background: none;
    border: none;
    text-align: left;
    font-size: 13px;
    color: #364153;
    cursor: pointer;
}

.email-priority-option:hover {
    background: #F3F4F6;
}

/* Editable Tags */
.email-editable-tags {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.email-editable-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: #F3F4F6;
    border-radius: 6px;
    font-size: 12px;
    color: #364153;
}

.email-editable-tag button {
    background: none;
    border: none;
    color: #9CA3AF;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.email-editable-tag button:hover {
    color: #EF4444;
}

/* Flag Button */
.email-flag-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    border-radius: 6px;
    color: #9CA3AF;
    cursor: pointer;
    margin-left: auto;
}

.email-flag-btn:hover {
    background: #F3F4F6;
    color: #F59E0B;
}

.email-flag-btn.flagged {
    color: #F59E0B;
}

/* Email Detail Content Area */
.email-detail-content {
    flex: 1;
    min-height: 0; /* Critical for flexbox scrolling to work */
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-bottom: 16px; /* Extra padding at bottom for scroll */
}

/* Email Cards */
.email-card {
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 10px;
    /* overflow: hidden removed - was clipping card content */
}

.email-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #E5E7EB;
    gap: 12px;
    flex-wrap: wrap;
}

.email-card-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.email-card-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.email-edit-btn-sm {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #155DFC;
    color: #FFFFFF;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}

.email-edit-btn-sm:hover {
    background: #1447E6;
}

.email-regenerate-btn-sm {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #F3F4F6;
    color: #364153;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}

.email-regenerate-btn-sm:hover {
    background: #E5E7EB;
}

.email-save-btn-sm {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #10B981;
    color: #FFFFFF;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}

.email-save-btn-sm:hover {
    background: #059669;
}

.email-cancel-btn-sm {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #F3F4F6;
    color: #364153;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}

.email-cancel-btn-sm:hover {
    background: #E5E7EB;
}

.email-card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #101828;
    margin: 0;
}

.email-card-badge {
    display: flex;
    align-items: center;
}

.email-card-body {
    padding: 16px;
}

.email-meta-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: #6A7282;
    margin-bottom: 12px;
}

.email-meta-label {
    font-weight: 500;
    color: #364153;
}

/* AI Card */
.email-ai-card .email-card-header {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.05) 0%, rgba(99, 102, 241, 0) 100%);
}

.email-card-actions {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid #E5E7EB;
    background: #F9FAFB;
}

.email-edit-btn {
    padding: 8px 16px;
    background: #155DFC;
    color: #FFFFFF;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}

.email-edit-btn:hover {
    background: #1447E6;
}

.email-regenerate-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #F3F4F6;
    color: #364153;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}

.email-regenerate-btn:hover {
    background: #E5E7EB;
}

/* Review Warning */
.email-review-warning {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #FEF3C7;
    border-radius: 8px;
    margin-bottom: 12px;
}

.email-review-warning-icon {
    width: 20px;
    height: 20px;
    color: #D97706;
    flex-shrink: 0;
}

.email-review-warning-text {
    font-size: 13px;
    color: #92400E;
}

/* AI Draft Badge */
.email-ai-draft-badge {
    font-size: 13px;
    font-weight: 500;
    padding: 4px 12px;
    border-radius: 9999px;
    background: #EEF2FF;
    color: #4338CA;
}

/* Review Notice */
.email-review-notice {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #F3F4F6;
    border-radius: 8px;
    font-size: 14px;
    color: #4B5563;
}

.email-review-notice-icon {
    color: #6B7280;
    flex-shrink: 0;
}

/* Email Header Card - legacy support */
.email-header-card {
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 10px;
    padding: 20px;
}

.email-header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.email-header-info {
    flex: 1;
}

.email-detail-subject {
    font-size: 18px;
    font-weight: 600;
    color: #101828;
    margin: 0 0 8px 0;
}

.email-detail-meta {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: #6A7282;
}

.email-detail-meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.email-send-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #155DFC;
    color: #FFFFFF;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease;
}

.email-send-btn:hover {
    background: #1447E6;
}

.email-send-btn:disabled {
    background: #9CA3AF;
    cursor: not-allowed;
}

/* Divider */
.email-header-divider {
    height: 1px;
    background: #E5E7EB;
    margin: 16px 0;
}

/* Tags Row */
.email-tags-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.email-detail-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #F3F4F6;
    border-radius: 10px;
    font-size: 13px;
    color: #364153;
}

.email-detail-tag svg {
    width: 16px;
    height: 16px;
    color: #6A7282;
}

.email-detail-tag-remove {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: #9CA3AF;
    display: flex;
    align-items: center;
}

.email-detail-tag-remove:hover {
    color: #EF4444;
}

.email-add-tag-btn {
    padding: 6px 12px;
    background: transparent;
    border: none;
    font-size: 13px;
    font-weight: 500;
    color: #6A7282;
    cursor: pointer;
}

.email-add-tag-btn:hover {
    color: #155DFC;
}

/* Secondary Actions (Flag, Ignore) */
.email-secondary-actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
    align-items: center;
}

.email-flag-btn,
.email-archive-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    background: transparent;
    border: 1px solid #E5E7EB;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    color: #6A7282;
    cursor: pointer;
    transition: all 0.15s ease;
}

.email-flag-btn:hover {
    color: #F59E0B;
    border-color: #F59E0B;
    background: #FFFBEB;
}

.email-flag-btn.active {
    color: #F59E0B;
    border-color: #F59E0B;
    background: #FFFBEB;
}

.email-archive-btn:hover {
    color: #6366F1;
    border-color: #6366F1;
    background: #EEF2FF;
}

.email-archive-btn.active {
    color: #6366F1;
    border-color: #6366F1;
    background: #EEF2FF;
}

.email-resolve-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    background: #ECFDF5;
    border: 1px solid #10B981;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    color: #10B981;
    cursor: pointer;
    transition: all 0.15s ease;
}

.email-resolve-btn:hover {
    background: #D1FAE5;
    border-color: #059669;
    color: #059669;
}

/* Original Email Card */
.email-content-card {
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 10px;
    overflow: hidden;
}

.email-content-header {
    padding: 16px 20px;
    border-bottom: 1px solid #E5E7EB;
}

.email-content-title {
    font-size: 14px;
    font-weight: 600;
    color: #101828;
    margin: 0;
}

.email-content-body {
    padding: 20px;
}

.email-body-text {
    font-size: 14px;
    line-height: 1.7;
    color: #364153;
    white-space: pre-wrap;
}

/* AI Response Card */
.email-ai-card {
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    overflow: visible; /* Override .email-card's overflow: hidden to prevent clipping */
}

.email-ai-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #E5E7EB;
}

.email-ai-title {
    font-size: 14px;
    font-weight: 600;
    color: #101828;
    margin: 0;
}

/* AI Draft badge in header - defined above */

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

.email-ai-content {
    background: #F9FAFB;
    border: 1px solid #E5E7EB;
    border-radius: 10px;
    padding: 20px;
    font-size: 14px;
    line-height: 1.7;
    color: #364153;
    white-space: pre-wrap;
}

/* Draft Editor */
.email-editor-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.email-draft-editor {
    width: 100%;
    min-height: 200px;
    padding: 16px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.7;
    border: 2px solid #155DFC;
    border-radius: 10px;
    resize: none;
    background: #FFFFFF;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.email-draft-editor:focus {
    outline: none;
    border-color: #1447E6;
    box-shadow: 0 0 0 4px rgba(21, 93, 252, 0.15);
}

.email-editor-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 4px;
}

#editorWordCount {
    font-size: 12px;
    color: #6A7282;
}

.email-editor-hint {
    font-size: 12px;
    color: #10B981;
    font-weight: 500;
}

/* Editor Action Buttons */
.email-save-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #10B981;
    color: #FFFFFF;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}

.email-save-btn:hover {
    background: #059669;
}

.email-cancel-btn {
    padding: 10px 20px;
    background: #F3F4F6;
    color: #364153;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}

.email-cancel-btn:hover {
    background: #E5E7EB;
}

/* Generate Draft */
.email-generate-draft {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 60px 40px;
    text-align: center;
}

.email-generate-draft p {
    font-size: 14px;
    color: #6A7282;
    margin: 0;
}

.email-generate-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: #155DFC;
    color: #FFFFFF;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

.email-generate-btn:hover {
    background: #1447E6;
}

/* Empty State */
.email-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: #6A7282;
    padding: 40px;
}

.email-empty-state img {
    opacity: 0.3;
    margin-bottom: 16px;
}

.email-empty-state h3 {
    font-size: 16px;
    color: #374151;
    margin: 0 0 8px 0;
}

.email-empty-state p {
    font-size: 14px;
    margin: 0;
}

/* Zero Inbox Celebration */
.email-zero-inbox {
    background: linear-gradient(180deg, #ECFDF5 0%, #F9FAFB 100%);
}

.email-zero-inbox h3 {
    color: #059669;
    font-size: 20px;
    font-weight: 600;
}

.email-zero-inbox p {
    color: #6A7282;
}

.email-celebration-icon {
    margin-bottom: 16px;
    animation: celebrate 0.6s ease-out;
}

@keyframes celebrate {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

.email-list-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: #6A7282;
    font-size: 14px;
    gap: 8px;
}

.email-list-empty-icon {
    font-size: 32px;
}

/* Loading State */
.email-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #6A7282;
}

.email-loading .loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #E5E7EB;
    border-top-color: #155DFC;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 12px;
}

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

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
    max-width: 400px;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    background: #FFFFFF;
    border-radius: 10px;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
    animation: toastSlideIn 0.3s ease;
    max-width: 100%;
}

.toast-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-icon svg {
    width: 12px;
    height: 12px;
}

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

.toast-title {
    font-weight: 600;
    color: #111827;
    margin-bottom: 2px;
}

.toast-message {
    color: #6B7280;
    line-height: 1.4;
    word-wrap: break-word;
}

.toast-close {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border: none;
    background: none;
    cursor: pointer;
    color: #9CA3AF;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.15s, color 0.15s;
}

.toast-close:hover {
    background: #F3F4F6;
    color: #6B7280;
}

/* Toast Types */
.toast-success .toast-icon {
    background: #D1FAE5;
    color: #059669;
}

.toast-error .toast-icon {
    background: #FEE2E2;
    color: #DC2626;
}

.toast-warning .toast-icon {
    background: #FEF3C7;
    color: #D97706;
}

.toast-info .toast-icon {
    background: #DBEAFE;
    color: #2563EB;
}

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

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

/* Confirmation Modal */
.confirm-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.15s ease;
}

.confirm-modal {
    background: #FFFFFF;
    border-radius: 12px;
    width: 100%;
    max-width: 420px;
    margin: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    animation: modalSlideIn 0.2s ease;
}

.confirm-modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 24px 16px;
}

.confirm-modal-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: #DBEAFE;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #2563EB;
}

.confirm-modal-icon svg {
    width: 20px;
    height: 20px;
}

.confirm-modal-title {
    font-size: 18px;
    font-weight: 600;
    color: #111827;
}

.confirm-modal-body {
    padding: 0 24px 20px;
}

.confirm-modal-recipient {
    background: #F9FAFB;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 12px;
}

.confirm-modal-recipient-label {
    font-size: 12px;
    color: #6B7280;
    margin-bottom: 4px;
}

.confirm-modal-recipient-email {
    font-size: 14px;
    font-weight: 500;
    color: #111827;
}

.confirm-modal-subject {
    font-size: 13px;
    color: #6B7280;
}

.confirm-modal-subject strong {
    color: #374151;
}

.confirm-modal-footer {
    display: flex;
    gap: 12px;
    padding: 16px 24px 20px;
    border-top: 1px solid #E5E7EB;
}

.confirm-modal-btn {
    flex: 1;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.confirm-modal-btn-cancel {
    background: #F3F4F6;
    border: 1px solid #E5E7EB;
    color: #374151;
}

.confirm-modal-btn-cancel:hover {
    background: #E5E7EB;
}

.confirm-modal-btn-confirm {
    background: #155DFC;
    border: none;
    color: #FFFFFF;
}

.confirm-modal-btn-confirm:hover {
    background: #1249D8;
}

.confirm-modal-btn-confirm:disabled {
    background: #93C5FD;
    cursor: not-allowed;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalSlideIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* Mobile Navigation */
.email-mobile-nav {
    display: none;
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    background: #FFFFFF;
    border-bottom: 1px solid #E5E7EB;
    padding: 12px 16px;
    z-index: 100;
}

.email-mobile-back {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    font-size: 14px;
    font-weight: 500;
    color: #155DFC;
    cursor: pointer;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

/* Tablet - Narrower left panel */
@media (max-width: 1200px) {
    .email-layout {
        grid-template-columns: 340px 4px 1fr;
    }
}

/* Tablet Portrait - Stack on selection */
@media (max-width: 1024px) {
    .email-layout {
        grid-template-columns: 1fr;
    }

    .email-resize-handle {
        display: none;
    }

    .email-list-panel {
        max-width: none;
    }

    .email-list-panel.hidden {
        display: none;
    }

    .email-detail-panel {
        display: none;
        position: fixed;
        top: 64px;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 50;
        padding-top: 60px;
    }

    .email-detail-panel.active {
        display: flex;
    }

    .email-mobile-nav {
        display: none;
    }

    .email-mobile-nav.active {
        display: block;
    }
}

/* Mobile - Full screen panels */
@media (max-width: 768px) {
    .email-page {
        height: calc(100vh - 56px);
    }

    .email-filters-section {
        padding: 12px;
    }

    .email-priority-filters {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 4px;
    }

    .email-priority-btn {
        flex-shrink: 0;
    }

    .email-item {
        padding: 12px;
    }

    .email-detail-panel {
        padding: 16px;
    }

    .email-header-card {
        padding: 16px;
    }

    .email-header-top {
        flex-direction: column;
        gap: 16px;
    }

    .email-send-btn {
        width: 100%;
        justify-content: center;
    }

    .email-tags-row {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 4px;
    }

    .email-detail-tag {
        flex-shrink: 0;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .email-status-filters {
        gap: 2px;
    }

    .email-status-btn {
        padding: 6px 10px;
    }

    .email-item-preview {
        -webkit-line-clamp: 1;
    }

    .email-item-tags {
        overflow-x: auto;
        flex-wrap: nowrap;
    }

    .email-tag {
        flex-shrink: 0;
    }
}

/* Loading spinner for buttons */
.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #E5E7EB;
    border-top-color: #155DFC;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
