/* 
============================================================================
SHALUB CRM — PREMIUM DESIGN SYSTEM v5.0
============================================================================
Core design tokens for a high-end, editorial aesthetic.
Themes: Deep Graphite, Metallic Gold, Glassmorphism.
*/

:root {
  /* Colors */
  --shalub-gold: #c9a646;
  --shalub-gold-light: #e6cf8b;
  --shalub-gold-dark: #a8862d;
  --shalub-graphite: #0f1115;
  --shalub-graphite-soft: #171a20;
  --shalub-graphite-deep: #07080a;
  --shalub-border: rgba(201, 166, 70, 0.12);
  --shalub-border-bright: rgba(201, 166, 70, 0.25);
  
  /* Gradientes */
  --grad-gold: linear-gradient(135deg, #c9a646 0%, #a8862d 100%);
  --grad-gold-text: linear-gradient(135deg, #f5deb3 0%, #c9a646 48%, #8f6b1d 100%);
  --grad-dark: linear-gradient(180deg, #171a20 0%, #0f1115 100%);
}

/* Base Styles */
body {
  font-family: 'Inter', sans-serif;
  background-color: var(--shalub-graphite-deep);
  background-image: 
    radial-gradient(circle at top left, rgba(201, 166, 70, 0.08), transparent 40%),
    radial-gradient(circle at bottom right, rgba(255, 255, 255, 0.03), transparent 30%);
  color: #f8fafc;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
}

/* Custom Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--shalub-graphite-deep); }
::-webkit-scrollbar-thumb { background: var(--shalub-gold-dark); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--shalub-gold); }

/* Premium Cards (Glassmorphism) */
.premium-card {
  background: linear-gradient(180deg, rgba(23, 26, 32, 0.8), rgba(12, 14, 19, 0.9));
  border: 1px solid var(--shalub-border);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Skeleton Loading States */
.skeleton {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.03) 25%, rgba(255, 255, 255, 0.08) 50%, rgba(255, 255, 255, 0.03) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite linear;
  border-radius: 8px;
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-text { height: 10px; width: 100%; }
.skeleton-title { height: 18px; width: 60%; }
.skeleton-row { height: 45px; width: 100%; margin-bottom: 4px; }

.premium-card:hover { border-color: var(--shalub-border-bright); box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5); }

/* Buttons */
.btn-gold {
  background: var(--grad-gold);
  color: #07080a;
  font-weight: 600;
  transition: all 0.2s ease;
  box-shadow: 0 4px 15px rgba(201, 166, 70, 0.2);
}

.btn-gold:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(201, 166, 70, 0.35); opacity: 0.95; }
.btn-gold:active { transform: translateY(0); scale: 0.98; }

/* Text Gradients */
.gradient-text {
  background: var(--grad-gold-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 800;
}

/* Inputs */
input.premium-input, select.premium-input, textarea.premium-input {
  background: rgba(255, 255, 255, 0.03) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  color: #fff !important;
  transition: all 0.2s ease;
}

input.premium-input:focus {
  border-color: var(--shalub-gold) !important;
  background: rgba(255, 255, 255, 0.05) !important;
  box-shadow: 0 0 0 3px rgba(201, 166, 70, 0.1);
  outline: none;
}

/* Sidebar & Navigation */
.sidebar-premium {
  background: rgba(7, 8, 10, 0.8) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-right: 1px solid var(--shalub-border);
}

.nav-link-premium {
  color: rgba(255, 255, 255, 0.6);
  transition: all 0.2s ease;
  position: relative;
}

.nav-link-premium:hover, .nav-link-premium.active {
  color: var(--shalub-gold-light);
  background: rgba(201, 166, 70, 0.05);
}

.nav-link-premium.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20%;
  height: 60%;
  width: 3px;
  background: var(--shalub-gold);
  box-shadow: 0 0 10px var(--shalub-gold);
}

/* Tables */
.premium-table thead { background: rgba(255, 255, 255, 0.02); }
.premium-table th { color: var(--shalub-gold-light); font-weight: 500; text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.7rem; }
.premium-table td { border-bottom: 1px solid rgba(255, 255, 255, 0.03); }
.premium-table tr:hover td { background: rgba(255, 255, 255, 0.01); }

/* Animation Classes */
.fade-in { animation: fadeIn 0.4s ease-out forwards; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Kanban Columns */
.kanban-col { background: rgba(255, 255, 255, 0.02); border: 1px dashed rgba(255, 255, 255, 0.05); }
.kanban-col.drag-over { border-color: var(--shalub-gold); background: rgba(201, 166, 70, 0.03); }

/* Premium Badges */
.premium-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.badge-google { background: rgba(66, 133, 244, 0.15); color: #8ab4f8; border-color: rgba(66, 133, 244, 0.3); }
.badge-meta { background: rgba(0, 129, 251, 0.15); color: #70b5ff; border-color: rgba(0, 129, 251, 0.3); }
.badge-whatsapp { background: rgba(37, 211, 102, 0.15); color: #6fed94; border-color: rgba(37, 211, 102, 0.3); }
.badge-gold { background: rgba(201, 166, 70, 0.15); color: var(--shalub-gold-light); border-color: var(--shalub-border-bright); }

/* Interactive Hover Effects */
.hover-lift { transition: transform 0.2s ease, box-shadow 0.2s ease; }
.hover-lift:hover { transform: translateY(-2px); box-shadow: 0 10px 25px rgba(0,0,0,0.3); }

/* High Visibility Typography */
.text-premium { color: rgba(255,255,255,0.9); font-weight: 500; }
.text-muted-premium { color: rgba(255,255,255,0.5); font-size: 0.75rem; }

/* Global Font Refinement */
* { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

/* FIX: Visibilidade de textos e fundos */
thead, .premium-table thead {
  background: rgba(0, 0, 0, 0.4) !important;
}

th {
  color: var(--shalub-gold-light) !important;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* Dropdowns e Selects (Impedir texto branco no fundo branco) */
select, .premium-input option, select option {
  background-color: var(--shalub-graphite-soft) !important;
  color: #fff !important;
}

/* WhatsApp Chat Header Fix */
#chat-header, .whatsapp-header {
  background: var(--shalub-graphite-deep) !important;
  border-bottom: 1px solid var(--shalub-border-bright) !important;
  color: #fff !important;
}

/* Chat Background Fallback (Resolves 404 for chat-bg-dark.png) */
.wa-chat-bg, #support-chat-messages {
  background-image: 
    radial-gradient(circle at 20% 30%, rgba(201, 166, 70, 0.05) 0%, transparent 10%),
    radial-gradient(circle at 80% 70%, rgba(201, 166, 70, 0.05) 0%, transparent 10%),
    linear-gradient(rgba(11, 18, 35, 0.97), rgba(11, 18, 35, 0.97)) !important;
  background-size: 100px 100px, 120px 120px, 100% 100% !important;
  background-repeat: repeat, repeat, no-repeat !important;
}

/* Correção de Dropdowns de Automação e Filtros */
.dropdown-menu, .select2-dropdown, .bg-white.dark\:bg-slate-900 {
  background-color: var(--shalub-graphite-soft) !important;
  border: 1px solid var(--shalub-border-bright) !important;
  color: #fff !important;
}

/* Forçar visibilidade em listas */
.text-slate-500, .dark .text-slate-400 {
  color: #a0aec0 !important; /* Um cinza mais claro para contraste */
}

/* WhatsApp Inbox Specific Fixes */
#wa-inbox-chat-list .bg-slate-50, 
#wa-inbox-chat-list .dark\:bg-white\/5 {
  background: var(--shalub-graphite-soft) !important;
}

#wa-inbox-conv-header {
  background: var(--shalub-graphite-deep) !important;
  border-bottom: 1px solid var(--shalub-border-bright) !important;
}

#wa-inbox-conv-header p {
  color: #fff !important;
}

#wa-inbox-conv-header span {
  color: var(--shalub-gold-light) !important;
}

/* Fix for any container using bg-slate-50 that should be dark */
.dark .bg-slate-50, .dark .bg-white {
  background-color: var(--shalub-graphite-soft) !important;
  color: #fff !important;
}

/* Fix table headers in all lists */
table thead th {
  background-color: rgba(0,0,0,0.5) !important;
  color: var(--shalub-gold-light) !important;
  border-bottom: 1px solid var(--shalub-border) !important;
}

/* Ensure text in inputs is visible */
input, textarea, select {
  color-scheme: dark;
}
/* Timeline & Activity Styles */
.timeline-container {
  position: relative;
  padding-left: 24px;
}

.timeline-container::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--shalub-border);
}

