/* ========================================
   EMAIL SPLIT-PANEL INTERFACE
   World-Class Design for CareerFlow
   ======================================== */

.sidebar-email-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  width: 100%;
  padding: 0.75rem 1.125rem;
  background: linear-gradient(135deg, #d4735e 0%, #b8513d 100%);
  color: white;
  border: none;
  border-radius: 0.5rem;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 44px;
}

.sidebar-email-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(212, 115, 94, 0.4);
}

.sidebar-email-btn svg {
  flex-shrink: 0;
}

/* Collapsed sidebar state */
.sidebar.collapsed .sidebar-email-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  padding: 0;
  justify-content: center;
  margin: 0 auto;
}

.sidebar.collapsed .sidebar-email-btn span {
  display: none;
}

/* Email List Sidebar (Left Panel) */
.email-sidebar {
  position: fixed;
  top: 0;
  right: -420px;
  width: 420px;
  height: 100vh;
  background: #ffffff;
  border-left: 1px solid #e5e7eb;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}

.email-sidebar.active {
  right: 0;
}

/* Fullscreen mode */
.email-sidebar.fullscreen {
  width: 100%;
  right: 0;
  z-index: 9999;
}

/* Email content panel in fullscreen mode */
.email-content-panel.fullscreen {
  left: 420px;
  right: 0;
  width: calc(100% - 420px);
  max-width: none;
  z-index: 10000;
}

.email-sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 24px 20px 24px;
  border-bottom: 1px solid #e5e7eb;
  background: #ffffff;
}

/* Email sidebar controls container */
.email-sidebar-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.email-sidebar-btn {
  background: transparent;
  border: none;
  color: #6b7280;
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.email-sidebar-btn:hover {
  background: #f3f4f6;
  color: #d4735e;
  transform: scale(1.05);
}

.email-sidebar-btn svg {
  width: 16px;
  height: 16px;
}

.email-sidebar-header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: #111827;
  letter-spacing: -0.02em;
}

.email-sidebar-close {
  background: transparent;
  border: none;
  font-size: 24px;
  color: #6b7280;
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.email-sidebar-close:hover {
  background: #f3f4f6;
  color: #111827;
  transform: scale(1.05);
}

.email-sidebar-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.email-item {
  padding: 18px 24px;
  border-bottom: 1px solid #e5e7eb;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  background: #ffffff;
}

.email-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: #d4735e;
  transform: scaleY(0);
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.email-item:hover::before {
  transform: scaleY(1);
}

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

.email-item.selected::before {
  transform: scaleY(1);
}

.email-item.unread {
  background: #fef3f2;
}

.email-item.unread .email-subject {
  font-weight: 600;
  color: #111827;
}

.email-from {
  font-size: 14px;
  font-weight: 600;
  color: #d4735e;
  margin-bottom: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.email-subject {
  font-size: 15px;
  font-weight: 500;
  color: #111827;
  margin-bottom: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.4;
}

.email-snippet {
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.5;
}

.email-date {
  font-size: 12px;
  color: #9ca3af;
  font-weight: 500;
}

.email-loading,
.email-error,
.email-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
}

.email-error {
  color: var(--error-color, #e74c3c);
}

.email-sidebar-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background: transparent;
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  pointer-events: none;
}

.email-sidebar-backdrop.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.gmail-reauth-btn,
.gmail-connect-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #4285f4;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
  max-width: 300px;
  margin: 0 auto;
}

.gmail-reauth-btn:hover,
.gmail-connect-btn:hover {
  background: #357ae8;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(66, 133, 244, 0.3);
}

.gmail-reauth-btn:active,
.gmail-connect-btn:active {
  transform: translateY(0);
}

.gmail-connect-btn svg {
  flex-shrink: 0;
}

/* ==== EMAIL CONTENT PANEL ====
   Split-panel design: slides in from right when email is clicked */

.email-content-panel {
  position: fixed;
  top: 0;
  right: -100%;
  width: 60%;
  min-width: 600px;
  max-width: 900px;
  height: 100vh;
  background: #ffffff;
  border-left: 1px solid #e5e7eb;
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.15);
  z-index: 1001;
  transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}

