/* ========================================
   LeadConnect - Complete Polished Styles
   ======================================== */

:root {
  --brand-50: #f0f4ff;
  --brand-100: #e0e7ff;
  --brand-500: #6366f1;
  --brand-600: #4f46e5;
  --brand-700: #4338ca;
  --brand-900: #312e81;
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --radius-sm: 0.375rem;
  --radius: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
  --transition: 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ========================================
   Layout & Container
   ======================================== */
.container {
  width: 100%;
  max-width: 80rem;
  margin: 0 auto;
  padding: 0 1.5rem;
}

@media (min-width: 640px) {
  .container { padding: 0 2rem; }
}

@media (min-width: 1024px) {
  .container { padding: 0 3rem; }
}

/* ========================================
   Animations
   ======================================== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

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

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

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

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

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes typing {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.animate-fade-in { animation: fadeIn 0.4s ease-out; }
.animate-slide-in { animation: slideIn 0.3s ease-out; }
.animate-slide-up { animation: slideUp 0.5s ease-out; }
.animate-pulse-slow { animation: pulse 2s infinite; }
.animate-spin { animation: spin 1s linear infinite; }

.section-reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.section-reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger animations */
.section-reveal:nth-child(1) { transition-delay: 0ms; }
.section-reveal:nth-child(2) { transition-delay: 100ms; }
.section-reveal:nth-child(3) { transition-delay: 200ms; }
.section-reveal:nth-child(4) { transition-delay: 300ms; }

/* ========================================
   Gradient Backgrounds
   ======================================== */
.gradient-brand {
  background: linear-gradient(135deg, var(--brand-500) 0%, var(--brand-700) 100%);
}

.gradient-brand-light {
  background: linear-gradient(135deg, var(--brand-50) 0%, var(--brand-100) 100%);
}

.gradient-hero {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.gradient-mesh {
  background: 
    radial-gradient(ellipse at 20% 0%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(139, 92, 246, 0.15) 0%, transparent 50%),
    var(--gray-50);
}

/* ========================================
   Glass Morphism
   ======================================== */
.glass {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.glass-dark {
  background: rgba(17, 24, 39, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.glass-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-lg);
}

/* ========================================
   Buttons
   ======================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius-lg);
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

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

.btn-sm { padding: 0.375rem 0.875rem; font-size: 0.8125rem; }
.btn-lg { padding: 0.875rem 1.75rem; font-size: 1rem; }
.btn-xl { padding: 1rem 2rem; font-size: 1.125rem; }

.btn-primary {
  background: linear-gradient(135deg, var(--brand-500) 0%, var(--brand-600) 100%);
  color: white;
  box-shadow: 0 4px 14px 0 rgba(99, 102, 241, 0.4);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--brand-600) 0%, var(--brand-700) 100%);
  box-shadow: 0 6px 20px 0 rgba(99, 102, 241, 0.5);
  transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) { transform: translateY(0); }

.btn-secondary {
  background: white;
  color: var(--gray-700);
  border: 1px solid var(--gray-300);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--gray-50);
  border-color: var(--gray-400);
  box-shadow: var(--shadow);
}

.btn-outline {
  background: transparent;
  color: var(--brand-600);
  border: 1px solid var(--brand-300);
}

.btn-outline:hover:not(:disabled) {
  background: var(--brand-50);
  border-color: var(--brand-500);
}

.btn-ghost {
  background: transparent;
  color: var(--gray-600);
  border: none;
}

.btn-ghost:hover:not(:disabled) {
  background: var(--gray-100);
  color: var(--gray-900);
}

.btn-success {
  background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
  color: white;
  box-shadow: 0 4px 14px 0 rgba(16, 185, 129, 0.4);
}

.btn-success:hover:not(:disabled) {
  box-shadow: 0 6px 20px 0 rgba(16, 185, 129, 0.5);
}

.btn-danger {
  background: linear-gradient(135deg, var(--error) 0%, #dc2626 100%);
  color: white;
  box-shadow: 0 4px 14px 0 rgba(239, 68, 68, 0.4);
}

.btn-danger:hover:not(:disabled) {
  box-shadow: 0 6px 20px 0 rgba(239, 68, 68, 0.5);
}

.btn-icon {
  padding: 0.5rem;
  border-radius: var(--radius);
}

.btn-loading {
  position: relative;
  color: transparent !important;
}

.btn-loading::after {
  content: '';
  position: absolute;
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* ========================================
   Form Elements
   ======================================== */
.form-group { margin-bottom: 1.25rem; }

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: 0.5rem;
}

.form-label.required::after {
  content: '*';
  color: var(--error);
  margin-left: 0.25rem;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: 0.9375rem;
  font-family: inherit;
  color: var(--gray-900);
  background: white;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-lg);
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}

.form-input::placeholder,
.form-select::placeholder,
.form-textarea::placeholder {
  color: var(--gray-400);
}

.form-input:hover,
.form-select:hover,
.form-textarea:hover {
  border-color: var(--gray-400);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled {
  background: var(--gray-100);
  color: var(--gray-500);
  cursor: not-allowed;
}

.form-input.error,
.form-select.error,
.form-textarea.error {
  border-color: var(--error);
}

.form-input.error:focus,
.form-select.error:focus,
.form-textarea.error:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.form-textarea {
  min-height: 100px;
  resize: vertical;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
  background-position: right 0.75rem center;
  background-repeat: no-repeat;
  background-size: 1.5rem;
  padding-right: 2.5rem;
}

.form-help {
  display: block;
  margin-top: 0.375rem;
  font-size: 0.8125rem;
  color: var(--gray-500);
}

.form-error {
  display: block;
  margin-top: 0.375rem;
  font-size: 0.8125rem;
  color: var(--error);
}

.form-checkbox,
.form-radio {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.form-checkbox input,
.form-radio input {
  width: 1.125rem;
  height: 1.125rem;
  accent-color: var(--brand-500);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
}

.form-checkbox label,
.form-radio label {
  font-size: 0.875rem;
  color: var(--gray-700);
  cursor: pointer;
}

/* Floating Label Input */
.form-floating {
  position: relative;
}

.form-floating > .form-input,
.form-floating > .form-select,
.form-floating > .form-textarea {
  padding-top: 1.25rem;
  padding-bottom: 0.375rem;
}

.form-floating > label {
  position: absolute;
  top: 0;
  left: 0.875rem;
  height: 100%;
  padding: 0.625rem 0;
  pointer-events: none;
  border: 1px solid transparent;
  transform-origin: 0 0;
  transition: opacity var(--transition), transform var(--transition);
  color: var(--gray-500);
}

.form-floating > .form-input:focus ~ label,
.form-floating > .form-select:focus ~ label,
.form-floating > .form-textarea:focus ~ label,
.form-floating > .form-input:not(:placeholder-shown) ~ label,
.form-floating > .form-select:not([value=""]) ~ label,
.form-floating > .form-textarea:not(:placeholder-shown) ~ label {
  opacity: 0.65;
  transform: scale(0.85) translateY(-0.5rem) translateX(0.15rem);
}

/* ========================================
   Cards
   ======================================== */
.card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--gray-300);
}

.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--gray-200);
}

