/*
 * css/styles.css
 * NexusMail Enterprise — Complete dark-theme stylesheet.
 * Includes: custom scrollbars, skeleton loading, tab transitions, Quill overrides.
 */

/* ========================================================================
   1. CSS RESET & ROOT VARIABLES
   ======================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-primary:     #0f1117;
  --bg-secondary:   #161b25;
  --bg-tertiary:    #1e2535;
  --bg-hover:       #252d3d;
  --bg-active:      #2a3348;
  --accent-blue:    #3b82f6;
  --accent-blue-h:  #2563eb;
  --accent-indigo:  #6366f1;
  --accent-purple:  #8b5cf6;
  --text-primary:   #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted:     #4b5563;
  --border-color:   #1e2d40;
  --border-light:   #2d3d54;
  --success:        #10b981;
  --warning:        #f59e0b;
  --danger:         #ef4444;
  --star-color:     #f59e0b;
  --skeleton-base:  #1e2535;
  --skeleton-shine: #252d3d;
  --radius-sm:      6px;
  --radius-md:      10px;
  --radius-lg:      16px;
  --shadow-sm:      0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:      0 4px 12px rgba(0,0,0,0.5);
  --shadow-lg:      0 8px 32px rgba(0,0,0,0.6);
  --transition-fast: 0.15s ease;
  --transition-med:  0.25s ease;
  --transition-slow: 0.4s ease;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  height: 100vh;
  overflow: hidden;
}

/* ========================================================================
   2. CUSTOM SCROLLBARS — Thin & elegant for dark theme
   ======================================================================== */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: var(--bg-secondary);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 10px;
  transition: background var(--transition-fast);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-blue);
}
::-webkit-scrollbar-corner {
  background: var(--bg-secondary);
}
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-light) var(--bg-secondary);
}

/* ========================================================================
   3. LAYOUT — Split-screen shell
   ======================================================================== */
#app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Auth screen */
#auth-screen {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn var(--transition-med) ease;
}

#mail-app {
  display: none;
  flex: 1;
  height: 100vh;
  overflow: hidden;
}

#mail-app.visible {
  display: flex;
  animation: fadeIn var(--transition-med) ease;
}

/* Sidebar */
#sidebar {
  width: 220px;
  min-width: 220px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 20px 12px;
  gap: 4px;
  overflow-y: auto;
}

/* Email list panel */
#email-list-panel {
  width: 340px;
  min-width: 280px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Email detail panel */
#email-detail-panel {
  flex: 1;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ========================================================================
   4. SIDEBAR NAVIGATION
   ======================================================================== */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 20px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 12px;
}

.sidebar-logo span {
  font-size: 1.1rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}

.nav-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 12px 8px 4px;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  transition: background var(--transition-fast), color var(--transition-fast);
  position: relative;
}

.nav-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-btn.active {
  background: var(--bg-active);
  color: var(--accent-blue);
}

.nav-btn .nav-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.8;
}

.nav-btn.active .nav-icon {
  opacity: 1;
}

.unread-badge {
  margin-left: auto;
  background: var(--accent-blue);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 20px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: var(--radius-sm);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-indigo));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.user-email-text {
  font-size: 0.72rem;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ========================================================================
   5. COMPOSE BUTTON
   ======================================================================== */
.compose-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-indigo));
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  transition: opacity var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
  box-shadow: 0 2px 12px rgba(59, 130, 246, 0.3);
}

.compose-btn:hover {
  opacity: 0.92;
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.45);
}

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

/* ========================================================================
   6. EMAIL LIST PANEL
   ======================================================================== */
.email-list-header {
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
}

.email-list-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.search-bar {
  padding: 8px 16px 8px;
  flex-shrink: 0;
}

.search-input-wrap {
  position: relative;
}

.search-input-wrap svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 7px 10px 7px 32px;
  font-size: 0.8rem;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

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

.search-input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

#email-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
}

.email-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-color);
  transition: background var(--transition-fast);
  position: relative;
  animation: slideInLeft 0.2s ease both;
}

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

.email-item.selected {
  background: var(--bg-active);
  border-left: 3px solid var(--accent-blue);
  padding-left: 11px;
}

.email-item.unread .email-item-subject {
  font-weight: 700;
  color: var(--text-primary);
}

.email-item.unread::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent-blue);
}

.email-item-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-active));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  flex-shrink: 0;
  font-family: monospace;
}

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