.email-content-panel.active {
  right: 0;
}

/* Email Content Header */
.email-content-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 28px 32px 24px 32px;
  border-bottom: 1px solid #e5e7eb;
  gap: 20px;
  background: #ffffff;
}

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

.email-content-title h2 {
  margin: 0 0 12px 0;
  font-size: 24px;
  font-weight: 700;
  color: #111827;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.email-content-close {
  background: transparent;
  border: none;
  color: #6b7280;
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}

.email-content-close:hover {
  background: #f3f4f6;
  color: #111827;
  transform: scale(1.05);
}

.email-content-close svg {
  width: 24px;
  height: 24px;
}

/* Email Meta Information */
.email-content-meta {
  padding: 0 32px 24px 32px;
  border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
}

.email-meta-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  font-size: 14px;
}

.email-meta-row:last-child {
  margin-bottom: 0;
}

.email-meta-label {
  color: #6b7280;
  font-weight: 500;
  min-width: 60px;
}

.email-meta-value {
  color: #111827;
  font-weight: 500;
  flex: 1;
}

/* AI Smart Cards - Job-Related Info */
.email-smart-cards {
  padding: 20px 32px;
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.smart-card {
  background: linear-gradient(135deg, rgba(212, 115, 94, 0.08) 0%, rgba(184, 81, 61, 0.05) 100%);
  border: 1px solid rgba(212, 115, 94, 0.2);
  border-radius: 10px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.smart-card-icon {
  width: 40px;
  height: 40px;
  background: rgba(212, 115, 94, 0.15);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.smart-card-icon svg {
  width: 22px;
  height: 22px;
  color: #d4735e;
}

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

.smart-card-label {
  font-size: 12px;
  font-weight: 600;
  color: #d4735e;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.smart-card-value {
  font-size: 15px;
  font-weight: 600;
  color: #111827;
  line-height: 1.3;
}

/* Email Body Content */
.email-content-body {
  flex: 1;
  overflow-y: auto;
  padding: 32px;
  font-size: 15px;
  line-height: 1.8;
  color: #374151;
  background: #ffffff;
}

.email-content-body p {
  margin-bottom: 1.2em;
}

.email-content-body a {
  color: #d4735e;
  text-decoration: none;
  border-bottom: 1px solid rgba(212, 115, 94, 0.3);
  transition: all 0.2s;
}

.email-content-body a:hover {
  border-bottom-color: #d4735e;
}

.email-content-body img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 16px 0;
}

/* Rich HTML Email Content Styles */
.email-content-body h1,
.email-content-body h2,
.email-content-body h3,
.email-content-body h4,
.email-content-body h5,
.email-content-body h6 {
  margin-top: 1.5em;
  margin-bottom: 0.75em;
  font-weight: 700;
  line-height: 1.4;
  color: #1f2937;
}

.email-content-body h1 {
  font-size: 2em;
  border-bottom: 2px solid #e5e7eb;
  padding-bottom: 0.3em;
}

.email-content-body h2 {
  font-size: 1.5em;
  border-bottom: 1px solid #f3f4f6;
  padding-bottom: 0.3em;
}

.email-content-body h3 {
  font-size: 1.25em;
}

.email-content-body h4 {
  font-size: 1.1em;
}

.email-content-body h5,
.email-content-body h6 {
  font-size: 1em;
  color: #4b5563;
}

.email-content-body ul,
.email-content-body ol {
  margin: 1em 0;
  padding-left: 2em;
}

.email-content-body li {
  margin: 0.5em 0;
  line-height: 1.6;
}

.email-content-body ul li {
  list-style-type: disc;
}

.email-content-body ol li {
  list-style-type: decimal;
}

.email-content-body blockquote {
  margin: 1.5em 0;
  padding: 1em 1.5em;
  border-left: 4px solid #d4735e;
  background: #f9fafb;
  border-radius: 0 8px 8px 0;
  color: #4b5563;
  font-style: italic;
}

.email-content-body blockquote p:last-child {
  margin-bottom: 0;
}

.email-content-body code {
  background: #f3f4f6;
  padding: 0.2em 0.4em;
  border-radius: 4px;
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Mono', 'Courier New', monospace;
  font-size: 0.9em;
  color: #d4735e;
}

.email-content-body pre {
  margin: 1.5em 0;
  padding: 1.5em;
  background: #1f2937;
  color: #f9fafb;
  border-radius: 8px;
  overflow-x: auto;
  line-height: 1.6;
}

.email-content-body pre code {
  background: transparent;
  padding: 0;
  color: inherit;
  font-size: 0.875em;
}

.email-content-body table {
  width: 100%;
  margin: 1.5em 0;
  border-collapse: collapse;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.email-content-body table thead {
  background: #f9fafb;
}

.email-content-body table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: #1f2937;
  border-bottom: 2px solid #e5e7eb;
}

.email-content-body table td {
  padding: 12px 16px;
  border-bottom: 1px solid #f3f4f6;
  color: #374151;
}

.email-content-body table tr:last-child td {
  border-bottom: none;
}

.email-content-body table tr:hover {
  background: #f9fafb;
}

.email-content-body hr {
  margin: 2em 0;
  border: none;
  border-top: 2px solid #e5e7eb;
}

.email-content-body strong,
.email-content-body b {
  font-weight: 600;
  color: #1f2937;
}

.email-content-body em,
.email-content-body i {
  font-style: italic;
}

.email-content-body del,
.email-content-body s {
  text-decoration: line-through;
  color: #9ca3af;
}

.email-content-body mark {
  background: #fef3c7;
  padding: 0.1em 0.3em;
  border-radius: 3px;
}

.email-content-body kbd {
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  padding: 0.1em 0.4em;
  font-family: 'SF Mono', 'Monaco', monospace;
  font-size: 0.9em;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.1);
}

/* Action Buttons */
.email-content-actions {
  padding: 20px 32px;
  border-top: 1px solid #e5e7eb;
  background: #f9fafb;
  display: flex;
  gap: 12px;
}

.email-action-btn {
  flex: 1;
  padding: 12px 20px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
}

.email-action-btn-primary {
  background: linear-gradient(135deg, #d4735e 0%, #b8513d 100%);
  color: white;
}

.email-action-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(212, 115, 94, 0.4);
}

.email-action-btn-secondary {
  background: #27272a;
  color: #e4e4e7;
  border: 1px solid #3f3f46;
}

.email-action-btn-secondary:hover {
  background: #3f3f46;
  transform: translateY(-2px);
}

/* ==== JOB SELECTION MODAL ==== */

.job-link-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.job-link-modal.active {
  opacity: 1;
  visibility: visible;
}

.job-link-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.job-link-content {
  position: relative;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.job-link-modal.active .job-link-content {
  transform: scale(1);
}

.job-link-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 28px;
  border-bottom: 1px solid #e5e7eb;
}

.job-link-header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: #111827;
  letter-spacing: -0.02em;
}

