/* ELESKA Mail Design System & Premium CSS */

:root {
  /* Font & General */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  /* Light Theme Variables */
  --primary-color: #1a9ce2;
  --primary-hover: #1480bc;
  --primary-light: #f0f9ff;
  --primary-light-hover: #e0f2fe;

  --bg-base: #f4f9fc;
  --bg-surface: #ffffff;
  --bg-sidebar: #ffffff;
  --border-color: #e2eaf0;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --hover-bg: #f1f5f9;
  --selected-bg: #e2e8f0;

  --badge-bg: #e0f2fe;
  --badge-text: #0369a1;

  --card-shadow: 0 4px 18px -4px rgba(26, 156, 226, 0.06), 0 2px 8px -2px rgba(26, 156, 226, 0.03);
  --header-shadow: 0 1px 3px 0 rgba(26, 156, 226, 0.05);
  --sidebar-width: 260px;
  --header-height: 70px;

  /* Transition durations */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (max-width: 768px) {
  :root {
    --header-height: 60px;
  }
}

/* Dark Theme Variables */
html[data-theme="dark"] {
  --primary-color: #ffffff;
  --primary-hover: #e5e5ea;
  --primary-light: #252528;
  --primary-light-hover: #2c2c2e;

  --bg-base: #1d1d1f;
  --bg-surface: #252528;
  --bg-sidebar: #1d1d1f;
  --border-color: #38383a;
  --text-main: #ffffff;
  --text-muted: #8e8e93;
  --hover-bg: #2c2c2e;
  --selected-bg: #3a3a3c;

  --badge-bg: #e11d48;
  --badge-text: #ffffff;

  --card-shadow: 0 4px 18px -4px rgba(0, 0, 0, 0.4), 0 2px 8px -2px rgba(0, 0, 0, 0.3);
  --header-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.2);
}

html[data-theme="dark"] select,
html[data-theme="dark"] option {
  background-color: #252528 !important;
  /* var(--bg-surface) */
  color: #f8fafc !important;
  /* var(--text-main) */
}

a {
    box-sizing: initial;
}

/* Premium Dropdown Styles */
.dropdown-menu {
  background-color: var(--bg-surface) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 12px !important;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08) !important;
  padding: 0.5rem !important;
  z-index: 10005 !important;
}

.dropdown-item {
  color: var(--text-main) !important;
  font-size: 0.875rem !important;
  padding: 0.5rem 0.85rem !important;
  border-radius: 8px !important;
  font-weight: 500 !important;
  display: flex !important;
  align-items: center !important;
  gap: 0.5rem !important;
  background-color: transparent !important;
  transition: background-color var(--transition-fast), color var(--transition-fast) !important;
}

.dropdown-item:hover,
.dropdown-item:focus,
.dropdown-item.active,
.dropdown-item:active {
  background-color: var(--hover-bg) !important;
  color: var(--text-main) !important;
}

html[data-theme="dark"] .dropdown-menu {
  background-color: var(--bg-surface) !important;
  border-color: var(--border-color) !important;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35) !important;
}

html[data-theme="dark"] .dropdown-item {
  color: var(--text-main) !important;
}

html[data-theme="dark"] .dropdown-item:hover,
html[data-theme="dark"] .dropdown-item:focus,
html[data-theme="dark"] .dropdown-item.active,
html[data-theme="dark"] .dropdown-item:active {
  background-color: var(--hover-bg) !important;
  color: var(--text-main) !important;
}

.dropdown-header {
  color: var(--text-muted) !important;
  font-weight: 600 !important;
}


/* Reset & Base Rules */
body {
  font-family: var(--font-family);
  background-color: var(--bg-base);
  color: var(--text-main);
  overflow: hidden;
  margin: 0;
  padding: 0;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* App Wrapper */
.eleska-app {
  display: flex;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
}

/* ========================================================
   LEFT SIDEBAR STYLE
   ======================================================== */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 1.5rem 1rem;
  z-index: 10;
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 2rem;
  padding-left: 0.5rem;
}

.logo-icon {
  background: linear-gradient(135deg, var(--primary-color), #8b5cf6);
  color: white;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.25rem;
  box-shadow: 0 4px 12px rgba(92, 60, 230, 0.3);
}

.logo-text {
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.5px;
  background: linear-gradient(to right, var(--text-main), var(--text-muted));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Compose Button */
.btn-compose {
  background: var(--primary-color);
  color: var(--bg-surface) !important;
  border: none;
  font-weight: 600;
  padding: 0.65rem 1.25rem;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), opacity var(--transition-fast), background-color var(--transition-fast);
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
}

.btn-compose:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
  color: var(--bg-surface) !important;
}

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

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

/* Navigation List */
.sidebar-nav {
  list-style: none;
  padding: 0;
  margin: 0;
  flex-grow: 1;
  overflow-y: auto;
}

.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background-color: var(--border-color);
  border-radius: 4px;
}

.nav-item-wrapper {
  margin-bottom: 0.25rem;
}

.nav-link-custom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1rem;
  border-radius: 12px;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.925rem;
  transition: background-color var(--transition-fast), color var(--transition-fast);
  cursor: pointer;
}

.nav-link-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.nav-link-left svg {
  width: 18px;
  height: 18px;
  stroke-width: 2px;
  transition: stroke var(--transition-fast);
}

.nav-link-custom:hover {
  background-color: var(--hover-bg);
  color: var(--text-main);
}

.nav-link-custom.active {
  background-color: var(--primary-light);
  color: var(--primary-color);
  font-weight: 600;
}

.nav-link-custom.active svg {
  stroke: var(--primary-color);
}

