/* ============================================
   STITCH UI ADN - Premium Edition
   Design System: Kobalt & Glassmorphism
   ============================================ */

/* ============================================
   DESIGN TOKENS & VARIABLES
   ============================================ */
:root {
  /* Brand Colors - Kobalt & Heat */
  --primary: #002FA7;
  /* Electric Klein Blue */
  --primary-light: #3060E0;
  --primary-dark: #001A66;
  --accent: #FF4500;
  /* Oven Heat Orange */
  --accent-light: #FF6B33;
  --accent-glow: rgba(255, 69, 0, 0.3);

  /* Glassmorphism System */
  --glass-surface: rgba(255, 255, 255, 0.65);
  --glass-border: rgba(255, 255, 255, 0.4);
  --glass-highlight: rgba(255, 255, 255, 0.8);
  --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
  --blur-strength: blur(20px);

  /* Grays - Cool & Clean */
  --bg-body: #F0F2F5;
  --text-main: #111827;
  --text-muted: #6B7280;
  --text-light: #9CA3AF;
  --gray-200: #E5E7EB;
  --gray-100: #F3F4F6;
  --gray-50: #F9FAFB;

  /* Semantic */
  --success: #059669;
  --warning: #D97706;
  --danger: #DC2626;
  --info: #2563EB;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;

  /* Radii */
  --r-sm: 6px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 24px;
  --r-full: 9999px;

  /* Transitions */
  --ease-elastic: cubic-bezier(0.175, 0.885, 0.32, 1.275);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --duration-fast: 200ms;
  --duration-medium: 350ms;

  /* Gradients */
  --grad-primary: linear-gradient(135deg, #002FA7 0%, #001A66 100%);
  --grad-accent: linear-gradient(135deg, #FF4500 0%, #FF8C00 100%);
  --grad-surface: linear-gradient(145deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.6));
}

/* ============================================
   RESET & BASE
   ============================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Poppins', sans-serif;
  background-color: var(--bg-body);
  background-image:
    radial-gradient(circle at 10% 20%, rgba(0, 47, 167, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(255, 69, 0, 0.05) 0%, transparent 40%);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

.main-wrapper {
  margin-left: 280px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.top-header {
  height: 80px;
  padding: 0 var(--space-2xl);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
  background: rgba(240, 242, 245, 0.85);
  backdrop-filter: var(--blur-strength);
  border-bottom: 1px solid rgba(255, 255, 255, 0.5);
}

.hamburger-btn {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-main);
  cursor: pointer;
  margin-right: var(--space-md);
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--r-full);
  border: none;
  background: white;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration-fast);
}

.icon-btn:hover {
  color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 47, 167, 0.15);
}

/* ============================================
   ADN PAGE CONTENT
   ============================================ */
.dashboard-content {
  padding: var(--space-xl) var(--space-2xl);
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

.header-left h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0;
}

.header-left .subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* STATS CARDS */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-lg);
}

.stat-card {
  background: white;
  border-radius: var(--r-xl);
  padding: var(--space-xl);
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  box-shadow: var(--glass-shadow);
  position: relative;
  overflow: hidden;
  transition: all var(--duration-medium) var(--ease-elastic);
}

.stat-card:hover {
  transform: translateY(-5px) scale(1.02);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 6px;
  bottom: 0;
  background: var(--gray-200);
}

.stat-card.gradient-blue::after {
  background: var(--primary);
}

.stat-card.gradient-green::after {
  background: var(--success);
}

.stat-card.gradient-orange::after {
  background: var(--accent);
}

.stat-card.gradient-purple::after {
  background: #8B5CF6;
}

.stat-icon {
  width: 60px;
  height: 60px;
  border-radius: var(--r-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  background: var(--bg-body);
  color: var(--text-light);
  transition: all var(--duration-fast);
}

.stat-card:hover .stat-icon {
  color: white;
}

.stat-card.gradient-blue:hover .stat-icon {
  background: var(--primary);
}

.stat-card.gradient-green:hover .stat-icon {
  background: var(--success);
}

.stat-card.gradient-orange:hover .stat-icon {
  background: var(--accent);
}

.stat-card.gradient-purple:hover .stat-icon {
  background: #8B5CF6;
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.1;
  margin: var(--space-xs) 0;
}

.stat-label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  font-weight: 600;
}

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

/* PANELS & CONTACT SECTIONS */
.panel {
  background: var(--glass-surface);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--r-xl);
  padding: var(--space-xl);
  backdrop-filter: blur(12px);
  margin-bottom: var(--space-lg);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  gap: var(--space-md);
}