.timeline-item {
  position: relative;
  padding-bottom: 24px;
}

.timeline-marker {
  position: absolute;
  left: -24px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--shalub-graphite-deep);
  border: 2px solid var(--shalub-gold);
  z-index: 1;
}

.timeline-content {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--shalub-border);
  border-radius: 12px;
  padding: 12px;
  transition: all 0.2s ease;
}

.timeline-content:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--shalub-gold-dark);
}

/* Toast & Notifications System */
.glass-premium {
  background: rgba(15, 17, 21, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(201, 166, 70, 0.2);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(100%) scale(0.9); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes slideOut {
  from { opacity: 1; transform: translateX(0) scale(1); }
  to { opacity: 0; transform: translateX(100%) scale(0.9); }
}

.animate-slide-in {
  animation: slideIn 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.animate-slide-out {
  animation: slideOut 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

/* Glass UI Utility */
.glass {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Status Pulse Animation */
.lead-status-pulse {
  width: 8px;
  height: 8px;
  background-color: var(--shalub-gold);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(201, 166, 70, 0.7);
  animation: pulse-gold 2s infinite;
}

@keyframes pulse-gold {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(201, 166, 70, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(201, 166, 70, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(201, 166, 70, 0); }
}

.interaction-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  background: var(--shalub-graphite-soft);
  border: 1px solid var(--shalub-border);
  color: var(--shalub-gold-light);
}

.interaction-btn:hover {
  background: var(--shalub-gold);
  color: #000;
  transform: translateY(-2px);
}
/* Command Palette (Ctrl+K) */
.command-palette-overlay {
  background: rgba(7, 8, 10, 0.7);
  backdrop-filter: blur(8px);
}

.command-palette-box {
  background: rgba(15, 17, 21, 0.95);
  border: 1px solid var(--shalub-border-bright);
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.8), 0 0 20px rgba(201, 166, 70, 0.1);
  border-radius: 20px;
}

.command-item {
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
}

.command-item.active, .command-item:hover {
  background: rgba(201, 166, 70, 0.1);
  border-left-color: var(--shalub-gold);
  transform: translateX(4px);
}

/* Modal 360° & Tabs */
.modal-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding: 0 24px;
}

.modal-tab-btn {
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.5);
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
}

.modal-tab-btn:hover {
  color: var(--shalub-gold-light);
}

.modal-tab-btn.active {
  color: var(--shalub-gold);
  border-bottom-color: var(--shalub-gold);
}

/* Temperature Filters */
.filter-temp-btn {
  @apply flex items-center gap-2 px-3 py-1.5 rounded-full text-[11px] font-bold uppercase transition-all border;
}

.filter-temp-btn.active {
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  transform: translateY(-1px);
}
/* Floating Bulk Bar */
#bulk-toolbar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(15, 17, 21, 0.9);
  backdrop-filter: blur(12px);
  border: 1px solid var(--shalub-gold);
  border-radius: 100px;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  z-index: 1000;
  box-shadow: 0 20px 40px rgba(0,0,0,0.5), 0 0 20px rgba(201, 166, 70, 0.2);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#bulk-toolbar.active {
  transform: translateX(-50%) translateY(0);
}

.bulk-count {
  background: var(--shalub-gold);
  color: #000;
  font-weight: 900;
  padding: 2px 10px;
  border-radius: 50px;
  font-size: 12px;
}

.bulk-action-btn {
  @apply flex items-center gap-2 px-4 py-2 rounded-full text-xs font-bold uppercase transition-all hover:bg-white/10 text-white/80 hover:text-white;
}

/* Funnel Chart */
.funnel-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 20px 0;
}