.badge-unread {
  background-color: var(--badge-bg);
  color: var(--badge-text);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

/* Labels Section */
.labels-header {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 1px;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  padding-left: 0.75rem;
  padding-right: 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.btn-add-label {
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.btn-add-label svg {
  width: 16px !important;
  height: 16px !important;
}

.btn-add-label:hover {
  background-color: var(--hover-bg);
  color: var(--text-main);
}

.label-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

/* ========================================================
   MAIN CONTENT WRAPPER
   ======================================================== */
.main-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
  overflow: hidden;
}

/* ========================================================
   TOP HEADER STYLE
   ======================================================== */
.top-header {
  height: var(--header-height);
  min-height: var(--header-height);
  flex-shrink: 0;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  box-shadow: var(--header-shadow);
  z-index: 9;
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

/* Search Bar Container */
.search-container {
  flex-grow: 1;
  max-width: 720px;
  position: relative;
  margin-right: 2rem;
  margin-top: 2px;
  margin-bottom: 2px;
}

.search-input-wrapper {
  display: flex;
  align-items: center;
  background-color: var(--bg-base);
  border: 1px solid transparent;
  border-radius: 28px;
  padding: 0.2rem 1.25rem 0.2rem 1rem;
  transition: background-color var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.search-input-wrapper:focus-within {
  background-color: var(--bg-surface);
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(92, 60, 230, 0.15);
}

/* Recent Search and Clear Input Styles */
.search-clear-btn {
  background: transparent;
  border: none;
  padding: 0;
  margin-left: 8px;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.search-clear-btn:hover {
  background-color: var(--hover-bg);
  color: var(--text-main);
}

.search-history-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color) !important;
  border-radius: 16px;
  margin-top: 8px;
  z-index: 1010;
  padding: 12px 0;
  max-height: 280px;
  overflow-y: auto;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08) !important;
}

.search-history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 16px 8px 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.btn-clear-history {
  background: transparent;
  border: none;
  color: var(--primary-color);
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.btn-clear-history:hover {
  text-decoration: underline;
}

.search-history-list {
  display: flex;
  flex-direction: column;
  margin-top: 6px;
}

.search-history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-main);
  transition: background-color var(--transition-fast);
}

.search-history-item:hover {
  background-color: var(--hover-bg);
}

.search-history-item-left {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 80%;
}

.search-history-item-left i,
.search-history-item-left svg {
  color: var(--text-muted);
  flex-shrink: 0;
  width: 14px;
  height: 14px;
}

.btn-delete-search-item {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
}

.btn-delete-search-item:hover {
  background-color: var(--border-color);
  color: var(--text-main);
}

.search-input {
  border: none;
  background: transparent;
  width: 100%;
  font-size: 0.95rem;
  color: var(--text-main);
  padding: 0.2rem 0.5rem;
}

.search-input:focus {
  outline: none;
}

.search-icon-left {
  color: var(--text-muted);
  width: 18px;
  height: 18px;
  margin-right: 0.25rem;
}

.btn-filter {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 4px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
}

.btn-filter:hover {
  background-color: var(--hover-bg);
  color: var(--text-main);
}

/* Header Action Right */
.header-actions-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-icon-header {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.btn-icon-header:hover {
  background-color: var(--hover-bg);
  color: var(--text-main);
}

.btn-icon-header svg {
  width: 20px;
  height: 20px;
}

.avatar-wrapper {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  overflow: hidden;
  margin-left: 0.5rem;
  border: 2px solid var(--border-color);
  cursor: pointer;
}

.avatar-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ========================================================
   MAIL VIEWPORT (TOOLBAR + LIST)
   ======================================================== */
.mail-viewport {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.mail-selection-bar {
  height: 52px;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

.btn-select-all-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: var(--text-muted);
  border-radius: 6px;
  transition: color 0.18s, background 0.18s;
  flex-shrink: 0;
}

.btn-select-all-icon:hover {
  background: var(--hover-bg);
  color: var(--primary-color);
}

/* Toolbar */
.mail-toolbar {
  min-height: 64px;
  height: auto;
  padding: 0.75rem 1.25rem;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

.avatar-pin-badge {
  position: absolute;
  bottom: -2px;
  right: -2px;
  background-color: var(--primary-color);
  color: var(--bg-surface) !important;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--bg-surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  z-index: 2;
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.avatar-pin-badge:hover {
  transform: scale(1.1);
}

/* Avatar attachment badge styling restored and made larger */
.avatar-attachment-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  background-color: #64748b;
  /* Sleek slate gray */
  color: var(--bg-surface) !important;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--bg-surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  z-index: 2;
  pointer-events: none;
}

.avatar-attachment-badge svg {
  width: 11px !important;
  height: 11px !important;
  stroke: var(--bg-surface) !important;
  fill: none !important;
}

.avatar-pin-badge svg {
  width: 9px;
  height: 9px;
}

.mail-avatar-wrap.avatar-pinned {
  border-color: var(--primary-color) !important;
}

.toolbar-group-left,
.toolbar-group-right {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.btn-toolbar {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.btn-toolbar:hover {
  background-color: var(--hover-bg);
  color: var(--text-main);
}

.btn-toolbar:disabled {
  opacity: 0.4;
  cursor: default;
}

.btn-toolbar:disabled:hover {
  background-color: transparent;
  color: var(--text-muted);
}

.btn-toolbar.active {
  background-color: var(--primary-light);
  color: var(--primary-color);
}

.btn-toolbar.active:hover {
  background-color: var(--primary-light);
  color: var(--primary-color);
}

.btn-toolbar svg {
  width: 19px;
  height: 19px;
}

/* Action buttons (archive, delete, spam, move, label) are hidden until mails are selected */
.btn-toolbar-action {
  display: none !important;
}

.btn-toolbar-action.toolbar-action-visible {
  display: flex !important;
}

/* dropdown wrapper that also has btn-toolbar-action */
div.btn-toolbar-action {
  display: none !important;
}

div.btn-toolbar-action.toolbar-action-visible {
  display: flex !important;
}

.toolbar-divider {
  width: 1px;
  height: 20px;
  background-color: var(--border-color);
  margin: 0 0.5rem;
}

/* Split button toolbar groups */
.toolbar-split-group {
  display: inline-flex;
  align-items: center;
  border-radius: 8px;
  background-color: transparent;
  transition: background-color var(--transition-fast);
  height: 36px;
}

.toolbar-split-group:hover {
  background-color: var(--hover-bg);
}

.toolbar-split-group .split-main-btn {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  width: 32px;
  height: 36px;
  padding: 0;
}

.toolbar-split-group .split-arrow-btn {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  width: 18px;
  height: 36px;
  padding: 0;
  border-left: 1px solid var(--border-color);
}

.toolbar-split-group .btn-toolbar:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

html[data-theme="dark"] .toolbar-split-group .btn-toolbar:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.dropdown-item.disabled,
.dropdown-item:disabled {
  opacity: 0.45 !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
  background-color: transparent !important;
  color: var(--text-muted) !important;
}

/* Mail List Scroll Wrapper */
.mail-list-container {
  flex-grow: 1;
  overflow-y: auto;
  background-color: var(--bg-surface);
  position: relative;
}

.mail-list-container::-webkit-scrollbar {
  width: 8px;
}

.mail-list-container::-webkit-scrollbar-thumb {
  background-color: var(--border-color);
  border-radius: 4px;
}

/* Mail List Row CSS */
.mail-row {
  display: flex;
  align-items: center;
  min-height: 60px;
  height: auto;
  padding: 0.45rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  background-color: #fcfcfd;
  /* slightly distinct base for read items */
  color: var(--text-main);
  text-decoration: none;
  font-size: 0.9rem;
  user-select: none;
  transition: background-color var(--transition-fast);
  cursor: pointer;
}

html[data-theme="dark"] .mail-row {
  background-color: #1c1c1e;
}

/* Unread row overrides */
.mail-row.unread {
  background-color: #f2f6fc;
}

html[data-theme="dark"] .mail-row.unread {
  background-color: #1e293b;
}

.mail-row.unread .mail-sender,
.mail-row.unread .mail-subject {
  font-weight: 700;
}

/* Selected row background overrides */
.mail-row.selected {
  background-color: var(--selected-bg) !important;
}

.mail-row:hover,
.mail-row.context-menu-active {
  background-color: var(--hover-bg) !important;
  box-shadow: inset 1px 0 0 var(--primary-color);
}

/* Row elements structure */
.mail-cell-star {
  width: 32px;
  display: flex;
  align-items: center;
  color: var(--text-muted);
}

.mail-star-icon {
  cursor: pointer;
  transition: color var(--transition-fast), transform 0.1s ease;
}

.mail-star-icon:hover {
  color: #eab308;
  transform: scale(1.15);
}

/* Pin icon */
.mail-pin-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  flex-shrink: 0;
  margin-right: 0.25rem;
  cursor: pointer;
  color: var(--text-muted);
  opacity: 0.35;
  transition: opacity 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.mail-pin-icon svg {
  width: 15px;
  height: 15px;
}

.mail-row:hover .mail-pin-icon {
  opacity: 1;
}

.mail-pin-icon:hover {
  color: var(--primary-color);
  transform: scale(1.15);
}

.mail-pin-icon.pinned {
  opacity: 1;
  color: var(--primary-color);
}

/* Pinned row accent */
.mail-row.pinned-row {
  border-left: 3px solid var(--primary-color);
  background: linear-gradient(90deg, color-mix(in srgb, var(--primary-color) 6%, transparent) 0%, transparent 40%);
}


/* Avatar wrapper — click to select */
.mail-avatar-wrap {
  position: relative;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  margin-left: 0.35rem;
  margin-right: 0.6rem;
  cursor: pointer;
  border-radius: 50%;
}

.mail-avatar-wrap:hover .mail-row-avatar {
  opacity: 0.75;
  transform: scale(1.05);
}

/* Checkmark overlay (hidden by default) */
.avatar-check-overlay {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: #5c3ce6;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
  z-index: 10;
}

.avatar-check-overlay svg {
  width: 16px;
  height: 16px;
  stroke: #ffffff;
}

.mail-avatar-wrap.avatar-selected .avatar-check-overlay {
  opacity: 1;
  transform: scale(1);
}

.mail-row-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
  object-fit: cover;
  border: 1px solid var(--border-color);
  user-select: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  width: 100%;
  height: 100%;
}

.mail-sender {
  width: 180px;
  min-width: 180px;
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 1rem;
}

.mail-content-summary {
  flex-grow: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-right: 1rem;
  gap: 2px;
}

.mail-subject {
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  max-width: 100%;
}

.mail-snippet {
  color: var(--text-muted);
  font-weight: 400 !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  max-width: 100%;
}

.snippet-sep {
  display: none !important;
}

.mail-badges {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: 0.5rem;
  padding-right: 0.5rem;
}

.badge-label-tag {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.1rem 0.45rem;
  border-radius: 6px;
  white-space: nowrap;
}

.badge-attachment {
  color: var(--text-muted);
  display: flex;
  align-items: center;
}

.badge-attachment svg {
  width: 14px;
  height: 14px;
}

.mail-date {
  width: 80px;
  min-width: 80px;
  text-align: right;
  color: var(--text-muted);
  font-size: 0.825rem;
}

/* ========================================================
   THREAD VIEW STYLES
   ======================================================== */

/* Thread count badge in list */
.thread-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--hover-bg);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 20px;
  min-width: 20px;
  border: 1px solid var(--border-color);
  white-space: nowrap;
  margin-left: 0.35rem;
  flex-shrink: 0;
}

.mail-row.unread .thread-count-badge {
  background: var(--primary-color);
  color: var(--bg-surface);
  border-color: var(--primary-color);
}

/* Multiple participant avatars stacked */
.thread-avatars {
  display: flex;
  align-items: center;
  position: relative;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.thread-avatar-item {
  position: absolute;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  border: 2px solid var(--bg-surface);
}

.thread-avatar-item:first-child {
  top: 0;
  left: 0;
  z-index: 2;
}

.thread-avatar-item:nth-child(2) {
  bottom: 0;
  right: 0;
  z-index: 1;
}

/* Thread message cards in detail panel */
.thread-messages-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.5rem 0;
}

.thread-message-card {
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-surface);
  transition: box-shadow var(--transition-fast);
}

.thread-message-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.thread-message-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem 1rem;
  cursor: pointer;
  user-select: none;
  background: var(--bg-surface);
  transition: background-color var(--transition-fast);
}

.thread-message-header:hover {
  background: var(--hover-bg);
}

.thread-msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
  color: #fff;
  border: 1px solid var(--border-color);
}