.job-link-close {
  background: transparent;
  border: none;
  color: #6b7280;
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s;
}

.job-link-close:hover {
  background: #f3f4f6;
  color: #111827;
}

.job-link-close svg {
  width: 20px;
  height: 20px;
}

.job-link-search {
  padding: 20px 28px;
  border-bottom: 1px solid #e5e7eb;
}

.job-link-search input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  color: #111827;
  transition: all 0.2s;
}

.job-link-search input:focus {
  outline: none;
  border-color: #d4735e;
  box-shadow: 0 0 0 3px rgba(212, 115, 94, 0.1);
}

.job-link-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
}

.job-link-loading,
.job-link-error,
.job-link-empty {
  text-align: center;
  padding: 40px 20px;
  color: #6b7280;
  font-size: 14px;
}

.job-link-error {
  color: #ef4444;
}

.job-link-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 28px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border-bottom: 1px solid #f3f4f6;
}

.job-link-item:hover {
  background: #f9fafb;
}

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

.job-link-item-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}

.job-link-item-header h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #111827;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.job-link-status {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.job-link-position {
  margin: 0 0 4px 0;
  font-size: 14px;
  color: #374151;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.job-link-location {
  margin: 0;
  font-size: 13px;
  color: #6b7280;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.job-link-arrow {
  flex-shrink: 0;
  color: #9ca3af;
  transition: all 0.2s;
}