.email-item-from {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.email-item-subject {
  font-size: 0.78rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.email-item-preview {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.email-item-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

.email-item-date {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.star-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 2px;
  display: flex;
  align-items: center;
  transition: color var(--transition-fast), transform var(--transition-fast);
}

.star-btn:hover, .star-btn.starred {
  color: var(--star-color);
  transform: scale(1.2);
}

.star-btn.starred {
  transform: none;
}

/* Attachment indicator */
.attachment-icon {
  color: var(--text-muted);
  display: flex;
  align-items: center;
}

/* ========================================================================
   7. SKELETON LOADING — Pulsing placeholders
   ======================================================================== */
@keyframes skeletonPulse {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton {
  background: linear-gradient(
    90deg,
    var(--skeleton-base) 25%,
    var(--skeleton-shine) 50%,
    var(--skeleton-base) 75%
  );
  background-size: 200% 100%;
  animation: skeletonPulse 1.6s infinite linear;
  border-radius: var(--radius-sm);
  display: block;
}

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

.skeleton-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  flex-shrink: 0;
}

.skeleton-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.skeleton-line-short  { height: 10px; width: 55%; }
.skeleton-line-medium { height: 9px;  width: 80%; }
.skeleton-line-long   { height: 8px;  width: 90%; }
.skeleton-line-tiny   { height: 8px;  width: 30%; }

.skeleton-detail-header {
  padding: 28px 32px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-bottom: 1px solid var(--border-color);
}

.skeleton-detail-body {
  padding: 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ========================================================================
   8. EMAIL DETAIL PANEL
   ======================================================================== */
.email-detail-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  gap: 12px;
  animation: fadeIn var(--transition-med) ease;
}

.email-detail-empty svg {
  opacity: 0.15;
}

.email-detail-empty p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

#email-view {
  display: none;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  animation: fadeIn var(--transition-med) ease;
}

#email-view.visible {
  display: flex;
}

.email-view-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.toolbar-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.78rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

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

.toolbar-btn.danger:hover {
  background: rgba(239,68,68,0.1);
  color: var(--danger);
  border-color: rgba(239,68,68,0.3);
}

.toolbar-btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.email-view-header {
  padding: 24px 28px 16px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.email-subject-line {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  line-height: 1.3;
  margin-bottom: 12px;
}

.email-meta-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.email-sender-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-indigo), var(--accent-purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

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

.email-sender-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
}

.email-sender-addr {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.email-date-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Email body iframe */
.email-body-wrap {
  flex: 1;
  overflow: hidden;
  padding: 16px 20px;
}

#email-iframe {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: var(--radius-md);
  background: #fff;
}

/* Attachments section */
.attachments-section {
  padding: 12px 20px 16px;
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}

.attachments-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 8px;
}

.attachments-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.attachment-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.attachment-chip:hover {
  background: var(--bg-hover);
  color: var(--accent-blue);
  border-color: var(--accent-blue);
}

/* ========================================================================
   9. COMPOSE MODAL
   ======================================================================== */
#compose-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  display: none;
  align-items: flex-end;
  justify-content: flex-end;
  z-index: 50;
  padding: 0 24px 24px;
  animation: fadeIn var(--transition-fast) ease;
}

#compose-modal.visible {
  display: flex;
}

.compose-window {
  width: 560px;
  max-width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp var(--transition-med) ease;
  max-height: 80vh;
}

.compose-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.compose-header-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.compose-close-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

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

.compose-field {
  padding: 10px 18px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.compose-field input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 0.83rem;
  color: var(--text-primary);
  padding: 2px 0;
}

.compose-field input::placeholder {
  color: var(--text-muted);
}

/* Quill editor container */
#compose-editor {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 180px;
}

.compose-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}

.send-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  background: var(--accent-blue);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.send-btn:hover {
  background: var(--accent-blue-h);
}

.send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

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

/* ========================================================================
   10. QUILL EDITOR DARK THEME RESET
   ======================================================================== */
.ql-toolbar.ql-snow {
  background: var(--bg-tertiary) !important;
  border: none !important;
  border-bottom: 1px solid var(--border-color) !important;
  padding: 6px 12px !important;
}

.ql-toolbar.ql-snow .ql-stroke {
  stroke: var(--text-secondary) !important;
}

.ql-toolbar.ql-snow .ql-fill {
  fill: var(--text-secondary) !important;
}

.ql-toolbar.ql-snow .ql-picker {
  color: var(--text-secondary) !important;
}

.ql-toolbar.ql-snow button:hover .ql-stroke,
.ql-toolbar.ql-snow button.ql-active .ql-stroke {
  stroke: var(--accent-blue) !important;
}