.thread-msg-meta {
  flex: 1;
  min-width: 0;
}

.thread-msg-sender {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.thread-msg-collapsed-preview {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.thread-msg-date {
  font-size: 0.78rem;
  color: var(--text-muted);
  flex-shrink: 0;
  white-space: nowrap;
}

.thread-msg-chevron {
  color: var(--text-muted);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.thread-msg-chevron svg {
  width: 16px;
  height: 16px;
}

.thread-message-card.expanded .thread-msg-chevron {
  transform: rotate(180deg);
}

.thread-message-body {
  display: none;
  padding: 0 1rem 1rem;
  border-top: 1px solid var(--border-color);
}

.thread-message-card.expanded .thread-message-body {
  display: block;
}

/* Selected active-focus thread message card */
.thread-message-card.active-focus {
  border-color: var(--primary-color) !important;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15), 0 2px 8px rgba(0, 0, 0, 0.08) !important;
}

/* Actions inside the thread card headers */
.thread-msg-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: 0.5rem;
  margin-right: 0.25rem;
}

.thread-card-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}

.thread-card-action-btn:hover {
  background-color: var(--hover-bg);
  color: var(--text-main);
}

.thread-message-body iframe {
  width: 100%;
  border: none;
  min-height: 100px;
}

.thread-header-info {
  padding: 0.75rem 1.25rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.thread-participant-line {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Thread toggle toolbar btn active state */
#btn-toolbar-threads.active i {
  color: var(--primary-color);
}

/* Custom Checkbox Design */
.eleska-checkbox {
  position: relative;
  width: 16px;
  height: 16px;
  cursor: pointer;
  appearance: none;
  border: 1.5px solid var(--text-muted);
  border-radius: 4px;
  outline: none;
  background-color: transparent;
  transition: background-color var(--transition-fast), border-color var(--transition-fast);
}

.eleska-checkbox:checked {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}

.eleska-checkbox:checked::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 5px;
  height: 9px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* ========================================================
   EMAIL DETAIL VIEW PAGE
   ======================================================== */
.email-detail-page {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--bg-surface);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transform: translateX(100%);
  transition: transform var(--transition-normal), background-color var(--transition-normal);
  overflow: hidden;
  /* needed to clip slide animation */
}

.email-detail-page.active {
  transform: translateX(0);
}

.detail-header {
  height: 52px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 1rem;
  gap: 0.25rem;
  flex-shrink: 0;
  background-color: var(--bg-surface);
  overflow: hidden;
}

/* Scrollable button area inside detail header */
.detail-header-scroll-area {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  padding: 0 0.25rem;
}

.detail-header-scroll-area::-webkit-scrollbar {
  display: none;
}

.detail-header-scroll-area {
  scrollbar-width: none;
  /* Firefox */
  -ms-overflow-style: none;
  /* IE/Edge */
}

.detail-content-scroll {
  flex-grow: 1;
  overflow-y: auto;
  padding: 2rem 2.5rem;
  padding-bottom: 5rem;
  /* leave space for floating buttons */
}

/* Floating bottom action bar inside detail view */
.detail-float-actions {
  position: absolute;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 40px;
  padding: 0.45rem 0.75rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  z-index: 200;
}

.detail-float-split-group {
  position: relative;
  display: inline-flex;
  align-items: center;
  border-radius: 30px;
  background: transparent;
  transition: background-color 0.15s;
}

.detail-float-split-group .dropdown-menu {
  bottom: calc(100% + 10px) !important;
  top: auto !important;
  right: 0 !important;
  left: auto !important;
  transform: none !important;
}

.detail-float-split-group .dropdown-menu.show {
  display: block !important;
}

.detail-float-split-group .float-split-main {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  padding-right: 0.4rem;
}

.detail-float-arrow-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-top-right-radius: 30px;
  border-bottom-right-radius: 30px;
  padding: 0.45rem 0.55rem;
  padding-left: 0.25rem;
  color: var(--text-muted);
  cursor: pointer;
  border-left: 1px solid var(--border-color);
  transition: background-color 0.15s, color 0.15s;
}

.detail-float-split-group:hover .detail-float-arrow-btn,
.detail-float-arrow-btn:hover {
  color: var(--text-main);
  background-color: var(--hover-bg);
}

.detail-float-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: transparent;
  border: none;
  border-radius: 30px;
  padding: 0.45rem 1rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}

.detail-float-btn:hover {
  background: var(--hover-bg);
  color: var(--text-main);
}

.detail-float-reply:hover {
  background: var(--primary-light);
  color: var(--primary-color);
}

.detail-float-delete:hover {
  background: #fef2f2;
  color: #dc2626;
}

html[data-theme="dark"] .detail-float-delete:hover {
  background: #3b0a0a;
  color: #f87171;
}

.detail-float-spam:hover {
  background: #fff7ed;
  color: #ea580c;
}

html[data-theme="dark"] .detail-float-spam:hover {
  background: #431407;
  color: #fb923c;
}

.detail-float-forward:hover {
  background: #f0fdf4;
  color: #16a34a;
}

html[data-theme="dark"] .detail-float-forward:hover {
  background: #052e16;
  color: #4ade80;
}

.detail-content-scroll::-webkit-scrollbar {
  width: 8px;
}

.detail-content-scroll::-webkit-scrollbar-thumb {
  background-color: var(--border-color);
  border-radius: 4px;
}

.detail-subject-row {
  margin-bottom: 1.5rem;
}

.detail-subject {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.detail-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.meta-sender-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.meta-avatar,
#detail-avatar-char {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background-color: var(--primary-light);
  color: #ffffff !important;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
}

.meta-names {
  display: flex;
  flex-direction: column;
}

.meta-sender-name {
  font-weight: 600;
  color: var(--text-main);
  font-size: 0.95rem;
}

.meta-sender-email {
  color: var(--text-muted) !important;
  font-size: 0.8rem;
  font-weight: 400;
  background-color: transparent !important;
  border: none !important;
  padding: 0 !important;
  border-radius: 0 !important;
  display: inline-flex !important;
  align-items: center;
  gap: 0.25rem;
  cursor: pointer;
  transition: color var(--transition-fast) ease;
  user-select: text;
}

.meta-sender-email:hover {
  color: var(--primary-color) !important;
  text-decoration: underline;
  background-color: transparent !important;
  border-color: transparent !important;
  transform: none !important;
}

.meta-right-info {
  text-align: right;
}

.meta-date {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.meta-recipients {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Recipient chip (multi-recipient list) */
.recipient-chips-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  font-size: 0.76rem;
  color: var(--text-muted);
}

.recipient-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px 2px 4px;
  border-radius: 20px;
  background: var(--bg-hover, rgba(26, 156, 226, 0.08));
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-main);
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  user-select: none;
  white-space: nowrap;
  max-width: 200px;
  overflow: hidden;
}

.recipient-chip:hover {
  background: rgba(26, 156, 226, 0.14);
  border-color: rgba(26, 156, 226, 0.35);
  transform: translateY(-1px);
}