.panel-header h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.panel-header p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Filter & Inputs Toolbar */
.filter-toolbar {
  display: flex;
  gap: var(--space-md);
  align-items: center;
  background: var(--gray-50);
  padding: 0.5rem;
  border-radius: var(--r-full);
  border: 1px solid var(--gray-200);
}

.chip-row {
  display: flex;
  gap: 0.5rem;
}

.chip {
  padding: 0.4rem 1rem;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--r-full);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--duration-fast);
  color: var(--text-muted);
}

.chip:hover,
.chip.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(0, 47, 167, 0.2);
}

.date-input-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: white;
  padding: 0.3rem 0.8rem;
  border-radius: var(--r-full);
  border: 1px solid var(--gray-200);
}

.date-input-group input {
  border: none;
  padding: 0;
  font-size: 0.85rem;
  color: var(--text-main);
  font-family: inherit;
  width: 110px;
}

.date-input-group label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  margin-right: 0.3rem;
}

/* Message Preview - iOS Style */
.message-preview-container {
  background: #E5E5EA;
  /* iOS gray bubble bg */
  border-radius: 18px;
  padding: 12px 16px;
  color: black;
  font-size: 1rem;
  line-height: 1.4;
  position: relative;
  max-width: 300px;
  align-self: flex-start;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Tail for bubble */
.message-preview-container::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: -6px;
  width: 20px;
  height: 20px;
  background: #E5E5EA;
  border-bottom-right-radius: 16px;
  z-index: -1;
}

.message-preview-container::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: -10px;
  width: 10px;
  height: 20px;
  background: white;
  border-bottom-right-radius: 10px;
  z-index: 0;
}

.bulk-textarea {
  width: 100%;
  border: 1px solid var(--gray-200);
  border-radius: var(--r-lg);
  padding: 1rem;
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.2s;
  resize: none;
  background: var(--gray-50);
}

.bulk-textarea:focus {
  border-color: var(--primary);
  background: white;
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 47, 167, 0.1);
}

/* DATA TABLE - Ultra Clean */
.table-responsive {
  overflow-x: auto;
  margin-top: var(--space-md);
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 0.8rem;
}

.data-table th {
  text-align: left;
  padding: 0 1rem;
  color: var(--text-light);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.data-table td {
  padding: 1.25rem 1rem;
  background: white;
  border-top: 1px solid transparent;
  border-bottom: 1px solid transparent;
  position: relative;
}

.data-table tr td:first-child {
  border-top-left-radius: var(--r-lg);
  border-bottom-left-radius: var(--r-lg);
}

.data-table tr td:last-child {
  border-top-right-radius: var(--r-lg);
  border-bottom-right-radius: var(--r-lg);
}

.data-table tr {
  transition: transform 0.2s, box-shadow 0.2s;
}

.data-table tr:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
  z-index: 10;
  cursor: pointer;
}

.data-table tr:hover td {
  background: white;
}

/* Keep white on hover to pop */

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

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

/* Avatar Placeholders */
.avatar-small {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--grad-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
}

/* Contact List Items (JS Generated) */
.adn-item {
  background: white;
  border-radius: var(--r-xl);
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  border: 1px solid transparent;
  box-shadow: var(--glass-shadow);
  transition: all var(--duration-fast);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.adn-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(0, 47, 167, 0.1);
  border-color: rgba(0, 47, 167, 0.1);
}

.adn-item.status-new::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  bottom: 0;
  background: var(--primary);
}

.adn-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  justify-content: space-between;
}

.adn-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--grad-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(0, 47, 167, 0.2);
}

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

.adn-info h4 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.2rem;
}

.adn-badges {
  display: flex;
  gap: 0.5rem;
}

.adn-details {
  display: flex;
  gap: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--gray-100);
  color: var(--text-muted);
  font-size: 0.9rem;
  flex-wrap: wrap;
}

.adn-detail-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.adn-detail-row i {
  color: var(--primary);
  opacity: 0.7;
}

.adn-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

.btn-action {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  color: var(--text-muted);
  padding: 0.5rem 1rem;
  border-radius: var(--r-full);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--duration-fast);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-action:hover {
  background: white;
  color: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* Avatar Placeholders */
.contact-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.contact-item {
  background: white;
  padding: 1rem;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid transparent;
  transition: all var(--duration-fast);
  cursor: pointer;
}

.contact-item:hover {
  border-color: var(--primary);
  transform: translateX(4px);
  box-shadow: 0 4px 15px rgba(0, 47, 167, 0.1);
}

.contact-info strong {
  display: block;
  color: var(--text-main);
  font-size: 1rem;
}

.contact-info span {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.contact-actions {
  display: flex;
  gap: 0.5rem;
}

/* Buttons */
.btn-primary {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: var(--r-full);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--duration-fast);
}

.btn-primary:hover {
  background: var(--primary-light);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 47, 167, 0.3);
}

