/* Dark Theme Design System */
:root {
  /* Spacing Scale */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  
  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
  
  /* GitHub Dark Theme Colors */
  --color-primary: #58a6ff;
  --color-primary-hover: #1f6feb;
  --color-success: #3fb950;
  --color-warning: #d29922;
  --color-error: #f85149;
  
  /* GitHub Dark Gray Scale */
  --color-gray-50: #0d1117;
  --color-gray-100: #161b22;
  --color-gray-200: #21262d;
  --color-gray-300: #30363d;
  --color-gray-400: #484f58;
  --color-gray-500: #6e7681;
  --color-gray-600: #8b949e;
  --color-gray-700: #b1bac4;
  --color-gray-800: #c9d1d9;
  --color-gray-900: #f0f6fc;
  
  /* Typography */
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 1.875rem;
  
  /* Line Heights */
  --line-height-tight: 1.25;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.75;
}

/* Base styles */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: var(--line-height-normal);
  color: var(--color-gray-900);
  background-color: var(--color-gray-50);
}

.app {
  width: 100%;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background-color: var(--color-gray-100);
  box-shadow: var(--shadow-lg);
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
  padding: var(--space-lg) var(--space-lg) var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--color-gray-200);
}

.header h1 {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--color-gray-900);
  margin: 0;
}

.profile {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  position: relative;
}

.profile button {
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--color-gray-300);
  border-radius: var(--radius-md);
  background-color: var(--color-gray-200);
  color: var(--color-gray-700);
  font-size: var(--font-size-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.profile button:hover {
  background-color: var(--color-gray-300);
  border-color: var(--color-gray-400);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.user-info {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
  border: 1px solid var(--color-gray-300);
  background-color: var(--color-gray-200);
}

.user-info:hover {
  background-color: var(--color-gray-300);
  border-color: var(--color-gray-400);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.user-info .name {
  font-weight: 600;
  color: var(--color-gray-900);
  font-size: var(--font-size-sm);
}

.dropdown-arrow {
  font-size: var(--font-size-xs);
  color: var(--color-gray-500);
  transition: transform 0.2s ease;
}

.user-info:hover .dropdown-arrow {
  transform: rotate(180deg);
}

.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background-color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-lg);
  color: white;
  border: 2px solid var(--color-gray-300);
  box-shadow: var(--shadow-sm);
}

/* Main Container */
.main-container {
  display: flex;
  gap: var(--space-xl);
  height: calc(100vh - 120px); /* Use full height minus header space */
  padding: 0;
}

.left-panel {
  flex: 0 0 400px;
  border-right: 1px solid var(--color-gray-200);
  padding: 0 var(--space-lg) 0 var(--space-lg);
}

.left-panel-narrow {
  flex: 0 0 300px;
  border-right: 1px solid var(--color-gray-200);
  padding: 0 var(--space-lg) 0 var(--space-lg);
}

.left-panel h2 {
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--color-gray-900);
  margin: 0 0 var(--space-md) 0;
}

.left-panel-narrow h2 {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-gray-900);
  margin: 0 0 var(--space-md) 0;
}

.left-panel-narrow h3 {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-gray-900);
  margin: 0 0 var(--space-md) 0;
}

.left-panel-narrow button {
  padding: var(--space-xs) var(--space-sm);
  border: none;
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  background-color: var(--color-gray-300);
  color: var(--color-gray-700);
  margin-top: var(--space-sm);
  margin-right: var(--space-xs);
  display: inline-block;
  border: 1px solid var(--color-gray-400);
}

.left-panel-narrow button:hover {
  background-color: var(--color-gray-400);
  color: var(--color-gray-800);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.left-panel-narrow button:active {
  transform: translateY(0);
  box-shadow: var(--shadow-xs);
}

.right-panel {
  flex: 1;
  padding-left: var(--space-lg);
  min-width: 0; /* Allow flex item to shrink */
  overflow: hidden;
  margin-right: 0; /* Remove negative margin */
}

/* Inbox Header */
.inbox-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-md);
  padding: 0 0 var(--space-sm) 0;
}

.inbox-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.action-icon {
  background: none;
  border: none;
  font-size: var(--font-size-lg);
  color: var(--color-gray-600);
  cursor: pointer;
  padding: var(--space-xs);
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
}

.action-icon:hover {
  background-color: var(--color-gray-300);
  color: var(--color-gray-800);
  transform: translateY(-1px);
}

.action-icon.active {
  background-color: var(--color-primary);
  color: white;
}