.recipient-chip-more {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 20px;
  background: var(--bg-hover, rgba(26, 156, 226, 0.06));
  border: 1px dashed var(--border-color, rgba(0, 0, 0, 0.15));
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--primary-color);
  transition: background 0.15s, border-color 0.15s;
  user-select: none;
  white-space: nowrap;
}

.recipient-chip-more:hover {
  background: rgba(26, 156, 226, 0.15);
  border-color: var(--primary-color);
}

.recipient-chip .chip-avatar {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.recipient-chip .chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Full address block in meta dropdown */
.address-chip-block {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: flex-start;
}

.address-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 5px 6px;
  border-radius: 20px;
  background: var(--bg-hover, rgba(26, 156, 226, 0.07));
  border: 1px solid var(--border-color, rgba(0, 0, 0, 0.08));
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  font-size: 0.78rem;
  max-width: 100%;
}

.address-chip:hover {
  background: rgba(26, 156, 226, 0.15);
  border-color: rgba(26, 156, 226, 0.4);
  box-shadow: 0 2px 8px rgba(26, 156, 226, 0.12);
}

.address-chip .chip-avatar-lg {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.address-chip .chip-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: 240px;
}

.address-chip .chip-info .chip-full-name {
  font-weight: 600;
  color: var(--text-main);
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.address-chip .chip-info .chip-email-addr {
  color: var(--primary-color);
  font-size: 0.68rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* HTML Email Body Container */
.detail-body-container,
.thread-msg-body-content {
  color: var(--text-main);
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 2.5rem;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  word-wrap: break-word;
  word-break: break-word;
  padding-bottom: 150px !important;
  position: relative !important;
  isolation: isolate;
  contain: layout style;
}

.detail-body-container *,
.thread-msg-body-content * {
  max-width: 100%;
}

.detail-body-container [style*="position: fixed"],
.detail-body-container [style*="position:fixed"],
.detail-body-container [style*="position: absolute"],
.detail-body-container [style*="position:absolute"],
.thread-msg-body-content [style*="position: fixed"],
.thread-msg-body-content [style*="position:fixed"],
.thread-msg-body-content [style*="position: absolute"],
.thread-msg-body-content [style*="position:absolute"] {
  position: relative !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
}

.detail-body-container img,
.thread-msg-body-content img {
  max-width: 100% !important;
  height: auto !important;
}

.detail-body-container pre,
.thread-msg-body-content pre {
  white-space: pre-wrap !important;
  word-wrap: break-word !important;
}

/* Attachments Layout */
.detail-attachments-container {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px dashed var(--border-color);
}

.attachments-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 1rem;
}

.attachments-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.attachment-card {
  background-color: var(--bg-base);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  cursor: pointer;
  text-decoration: none;
}

.attachment-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--card-shadow);
  border-color: var(--primary-color);
}

.attachment-icon-box {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-color);
}

