/* LeadsHMO - Design System & Premium CSS */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
  /* Color Palette (HSL tailorable) */
  --bg-deep: 222 47% 6%;
  --bg-card: 223 47% 11%;
  --bg-card-hover: 223 47% 15%;
  
  --primary: 250 89% 65%; /* Sleek Indigo */
  --primary-glow: 250 89% 65% / 0.15;
  --secondary: 187 92% 45%; /* Vibrant Cyan */
  --secondary-glow: 187 92% 45% / 0.15;
  
  --text-primary: 210 40% 98%;
  --text-secondary: 215 20% 65%;
  --text-muted: 215 15% 45%;
  
  --border-subtle: 217 30% 18%;
  --border-focus: 250 89% 65% / 0.4;
  
  /* Status Colors */
  --success: 142 70% 45%;
  --warning: 37 90% 50%;
  --danger: 350 80% 55%;
  --info: 199 89% 48%;
  
  /* Font Stacks */
  --font-display: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  
  /* Transitions */
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s ease;
}

/* Base resets & scrollbar styling */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  scrollbar-width: thin;
  scrollbar-color: hsl(var(--border-subtle)) transparent;
}

*::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background-color: hsl(var(--border-subtle));
  border-radius: 20px;
}

body {
  background-color: hsl(var(--bg-deep));
  color: hsl(var(--text-primary));
  font-family: var(--font-sans);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* Background Gradients (Atmospheric Glows) */
body::before {
  content: "";
  position: absolute;
  top: -10%;
  left: -10%;
  width: 50%;
  height: 60%;
  background: radial-gradient(circle, hsl(var(--primary) / 0.08) 0%, transparent 70%);
  z-index: -1;
  pointer-events: none;
}

body::after {
  content: "";
  position: absolute;
  bottom: -10%;
  right: -10%;
  width: 60%;
  height: 60%;
  background: radial-gradient(circle, hsl(var(--secondary) / 0.05) 0%, transparent 70%);
  z-index: -1;
  pointer-events: none;
}

/* Layout Structure */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar Navigation */
.sidebar {
  width: 280px;
  background-color: hsl(var(--bg-card));
  border-right: 1px solid hsl(var(--border-subtle));
  display: flex;
  flex-direction: column;
  padding: 2rem 1.5rem;
  flex-shrink: 0;
  z-index: 10;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 3rem;
}

.brand-logo {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, hsl(var(--primary)) 0%, hsl(var(--secondary)) 100%);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px hsl(var(--primary) / 0.25);
}

.brand-logo i {
  font-size: 1.25rem;
  color: white;
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.35rem;
  background: linear-gradient(to right, #fff, #a5b4fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.nav-item a {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1rem;
  color: hsl(var(--text-secondary));
  text-decoration: none;
  border-radius: 10px;
  font-weight: 500;
  font-size: 0.95rem;
  transition: var(--transition-smooth);
}

.nav-item a i {
  font-size: 1.15rem;
}

.nav-item.active a, .nav-item a:hover {
  background-color: hsl(var(--bg-card-hover));
  color: hsl(var(--text-primary));
}

.nav-item.active a {
  border-left: 3px solid hsl(var(--primary));
  background: linear-gradient(to right, hsl(var(--primary) / 0.1), transparent);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 2rem;
  border-top: 1px solid hsl(var(--border-subtle));
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid hsl(var(--border-subtle));
  background-color: hsl(var(--bg-card-hover));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: hsl(var(--secondary));
}

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

.user-name {
  font-weight: 600;
  font-size: 0.9rem;
}

.user-role {
  font-size: 0.75rem;
  color: hsl(var(--text-muted));
}

/* Main Content Area */
.main-content {
  flex-grow: 1;
  padding: 2.5rem;
  max-width: 1600px;
  margin: 0 auto;
  width: calc(100% - 280px);
}

/* Header Section */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2.5rem;
}

.header-title h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2.25rem;
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
}

.header-title p {
  color: hsl(var(--text-secondary));
  font-size: 0.95rem;
}

.header-actions {
  display: flex;
  gap: 1rem;
}

/* Glass Cards and Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.card {
  background-color: hsl(var(--bg-card));
  border: 1px solid hsl(var(--border-subtle));
  border-radius: 16px;
  padding: 1.5rem;
  transition: var(--transition-smooth);
}

.card:hover {
  transform: translateY(-4px);
  border-color: hsl(var(--primary) / 0.3);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.stat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stat-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: hsl(var(--text-secondary));
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.stat-icon.primary {
  background-color: hsl(var(--primary) / 0.1);
  color: hsl(var(--primary));
}

.stat-icon.secondary {
  background-color: hsl(var(--secondary) / 0.1);
  color: hsl(var(--secondary));
}

.stat-icon.success {
  background-color: hsl(var(--success) / 0.1);
  color: hsl(var(--success));
}

.stat-icon.warning {
  background-color: hsl(var(--warning) / 0.1);
  color: hsl(var(--warning));
}

.stat-value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.stat-trend {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 500;
}

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

.stat-trend.down {
  color: hsl(var(--danger));
}

/* Two-column layout */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.grid-col-full {
  grid-column: 1 / -1;
}