/* Filter Container */
.filter-container {
  position: relative;
  display: inline-block;
  z-index: 1000;
}

/* Filter Dropdown */
.filter-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 6px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  z-index: 9999;
  min-width: 200px;
  max-height: 300px;
  overflow-y: auto;
  margin-top: 4px;
}

.filter-option {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: none;
  background: none;
  text-align: left;
  cursor: pointer;
  font-size: 0.875rem;
  color: #f0f6fc;
  transition: background-color 0.2s ease;
}

.filter-option:hover {
  background-color: #21262d;
}

.filter-option.active {
  background-color: #58a6ff;
  color: white;
}

.filter-label {
  font-weight: 500;
}

.filter-count {
  color: #8b949e;
  font-size: 0.75rem;
}

.filter-option.active .filter-count {
  color: rgba(255, 255, 255, 0.8);
}

.inbox-status {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  font-size: var(--font-size-sm);
  color: var(--color-gray-600);
  justify-content: flex-end;
}

.refreshing {
  color: var(--color-warning);
  font-weight: 500;
}

.sync-message {
  color: var(--color-gray-600);
  font-size: var(--font-size-sm);
}

.last-updated {
  color: var(--color-gray-500);
  font-size: var(--font-size-xs);
}

/* System Input */
.system-input {
  width: 100%;
  padding: var(--space-md);
  border: 1px solid var(--color-gray-300);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: var(--font-size-sm);
  line-height: var(--line-height-relaxed);
  resize: vertical;
  min-height: 120px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  background-color: var(--color-gray-200);
  color: var(--color-gray-900);
}

.system-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Secondary CTA Button */
.secondary-cta-btn {
  background-color: transparent;
  border: 1px solid var(--color-gray-400);
  color: var(--color-gray-700);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  white-space: nowrap;
}

.secondary-cta-btn:hover:not(:disabled) {
  background-color: var(--color-gray-300);
  border-color: var(--color-gray-500);
  color: var(--color-gray-800);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.secondary-cta-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Tools List */
.tools-list {
  list-style: none;
  padding: 0;
  margin: var(--space-md) 0;
}

.tools-list li {
  padding: var(--space-sm) var(--space-md);
  margin-bottom: var(--space-xs);
  background-color: var(--color-gray-200);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  color: var(--color-gray-700);
  border: 1px solid var(--color-gray-300);
}

/* Inbox Section */
.inbox-section {
  margin-bottom: var(--space-xl);
}

.inbox-section h3 {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--color-gray-900);
  margin: 0 0 var(--space-md) 0;
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--color-gray-200);
}

/* Email List */
.email-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow-y: auto;
  overflow-x: hidden;
  width: 100%;
  box-sizing: border-box;
  height: calc(100vh - 200px); /* Account for header, tabs, and other UI elements */
  padding-bottom: var(--space-xl); /* Add bottom padding so last email is always visible */
}

/* Empty State */
.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 300px;
  padding: var(--space-xl);
}

.empty-state-content {
  text-align: center;
  max-width: 400px;
}

.empty-state-content h3 {
  color: var(--color-gray-700);
  font-size: var(--font-size-xl);
  font-weight: 600;
  margin: 0 0 var(--space-md) 0;
}

.empty-state-content p {
  color: var(--color-gray-600);
  font-size: var(--font-size-md);
  margin: 0 0 var(--space-xl) 0;
  line-height: 1.5;
}

.empty-state-actions {
  display: flex;
  gap: var(--space-md);
  justify-content: center;
  flex-wrap: wrap;
}

.cta-button {
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  font-size: var(--font-size-md);
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 140px;
}

.cta-button.primary {
  background-color: var(--color-primary);
  color: white;
}

