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

:root {
  --pink: #E91E63;
  --pink-dark: #C2185B;
  --pink-light: #FCE4EC;
  --dark: #1A1A2E;
  --dark-2: #16213E;
  --dark-3: #0F3460;
  --white: #FFFFFF;
  --gray-50: #F8F9FA;
  --gray-100: #F1F3F5;
  --gray-200: #E9ECEF;
  --gray-300: #DEE2E6;
  --gray-400: #CED4DA;
  --gray-500: #ADB5BD;
  --gray-600: #6C757D;
  --gray-700: #495057;
  --gray-800: #343A40;
  --gray-900: #212529;
  --success: #28A745;
  --warning: #FFC107;
  --danger: #DC3545;
  --info: #17A2B8;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow: 0 4px 16px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.15);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --transition: all 0.2s ease;
}

body {
  font-family: 'Poppins', sans-serif;
  background: var(--gray-50);
  color: var(--gray-900);
  min-height: 100vh;
}

/* ===== TOP BAR ===== */
.top-bar {
  height: 4px;
  background: linear-gradient(90deg, var(--pink), #9C27B0, var(--pink));
  background-size: 200% 100%;
  animation: shimmer 3s ease-in-out infinite;
  position: sticky; top: 0; z-index: 100;
}
@keyframes shimmer {
  0%, 100% { background-position: 0% 0%; }
  50% { background-position: 100% 0%; }
}

/* ===== BRAND ===== */
.brand-env { font-size: inherit; font-weight: 800; color: var(--white); }
.brand-ox  { font-size: inherit; font-weight: 800; color: var(--pink); }
.brand-tagline { font-size: 0.6rem; letter-spacing: 3px; color: var(--gray-400); font-weight: 500; text-transform: uppercase; }

/* ===== LOGIN PAGE ===== */
.login-page { 
  background: var(--dark); 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  min-height: 100vh;
}
.login-container { width: 100%; max-width: 440px; padding: 1.5rem; }
.login-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  box-shadow: var(--shadow-lg);
}
.login-logo {
  text-align: center;
  margin-bottom: 1.5rem;
  font-size: 2.2rem;
}
.login-logo .brand-env { color: var(--dark); }
.login-logo .brand-tagline { color: var(--gray-500); margin-top: 0.2rem; font-size: 0.65rem; }
.login-title { font-size: 1.4rem; font-weight: 700; text-align: center; color: var(--gray-900); }
.login-subtitle { text-align: center; color: var(--gray-500); font-size: 0.85rem; margin: 0.4rem 0 1.5rem; }
.login-footer { text-align: center; margin-top: 1.5rem; color: var(--gray-400); font-size: 0.75rem; }
.login-form { display: flex; flex-direction: column; gap: 1rem; }

/* ===== FORMS ===== */
.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-group label { font-size: 0.85rem; font-weight: 600; color: var(--gray-700); }
.form-group input, .form-group select, .form-group textarea {
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  font-family: 'Poppins', sans-serif;
  font-size: 0.9rem;
  color: var(--gray-900);
  transition: var(--transition);
  outline: none;
  width: 100%;
}
.form-group input:focus {
  border-color: var(--pink);
  box-shadow: 0 0 0 3px rgba(233,30,99,0.12);
}
.form-hint { font-size: 0.75rem; color: var(--gray-500); }