/* Table Section styling */
.table-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.table-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
}

.table-wrapper {
  overflow-x: auto;
  width: 100%;
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.custom-table th {
  padding: 1rem;
  border-bottom: 1px solid hsl(var(--border-subtle));
  color: hsl(var(--text-secondary));
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.custom-table td {
  padding: 1.15rem 1rem;
  border-bottom: 1px solid hsl(var(--border-subtle));
  font-size: 0.9rem;
}

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

.custom-table tr:hover td {
  background-color: hsl(var(--bg-card-hover) / 0.4);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.badge.success {
  background-color: hsl(var(--success) / 0.1);
  color: hsl(var(--success));
}
.badge.success::before { background-color: hsl(var(--success)); }

.badge.warning {
  background-color: hsl(var(--warning) / 0.1);
  color: hsl(var(--warning));
}
.badge.warning::before { background-color: hsl(var(--warning)); }

.badge.danger {
  background-color: hsl(var(--danger) / 0.1);
  color: hsl(var(--danger));
}
.badge.danger::before { background-color: hsl(var(--danger)); }

.badge.info {
  background-color: hsl(var(--info) / 0.1);
  color: hsl(var(--info));
}
.badge.info::before { background-color: hsl(var(--info)); }

/* Inputs and Forms */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: hsl(var(--text-secondary));
}

.input-styled, .select-styled {
  background-color: hsl(var(--bg-card-hover));
  border: 1px solid hsl(var(--border-subtle));
  border-radius: 10px;
  padding: 0.75rem 1rem;
  color: white;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  outline: none;
  width: 100%;
  transition: var(--transition-smooth);
}

.input-styled:focus, .select-styled:focus {
  border-color: hsl(var(--primary));
  box-shadow: 0 0 0 4px hsl(var(--primary) / 0.15);
}

/* Premium Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border-radius: 10px;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  outline: none;
  transition: var(--transition-smooth);
}

.btn-primary {
  background: linear-gradient(135deg, hsl(var(--primary)) 0%, hsl(var(--primary) / 0.8) 100%);
  color: white;
  box-shadow: 0 4px 16px hsl(var(--primary) / 0.25);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px hsl(var(--primary) / 0.4);
}

.btn-secondary {
  background-color: hsl(var(--border-subtle));
  color: hsl(var(--text-primary));
  border: 1px solid hsl(var(--border-subtle));
}

.btn-secondary:hover {
  background-color: hsl(var(--bg-card-hover));
}

.btn-icon {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 8px;
}

/* Interactive Tabs */
.view-panel {
  display: none;
}

.view-panel.active {
  display: block;
  animation: fadeIn 0.4s ease-out;
}

/* WhatsApp Mobile Preview Component */
.chat-preview-container {
  display: flex;
  flex-direction: column;
  height: 520px;
  background-color: #0d111c;
  border: 1px solid hsl(var(--border-subtle));
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
}

.chat-header {
  background-color: #171d2b;
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid hsl(var(--border-subtle));
}

.chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: white;
  font-size: 1.1rem;
}

.chat-name-container {
  display: flex;
  flex-direction: column;
}

.chat-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.chat-status {
  font-size: 0.75rem;
  color: #10b981;
}

.chat-messages {
  flex-grow: 1;
  padding: 1.25rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background-image: radial-gradient(#1e293b 1px, transparent 1px);
  background-size: 16px 16px;
}

.msg {
  max-width: 80%;
  padding: 0.75rem 1rem;
  border-radius: 14px;
  font-size: 0.88rem;
  line-height: 1.4;
  position: relative;
}

.msg.incoming {
  align-self: flex-start;
  background-color: #1f293d;
  color: white;
  border-top-left-radius: 2px;
}

.msg.outgoing {
  align-self: flex-end;
  background-color: #059669;
  color: white;
  border-top-right-radius: 2px;
}

.chat-footer {
  padding: 0.85rem;
  background-color: #171d2b;
  border-top: 1px solid hsl(var(--border-subtle));
  display: flex;
  gap: 0.75rem;
}

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

/* Search Bar Wrapper */
.search-wrapper {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.search-wrapper .input-styled {
  flex-grow: 1;
}

/* Scraping progress bar */
.progress-bar-container {
  width: 100%;
  height: 8px;
  background-color: hsl(var(--border-subtle));
  border-radius: 10px;
  overflow: hidden;
  margin: 1rem 0;
  display: none;
}

.progress-bar-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, hsl(var(--primary)) 0%, hsl(var(--secondary)) 100%);
  transition: width 0.1s ease;
}

/* Media Queries for responsiveness */
@media (max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid hsl(var(--border-subtle));
  }
  .main-content {
    width: 100%;
    padding: 1.5rem;
  }
}