.cta-button.primary:hover:not(:disabled) {
  background-color: var(--color-primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.cta-button.secondary {
  background-color: var(--color-gray-200);
  color: var(--color-gray-700);
  border: 1px solid var(--color-gray-300);
}

.cta-button.secondary:hover:not(:disabled) {
  background-color: var(--color-gray-300);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.cta-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Loading State */
.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 300px;
  padding: var(--space-xl);
}

.loading-state-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
}

.loading-state-content p {
  color: var(--color-gray-600);
  font-size: var(--font-size-md);
  margin: 0;
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--color-gray-300);
  border-top: 3px solid var(--color-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Email Item */
.email-item {
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--color-gray-300);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

/* Compact Email Item Layout */
.email-item-compact {
  padding: var(--space-lg) var(--space-lg);
  border-bottom: 1px solid var(--color-gray-300);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-md);
  width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

.email-item-compact:hover {
  background-color: var(--color-gray-300);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.email-item-compact.processed {
  background-color: var(--color-gray-200);
  opacity: 0.8;
}

.email-item-compact.processing {
  background-color: rgba(245, 158, 11, 0.1);
  border-left: 4px solid var(--color-warning);
}

.email-item-compact.unprocessed {
  background-color: rgba(59, 130, 246, 0.1);
  border-left: 4px solid var(--color-primary);
}

.email-item-compact.awaiting {
  background-color: rgba(245, 158, 11, 0.1);
  border-left: 4px solid var(--color-warning);
}

.email-content {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--font-size-sm);
  color: var(--color-gray-700);
  overflow: hidden;
  min-width: 0; /* Allow flex item to shrink below content size */
  max-width: calc(100% - 220px); /* Reserve space for tags and status */
}

.sender-name {
  font-weight: 600;
  color: var(--color-gray-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px; /* Reduced from 150px */
  flex-shrink: 0;
}

.email-separator {
  color: var(--color-gray-500);
  margin: 0 var(--space-xs);
  flex-shrink: 0;
}

.email-subject {
  font-weight: 500;
  color: var(--color-gray-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
  min-width: 0; /* Allow this to shrink */
  max-width: none; /* Remove any max-width constraint */
}

.email-preview {
  color: var(--color-gray-600);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0; /* Allow this to shrink */
}

.email-tags {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  flex-shrink: 0;
  max-width: 120px;
  overflow: visible; /* Changed from hidden to visible for hover expansion */
  position: relative;
  z-index: 1;
}

.email-tags:hover {
  max-width: none; /* Allow expansion on hover */
  overflow: visible;
  z-index: 10; /* Bring to front on hover */
}

.email-tag {
  padding: 2px var(--space-xs);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  font-weight: 500;
  background-color: rgba(99, 102, 241, 0.1);
  color: #6366f1;
  border: 1px solid rgba(99, 102, 241, 0.2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: all 0.2s ease;
}

.email-tag-more {
  background-color: rgba(107, 114, 126, 0.1);
  color: #6b727e;
  border: 1px solid rgba(107, 114, 126, 0.2);
  cursor: pointer;
  font-weight: 600;
}

.email-tag-more:hover {
  background-color: rgba(107, 114, 126, 0.2);
  color: #4b5563;
}

.email-status {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  flex-shrink: 0;
  min-width: 100px; /* Ensure minimum space for status */
  margin-right: 0;
  justify-content: flex-end;
}

.status-tag-compact {
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-lg);
  font-size: var(--font-size-xs);
  font-weight: 600;
  border: 1px solid;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  white-space: nowrap;
}

.status-tag-compact.unprocessed {
  background-color: rgba(59, 130, 246, 0.2);
  color: var(--color-primary);
  border-color: rgba(59, 130, 246, 0.3);
}

.status-tag-compact.processing {
  background-color: rgba(245, 158, 11, 0.2);
  color: var(--color-warning);
  border-color: rgba(245, 158, 11, 0.3);
}

.status-tag-compact.awaiting {
  background-color: rgba(245, 158, 11, 0.2);
  color: var(--color-warning);
  border-color: rgba(245, 158, 11, 0.3);
}

.status-tag-compact.processed {
  background-color: rgba(16, 185, 129, 0.2);
  color: var(--color-success);
  border-color: rgba(16, 185, 129, 0.3);
}

.status-tag-compact.unknown {
  background-color: var(--color-gray-300);
  color: var(--color-gray-600);
  border-color: var(--color-gray-400);
}

.draft-indicator {
  font-size: var(--font-size-sm);
  color: var(--color-warning);
}

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

.email-item:hover {
  background-color: var(--color-gray-300);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.email-item.processed {
  background-color: var(--color-gray-200);
  opacity: 0.8;
}

.email-item.processing {
  background-color: rgba(245, 158, 11, 0.1);
  border-left: 4px solid var(--color-warning);
}

.email-item.unprocessed {
  background-color: rgba(59, 130, 246, 0.1);
  border-left: 4px solid var(--color-primary);
}

.email-item.awaiting {
  background-color: rgba(245, 158, 11, 0.1);
  border-left: 4px solid var(--color-warning);
}

/* Email Header */
.email-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-sm);
  gap: var(--space-md);
}

.subject {
  font-weight: 600;
  color: var(--color-gray-900);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-tight);
  flex: 1;
  margin: 0;
}

.status-label {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  flex-shrink: 0;
}

.status-tag {
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-lg);
  font-size: var(--font-size-xs);
  font-weight: 600;
  border: 1px solid;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.status-tag.unprocessed {
  background-color: rgba(59, 130, 246, 0.2);
  color: var(--color-primary);
  border-color: rgba(59, 130, 246, 0.3);
}

.status-tag.processing {
  background-color: rgba(245, 158, 11, 0.2);
  color: var(--color-warning);
  border-color: rgba(245, 158, 11, 0.3);
}

.status-tag.awaiting {
  background-color: rgba(245, 158, 11, 0.2);
  color: var(--color-warning);
  border-color: rgba(245, 158, 11, 0.3);
}

.status-tag.processed {
  background-color: rgba(16, 185, 129, 0.2);
  color: var(--color-success);
  border-color: rgba(16, 185, 129, 0.3);
}

.status-tag.unknown {
  background-color: var(--color-gray-300);
  color: var(--color-gray-600);
  border-color: var(--color-gray-400);
}

/* Meta Information */
.meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--font-size-xs);
  color: var(--color-gray-500);
  margin-bottom: var(--space-xs);
}