.card-body { padding: 1.5rem; }
.card-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--gray-200);
  background: var(--gray-50);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

.card-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--gray-900);
}

.card-subtitle {
  font-size: 0.875rem;
  color: var(--gray-500);
  margin-top: 0.25rem;
}

/* Stat Card */
.stat-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  transition: all var(--transition);
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--gray-300);
  transform: translateY(-2px);
}

.stat-icon {
  width: 3rem;
  height: 3rem;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.stat-icon.primary { background: var(--brand-100); color: var(--brand-600); }
.stat-icon.success { background: #d1fae5; color: var(--success); }
.stat-icon.warning { background: #fef3c7; color: var(--warning); }
.stat-icon.info { background: #dbeafe; color: #3b82f6; }
.stat-icon.purple { background: #f3e8ff; color: #a855f7; }

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1.2;
}

.stat-label {
  font-size: 0.875rem;
  color: var(--gray-500);
  margin-top: 0.25rem;
}

.stat-trend {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
}

.stat-trend.up { color: var(--success); }
.stat-trend.down { color: var(--error); }

/* ========================================
   Badges & Status
   ======================================== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 9999px;
}

.badge-primary { background: var(--brand-100); color: var(--brand-700); }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-error { background: #fee2e2; color: #991b1b; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-purple { background: #f3e8ff; color: #7e22ce; }
.badge-gray { background: var(--gray-100); color: var(--gray-700); }
.badge-outline { background: transparent; border: 1px solid currentColor; }

/* Status Badges */
.status-new { background: var(--gray-100); color: var(--gray-700); }
.status-contacted { background: #dbeafe; color: #1e40af; }
.status-ai_talking { background: #f3e8ff; color: #7e22ce; }
.status-interested { background: #fef3c7; color: #92400e; }
.status-human_transfer { background: #d1fae5; color: #065f46; }
.status-closed { background: var(--gray-100); color: var(--gray-700); }
.status-do_not_contact { background: #fee2e2; color: #991b1b; }

/* ========================================
   Tables
   ======================================== */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-xl);
  border: 1px solid var(--gray-200);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.table thead {
  background: var(--gray-50);
}

.table th {
  padding: 0.875rem 1rem;
  text-align: left;
  font-weight: 600;
  color: var(--gray-500);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--gray-200);
}

.table td {
  padding: 0.875rem 1rem;
  color: var(--gray-900);
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}

.table tbody tr {
  transition: background var(--transition);
}

.table tbody tr:hover {
  background: var(--gray-50);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

/* ========================================
   Toast Notifications
   ======================================== */
.toast-container {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: white;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  border-left: 4px solid;
  min-width: 280px;
  max-width: 420px;
  animation: slideIn 0.3s ease-out;
  pointer-events: auto;
}

.toast.exiting { animation: fadeIn 0.2s ease-in reverse; }

.toast-success { border-color: var(--success); }
.toast-error { border-color: var(--error); }
.toast-warning { border-color: var(--warning); }
.toast-info { border-color: var(--brand-500); }

.toast-icon {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  margin-top: 0.125rem;
}

.toast-success .toast-icon { color: var(--success); }
.toast-error .toast-icon { color: var(--error); }
.toast-warning .toast-icon { color: var(--warning); }
.toast-info .toast-icon { color: var(--brand-500); }

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

.toast-title {
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: 0.25rem;
}

.toast-message {
  font-size: 0.875rem;
  color: var(--gray-600);
  line-height: 1.5;
}

.toast-close {
  flex-shrink: 0;
  padding: 0.25rem;
  color: var(--gray-400);
  border: none;
  background: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

.toast-close:hover { color: var(--gray-600); background: var(--gray-100); }

/* ========================================
   Loading States
   ======================================== */
.skeleton {
  background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-100) 50%, var(--gray-200) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius);
}

.skeleton-text {
  height: 1rem;
  margin-bottom: 0.5rem;
}

.skeleton-text:last-child { width: 60%; }
.skeleton-text:nth-last-child(2) { width: 80%; }

.skeleton-avatar {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
}

.skeleton-card {
  padding: 1.5rem;
}

.skeleton-table-row td {
  padding: 0.875rem 1rem;
}

.skeleton-table-row .skeleton { height: 1rem; border-radius: var(--radius-sm); }

/* Spinner */
.spinner {
  display: inline-block;
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid var(--gray-200);
  border-top-color: var(--brand-500);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.spinner-sm { width: 1rem; height: 1rem; border-width: 1.5px; }
.spinner-lg { width: 2rem; height: 2rem; border-width: 3px; }

/* Page Loading Overlay */
.page-loader {
  position: fixed;
  inset: 0;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.3s, visibility 0.3s;
}

.page-loader.hidden { opacity: 0; visibility: hidden; }

.page-loader-content {
  text-align: center;
}

.page-loader-logo {
  width: 4rem;
  height: 4rem;
  margin: 0 auto 1.5rem;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.5rem;
  font-weight: 700;
}

/* ========================================
   Modal / Dialog
   ======================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease-out;
}

.modal-overlay.open { opacity: 1; visibility: visible; }

.modal {
  background: white;
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-xl);
  max-width: 32rem;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  transform: scale(0.95) translateY(10px);
  transition: all 0.2s ease-out;
}

.modal-overlay.open .modal { transform: scale(1) translateY(0); }

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--gray-900);
}

.modal-close {
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-400);
  background: none;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
}

.modal-close:hover { color: var(--gray-600); background: var(--gray-100); }

.modal-body { padding: 1.5rem; overflow-y: auto; }
.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--gray-200);
  background: var(--gray-50);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* ========================================
   Tabs
   ======================================== */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--gray-200);
  margin-bottom: 1.5rem;
}

.tab-btn {
  padding: 0.875rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-500);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}

.tab-btn:hover { color: var(--gray-700); }

.tab-btn.active {
  color: var(--brand-600);
  border-bottom-color: var(--brand-500);
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 1rem;
  height: 1rem;
  background: var(--brand-500);
  border-radius: 50%;
  opacity: 0.15;
}

.tab-panel { animation: fadeIn 0.3s ease-out; }

/* ========================================
   Dropdown Menu
   ======================================== */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  min-width: 12rem;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 0.5rem;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-0.5rem);
  transition: all var(--transition);
}

.dropdown.open .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  color: var(--gray-700);
  background: none;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  transition: all var(--transition);
}

.dropdown-item:hover { background: var(--gray-100); color: var(--gray-900); }
.dropdown-item.danger:hover { background: #fef2f2; color: var(--error); }

.dropdown-divider { height: 1px; background: var(--gray-200); margin: 0.5rem 0; }

.dropdown-item-icon {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
}

/* ========================================
   Tooltip
   ======================================== */
.tooltip {
  position: relative;
}

.tooltip::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 0.5rem);
  left: 50%;
  transform: translateX(-50%);
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: white;
  background: var(--gray-900);
  border-radius: var(--radius);
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition);
  z-index: 100;
}