/* ===== BUTTONS ===== */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  background: var(--pink);
  color: var(--white);
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.75rem 1.5rem;
  font-family: 'Poppins', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
  white-space: nowrap;
}
.btn-primary:hover { background: var(--pink-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(233,30,99,0.3); }
.btn-full { width: 100%; }

.btn-outline {
  display: inline-flex; align-items: center; gap: 0.5rem;
  background: transparent;
  color: var(--gray-700);
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm);
  padding: 0.65rem 1.2rem;
  font-family: 'Poppins', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
}
.btn-outline:hover { border-color: var(--pink); color: var(--pink); }

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  border-radius: 6px;
}
.btn-whatsapp {
  display: inline-flex; align-items: center; gap: 0.5rem;
  background: #25D366;
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.65rem 1.2rem;
  font-family: 'Poppins', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
}
.btn-whatsapp:hover { background: #128C7E; }
.btn-copy-link { cursor: pointer; }

/* ===== ALERTS ===== */
.alert {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}
.alert-success { background: #D4EDDA; color: #155724; border: 1px solid #C3E6CB; }
.alert-error   { background: #F8D7DA; color: #721C24; border: 1px solid #F5C6CB; }
.alert-warning { background: #FFF3CD; color: #856404; border: 1px solid #FFEEBA; }

/* ===== ADMIN LAYOUT ===== */
.admin-layout {
  display: flex;
  min-height: calc(100vh - 4px);
}

.sidebar {
  width: 240px;
  background: var(--dark);
  min-height: calc(100vh - 4px);
  display: flex;
  flex-direction: column;
  padding: 0;
  position: sticky;
  top: 4px;
  height: calc(100vh - 4px);
  overflow-y: auto;
}
.sidebar-logo {
  padding: 1.5rem;
  font-size: 1.8rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-nav {
  flex: 1;
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  color: var(--gray-400);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: var(--transition);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: var(--white); }
.nav-item.active { background: var(--pink); color: var(--white); }
.nav-item.logout { color: var(--gray-500); }
.nav-item.logout:hover { color: #ff6b6b; background: rgba(255,107,107,0.1); }
.nav-item.nav-item-sub { padding-left: 1.75rem; font-size: 0.82rem; }
.nav-group-label { font-size: 0.62rem; font-weight: 800; letter-spacing: 0.08em; color: rgba(255,255,255,0.25); text-transform: uppercase; padding: 0.85rem 1rem 0.3rem; }
.sidebar-footer { padding: 1rem 0.75rem; border-top: 1px solid rgba(255,255,255,0.08); }

.main-content {
  flex: 1;
  padding: 2rem;
  min-width: 0;
}

/* ===== PAGE HEADER ===== */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.page-header h1 { font-size: 1.6rem; font-weight: 700; color: var(--gray-900); }
.page-subtitle { color: var(--gray-500); font-size: 0.85rem; margin-top: 0.2rem; }
.header-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: center; }

/* ===== STATS GRID ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
}
.stat-icon { font-size: 2rem; margin-bottom: 0.5rem; }
.stat-value { font-size: 2rem; font-weight: 800; color: var(--dark); }
.stat-label { font-size: 0.8rem; color: var(--gray-500); font-weight: 500; margin-top: 0.2rem; }

/* ===== TABLE CARD ===== */
.table-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  overflow: hidden;
}
.table-header {
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--gray-200);
}
.table-header h2 { font-size: 1rem; font-weight: 700; }
.table-count { font-size: 0.8rem; color: var(--gray-500); background: var(--gray-100); padding: 0.25rem 0.75rem; border-radius: 20px; }
.table-wrapper { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.data-table th {
  background: var(--gray-50);
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  color: var(--gray-600);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}
.data-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--gray-50); }
.td-name strong { color: var(--gray-900); font-weight: 600; }
.td-email { font-size: 0.8rem; color: var(--gray-600); }
.td-center { text-align: center; }

/* ===== BADGES ===== */
.badge {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-success { background: #D4EDDA; color: #155724; }
.badge-warning { background: #FFF3CD; color: #856404; }
.badge-danger  { background: #F8D7DA; color: #721C24; }
.badge-info    { background: #D1ECF1; color: #0C5460; }
.badge-secondary { background: var(--gray-100); color: var(--gray-600); }

.interest-badge {
  display: inline-flex; align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--gray-500);
}
.empty-icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-state p { margin-bottom: 1rem; }

/* ===== FORM CARD ===== */
.form-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  margin-bottom: 1.5rem;
}
.form-row { margin-bottom: 1.25rem; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.form-actions { display: flex; gap: 1rem; justify-content: flex-end; margin-top: 1.5rem; }

.info-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.5rem 2rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  border-left: 4px solid var(--pink);
}
.info-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: 1rem; color: var(--dark); }
.info-card ol { padding-left: 1.5rem; color: var(--gray-600); font-size: 0.875rem; }
.info-card ol li { margin-bottom: 0.5rem; line-height: 1.6; }

/* ===== LEAD DETAIL ===== */
.detail-top-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 260px;
  gap: 1rem;
  margin-bottom: 1rem;
}
.detail-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
}
.full-width-card { grid-column: 1 / -1; margin-bottom: 1rem; }
.card-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--gray-100);
}