.from {
  font-weight: 500;
  color: var(--color-gray-700);
}

.timestamp {
  color: var(--color-gray-500);
}

/* Email Actions */
.email-actions {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
  margin-top: var(--space-sm);
}

.action-tag {
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-lg);
  font-size: var(--font-size-xs);
  font-weight: 500;
  background-color: var(--color-gray-300);
  color: var(--color-gray-700);
  border: 1px solid var(--color-gray-400);
}

.awaiting-tag {
  background-color: rgba(245, 158, 11, 0.2) !important;
  color: var(--color-warning) !important;
  border-color: rgba(245, 158, 11, 0.3) !important;
}

/* Empty State */
.empty-state {
  text-align: center;
  color: var(--color-gray-500);
  font-style: italic;
  padding: var(--space-2xl);
  font-size: var(--font-size-sm);
}

/* Loading */
.loading {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 50vh;
  font-size: var(--font-size-lg);
  color: var(--color-gray-600);
}

/* Onboarding */
.onboarding {
  display: flex;
  flex-direction: column;
  max-width: 600px;
  margin: var(--space-2xl) auto;
  gap: var(--space-md);
  padding: var(--space-xl);
  background-color: var(--color-gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--color-gray-300);
}

.onboarding input {
  padding: var(--space-md);
  border: 1px solid var(--color-gray-300);
  border-radius: var(--radius-md);
  font-size: var(--font-size-base);
  background-color: var(--color-gray-100);
  color: var(--color-gray-900);
}

.onboarding button {
  padding: var(--space-md) var(--space-lg);
  border: none;
  border-radius: var(--radius-md);
  font-size: var(--font-size-base);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  background-color: var(--color-primary);
  color: white;
}