.job-link-item:hover .job-link-arrow {
  color: #d4735e;
  transform: translateX(4px);
}

/* ==== EMAIL REPLY COMPOSER ==== */

.email-reply-composer {
  background: #ffffff;
  border-top: 2px solid #d4735e;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.1);
  animation: slideUpFade 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.email-reply-composer.closing {
  animation: slideDownFade 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.email-reply-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 32px;
  border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
}

.email-reply-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #111827;
}

.email-reply-close {
  background: transparent;
  border: none;
  color: #6b7280;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s;
}

.email-reply-close:hover {
  background: #e5e7eb;
  color: #111827;
}

.email-reply-close svg {
  width: 18px;
  height: 18px;
}

.email-reply-form {
  padding: 24px 32px 32px 32px;
}

.email-reply-field {
  margin-bottom: 20px;
}

.email-reply-field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.email-reply-field input,
.email-reply-field textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  color: #111827;
  transition: all 0.2s;
  background: #ffffff;
}

.email-reply-field input:focus,
.email-reply-field textarea:focus {
  outline: none;
  border-color: #d4735e;
  box-shadow: 0 0 0 3px rgba(212, 115, 94, 0.1);
}

.email-reply-field input[readonly] {
  background: #f9fafb;
  color: #6b7280;
  cursor: not-allowed;
}

.email-reply-field textarea {
  resize: vertical;
  min-height: 200px;
  line-height: 1.6;
}

.email-reply-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.email-reply-send-btn,
.email-reply-cancel-btn {
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
}

.email-reply-send-btn {
  flex: 1;
  background: linear-gradient(135deg, #d4735e 0%, #b8513d 100%);
  color: white;
}

.email-reply-send-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(212, 115, 94, 0.4);
}

.email-reply-send-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.email-reply-cancel-btn {
  background: #f3f4f6;
  color: #6b7280;
}

.email-reply-cancel-btn:hover {
  background: #e5e7eb;
  color: #374151;
}

.email-reply-status {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  background: #eff6ff;
  color: #1e40af;
}

.email-reply-status.success {
  background: #f0fdf4;
  color: #15803d;
}

.email-reply-status.error {
  background: #fef2f2;
  color: #dc2626;
}

.spinning {
  animation: spin 1s linear infinite;
}

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

/* Responsive Design */
@media (max-width: 1200px) {
  .email-content-panel {
    width: 70%;
    min-width: 500px;
  }
}

@media (max-width: 768px) {
  .email-sidebar {
    width: 100%;
    right: -100%;
  }

  .email-sidebar.active {
    right: 0;
  }

  .email-content-panel {
    width: 100%;
    min-width: 100%;
    max-width: 100%;
  }

  .email-content-header,
  .email-content-meta,
  .email-smart-cards,
  .email-content-body,
  .email-content-actions {
    padding-left: 20px;
    padding-right: 20px;
  }

  .email-action-btn {
    font-size: 13px;
    padding: 10px 16px;
  }

  .job-link-content {
    width: 95%;
    max-height: 90vh;
  }

  .job-link-header,
  .job-link-search {
    padding: 20px;
  }

  .job-link-item {
    padding: 14px 20px;
  }
}

/* ==== EMAIL COMPOSE BUTTON ==== */

.email-compose-btn-container {
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
  background: #ffffff;
}

.email-compose-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 20px;
  background: linear-gradient(135deg, #d4735e 0%, #b8513d 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(212, 115, 94, 0.2);
}

.email-compose-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(212, 115, 94, 0.4);
}

.email-compose-btn:active {
  transform: translateY(0);
}

.email-compose-btn svg {
  flex-shrink: 0;
}

/* ==== EMAIL SEARCH BAR ==== */

.email-search-container {
  padding: 16px 20px 12px 20px;
  border-bottom: 1px solid #e5e7eb;
  background: #ffffff;
}