.tooltip::after {
  content: '';
  position: absolute;
  bottom: calc(100% + 0.125rem);
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--gray-900);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition);
}

.tooltip:hover::before,
.tooltip:hover::after { opacity: 1; visibility: visible; }

/* ========================================
   Avatar
   ======================================== */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  font-weight: 600;
  color: white;
  background: var(--brand-500);
  font-size: 0.875rem;
  overflow: hidden;
}

.avatar-sm { width: 2rem; height: 2rem; font-size: 0.75rem; }
.avatar-lg { width: 3.5rem; height: 3.5rem; font-size: 1.25rem; }
.avatar-xl { width: 5rem; height: 5rem; font-size: 1.75rem; }

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

.avatar-group { display: flex; }
.avatar-group .avatar { margin-left: -0.75rem; border: 2px solid white; }
.avatar-group .avatar:first-child { margin-left: 0; }

/* ========================================
   Chat Widget Specific
   ======================================== */
.chat-bubble {
  max-width: 85%;
  word-break: break-word;
  animation: fadeIn 0.3s ease-out;
}

.chat-bubble.user {
  margin-left: auto;
  text-align: right;
}

.chat-bubble.ai {
  margin-right: auto;
  text-align: left;
}

.chat-bubble.ai .bubble-content {
  background: white;
  border: 1px solid var(--gray-200);
  color: var(--gray-800);
  border-radius: var(--radius-xl) var(--radius-xl) var(--radius-xl) var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

.chat-bubble.user .bubble-content {
  background: linear-gradient(135deg, var(--brand-500), var(--brand-600));
  color: white;
  border-radius: var(--radius-xl) var(--radius-xl) var(--radius-sm) var(--radius-xl);
  box-shadow: 0 4px 14px 0 rgba(99, 102, 241, 0.3);
}

.bubble-content {
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  line-height: 1.5;
}

.bubble-time {
  font-size: 0.625rem;
  color: var(--gray-400);
  margin-top: 0.25rem;
  text-align: right;
}

.chat-bubble.ai .bubble-time { color: var(--gray-400); }

/* Typing Indicator */
.typing-indicator {
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.75rem 1rem;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-xl) var(--radius-xl) var(--radius-xl) var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

.typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gray-400);
  animation: typing 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) { animation-delay: 0s; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

/* ========================================
   Document Card
   ======================================== */
.document-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition);
}