.info-list { display: flex; flex-direction: column; gap: 0.75rem; }
.info-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.info-label { font-size: 0.8rem; color: var(--gray-500); font-weight: 500; white-space: nowrap; }
.info-value { font-size: 0.875rem; color: var(--gray-800); font-weight: 500; text-align: right; }
.wa-link { color: #25D366; text-decoration: none; }
.wa-link:hover { text-decoration: underline; }

.metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.metric-item { text-align: center; padding: 0.75rem; background: var(--gray-50); border-radius: var(--radius-sm); }
.metric-value { font-size: 1.5rem; font-weight: 800; color: var(--dark); }
.metric-label { font-size: 0.72rem; color: var(--gray-500); margin-top: 0.2rem; }

/* Interest Card */
.interest-display { display: flex; align-items: baseline; justify-content: center; gap: 0.3rem; margin-bottom: 1rem; }
.interest-number { font-size: 3.5rem; font-weight: 900; line-height: 1; }
.interest-label-big { font-size: 1.5rem; color: var(--gray-400); font-weight: 300; }
.interest-number.interest-success { color: var(--success); }
.interest-number.interest-info    { color: var(--info); }
.interest-number.interest-warning { color: #e67e00; }
.interest-number.interest-danger  { color: var(--danger); }
.interest-number.interest-secondary { color: var(--gray-400); }
.interest-bar-wrap { margin-bottom: 0.75rem; }
.interest-bar { height: 8px; background: var(--gray-200); border-radius: 4px; overflow: hidden; }
.interest-fill { height: 100%; background: linear-gradient(90deg, var(--pink), #9C27B0); border-radius: 4px; transition: width 0.8s ease; }
.interest-tag { display: inline-flex; padding: 0.25rem 1rem; border-radius: 20px; font-size: 0.8rem; font-weight: 600; margin-bottom: 0.75rem; }
.interest-hint small { font-size: 0.72rem; color: var(--gray-400); line-height: 1.5; display: block; text-align: center; }

/* Chart */
.chart-wrap { padding: 1rem 0; max-height: 260px; }

/* Heatmap */
.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(11, 1fr);
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.heatmap-cell {
  text-align: center;
  padding: 0.75rem 0.3rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.heatmap-cell:hover { transform: translateY(-2px); }
.heat-none   { background: var(--gray-100); color: var(--gray-400); }
.heat-low    { background: #C8E6C9; color: #1B5E20; }
.heat-medium { background: #FFF9C4; color: #F57F17; }
.heat-high   { background: #FCE4EC; color: #880E4F; }
.heat-number { font-size: 1.1rem; font-weight: 800; }
.heat-name   { font-size: 0.6rem; font-weight: 500; margin: 0.2rem 0; line-height: 1.2; }
.heat-time   { font-size: 0.75rem; font-weight: 700; }
.heat-views  { font-size: 0.65rem; }
.heatmap-legend {
  display: flex; gap: 1rem; flex-wrap: wrap;
  font-size: 0.78rem; color: var(--gray-600);
}

/* Event Log */
.event-log { display: flex; flex-direction: column; gap: 0; max-height: 400px; overflow-y: auto; }
.event-item {
  display: flex; align-items: flex-start; gap: 1rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--gray-100);
  font-size: 0.82rem;
}
.event-item:last-child { border-bottom: none; }
.event-time { color: var(--gray-400); font-size: 0.72rem; white-space: nowrap; min-width: 120px; }
.event-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gray-300); margin-top: 4px; flex-shrink: 0; }
.event-proposal_opened .event-dot  { background: var(--success); }
.event-proposal_closed .event-dot  { background: var(--danger); }
.event-slide_viewed .event-dot     { background: var(--info); }
.event-slide_revisited .event-dot  { background: var(--warning); }
.event-text { color: var(--gray-700); flex: 1; }
.event-text small { color: var(--gray-400); margin-left: 0.3rem; }

/* Toast */
.toast {
  position: fixed; bottom: 2rem; right: 2rem;
  background: var(--dark); color: var(--white);
  padding: 0.75rem 1.5rem; border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem; font-weight: 500;
  z-index: 9999;
  transition: opacity 0.3s ease;
}
.toast.hidden { opacity: 0; pointer-events: none; }

/* Utils */
.text-muted { color: var(--gray-400); }
.text-pink  { color: var(--pink); }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .detail-top-grid { grid-template-columns: 1fr; }
  .heatmap-grid { grid-template-columns: repeat(6, 1fr); }
  .form-row-2 { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .admin-layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; min-height: unset; position: relative; top: 0; }
  .main-content { padding: 1rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .heatmap-grid { grid-template-columns: repeat(4, 1fr); }
}