.email-search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.email-search-icon {
  position: absolute;
  left: 12px;
  color: #9ca3af;
  pointer-events: none;
  z-index: 1;
}

.email-search-input {
  width: 100%;
  padding: 10px 36px 10px 40px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  color: #111827;
  background: #f9fafb;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.email-search-input:focus {
  outline: none;
  border-color: #d4735e;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(212, 115, 94, 0.1);
}

.email-search-input::placeholder {
  color: #9ca3af;
}

.email-search-clear {
  position: absolute;
  right: 8px;
  background: transparent;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  padding: 6px;
  border-radius: 4px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.email-search-clear:hover {
  background: #f3f4f6;
  color: #111827;
}

/* ==== EMAIL FILTER TABS ==== */

.email-filter-tabs {
  display: flex;
  gap: 4px;
  padding: 12px 20px;
  border-bottom: 1px solid #e5e7eb;
  background: #ffffff;
  overflow-x: auto;
  scrollbar-width: none;
}

.email-filter-tabs::-webkit-scrollbar {
  display: none;
}

.email-filter-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: transparent;
  border: 1px solid #e5e7eb;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  flex-shrink: 0;
}

.email-filter-tab svg {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
}

.email-filter-tab:hover {
  background: #f9fafb;
  border-color: #d1d5db;
  color: #111827;
}

.email-filter-tab.active {
  background: linear-gradient(135deg, #d4735e 0%, #b8513d 100%);
  border-color: #d4735e;
  color: white;
}

.email-filter-tab.active svg {
  stroke: white;
  fill: none;
}

/* ==== EMAIL COMPOSE MODAL ==== */

.email-compose-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.email-compose-modal.active {
  opacity: 1;
  visibility: visible;
}

.email-compose-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.email-compose-content {
  position: relative;
  width: 90%;
  max-width: 700px;
  max-height: 85vh;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.email-compose-modal.active .email-compose-content {
  transform: scale(1);
}

.email-compose-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 28px;
  border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
  border-radius: 12px 12px 0 0;
}

.email-compose-header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: #111827;
}

.email-compose-close {
  background: transparent;
  border: none;
  color: #6b7280;
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s;
}

.email-compose-close:hover {
  background: #e5e7eb;
  color: #111827;
}

.email-compose-close svg {
  width: 20px;
  height: 20px;
}

.email-compose-form {
  padding: 24px 28px 28px 28px;
  overflow-y: auto;
}

.email-compose-field {
  margin-bottom: 20px;
}

.email-compose-field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.email-compose-field input,
.email-compose-field textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  color: #111827;
  transition: all 0.2s;
  background: #ffffff;
}

.email-compose-field input:focus,
.email-compose-field textarea:focus {
  outline: none;
  border-color: #d4735e;
  box-shadow: 0 0 0 3px rgba(212, 115, 94, 0.1);
}

.email-compose-field textarea {
  resize: vertical;
  min-height: 300px;
  line-height: 1.6;
}

.email-compose-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.email-compose-send-btn,
.email-compose-cancel-btn {
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
}

.email-compose-send-btn {
  flex: 1;
  background: linear-gradient(135deg, #d4735e 0%, #b8513d 100%);
  color: white;
}

.email-compose-send-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(212, 115, 94, 0.4);
}

.email-compose-send-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.email-compose-cancel-btn {
  background: #f3f4f6;
  color: #6b7280;
}

.email-compose-cancel-btn:hover {
  background: #e5e7eb;
  color: #374151;
}

.email-compose-status {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  background: #eff6ff;
  color: #1e40af;
}

.email-compose-status.success {
  background: #f0fdf4;
  color: #15803d;
}

.email-compose-status.error {
  background: #fef2f2;
  color: #dc2626;
}

/* ==== ENHANCED COMPOSE MODAL ==== */

/* Header actions (minimize/close) */
.email-compose-header .header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.minimize-compose {
  background: transparent;
  border: none;
  color: #6b7280;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 20px;
  font-weight: 700;
  transition: all 0.2s;
  padding-bottom: 8px;
}