.funnel-step {
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 800;
  font-size: 11px;
  position: relative;
  transition: all 0.3s ease;
  clip-path: polygon(0 0, 100% 0, 95% 100%, 5% 100%);
}

.funnel-step:hover {
  filter: brightness(1.2);
  transform: scaleX(1.02);
}
/* Responsive Fixes */
@media (max-width: 768px) {
  .bulk-toolbar {
    width: 90% !important;
    gap: 10px !important;
    padding: 10px !important;
  }
  
  .bulk-action-btn span {
    display: none;
  }
  
  .premium-card {
    padding: 1rem !important;
  }
  
  .modal-box {
    width: 95% !important;
    margin: 10px !important;
  }

  /* WhatsApp Web Mobile Fixes */
  #whatsapp-inbox-container {
    height: calc(100dvh - 120px) !important;
    margin: -1.5rem !important;
    border-radius: 0 !important;
    border: none !important;
  }
  
  .bubble {
    max-width: 90% !important;
  }
}

/* Sidebar Collapsed State Fixes */
.collapsed-sidebar .sidebar-text {
  display: none !important;
}

.collapsed-sidebar {
  width: 80px !important;
}

/* ============================================================================
   PREMIUM MODAL SYSTEM (Alert Replacement)
   ============================================================================ */
.shalub-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(7, 8, 10, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.shalub-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.shalub-modal-box {
  background: linear-gradient(135deg, rgba(23, 26, 32, 0.95) 0%, rgba(15, 17, 21, 0.98) 100%);
  border: 1px solid var(--shalub-border-bright);
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.8), 0 0 30px rgba(201, 166, 70, 0.1);
  border-radius: 24px;
  width: 90%;
  max-width: 500px;
  padding: 40px;
  transform: scale(0.9) translateY(20px);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  text-align: center;
}

.shalub-modal-overlay.active .shalub-modal-box {
  transform: scale(1) translateY(0);
}

.shalub-modal-title {
  color: var(--shalub-gold);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.shalub-modal-content {
  color: rgba(255, 255, 255, 0.85);
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 30px;
  max-height: 60vh;
  overflow-y: auto;
  text-align: left;
}

.shalub-modal-btn {
  background: var(--grad-gold);
  color: #07080a;
  border: none;
  padding: 14px 40px;
  border-radius: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 10px 25px rgba(201, 166, 70, 0.3);
}

.shalub-modal-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 35px rgba(201, 166, 70, 0.45);
  filter: brightness(1.1);
}

.shalub-modal-btn:active {
  transform: translateY(0);
  scale: 0.96;
}

/* Personalização para Resumo de IA */
.shalub-modal-content strong {
  color: var(--shalub-gold-light);
}

.shalub-modal-content ul {
  list-style: none;
  padding: 0;
}

.shalub-modal-content li {
  margin-bottom: 12px;
  padding-left: 20px;
  position: relative;
}

.shalub-modal-content li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--shalub-gold);
}