.attachment-card-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.attachment-card-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attachment-card-size {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Detail Reply/Forward Actions Box */
.detail-actions-box {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
}

.btn-detail-action {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.65rem 1.25rem;
  border-radius: 10px;
  transition: transform var(--transition-fast);
}

.btn-detail-action:hover {
  transform: translateY(-1px);
}

/* Inline Reply Editor Box */
.detail-reply-editor-wrapper {
  margin-top: 2rem;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  overflow: hidden;
  background-color: var(--bg-surface);
  box-shadow: var(--card-shadow);
  display: none;
  /* opened dynamically */
}

.reply-editor-header {
  background-color: var(--bg-base);
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.reply-editor-actions {
  padding: 0.75rem 1.25rem;
  background-color: var(--bg-base);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ========================================================
   COMPOSE FLOATING MODAL WINDOW
   ======================================================== */
.compose-modal {
  position: absolute;
  bottom: 0;
  right: 80px;
  width: 850px;
  height: 650px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  z-index: 1050;
  overflow: hidden;
  transition: background-color var(--transition-normal);
}

.compose-modal.maximized {
  width: 100% !important;
  height: 100% !important;
  right: 0 !important;
  bottom: 0 !important;
  left: 0 !important;
  top: 0 !important;
  border-radius: 0 !important;
}

/* Quill Editor Height Fit */
.compose-editor-container .ql-container {
  height: 380px !important;
  display: flex;
  flex-direction: column;
}

.compose-editor-container .ql-editor {
  flex-grow: 1;
  overflow-y: auto;
}

html[data-theme="dark"] .compose-modal {
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
}

.compose-header {
  background-color: var(--bg-base);
  color: var(--text-main);
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: move;
  /* Drag handle */
  user-select: none;
}

.compose-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.compose-header-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.btn-compose-header {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.1s ease, color 0.1s ease;
}

.btn-compose-header:hover {
  background-color: var(--hover-bg);
  color: var(--text-main);
}

.btn-compose-header svg {
  width: 14px;
  height: 14px;
}

#btn-compose-close {
  width: 30px !important;
  height: 30px !important;
}

#btn-compose-close svg {
  width: 17px !important;
  height: 17px !important;
}

.compose-body {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.compose-fields-wrapper {
  padding: 0.5rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  max-height: 185px;
  overflow-y: auto;
}

.recipient-tags-wrapper {
  max-height: 84px;
  overflow-y: auto;
  padding: 2px 4px;
}

.recipient-tags-wrapper::-webkit-scrollbar,
.compose-fields-wrapper::-webkit-scrollbar {
  width: 5px;
}

.recipient-tags-wrapper::-webkit-scrollbar-thumb,
.compose-fields-wrapper::-webkit-scrollbar-thumb {
  background-color: var(--border-color);
  border-radius: 4px;
}

.compose-field-row {
  display: flex;
  align-items: center;
  padding: 0.4rem 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

html[data-theme="dark"] .compose-field-row {
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.compose-field-row:last-child {
  border-bottom: none;
}

.compose-field-label {
  font-size: 0.875rem;
  color: var(--text-muted);
  width: 60px;
  font-weight: 500;
}

.compose-field-input {
  border: none;
  background: transparent;
  flex-grow: 1;
  color: var(--text-main);
  font-size: 0.9rem;
}

.compose-field-input:focus {
  outline: none;
}

.compose-cc-bcc-toggles {
  display: flex;
  gap: 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
}

.compose-cc-bcc-toggles span:hover {
  color: var(--primary-color);
}

.compose-editor-container {
  flex-grow: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Customize Summernote Inside Modal */
.note-editor.note-frame {
  border: none !important;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  overflow: hidden;
}

.note-editing-area {
  flex-grow: 1;
  overflow-y: auto;
}

.note-statusbar {
  display: none !important;
}

.compose-footer {
  padding: 0.85rem 1.25rem;
  background-color: var(--bg-base);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.compose-footer-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn-send-split {
  display: inline-flex;
  align-items: center;
  border-radius: 10px;
  overflow: visible;
  background: var(--primary-color) !important;
  box-shadow: 0 4px 10px rgba(92, 60, 230, 0.2);
}

.btn-send-main {
  background: transparent;
  color: #ffffff !important;
  border: none;
  padding: 0.6rem 1.2rem;
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-send-dropdown {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #ffffff !important;
  padding: 0.6rem 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-send-split:hover {
  background: var(--primary-hover);
}

.compose-footer-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.btn-compose-footer {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.btn-compose-footer:hover {
  background-color: var(--hover-bg);
  color: var(--text-main);
}

.btn-compose-footer svg {
  width: 16px;
  height: 16px;
}

/* ========================================================
   MISCELLANEOUS UTILITIES
   ======================================================== */
.bg-gradient-eleska {
  background: var(--primary-color) !important;
  color: var(--bg-surface) !important;
}

/* No items / Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  text-align: center;
  color: var(--text-muted);
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  stroke-width: 1.5px;
  color: var(--border-color);
  margin-bottom: 1.5rem;
}

.empty-state-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

.empty-state-desc {
  font-size: 0.9rem;
  max-width: 320px;
}

/* Infinite Scroll Loader spinner */
.infinite-scroll-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  color: var(--text-muted);
  gap: 0.5rem;
  font-size: 0.85rem;
}

.spinner-eleska {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* Label Create Modal Style (Minimal sweetalert style or popup) */
.label-badge-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
}

/* Quill Editor Customizations */
.ql-container.ql-snow {
  border: none !important;
  font-family: var(--font-family) !important;
  font-size: 0.9rem !important;
}

.ql-toolbar.ql-snow {
  border: none !important;
  border-bottom: 1px solid var(--border-color) !important;
  background-color: var(--bg-base) !important;
  border-radius: 12px 12px 0 0 !important;
}

.ql-editor {
  font-family: var(--font-family) !important;
  color: var(--text-main) !important;
  background-color: var(--bg-surface) !important;
  font-size: 0.9rem !important;
  min-height: 100px;
}

/* Quill Dark Mode */
html[data-theme="dark"] .ql-toolbar.ql-snow {
  background-color: var(--bg-base) !important;
  border-bottom-color: var(--border-color) !important;
}

html[data-theme="dark"] .ql-snow .ql-stroke {
  stroke: var(--text-main) !important;
}

html[data-theme="dark"] .ql-snow .ql-fill {
  fill: var(--text-main) !important;
}

html[data-theme="dark"] .ql-snow .ql-picker {
  color: var(--text-main) !important;
}

html[data-theme="dark"] .ql-snow .ql-picker-options {
  background-color: var(--bg-surface) !important;
  border-color: var(--border-color) !important;
}

html[data-theme="dark"] .ql-editor {
  color: var(--text-main) !important;
  background-color: var(--bg-surface) !important;
}

/* Composer Attachment Preview Badges styling */
.attachment-preview-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background-color: var(--hover-bg);
  border: 1px solid var(--border-color);
  padding: 0.35rem 0.6rem;
  border-radius: 8px;
  font-size: 0.78rem;
  color: var(--text-main);
  transition: background-color var(--transition-fast);
}

.attachment-preview-badge:hover {
  background-color: var(--border-color);
}

/* Background light matching Eleska color variables */
.bg-light-eleska {
  background-color: var(--bg-base) !important;
}

html[data-theme="dark"] .bg-light-eleska {
  background-color: #10192e !important;
}

/* Custom styles for switch input */
.eleska-switch:checked {
  background-color: var(--primary-color) !important;
  border-color: var(--primary-color) !important;
}

/* Contacts Layout Styles */
.contact-avatar-badge {
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(92, 60, 230, 0.15);
}

.contact-row-actions button {
  opacity: 0.6;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.contact-row-actions button:hover {
  opacity: 1;
  transform: scale(1.1);
}

/* Meta Sender Info Clickable Profile */
.meta-sender-info {
  cursor: pointer;
  transition: opacity var(--transition-fast);
}

.meta-sender-info:hover {
  opacity: 0.8;
}

/* Recipient Tags Wrapper & Pills */
.recipient-tags-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  flex-grow: 1;
}

.recipient-pill-tag {
  background-color: var(--primary-light);
  color: var(--primary-color);
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 0.8rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(92, 60, 230, 0.15);
  transition: background-color var(--transition-fast);
}

.recipient-pill-tag:hover {
  background-color: var(--primary-light-hover);
}

.recipient-pill-tag .btn-remove-recipient {
  border: none;
  background: transparent;
  padding: 0;
  color: var(--primary-color);
  font-size: 0.95rem;
  cursor: pointer;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.recipient-pill-tag .btn-remove-recipient:hover {
  color: var(--badge-text);
}

/* Autocomplete suggestions box */
.autocomplete-suggestions-box {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
  max-height: 220px;
  overflow-y: auto;
  z-index: 2200;
  display: none;
}

.autocomplete-suggestion-item {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  cursor: pointer;
  gap: 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.02);
  transition: background-color var(--transition-fast);
}

.autocomplete-suggestion-item:hover {
  background-color: var(--hover-bg);
}

.suggestion-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: var(--primary-color);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 600;
}

.suggestion-info {
  display: flex;
  flex-direction: column;
}

.suggestion-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
}

.suggestion-email {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Undo Send Banner */
.undo-send-banner {
  position: fixed;
  bottom: 2rem;
  left: 2rem;
  background-color: var(--text-main);
  color: var(--bg-surface);
  border-radius: 14px;
  padding: 0.8rem 1.4rem;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.22);
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 1rem;
  animation: slideUpFade 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid var(--border-color);
}

.undo-content {
  display: flex;
  align-items: center;
  font-size: 0.875rem;
  font-weight: 600;
}

.btn-undo-action {
  background: var(--primary-light);
  border: none;
  color: var(--primary-color) !important;
  font-weight: 700;
  cursor: pointer;
  margin-left: auto;
  padding: 4px 10px;
  border-radius: 8px;
  transition: transform 0.15s ease, opacity 0.15s;
}

.btn-undo-action:hover {
  transform: scale(1.03);
  opacity: 0.9;
}

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

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Premium Restyling for Toastr Notifications */
#toast-container>div {
  opacity: 0.98 !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08) !important;
  border-radius: 16px !important;
  background-color: var(--bg-surface) !important;
  color: var(--text-main) !important;
  border: 1px solid var(--border-color) !important;
  font-family: 'Inter', sans-serif !important;
  font-weight: 500 !important;
  padding: 14px 18px 14px 50px !important;
  background-position: 18px 14px !important;
  background-size: 20px !important;
  transition: all 0.3s ease !important;
}

#toast-container>.toast-success {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2310b981' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 11.08V12a10 10 0 1 1-5.93-9.14'%3E%3C/path%3E%3Cpolyline points='22 4 12 14.01 9 11.01'%3E%3C/polyline%3E%3C/svg%3E") !important;
  border-left: 5px solid #10b981 !important;
}

#toast-container>.toast-error {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23ef4444' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3Cline x1='15' y1='9' x2='9' y2='15'%3E%3C/line%3E%3Cline x1='9' y1='9' x2='15' y2='15'%3E%3C/line%3E%3C/svg%3E") !important;
  border-left: 5px solid #ef4444 !important;
}

#toast-container>.toast-info {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%235c3ce6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3Cline x1='12' y1='16' x2='12' y2='12'%3E%3C/line%3E%3Cline x1='12' y1='8' x2='12.01' y2='8'%3E%3C/line%3E%3C/svg%3E") !important;
  border-left: 5px solid #5c3ce6 !important;
}

#toast-container>.toast-warning {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23f59e0b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z'%3E%3C/path%3E%3Cline x1='12' y1='9' x2='12' y2='13'%3E%3C/line%3E%3Cline x1='12' y1='17' x2='12.01' y2='17'%3E%3C/line%3E%3C/svg%3E") !important;
  border-left: 5px solid #f59e0b !important;
}

/* Premium Restylying for SweetAlert2 Dialogs */
.swal2-popup {
  background: var(--bg-surface) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 24px !important;
  box-shadow: 0 15px 50px rgba(0, 0, 0, 0.15) !important;
  color: var(--text-main) !important;
  font-family: 'Inter', sans-serif !important;
  padding: 2rem 1.5rem !important;
}

.swal2-title {
  color: var(--text-main) !important;
  font-weight: 700 !important;
  font-size: 1.35rem !important;
}

.swal2-html-container {
  color: var(--text-muted) !important;
  font-size: 0.95rem !important;
}

.swal2-actions {
  margin-top: 1.5rem !important;
}

.swal2-confirm {
  background: var(--primary-color) !important;
  border-radius: 12px !important;
  font-weight: 600 !important;
  padding: 10px 24px !important;
  box-shadow: none !important;
}

.swal2-cancel {
  background: var(--hover-bg) !important;
  color: var(--text-main) !important;
  border-radius: 12px !important;
  font-weight: 600 !important;
  padding: 10px 24px !important;
}

.swal2-icon {
  border-width: 3px !important;
}

.swal2-icon.swal2-success .swal2-success-ring {
  border: 4px solid rgba(16, 185, 129, 0.2) !important;
}

.swal2-icon.swal2-success [class^='swal2-success-line'] {
  background-color: #10b981 !important;
}

/* Restyle Settings Page Custom Toast */
.settings-toast {
  background: var(--bg-surface) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 16px !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08) !important;
  font-family: 'Inter', sans-serif !important;
  padding: 12px 18px !important;
  font-weight: 600 !important;
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
}

.settings-toast-success {
  border-left: 5px solid #10b981 !important;
  color: #10b981 !important;
}

.settings-toast-error {
  border-left: 5px solid #ef4444 !important;
  color: #ef4444 !important;
}

/* Premium Settings Avatar Customization */
.settings-avatar-row {
  display: flex !important;
  align-items: center !important;
  gap: 1.5rem !important;
  padding: 1rem 0 !important;
}