.minimize-compose:hover {
  background: #e5e7eb;
  color: #111827;
}

/* Minimized state */
.email-compose-modal.minimized {
  align-items: flex-end;
  padding: 20px;
}

.email-compose-modal.minimized .email-compose-content {
  max-width: 500px;
  max-height: 60px;
}

.email-compose-modal.minimized .email-compose-form,
.email-compose-modal.minimized .compose-toolbar,
.email-compose-modal.minimized .compose-attachments {
  display: none;
}

/* To field with CC/BCC buttons */
.compose-to-field {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}

.compose-to-field input {
  flex: 1;
}

.recipient-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.show-cc-bcc {
  background: transparent;
  border: 1px solid #d1d5db;
  color: #6b7280;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.show-cc-bcc:hover {
  background: #f3f4f6;
  color: #d4735e;
  border-color: #d4735e;
}

/* CC/BCC fields */
.compose-cc,
.compose-bcc {
  display: none;
  align-items: center;
  gap: 12px;
}

/* Rich Text Formatting Toolbar */
.compose-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  margin-bottom: 12px;
}

.toolbar-group {
  display: flex;
  gap: 2px;
}

.toolbar-separator {
  width: 1px;
  height: 24px;
  background: #e5e7eb;
  margin: 0 8px;
}

.toolbar-btn {
  background: transparent;
  border: none;
  color: #6b7280;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 4px;
}

.toolbar-btn:hover {
  background: #e5e7eb;
  color: #111827;
}

.toolbar-btn strong,
.toolbar-btn em,
.toolbar-btn u {
  font-family: Georgia, serif;
  font-size: 14px;
}

/* Content Editable Message Field */
.compose-message-field {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.compose-editor {
  width: 100%;
  min-height: 300px;
  padding: 14px 16px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  color: #111827;
  line-height: 1.7;
  background: #ffffff;
  overflow-y: auto;
  transition: all 0.2s;
}

.compose-editor:focus {
  outline: none;
  border-color: #d4735e;
  box-shadow: 0 0 0 3px rgba(212, 115, 94, 0.1);
}

.compose-editor:empty:before {
  content: attr(data-placeholder);
  color: #9ca3af;
  font-style: italic;
}

/* Preserve formatting in editor */
.compose-editor p {
  margin-bottom: 1em;
}

.compose-editor ul,
.compose-editor ol {
  margin: 0.5em 0;
  padding-left: 2em;
}

.compose-editor a {
  color: #d4735e;
  text-decoration: underline;
}

/* File Attachments */
.compose-attachments {
  margin-top: 16px;
}

.attached-files {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.attached-file {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  transition: all 0.2s;
}

.attached-file:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
}

.file-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.file-info {
  flex: 1;
  min-width: 0;
}

.file-name {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-size {
  font-size: 12px;
  color: #6b7280;
  margin-top: 2px;
}

.remove-file {
  background: transparent;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  font-size: 24px;
  transition: all 0.2s;
  flex-shrink: 0;
}

.remove-file:hover {
  background: #fee2e2;
  color: #dc2626;
}

/* Drag and drop overlay */
.email-compose-content.drag-over {
  background: rgba(212, 115, 94, 0.05);
  border: 2px dashed #d4735e;
}

/* Enhanced action buttons */
.email-compose-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
}

.email-compose-actions .footer-left,
.email-compose-actions .footer-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-icon {
  background: transparent;
  border: 1px solid #d1d5db;
  color: #6b7280;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  background: #f3f4f6;
  color: #d4735e;
  border-color: #d4735e;
}

.attach-btn:hover {
  transform: rotate(15deg);
}

.draft-btn:hover {
  transform: scale(1.1);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .compose-toolbar {
    flex-wrap: wrap;
    padding: 8px 10px;
  }

  .toolbar-separator {
    display: none;
  }

  .email-compose-actions {
    flex-wrap: wrap;
  }

  .email-compose-actions .footer-left,
  .email-compose-actions .footer-right {
    width: 100%;
    justify-content: space-between;
  }
}

