/* ==========================================================================
   WHATSAPP HERMES MARKETING DASHBOARD - STYLESHEET
   Design System: Modern Glassmorphism & Dark Mode Theme
   ========================================================================== */

:root {
  --bg-main: #0B0F19;
  --bg-sidebar: #111827;
  --bg-card: rgba(17, 24, 39, 0.75);
  --bg-card-hover: rgba(31, 41, 55, 0.85);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-color-highlight: rgba(16, 185, 129, 0.3);

  --text-main: #F9FAFB;
  --text-muted: #9CA3AF;
  --text-dim: #6B7280;

  --primary: #10B981; /* WhatsApp Emerald */
  --primary-hover: #059669;
  --primary-glow: rgba(16, 185, 129, 0.25);

  --urgent: #EF4444; /* Crimson Urgent */
  --urgent-glow: rgba(239, 68, 68, 0.3);
  --warning: #F59E0B; /* Amber */
  --blue: #3B82F6; /* Sapphire */
  --purple: #8B5CF6;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;

  --shadow-main: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(16, 185, 129, 0.15);

  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  overflow-x: hidden;
}

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

/* Sidebar */
.sidebar {
  width: 270px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px 24px 12px;
  border-bottom: 1px solid var(--border-color);
}

.logo-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #10B981, #047857);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #FFF;
  box-shadow: var(--shadow-glow);
}

.brand-text h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.brand-text span {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.nav-menu {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  width: 100%;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

.nav-item.active {
  background: var(--primary-glow);
  color: var(--primary);
  border-left: 3px solid var(--primary);
  font-weight: 600;
}

.nav-item i {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.badge {
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  margin-left: auto;
}

.badge-urgent {
  background: var(--urgent);
  color: #FFF;
  animation: pulse-urgent 1.8s infinite;
}

@keyframes pulse-urgent {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6); }
  70% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

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

.connection-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0, 0, 0, 0.2);
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.status-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #6B7280;
}

.status-indicator.online {
  background: var(--primary);
  box-shadow: 0 0 10px var(--primary);
}

.connection-info .title {
  display: block;
  font-size: 12px;
  font-weight: 600;
}

.connection-info .sub {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
}

/* Main Content Layout */
.main-content {
  margin-left: 270px;
  flex: 1;
  padding: 24px 32px;
  max-width: 1400px;
}

/* Top Bar */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
  gap: 20px;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  width: 420px;
  backdrop-filter: blur(10px);
}

.search-bar i {
  color: var(--text-muted);
}

.search-bar input {
  background: transparent;
  border: none;
  color: var(--text-main);
  outline: none;
  width: 100%;
  font-family: var(--font-sans);
  font-size: 14px;
}

.topbar-actions {
  display: flex;
  gap: 12px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: #FFF;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-urgent {
  background: var(--urgent);
  color: #FFF;
  box-shadow: 0 4px 12px var(--urgent-glow);
}

.btn-urgent:hover {
  background: #DC2626;
}

.btn-xs {
  padding: 6px 12px;
  font-size: 12px;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  backdrop-filter: blur(12px);
  transition: transform 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
}

.stat-card.border-primary { border-top: 3px solid var(--primary); }
.stat-card.border-urgent { border-top: 3px solid var(--urgent); }
.stat-card.border-warning { border-top: 3px solid var(--warning); }
.stat-card.border-success { border-top: 3px solid #10B981; }

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

.stat-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

.stat-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.bg-primary { background: var(--primary-glow); color: var(--primary); }
.bg-urgent { background: var(--urgent-glow); color: var(--urgent); }
.bg-warning { background: rgba(245, 158, 11, 0.2); color: var(--warning); }
.bg-success { background: rgba(16, 185, 129, 0.2); color: #10B981; }

.stat-value {
  font-size: 32px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 8px;
}

.stat-sub {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.text-urgent { color: var(--urgent); }
.text-success { color: var(--primary); }

/* Dashboard Cards Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 28px;
}

.dash-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(12px);
  overflow: hidden;
}

.dash-card.full-width {
  grid-column: span 2;
}

.dash-card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dash-card-header h3 {
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dash-card-body {
  padding: 20px 24px;
}

.dash-card-body.p-0 {
  padding: 0;
}

/* Urgent Queue Items */
.urgent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  transition: all 0.2s ease;
}

.urgent-item:hover {
  background: rgba(239, 68, 68, 0.15);
}

.urgent-info h4 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
}

.urgent-info p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.urgent-info .time {
  font-size: 11px;
  color: var(--urgent);
  font-weight: 600;
  margin-top: 4px;
}

/* Funnel & Target */
.funnel-progress-bars {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 24px;
}

.funnel-bar-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.funnel-label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}

.progress-track {
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  transition: width 0.4s ease;
}

.daily-target-widget {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  padding: 16px;
  border-radius: var(--radius-md);
}

.target-header {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 10px;
}

/* Activity Log */
.activity-log-list {
  list-style: none;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border-color);
}

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

.activity-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;

}

.activity-content {
  flex: 1;
}

.activity-content p {
  font-size: 14px;
}

.activity-content .time {
  font-size: 11px;
  color: var(--text-dim);
}

/* Tab Views */
.tab-view {
  display: none;
}

.tab-view.active {
  display: block;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 24px;
}

.section-header h2 {
  font-size: 22px;
  font-weight: 700;
}

.section-header p {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 4px;
}

/* Filter Pills */
.filter-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pill {
  padding: 6px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pill:hover, .pill.active {
  background: var(--primary-glow);
  color: var(--primary);
  border-color: var(--primary);
}

/* Leads Table */
.table-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  backdrop-filter: blur(12px);
}

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

.leads-table th {
  background: rgba(0, 0, 0, 0.3);
  padding: 16px 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
}

.leads-table td {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  font-size: 14px;
}

.leads-table tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.lead-facility-name {
  font-weight: 600;
  display: block;
}

.lead-contact-name {
  font-size: 12px;
  color: var(--text-muted);
}

.stage-select {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 13px;
}

/* Urgent Grid Cards */
.leads-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.urgent-card {
  background: rgba(239, 68, 68, 0.05);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-lg);
  padding: 20px;
  backdrop-filter: blur(10px);
}

.urgent-card-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
}

.urgent-card-title {
  font-size: 16px;
  font-weight: 700;
}

.urgent-card-msg {
  background: rgba(0, 0, 0, 0.3);
  padding: 12px;
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--text-main);
  margin-bottom: 16px;
  border-left: 3px solid var(--urgent);
}

/* Templates Grid */
.templates-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.template-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.template-header {
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 10px;
}

.template-body {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.3);
  padding: 12px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  white-space: pre-wrap;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 540px;
  max-width: 90%;
  padding: 28px;
  box-shadow: var(--shadow-main);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

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

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

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

.form-group.full-width {
  grid-column: span 2;
}

.form-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

.form-group input, .form-group select, .form-group textarea {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 14px;
  outline: none;
}

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

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}

.code-block {
  background: #000;
  padding: 16px;
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 13px;
  color: #10B981;
  overflow-x: auto;
}

.input-copy-group {
  display: flex;
  gap: 8px;
}

.input-copy-group input {
  flex: 1;
}

.mt-20 {
  margin-top: 20px;
}

/* Pulsating Glow for Urgent Cards */
.pulsating-glow {
  box-shadow: 0 0 15px var(--urgent-glow);
}