.settings-avatar {
  width: 90px !important;
  height: 90px !important;
  border-radius: 50% !important;
  overflow: visible !important;
  /* to show camera badge properly */
  border: 4px solid var(--primary-light) !important;
  box-shadow: 0 8px 24px rgba(92, 60, 230, 0.15) !important;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease !important;
  flex-shrink: 0 !important;
  position: relative !important;
}

.settings-avatar:hover {
  transform: scale(1.04);
  border-color: var(--primary-color) !important;
}

.settings-avatar img {
  width: 100% !important;
  height: 100% !important;
  border-radius: 50% !important;
  object-fit: cover !important;
  border: 2px solid var(--bg-surface) !important;
}

.settings-avatar>div {
  position: absolute !important;
  bottom: 0px !important;
  right: 0px !important;
  background: var(--primary-color) !important;
  color: white !important;
  width: 28px !important;
  height: 28px !important;
  border-radius: 50% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  border: 3px solid var(--bg-surface) !important;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15) !important;
  transition: background-color 0.2s !important;
}

.settings-avatar:hover>div {
  background: #4a2ec2 !important;
}

/* Enable scrolling on settings page container since body overflow is hidden globally */
.settings-page {
  height: 100vh !important;
  height: 100dvh !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
}

/* Default Letter Avatar styling */
.avatar-letter-circle {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--primary-color);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  border: 1px solid var(--border-color);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  user-select: none;
}

/* Splash Screen Styles */
.eleska-splash {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: radial-gradient(circle at center, var(--bg-surface) 0%, var(--bg-base) 100%);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.6s ease;
}

.eleska-splash::before {
  content: "";
  position: absolute;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.12) 0%, rgba(99, 102, 241, 0) 70%);
  filter: blur(40px);
  z-index: -1;
  animation: pulse-aura 3s ease-in-out infinite alternate;
}

.eleska-splash.fade-out {
  opacity: 0;
  visibility: hidden;
}

.splash-container {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: splashZoomIn 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.splash-logo-wrapper {
  position: relative;
  width: 96px;
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2rem;
  padding: 16px;
}

.splash-logo-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  z-index: 2;
  animation: logoPulse 2s ease-in-out infinite alternate;
}

.logo-spinner {
  position: absolute;
  top: -6px;
  left: -6px;
  right: -6px;
  bottom: -6px;
  border: 3px solid transparent;
  border-top: 3px solid #1a9ce2;
  border-bottom: 3px solid #1a9ce2;
  border-radius: 50%;
  animation: spin 1.8s cubic-bezier(0.5, 0.1, 0.5, 0.9) infinite;
  z-index: 1;
}

@keyframes logoPulse {
  0% {
    transform: scale(0.95);
  }

  100% {
    transform: scale(1.05);
  }
}

.splash-title {
  font-family: 'Outfit', 'Inter', sans-serif;
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: 3px;
  background: linear-gradient(135deg, var(--text-main) 30%, var(--primary-color) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin: 0;
  filter: drop-shadow(0 2px 6px rgba(99, 102, 241, 0.08));
}

.splash-subtitle {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 5px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-top: 0.5rem;
  opacity: 0.85;
}

@keyframes splashZoomIn {
  from {
    opacity: 0;
    transform: scale(0.94);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

@keyframes spin-reverse {
  0% {
    transform: rotate(360deg);
  }

  100% {
    transform: rotate(0deg);
  }
}

@keyframes pulse-aura {
  0% {
    opacity: 0.4;
    transform: scale(0.9);
  }

  100% {
    opacity: 0.8;
    transform: scale(1.1);
  }
}

/* Horizontal scrolling compose recipient tags wrapper on mobile views */
@media (max-width: 768px) {
  .recipient-tags-wrapper {
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding-bottom: 4px !important;
    gap: 6px !important;
  }

  .recipient-tags-wrapper::-webkit-scrollbar {
    display: none !important;
  }

  .recipient-tags-wrapper {
    scrollbar-width: none;
  }

  .recipient-tags-wrapper input {
    min-width: 120px !important;
    flex-shrink: 0 !important;
  }
}

/* Pull to Refresh Indicator styling */
.ptr-indicator {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(-50px) scale(0.3);
  z-index: 10;
  pointer-events: none;
}

.ptr-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  background: var(--bg-surface);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.06);
  padding: 2px;
}

.ptr-ready .ptr-spinner {
  border-top-color: #10b981;
  /* turns green when ready to trigger */
}

/* Context Menu Style */
.custom-context-menu {
  display: none;
  position: absolute;
  z-index: 10000;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
  padding: 6px 0;
  min-width: 190px;
  animation: fadeInFast 0.15s ease;
}

/* Context Menu Submenu Styles */
.context-menu-item.has-submenu {
  position: relative;
}

.context-menu-submenu {
  display: none;
  position: absolute;
  left: 100%;
  top: -6px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
  padding: 6px 0;
  min-width: 160px;
  z-index: 10005;
}

.context-menu-submenu.submenu-left {
  left: auto;
  right: 100%;
}

.context-menu-item.has-submenu:hover .context-menu-submenu {
  display: block;
}

.context-menu-submenu-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  color: var(--text-main);
  text-decoration: none;
  font-size: 0.825rem;
  font-weight: 500;
  transition: background-color var(--transition-fast), color var(--transition-fast);
  cursor: pointer;
}

.context-menu-submenu-item:hover {
  background-color: var(--hover-bg);
  color: var(--primary-color) !important;
}

.label-badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

@keyframes fadeInFast {
  from {
    opacity: 0;
    transform: scale(0.97);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.context-menu-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  color: var(--text-main);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: background-color var(--transition-fast), color var(--transition-fast);
  cursor: pointer;
}

.context-menu-item:hover {
  background-color: var(--hover-bg);
  color: var(--text-main);
  text-decoration: none;
}

.context-menu-item svg {
  width: 15px;
  height: 15px;
  stroke-width: 2px;
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.context-menu-item:hover svg {
  color: var(--primary-color);
}

.context-menu-item:hover .text-danger {
  color: #dc2626 !important;
}

.context-menu-item:hover svg.text-danger {
  color: #dc2626 !important;
}

.context-menu-divider {
  height: 1px;
  background-color: var(--border-color);
  margin: 4px 0;
}

/* Subscriptions Feature */
.subscription-row {
  cursor: default !important;
}

.subscription-row:hover {
  background-color: var(--hover-bg);
}

.btn-unsubscribe-badge:hover {
  background-color: #dc3545;
  color: white;
}


/* Inline Thread Children Styles */
.thread-child-row {
  margin-left: 20px;
  border-left: 3px solid var(--border-color) !important;
  background-color: var(--hover-bg);
}

.thread-dropdown-btn:hover {
  background-color: var(--border-color) !important;
  color: var(--text-main) !important;
}

/* Drag and Drop & Keyboard Navigation Styles */
.sidebar-folder-item.drag-over {
  background-color: var(--hover-bg) !important;
  border-left: 4px solid var(--primary-color) !important;
  color: var(--primary-color) !important;
  transform: scale(1.02);
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.mail-row.keyboard-focused {
  outline: 2px solid var(--primary-color) !important;
  outline-offset: -2px;
  background-color: var(--hover-bg) !important;
}

/* Advanced Search Styles */
.search-filter-toggle-btn {
  background: transparent;
  border: none;
  padding: 0;
  margin-left: 8px;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.search-filter-toggle-btn:hover,
.search-filter-toggle-btn.active {
  background-color: var(--hover-bg);
  color: var(--text-main);
}

.search-advanced-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color) !important;
  border-radius: 16px;
  margin-top: 8px;
  padding: 1.25rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  z-index: 999;
}

.advanced-search-field-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
}

.advanced-search-field-row label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: left;
}

.advanced-search-field-row input,
.advanced-search-field-row select {
  background-color: var(--bg-base);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: 8px;
  padding: 0.45rem 0.75rem;
  font-size: 0.85rem;
  width: 100%;
  outline: none;
  transition: border-color var(--transition-fast);
}

.advanced-search-field-row input:focus,
.advanced-search-field-row select:focus {
  border-color: var(--primary-color);
}

.advanced-search-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.25rem;
  border-top: 1px solid var(--border-color);
  padding-top: 0.85rem;
}