.btn-secondary {
  background: var(--gray-100);
  color: var(--text-main);
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: var(--r-full);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--duration-fast);
}

.btn-secondary:hover {
  background: var(--gray-200);
}

.btn-small {
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
}

.btn-icon-small {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--gray-200);
  background: white;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration-fast);
}

.btn-icon-small:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* Badges */
.badge-soft {
  padding: 0.3rem 0.8rem;
  background: var(--gray-100);
  border-radius: var(--r-full);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.status-badge {
  padding: 0.25rem 0.75rem;
  border-radius: var(--r-full);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.status-new {
  background: rgba(59, 130, 246, 0.1);
  color: #2563EB;
}

.status-pending {
  background: rgba(245, 158, 11, 0.1);
  color: #D97706;
}

.status-done {
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: white;
  border-radius: var(--r-xl);
  width: 90%;
  max-width: 600px;
  padding: var(--space-xl);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  transform: scale(0.95);
  transition: transform 0.3s;
}

.modal-overlay.active .modal {
  transform: scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-lg);
}

.modal-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-md);
  margin-top: var(--space-xl);
}

.detail-section-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-muted);
  margin: 1.5rem 0 1rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.timeline {
  list-style: none;
  padding-left: 0;
  margin: 0;
  position: relative;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 10px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--gray-100);
}

.timeline-item {
  padding-left: 30px;
  margin-bottom: 1.5rem;
  position: relative;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 5px;
  width: 12px;
  height: 12px;
  background: var(--primary);
  border-radius: 50%;
  box-shadow: 0 0 0 4px white;
  z-index: 1;
}

.timeline-date {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.timeline-content {
  background: var(--bg-body);
  padding: 0.8rem;
  border-radius: var(--r-md);
  font-size: 0.9rem;
}

/* Toasts */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: white;
  padding: 1rem;
  border-radius: var(--r-md);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  border-left: 4px solid var(--primary);
  min-width: 300px;
  animation: slideIn 0.3s ease;
  display: flex;
  align-items: center;
  gap: 10px;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }

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

.toast.success {
  border-left-color: var(--success);
}

.toast.error {
  border-left-color: var(--danger);
}

/* Skeletons */
.skeleton-text {
  height: 16px;
  background: var(--gray-100);
  border-radius: var(--r-sm);
  margin-bottom: 8px;
  width: 100%;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% {
    opacity: 0.6;
  }

  50% {
    opacity: 1;
  }

  100% {
    opacity: 0.6;
  }
}

/* Filter Dropdown */
.filter-dropdown {
  position: relative;
}

.filter-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 280px;
  background: white;
  border-radius: var(--r-lg);
  box-shadow: var(--glass-shadow);
  padding: var(--space-lg);
  z-index: 10;
  display: none;
  border: 1px solid var(--gray-100);
}

.filter-menu.active {
  display: block;
  animation: fadeInUp 0.2s ease-out;
}

.filter-group {
  margin-bottom: 1rem;
}

.filter-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-muted);
}

.filter-actions-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
  border-top: 1px solid var(--gray-100);
  padding-top: 1rem;
}

.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* ============================================
   FOOTER (Dashboard style)
   ============================================ */
.dashboard-footer {
  margin-top: auto;
  padding: var(--space-lg) var(--space-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  font-size: 0.95rem;
  color: var(--text-muted);
  background: white;
  border-top: 1px solid var(--gray-200);
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
  border-radius: 0 0 12px 12px;
}

.dashboard-footer p {
  margin: 0;
}

/* Responsive */
@media (max-width: 1024px) {
  .dashboard-content {
    padding: var(--space-md);
  }
}

@media (max-width: 768px) {
  .main-wrapper {
    margin-left: 0;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .table-responsive {
    border: 1px solid var(--gray-200);
    border-radius: var(--r-md);
  }
}

/* Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

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

.stats-grid>*,
.panel,
.contact-item {
  animation: fadeInUp 0.5s var(--ease-smooth) forwards;
}

.stats-grid>*:nth-child(2) {
  animation-delay: 0.1s;
}

.stats-grid>*:nth-child(3) {
  animation-delay: 0.2s;
}

.stats-grid>*:nth-child(4) {
  animation-delay: 0.3s;
}