.onboarding button:hover {
  background-color: var(--color-primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.onboarding p {
  margin: var(--space-sm) 0;
  color: var(--color-gray-700);
  line-height: var(--line-height-relaxed);
}

/* Whitelist Rules */
.whitelist-rules {
  margin: var(--space-lg) 0;
}

.rule-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.rule-row select {
  padding: var(--space-sm) var(--space-md);
  background-color: var(--color-gray-100);
  color: var(--color-gray-900);
  border: 1px solid var(--color-gray-300);
  border-radius: var(--radius-md);
  min-width: 140px;
  font-size: var(--font-size-sm);
}

.rule-row input {
  flex: 1;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--color-gray-300);
  border-radius: var(--radius-md);
  background-color: var(--color-gray-100);
  color: var(--color-gray-900);
  font-size: var(--font-size-sm);
}

.onboarding-actions {
  display: flex;
  gap: var(--space-md);
  justify-content: space-between;
  margin-top: var(--space-lg);
}

.onboarding-actions button {
  flex: 1;
  padding: var(--space-md) var(--space-lg);
  border: none;
  border-radius: var(--radius-md);
  font-size: var(--font-size-base);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  background-color: var(--color-primary);
  color: white;
}

.onboarding-actions button:hover {
  background-color: var(--color-primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.prompt-setup {
  margin: var(--space-lg) 0;
}

.prompt-setup label {
  display: block;
  margin-bottom: var(--space-sm);
  font-weight: 600;
  color: var(--color-gray-900);
}

.prompt-setup textarea {
  width: 100%;
  padding: var(--space-md);
  border: 1px solid var(--color-gray-300);
  border-radius: var(--radius-md);
  background-color: var(--color-gray-100);
  color: var(--color-gray-900);
  font-family: inherit;
  font-size: var(--font-size-sm);
  resize: vertical;
  margin-bottom: var(--space-sm);
  line-height: var(--line-height-relaxed);
}

.prompt-setup textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.prompt-setup small {
  color: var(--color-gray-500);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-relaxed);
}

.error {
  color: var(--color-error);
  padding: var(--space-md);
  background-color: rgba(239, 68, 68, 0.1);
  border: 1px solid var(--color-error);
  border-radius: var(--radius-md);
}

/* User Selector */
.user-selector {
  display: flex;
  flex-direction: column;
  max-width: 700px;
  margin: var(--space-2xl) auto;
  padding: var(--space-xl);
  background-color: var(--color-gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--color-gray-300);
}

.user-selector h2 {
  margin: 0 0 var(--space-sm) 0;
  color: var(--color-gray-900);
  text-align: center;
  font-size: var(--font-size-2xl);
  font-weight: 700;
}

.user-selector p {
  margin: 0 0 var(--space-xl) 0;
  color: var(--color-gray-600);
  text-align: center;
  line-height: var(--line-height-relaxed);
}

.user-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.user-item {
  display: flex;
  align-items: center;
  padding: var(--space-lg);
  border: 1px solid var(--color-gray-300);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.2s ease;
  background-color: var(--color-gray-100);
}

.user-item:hover {
  background-color: var(--color-gray-300);
  border-color: var(--color-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.user-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background-color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-xl);
  margin-right: var(--space-lg);
  color: white;
  border: 2px solid var(--color-gray-300);
}

.user-info {
  flex: 1;
}

.user-email {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--color-gray-900);
  margin-bottom: var(--space-xs);
}

.user-host {
  font-size: var(--font-size-sm);
  color: var(--color-gray-600);
  margin-bottom: var(--space-xs);
}

.user-last-processed {
  font-size: var(--font-size-xs);
  color: var(--color-gray-500);
}

.user-select-arrow {
  font-size: var(--font-size-lg);
  color: var(--color-primary);
  margin-left: var(--space-lg);
  opacity: 0.7;
  transition: all 0.2s ease;
}

.user-item:hover .user-select-arrow {
  opacity: 1;
  transform: translateX(4px);
}

.user-actions {
  margin-top: var(--space-lg);
}

.add-new-btn {
  background-color: var(--color-primary);
  color: white;
  border: none;
  padding: var(--space-md) var(--space-xl);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: var(--font-size-base);
  font-weight: 600;
  transition: all 0.2s ease;
  width: 100%;
}

.add-new-btn:hover {
  background-color: var(--color-primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* Responsive Design */
@media (max-width: 1024px) {
  .app {
    padding: var(--space-md);
  }
  
  .main-container {
    flex-direction: column;
    gap: var(--space-lg);
  }
  
  .left-panel {
    flex: none;
    border-right: none;
    border-bottom: 1px solid var(--color-gray-200);
    padding-right: 0;
    padding-bottom: var(--space-lg);
  }
  
  .right-panel {
    padding-left: 0;
  }
}

@media (max-width: 768px) {
  .app {
    padding: var(--space-sm);
  }
  
  .header {
    flex-direction: column;
    gap: var(--space-md);
    align-items: flex-start;
  }
  
  .profile {
    width: 100%;
    justify-content: space-between;
  }
  
  .email-list {
    max-height: 400px;
    padding-bottom: var(--space-xl); /* Ensure last email is visible on mobile too */
  }
  
  .email-item {
    padding: var(--space-sm) var(--space-md);
  }
  
  .email-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
  }
  
  .status-label {
    align-self: flex-end;
  }
}

/* Email Tabs */
.email-tabs {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
  border-bottom: 1px solid var(--color-gray-300);
}

.tab-button {
  padding: var(--space-sm) var(--space-md);
  border: none;
  background: none;
  color: var(--color-gray-600);
  font-size: var(--font-size-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border-bottom: 2px solid transparent;
  border-radius: 0;
}

.tab-button:hover {
  color: var(--color-gray-800);
  background-color: var(--color-gray-200);
}

.tab-button.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
  background-color: var(--color-gray-200);
}