.advanced-search-btn-cancel {
  background-color: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  border-radius: 8px;
  padding: 0.45rem 1rem;
  font-size: 0.825rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.advanced-search-btn-cancel:hover {
  background-color: var(--hover-bg);
  color: var(--text-main);
}

.advanced-search-btn-submit {
  background-color: var(--primary-color);
  border: none;
  color: white;
  border-radius: 8px;
  padding: 0.45rem 1rem;
  font-size: 0.825rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color var(--transition-fast);
}

.advanced-search-btn-submit:hover {
  background-color: var(--primary-dark);
}

/* Custom Premium HTML Rich Editor */
.custom-editor-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background-color: var(--bg-base);
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
}

.editor-tb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
}

.editor-tb-btn:hover {
  background-color: var(--hover-bg);
  color: var(--text-main);
}

.editor-tb-btn.active {
  background-color: var(--primary-color-light);
  color: var(--primary-color);
}

.editor-tb-btn svg {
  width: 14px;
  height: 14px;
}

.editor-tb-separator {
  width: 1px;
  height: 16px;
  background-color: var(--border-color);
  margin: 0 4px;
}

.custom-editor-body {
  flex-grow: 1;
  overflow-y: auto;
  outline: none;
  padding: 16px 20px;
  background-color: var(--bg-surface);
  color: var(--text-main);
  font-size: 0.925rem;
  line-height: 1.6;
  min-height: 300px;
}

.custom-editor-body:empty::before {
  content: attr(placeholder);
  color: var(--text-muted);
  pointer-events: none;
  display: block;
}

/* Ensure embedded images and tables inside editor display nicely */
.custom-editor-body img {
  max-width: 100%;
  height: auto;
}

.custom-editor-body table {
  border-collapse: collapse;
  max-width: 100%;
}

/* Premium Form Design styles */
.form-field-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  width: 100%;
}

.form-label-premium {
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0px;
}

.input-group-premium {
  position: relative;
  display: flex;
  width: 100%;
}

.form-control-premium {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-main);
  background-color: var(--bg-base);
  border: 1.5px solid var(--border-color);
  border-radius: 12px;
  transition: all var(--transition-fast);
  outline: none;
}

.form-control-premium::placeholder {
  color: var(--text-muted);
  opacity: 0.65;
}

.form-control-premium:focus {
  border-color: var(--primary-color);
  background-color: var(--bg-surface);
  box-shadow: 0 0 0 3px rgba(92, 60, 230, 0.12);
}

textarea.form-control-premium {
  resize: none;
}

.contact-meta-link {
  color: #5c3ce6;
  cursor: pointer;
  font-weight: 600;
  transition: opacity var(--transition-fast);
  text-decoration: none;
}

html[data-theme="dark"] .contact-meta-link {
  color: #a78bfa !important;
}

html[data-theme="dark"] .btn-close {
  filter: invert(1) grayscale(100%) brightness(200%) !important;
}

.contact-meta-link:hover {
  text-decoration: underline;
  opacity: 0.85;
}

/* btn-send-split: dark mode — white background, black text & icons */
html[data-theme="dark"] .btn-send-split {
  background: #ffffff !important;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}

html[data-theme="dark"] .btn-send-split .btn-send-main,
html[data-theme="dark"] .btn-send-split .btn-send-dropdown {
  color: #000000 !important;
}

html[data-theme="dark"] .btn-send-split svg,
html[data-theme="dark"] .btn-send-split i {
  color: #000000 !important;
  stroke: #000000 !important;
}

/* btn-remove-tag - styles matching btn-remove-recipient to prevent broken square */
.recipient-pill-tag .btn-remove-tag {
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  color: var(--primary-color);
  font-size: 0.95rem;
  cursor: pointer;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  width: auto;
  height: auto;
  border-radius: 0;
  box-shadow: none;
  outline: none;
}

.recipient-pill-tag .btn-remove-tag:hover {
  color: var(--badge-text);
  background: transparent;
}

.recipient-pill-tag .btn-remove-tag svg {
  display: block;
}

/* ========================================================
   ADDITIONAL PREMIUM UI OVERRIDES & FIXES
   ======================================================== */

/* btn-send-dropdown show: make icon white in dark mode */
html[data-theme="dark"] .btn-send-dropdown.show i,
html[data-theme="dark"] .btn-send-dropdown.show svg {
  color: #ffffff !important;
  stroke: #ffffff !important;
}

/* Premium Empty Trash Button styling */
.btn-empty-trash {
  background-color: rgba(239, 68, 68, 0.08) !important;
  color: #ef4444 !important;
  border: 1px solid rgba(239, 68, 68, 0.2) !important;
  transition: all var(--transition-fast) ease-in-out;
  box-shadow: 0 2px 4px rgba(239, 68, 68, 0.05);
}

.btn-empty-trash:hover {
  background-color: #ef4444 !important;
  color: #ffffff !important;
  border-color: #ef4444 !important;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

html[data-theme="dark"] .btn-empty-trash {
  background-color: rgba(248, 113, 113, 0.1) !important;
  color: #f87171 !important;
  border-color: rgba(248, 113, 113, 0.2) !important;
}

html[data-theme="dark"] .btn-empty-trash:hover {
  background-color: #ef4444 !important;
  color: #ffffff !important;
  border-color: #ef4444 !important;
}

/* Premium Circle Add Rule Button */
.btn-circle-add {
  width: 32px;
  height: 32px;
  border-radius: 50% !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 !important;
  border: 1px solid var(--border-color) !important;
  background-color: var(--bg-surface) !important;
  color: var(--text-main) !important;
  transition: all var(--transition-fast) ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.btn-circle-add:hover {
  background-color: var(--primary-color) !important;
  border-color: var(--primary-color) !important;
  color: #ffffff !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

html[data-theme="dark"] .btn-circle-add {
  background-color: #2c2c2e !important;
  border-color: #3a3a3c !important;
}

html[data-theme="dark"] .btn-circle-add:hover {
  background-color: var(--primary-color) !important;
  border-color: var(--primary-color) !important;
  color: #ffffff !important;
}

/* Quill Placeholder Hide Rule */
.ql-editor.ql-blank::before {
  content: "" !important;
  display: none !important;
}

/* Text-muted Legibility/Accessibility Overrides */
.text-muted {
  color: var(--text-muted) !important;
}

html[data-theme="dark"] .text-muted {
  color: #9ca3af !important;
  /* higher contrast in dark mode */
}

/* Premium Settings Avatar Design */
.settings-avatar {
  width: 96px !important;
  height: 96px !important;
  border-radius: 50% !important;
  position: relative !important;
  cursor: pointer !important;
  background: linear-gradient(135deg, #8b5cf6, #3b82f6) !important;
  padding: 3px !important;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
  box-shadow: 0 10px 25px -5px rgba(139, 92, 246, 0.3) !important;
}

.settings-avatar:hover {
  transform: scale(1.05) translateY(-2px) !important;
  box-shadow: 0 15px 30px -5px rgba(139, 92, 246, 0.45) !important;
}

.settings-avatar img {
  width: 100% !important;
  height: 100% !important;
  border-radius: 50% !important;
  object-fit: cover !important;
  border: 3px solid var(--bg-surface) !important;
}

.settings-avatar .avatar-letter-circle {
  width: 100% !important;
  height: 100% !important;
  border-radius: 50% !important;
  background: linear-gradient(135deg, #8b5cf6, #3b82f6) !important;
  color: #ffffff !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 2.4rem !important;
  font-weight: 800 !important;
  border: 3px solid var(--bg-surface) !important;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.15) !important;
}

.settings-avatar .avatar-edit-badge {
  position: absolute !important;
  bottom: 0px !important;
  right: 0px !important;
  background: var(--bg-surface) !important;
  color: var(--text-main) !important;
  width: 30px !important;
  height: 30px !important;
  border-radius: 50% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  border: 2px solid var(--border-color) !important;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15) !important;
  transition: all 0.2s ease !important;
}

.settings-avatar:hover .avatar-edit-badge {
  background: var(--primary-color) !important;
  color: var(--bg-surface) !important;
  border-color: var(--primary-color) !important;
  transform: scale(1.1) !important;
}

/* Modern Premium Toastr Overrides */
#toast-container {
  padding: 12px;
}

#toast-container>.toast {
  background-image: none !important;
  padding: 16px 20px 16px 50px !important;
  border-radius: 16px !important;
  font-family: var(--font-family) !important;
  font-size: 0.875rem !important;
  font-weight: 500 !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08) !important;
  opacity: 0.98 !important;
  border: 1px solid rgba(255, 255, 255, 0.4) !important;
  backdrop-filter: blur(12px) !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

#toast-container>.toast-success {
  background-color: rgba(240, 253, 244, 0.9) !important;
  color: #15803d !important;
  border: 1px solid rgba(74, 222, 128, 0.3) !important;
}

#toast-container>.toast-success::before {
  content: "✓";
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.25rem;
  font-weight: bold;
}