.document-card:hover {
  background: white;
  border-color: var(--brand-300);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.document-icon {
  width: 3rem;
  height: 3.75rem;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.document-icon.pdf { background: #fee2e2; color: var(--error); }
.document-icon.doc { background: #dbeafe; color: #3b82f6; }
.document-icon.image { background: #f3e8ff; color: #a855f7; }

.document-info { flex: 1; min-width: 0; }
.document-title { font-weight: 500; color: var(--gray-900); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.document-meta { font-size: 0.75rem; color: var(--gray-500); margin-top: 0.125rem; }

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

.empty-state-icon {
  width: 4rem;
  height: 4rem;
  color: var(--gray-300);
  margin-bottom: 1rem;
}

.empty-state-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 0.5rem;
}

.empty-state-message {
  font-size: 0.875rem;
  max-width: 20rem;
  line-height: 1.6;
}

.empty-state-action { margin-top: 1.5rem; }

/* ========================================
   Scrollbar
   ======================================== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 4px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }
::-webkit-scrollbar-corner { background: transparent; }

/* Firefox */
* { scrollbar-width: thin; scrollbar-color: var(--gray-300) transparent; }

/* ========================================
   Focus Visible (Accessibility)
   ======================================== */
*:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
}

/* ========================================
   Print Styles
   ======================================== */
@media print {
  .no-print { display: none !important; }
  .page-break { page-break-after: always; }
}

/* ========================================
   Reduced Motion
   ======================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ========================================
   Utility Classes
   ======================================== */
.text-gradient {
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.bg-gradient-brand { background: linear-gradient(135deg, var(--brand-500), var(--brand-700)); }
.bg-gradient-hero { background: linear-gradient(135deg, #667eea, #764ba2); }

.truncate-1 { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.truncate-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.truncate-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ========================================
   Responsive Helpers
   ======================================== */
@media (max-width: 639px) {
  .hide-mobile { display: none !important; }
  .container { padding: 0 1rem; }
  .btn-xl { padding: 0.875rem 1.5rem; font-size: 1rem; }
  .stat-value { font-size: 1.5rem; }
  .modal { margin: 1rem; max-height: calc(100vh - 2rem); }
  .toast-container { left: 1rem; right: 1rem; top: auto; bottom: 1rem; }
  .toast { min-width: auto; max-width: none; }
}

@media (min-width: 640px) and (max-width: 1023px) {
  .hide-tablet { display: none !important; }
}

@media (min-width: 1024px) {
  .hide-desktop { display: none !important; }
}

/* ========================================
   Dark Mode Support (Future)
   ======================================== */
@media (prefers-color-scheme: dark) {
  :root {
    --gray-50: #0f172a;
    --gray-100: #1e293b;
    --gray-200: #334155;
    --gray-300: #475569;
    --gray-400: #64748b;
    --gray-500: #94a3b8;
    --gray-600: #cbd5e1;
    --gray-700: #e2e8f0;
    --gray-800: #f1f5f9;
    --gray-900: #f8fafc;
  }
}