.ql-toolbar.ql-snow button:hover .ql-fill,
.ql-toolbar.ql-snow button.ql-active .ql-fill {
  fill: var(--accent-blue) !important;
}

.ql-toolbar.ql-snow .ql-picker-options {
  background: var(--bg-tertiary) !important;
  border-color: var(--border-color) !important;
}

.ql-container.ql-snow {
  border: none !important;
  background: var(--bg-secondary) !important;
  flex: 1;
}

.ql-editor {
  color: var(--text-primary) !important;
  font-size: 0.88rem !important;
  min-height: 160px !important;
  padding: 14px 18px !important;
}

.ql-editor.ql-blank::before {
  color: var(--text-muted) !important;
  font-style: normal !important;
  left: 18px !important;
}

.ql-editor a {
  color: var(--accent-blue) !important;
}

/* ========================================================================
   11. AUTH SCREEN
   ======================================================================== */
.auth-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 400px;
  box-shadow: var(--shadow-lg);
}

.auth-logo {
  text-align: center;
  margin-bottom: 28px;
}

.auth-logo-text {
  font-size: 1.4rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.03em;
}

.auth-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 4px;
}

.auth-tabs {
  display: flex;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
}

.auth-tab-btn {
  flex: 1;
  padding: 10px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-bottom: -1px;
}

.auth-tab-btn.active {
  color: var(--accent-blue);
  border-bottom-color: var(--accent-blue);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-input {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  font-size: 0.85rem;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input::placeholder {
  color: var(--text-muted);
}

.form-input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.auth-submit-btn {
  padding: 11px;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-indigo));
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
  box-shadow: 0 2px 12px rgba(59, 130, 246, 0.3);
  margin-top: 4px;
}

.auth-submit-btn:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

.auth-submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.auth-error {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 0.78rem;
  color: var(--danger);
  display: none;
}

.auth-error.visible {
  display: block;
  animation: fadeIn var(--transition-fast) ease;
}

/* ========================================================================
   12. TOAST NOTIFICATIONS
   ======================================================================== */
#toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 500;
  color: #fff;
  box-shadow: var(--shadow-md);
  pointer-events: auto;
  animation: slideUp 0.25s ease both;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 220px;
  max-width: 380px;
}

.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }
.toast.info    { background: var(--accent-blue); }
.toast.warning { background: var(--warning); color: #1a0f00; }

.toast.removing {
  animation: fadeOut 0.3s ease both;
}

/* ========================================================================
   13. PAGINATION
   ======================================================================== */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}

.page-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.page-btn:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.page-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.page-info {
  font-size: 0.73rem;
  color: var(--text-muted);
}

/* ========================================================================
   14. ANIMATIONS & TRANSITIONS
   ======================================================================== */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

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

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

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-12px); }
  to   { opacity: 1; transform: translateX(0); }
}

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

/* Tab fade-in for content panels */
.tab-fade {
  animation: fadeIn var(--transition-med) ease both;
}

/* Panel slide-in for email detail */
.panel-slide-in {
  animation: slideInRight var(--transition-med) ease both;
}

/* ========================================================================
   15. EMPTY STATE
   ======================================================================== */
.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px;
  color: var(--text-muted);
  animation: fadeIn var(--transition-med) ease;
}

.empty-state svg {
  opacity: 0.15;
  margin-bottom: 4px;
}

.empty-state h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.empty-state p {
  font-size: 0.78rem;
  text-align: center;
  max-width: 240px;
  line-height: 1.5;
}

/* ========================================================================
   16. UTILITY CLASSES
   ======================================================================== */
.hidden { display: none !important; }
.flex   { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.ml-auto { margin-left: auto; }
.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-muted { color: var(--text-muted); }

/* ========================================================================
   17. RESPONSIVE — Collapse list on small screens
   ======================================================================== */
@media (max-width: 900px) {
  #sidebar { width: 56px; min-width: 56px; padding: 16px 8px; }
  .nav-btn span, .compose-btn span, .sidebar-logo span,
  .user-email-text, .nav-label { display: none; }
  .compose-btn { padding: 10px; justify-content: center; }
  .user-info { justify-content: center; }
  #email-list-panel { width: 280px; min-width: 220px; }
}

@media (max-width: 640px) {
  #email-list-panel { display: none; }
  #email-detail-panel { flex: 1; }
  #email-list-panel.mobile-visible { display: flex; position: absolute; z-index: 20; width: 100%; height: 100%; }
}