#toast-container>.toast-error {
  background-color: rgba(254, 242, 242, 0.9) !important;
  color: #b91c1c !important;
  border: 1px solid rgba(248, 113, 113, 0.3) !important;
}

#toast-container>.toast-error::before {
  content: "✕";
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.1rem;
  font-weight: bold;
}

#toast-container>.toast-info {
  background-color: rgba(240, 249, 255, 0.9) !important;
  color: #0369a1 !important;
  border: 1px solid rgba(56, 189, 248, 0.3) !important;
}

#toast-container>.toast-info::before {
  content: "ℹ";
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.25rem;
  font-weight: bold;
}

#toast-container>.toast-warning {
  background-color: rgba(255, 251, 235, 0.9) !important;
  color: #b45309 !important;
  border: 1px solid rgba(251, 191, 36, 0.3) !important;
}

#toast-container>.toast-warning::before {
  content: "⚠";
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.1rem;
  font-weight: bold;
}

html[data-theme="dark"] #toast-container>.toast-success {
  background-color: rgba(20, 83, 45, 0.9) !important;
  color: #b9f6ca !important;
  border-color: rgba(34, 197, 94, 0.2) !important;
}

html[data-theme="dark"] #toast-container>.toast-error {
  background-color: rgba(127, 29, 29, 0.9) !important;
  color: #ffcdd2 !important;
  border-color: rgba(239, 68, 68, 0.2) !important;
}

html[data-theme="dark"] #toast-container>.toast-info {
  background-color: rgba(12, 74, 110, 0.9) !important;
  color: #b3e5fc !important;
  border-color: rgba(14, 165, 233, 0.2) !important;
}

html[data-theme="dark"] #toast-container>.toast-warning {
  background-color: rgba(120, 53, 4, 0.9) !important;
  color: #ffe082 !important;
  border-color: rgba(245, 158, 11, 0.2) !important;
}

/* Hide star column in the mail list rows */
.mail-row .mail-cell-star {
  display: none !important;
}

/* SweetAlert2 dark mode button & container visibility overrides */
html[data-theme="dark"] .swal2-popup {
  background-color: var(--bg-surface) !important;
  color: var(--text-main) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 20px !important;
}

html[data-theme="dark"] .swal2-popup .swal2-title,
html[data-theme="dark"] .swal2-popup .swal2-html-container {
  color: var(--text-main) !important;
}

html[data-theme="dark"] .swal2-popup .swal2-confirm.swal2-styled {
  background-color: var(--primary-color) !important;
  color: #1d1d1f !important;
  border: 1px solid var(--primary-color) !important;
  border-radius: 12px !important;
  font-weight: 600 !important;
  font-size: 0.9rem !important;
}

html[data-theme="dark"] .swal2-popup .swal2-confirm.swal2-styled:hover {
  background-color: var(--primary-hover) !important;
  color: #1d1d1f !important;
}

html[data-theme="dark"] .swal2-popup .swal2-cancel.swal2-styled {
  background-color: transparent !important;
  color: var(--text-muted) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 12px !important;
  font-weight: 500 !important;
  font-size: 0.9rem !important;
}

html[data-theme="dark"] .swal2-popup .swal2-cancel.swal2-styled:hover {
  background-color: var(--hover-bg) !important;
  color: var(--text-main) !important;
}

/* Position context submenu upward when overflowing viewport */
.context-menu-submenu.submenu-up {
  top: auto !important;
  bottom: -6px !important;
}

/* Disable underline globally */
*,
*:hover,
*:focus,
a,
a:hover,
a:focus {
  text-decoration: none !important;
}

/* Notepad++ / Premium IDE Dark Brown Code Editor Styles */
.code-editor-wrapper {
  display: flex;
  background-color: #1a1512 !important;
  /* Dark Brown background */
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 0.9rem;
  line-height: 1.5;
  box-sizing: border-box;
}

.code-line-numbers {
  padding: 16px 8px 16px 12px;
  background-color: #231d19;
  /* Lighter warm brown for gutter */
  border-right: 1px solid #382e27;
  color: #8c7669;
  /* Warm brown/grey text */
  text-align: right;
  user-select: none;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  overflow: hidden;
  box-sizing: border-box;
}

.code-textarea {
  flex: 1;
  background-color: #1a1512 !important;
  color: #e6cbbe !important;
  /* Premium warm text */
  border: none !important;
  outline: none !important;
  padding: 16px 12px !important;
  resize: none !important;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  margin: 0 !important;
  box-sizing: border-box;
  overflow-y: auto;
}

/* Email body chip styling (strictly inside .detail-body-container) */
.detail-body-container .detail-body-chips-wrapper {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px;
  max-width: 100%;
  vertical-align: middle;
}

.detail-body-container .detail-body-chips-wrapper.scrollable-chips {
  display: flex;
  max-height: 72px;
  overflow-y: auto;
  padding: 4px 6px;
  margin: 4px 0;
  border-radius: 8px;
  background-color: var(--bg-surface-secondary, rgba(99, 102, 241, 0.04));
  border: 1px dashed var(--border-color, rgba(99, 102, 241, 0.18));
}

.detail-body-container .detail-body-chips-wrapper.scrollable-chips::-webkit-scrollbar {
  width: 4px;
}

.detail-body-container .detail-body-chips-wrapper.scrollable-chips::-webkit-scrollbar-thumb {
  background: rgba(150, 150, 150, 0.35);
  border-radius: 4px;
}

.detail-body-container .detail-body-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px 2px 3px;
  margin: 1px 3px 1px 0;
  background-color: var(--bg-surface-secondary, rgba(99, 102, 241, 0.08));
  border: 1px solid var(--border-color, rgba(99, 102, 241, 0.2));
  border-radius: 50rem;
  font-size: 0.72rem;
  line-height: 1.1;
  color: var(--text-main);
  cursor: pointer;
  vertical-align: middle;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  text-decoration: none !important;
}

.detail-body-container .detail-body-chip:hover {
  background-color: var(--primary-light, rgba(99, 102, 241, 0.15));
  border-color: var(--primary-color, #6366f1);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.18);
}

.detail-body-container .detail-body-chip:active {
  transform: translateY(0);
  box-shadow: none;
}

.detail-body-container .detail-body-chip-avatar {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  font-weight: 700;
  flex-shrink: 0;
  text-transform: uppercase;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.detail-body-container .detail-body-chip-info {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
  font-size: 0.72rem;
}

.detail-body-container .detail-body-chip-name {
  font-weight: 600;
  font-size: 0.72rem;
  color: var(--text-main);
}

.detail-body-container .detail-body-chip-email {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.detail-body-container .detail-body-chip-name + .detail-body-chip-email::before {
  content: "<";
}
.detail-body-container .detail-body-chip-name + .detail-body-chip-email::after {
  content: ">";
}

.detail-body-container .detail-body-chip-icon {
  width: 10px;
  height: 10px;
  margin-left: 1px;
  color: var(--primary-color, #6366f1);
  opacity: 0.6;
  transition: opacity 0.2s ease, transform 0.2s ease;
  flex-shrink: 0;
}

.detail-body-container .detail-body-chip:hover .detail-body-chip-icon {
  opacity: 1;
  transform: scale(1.1);
}

.detail-body-container .detail-body-header-label {
  font-weight: 700;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-right: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Dark mode adjustments */
html[data-theme="dark"] .detail-body-container .detail-body-chip {
  background-color: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
  color: #f3f4f6;
}

html[data-theme="dark"] .detail-body-container .detail-body-chip:hover {
  background-color: rgba(167, 139, 250, 0.18);
  border-color: #a78bfa;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

html[data-theme="dark"] .detail-body-container .detail-body-chip-name {
  color: #f9fafb;
}

html[data-theme="dark"] .detail-body-container .detail-body-chip-email {
  color: #9ca3af;
}

html[data-theme="dark"] .detail-body-container .detail-body-chip-icon {
  color: #a78bfa;
}