/**
 * Theme Config - Call Blaster AI
 * 
 * Variables CSS corporativas y estilos personalizados
 * Tema unificado para todos los módulos
 * 
 * @version 1.0.0
 */

:root {
  /* ========================================
     COLORES PRIMARIOS
     ======================================== */
  --cb-orange-primary: #F97316;
  --cb-orange-hover: #EA580C;
  --cb-orange-light: #FB923C;
  --cb-orange-dark: #C2410C;
  
  /* ========================================
     COLORES DE ESTADO
     ======================================== */
  --cb-success: #10B981;
  --cb-success-dark: #059669;
  --cb-info: #3B82F6;
  --cb-warning: #F59E0B;
  --cb-error: #EF4444;
  
  /* ========================================
     COLORES DE PIPELINE/FLUJOS
     ======================================== */
  --cb-pipeline-new: #3B82F6;        /* Azul - Contactos nuevos */
  --cb-pipeline-active: #8B5CF6;     /* Morado - En proceso */
  --cb-pipeline-qualified: #10B981;  /* Verde - Calificados */
  --cb-pipeline-discarded: #6B7280;  /* Gris - Descartados */
  
  /* ========================================
     FONDOS Y SUPERFICIES
     ======================================== */
  --cb-bg-primary: #111827;
  --cb-bg-secondary: #1F2937;
  --cb-bg-tertiary: #374151;
  --cb-bg-hover: #2D3748;
  
  /* ========================================
     TEXTOS
     ======================================== */
  --cb-text-primary: #F9FAFB;
  --cb-text-secondary: #D1D5DB;
  --cb-text-muted: #9CA3AF;
  --cb-text-disabled: #6B7280;
  
  /* ========================================
     BORDES Y DIVISORES
     ======================================== */
  --cb-border-default: #374151;
  --cb-border-hover: #4B5563;
  --cb-border-focus: #F97316;
  
  /* ========================================
     SOMBRAS
     ======================================== */
  --cb-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --cb-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --cb-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --cb-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  
  /* ========================================
     TRANSICIONES
     ======================================== */
  --cb-transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --cb-transition-base: 300ms cubic-bezier(0.4, 0, 0.2, 1);
  --cb-transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========================================
   FUENTE GLOBAL
   ======================================== */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ========================================
   HEADINGS
   ======================================== */
h1 {
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 1.2;
}

h2 {
  font-size: 1.875rem;
  font-weight: 600;
  line-height: 1.3;
}

h3 {
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.3;
}

h4 {
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 1.4;
}

h5 {
  font-size: 1.125rem;
  font-weight: 500;
  line-height: 1.4;
}

h6 {
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.5;
}

/* ========================================
   UTILIDADES PERSONALIZADAS
   ======================================== */

/* Glass Morphism Effect */
.glass-effect {
  background: rgba(17, 24, 39, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(249, 115, 22, 0.1);
}

/* Gradient Background */
.gradient-primary {
  background: linear-gradient(135deg, var(--cb-orange-primary) 0%, var(--cb-orange-dark) 100%);
}

.gradient-success {
  background: linear-gradient(135deg, var(--cb-success) 0%, var(--cb-success-dark) 100%);
}

.gradient-info {
  background: linear-gradient(135deg, var(--cb-info) 0%, #2563EB 100%);
}

/* Smooth Transitions */
.transition-smooth {
  transition: all var(--cb-transition-base);
}

.transition-fast {
  transition: all var(--cb-transition-fast);
}

.transition-slow {
  transition: all var(--cb-transition-slow);
}

/* Hover Effects */
.hover-lift {
  transition: transform var(--cb-transition-fast), box-shadow var(--cb-transition-fast);
}

.hover-lift:hover {
  transform: translateY(-2px);
  box-shadow: var(--cb-shadow-lg);
}

/* Navigation Active State */
.nav-link {
  position: relative;
  transition: all var(--cb-transition-fast);
}

.nav-link:hover {
  background-color: rgba(249, 115, 22, 0.1);
  color: var(--cb-orange-primary);
}

.nav-link.active {
  background-color: var(--cb-orange-primary);
  color: white;
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  height: 2px;
  background: white;
  border-radius: 2px 2px 0 0;
}

/* Cards */
.card-hover {
  transition: all var(--cb-transition-base);
  cursor: pointer;
}

.card-hover:hover {
  transform: translateY(-4px);
  box-shadow: var(--cb-shadow-xl);
  border-color: var(--cb-orange-primary);
}

/* Badges Personalizados */
.badge-pipeline-new {
  background-color: var(--cb-pipeline-new);
  color: white;
}

.badge-pipeline-active {
  background-color: var(--cb-pipeline-active);
  color: white;
}

.badge-pipeline-qualified {
  background-color: var(--cb-pipeline-qualified);
  color: white;
}

.badge-pipeline-discarded {
  background-color: var(--cb-pipeline-discarded);
  color: white;
}

/* Scrollbar Personalizado */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--cb-bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--cb-bg-tertiary);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--cb-border-hover);
}

/* Firefox Scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--cb-bg-tertiary) var(--cb-bg-secondary);
}

/* Focus States */
*:focus {
  outline: 2px solid var(--cb-orange-primary);
  outline-offset: 2px;
}

*:focus:not(:focus-visible) {
  outline: none;
}

/* Loading Skeleton */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--cb-bg-secondary) 25%,
    var(--cb-bg-tertiary) 50%,
    var(--cb-bg-secondary) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Pulse Animation */
.pulse-primary {
  animation: pulse-primary 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse-primary {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* Glow Effect */
.glow-primary {
  box-shadow: 0 0 20px rgba(249, 115, 22, 0.5);
}

.glow-success {
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.5);
}

/* Text Gradient */
.text-gradient-primary {
  background: linear-gradient(135deg, var(--cb-orange-primary) 0%, var(--cb-orange-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Responsive Utilities */
@media (max-width: 768px) {
  h1 {
    font-size: 1.875rem;
  }
  
  h2 {
    font-size: 1.5rem;
  }
  
  h3 {
    font-size: 1.25rem;
  }
}

/* Print Styles */
@media print {
  .no-print {
    display: none !important;
  }
  
  * {
    color: #000 !important;
    background: #fff !important;
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  * {
    border-color: currentColor !important;
  }
}

/* Dark Mode Adjustments (ya estamos en dark, pero por si se necesita toggle) */
[data-theme="light"],
[data-theme="winter"] {
  --cb-bg-primary: #FFFFFF;
  --cb-bg-secondary: #F9FAFB;
  --cb-bg-tertiary: #F3F4F6;
  --cb-bg-hover: #F3F4F6;
  --cb-text-primary: #111827;
  --cb-text-secondary: #374151;
  --cb-text-muted: #6B7280;
  --cb-text-disabled: #9CA3AF;
  --cb-border-default: #E5E7EB;
  --cb-border-hover: #D1D5DB;
  
  /* Sombras para tema claro */
  --cb-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --cb-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --cb-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --cb-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

[data-theme="night"],
[data-theme="dark"] {
  --cb-bg-primary: #111827;
  --cb-bg-secondary: #1F2937;
  --cb-bg-tertiary: #374151;
  --cb-bg-hover: #2D3748;
  --cb-text-primary: #F9FAFB;
  --cb-text-secondary: #D1D5DB;
  --cb-text-muted: #9CA3AF;
  --cb-text-disabled: #6B7280;
  --cb-border-default: #374151;
  --cb-border-hover: #4B5563;
  
  /* Sombras para tema oscuro */
  --cb-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --cb-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  --cb-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
  --cb-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
}

/* ========================================
   NAVBAR GLOBAL - DUAL THEME
   ======================================== */

/* Navbar Night (Oscuro) */
[data-theme="night"] header.sticky.top-0,
[data-theme="dark"] header.sticky.top-0 {
  background: linear-gradient(to right, #1a1a2e, #16213e);
  border-bottom: 1px solid rgba(249, 115, 22, 0.2);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-theme="night"] .navbar,
[data-theme="dark"] .navbar {
  background: transparent;
}

[data-theme="night"] .navbar-start .text-xl,
[data-theme="dark"] .navbar-start .text-xl {
  color: var(--cb-text-primary);
  font-weight: 700;
}

[data-theme="night"] .navbar button,
[data-theme="dark"] .navbar button {
  color: var(--cb-text-secondary);
  transition: all 0.2s ease;
}

[data-theme="night"] .navbar button:hover,
[data-theme="dark"] .navbar button:hover {
  color: var(--cb-orange-primary);
  background-color: rgba(249, 115, 22, 0.1);
}

/* Navbar Winter (Claro) */
[data-theme="winter"] header.sticky.top-0,
[data-theme="light"] header.sticky.top-0 {
  background: linear-gradient(to right, #FFFFFF, #F9FAFB);
  border-bottom: 1px solid #E5E7EB;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

[data-theme="winter"] .navbar,
[data-theme="light"] .navbar {
  background: transparent;
}

[data-theme="winter"] .navbar-start .text-xl,
[data-theme="light"] .navbar-start .text-xl {
  color: var(--cb-text-primary);
  font-weight: 700;
}

[data-theme="winter"] .navbar button,
[data-theme="light"] .navbar button {
  color: var(--cb-text-secondary);
  transition: all 0.2s ease;
}

[data-theme="winter"] .navbar button:hover,
[data-theme="light"] .navbar button:hover {
  color: var(--cb-orange-primary);
  background-color: rgba(249, 115, 22, 0.05);
}

/* WhatsApp icon siempre verde */
.navbar .fa-whatsapp {
  color: #25D366 !important;
}

/* Separadores en navbar */
[data-theme="night"] .navbar .divider-horizontal,
[data-theme="dark"] .navbar .divider-horizontal {
  background-color: rgba(255, 255, 255, 0.1);
}

[data-theme="winter"] .navbar .divider-horizontal,
[data-theme="light"] .navbar .divider-horizontal {
  background-color: rgba(0, 0, 0, 0.1);
}

/* ========================================
   FOOTER GLOBAL - DUAL THEME
   ======================================== */

[data-theme="night"] footer,
[data-theme="dark"] footer {
  background-color: var(--cb-bg-secondary);
  border-top: 1px solid var(--cb-border-default);
  color: var(--cb-text-secondary);
}

[data-theme="winter"] footer,
[data-theme="light"] footer {
  background-color: var(--cb-bg-secondary);
  border-top: 1px solid var(--cb-border-default);
  color: var(--cb-text-secondary);
}

/* ========================================
   PANEL LATERAL (DRAWER) - DUAL THEME
   ======================================== */

[data-theme="night"] .drawer-side .menu,
[data-theme="dark"] .drawer-side .menu {
  background-color: var(--cb-bg-secondary);
  color: var(--cb-text-primary);
  border-right: 1px solid var(--cb-border-default);
}

[data-theme="winter"] .drawer-side .menu,
[data-theme="light"] .drawer-side .menu {
  background-color: #FFFFFF;
  color: var(--cb-text-primary);
  border-right: 1px solid var(--cb-border-default);
}

/* ========================================
   INPUTS Y FORMULARIOS - DUAL THEME
   ======================================== */

[data-theme="night"] .input,
[data-theme="night"] .select,
[data-theme="night"] .textarea,
[data-theme="dark"] .input,
[data-theme="dark"] .select,
[data-theme="dark"] .textarea {
  background-color: var(--cb-bg-tertiary);
  color: var(--cb-text-primary);
  border-color: var(--cb-border-default);
}

[data-theme="winter"] .input,
[data-theme="winter"] .select,
[data-theme="winter"] .textarea,
[data-theme="light"] .input,
[data-theme="light"] .select,
[data-theme="light"] .textarea {
  background-color: #F9FAFB;
  color: var(--cb-text-primary);
  border-color: var(--cb-border-default);
}

[data-theme="night"] .input:focus,
[data-theme="night"] .select:focus,
[data-theme="night"] .textarea:focus,
[data-theme="dark"] .input:focus,
[data-theme="dark"] .select:focus,
[data-theme="dark"] .textarea:focus,
[data-theme="winter"] .input:focus,
[data-theme="winter"] .select:focus,
[data-theme="winter"] .textarea:focus,
[data-theme="light"] .input:focus,
[data-theme="light"] .select:focus,
[data-theme="light"] .textarea:focus {
  border-color: var(--cb-orange-primary);
  outline: none;
  box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.2);
}

/* ========================================
   COMPONENTES ESPECIALIZADOS
   ======================================== */

/* Kanban Board */
.kanban-column {
  min-width: 200px;
  max-width: 250px;
}

.kanban-card {
  cursor: grab;
  user-select: none;
}

.kanban-card:active {
  cursor: grabbing;
}

.kanban-card.dragging {
  opacity: 0.5;
  transform: rotate(3deg);
}

/* Chat Bubbles (para Consola) */
.chat-bubble-sent {
  background-color: var(--cb-success);
  color: white;
}

.chat-bubble-received {
  background-color: var(--cb-bg-tertiary);
  color: var(--cb-text-primary);
}

/* Calendar (para Eventos) */
.calendar-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  transition: all var(--cb-transition-fast);
}

.calendar-day:hover {
  background-color: var(--cb-bg-tertiary);
}

.calendar-day.selected {
  background-color: var(--cb-orange-primary);
  color: white;
}

.calendar-day.disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Status Indicators */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.online {
  background-color: var(--cb-success);
  box-shadow: 0 0 8px var(--cb-success);
}

.status-dot.offline {
  background-color: var(--cb-text-muted);
}

.status-dot.busy {
  background-color: var(--cb-error);
  box-shadow: 0 0 8px var(--cb-error);
}

/* ========================================
   ANIMACIONES PERSONALIZADAS
   ======================================== */

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideInUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes slideInRight {
  from {
    transform: translateX(20px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.animate-fade-in {
  animation: fadeIn var(--cb-transition-base);
}

.animate-slide-in-up {
  animation: slideInUp var(--cb-transition-base);
}

.animate-slide-in-right {
  animation: slideInRight var(--cb-transition-base);
}

/* Stagger Animation for Lists */
.stagger-item {
  animation: slideInUp var(--cb-transition-base);
}

.stagger-item:nth-child(1) { animation-delay: 0ms; }
.stagger-item:nth-child(2) { animation-delay: 50ms; }
.stagger-item:nth-child(3) { animation-delay: 100ms; }
.stagger-item:nth-child(4) { animation-delay: 150ms; }
.stagger-item:nth-child(5) { animation-delay: 200ms; }
.stagger-item:nth-child(n+6) { animation-delay: 250ms; }

/* ========================================
   OVERRIDE DAISYUI PRIMARY COLORS
   Fuerza el uso de naranja #F97316 en lugar del azul por defecto
   ======================================== */

/* Botones Primary */
.btn-primary {
  background-color: #F97316 !important;
  border-color: #F97316 !important;
  color: white !important;
}

.btn-primary:hover {
  background-color: #EA580C !important;
  border-color: #EA580C !important;
}

.btn-primary:focus {
  background-color: #EA580C !important;
  border-color: #EA580C !important;
  box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.2) !important;
}

.btn-primary:active {
  background-color: #C2410C !important;
  border-color: #C2410C !important;
}

/* Tabs Primary */
.tab-active,
input:checked + .tab,
.tabs-lifted input:checked + .tab {
  color: #F97316 !important;
  border-color: #F97316 !important;
}

/* Badges Primary */
.badge-primary {
  background-color: #F97316 !important;
  border-color: #F97316 !important;
  color: white !important;
}

/* Alerts Primary */
.alert-primary {
  background-color: rgba(249, 115, 22, 0.1) !important;
  border-color: #F97316 !important;
  color: #F97316 !important;
}

/* Progress Primary */
.progress-primary::-webkit-progress-value {
  background-color: #F97316 !important;
}

.progress-primary::-moz-progress-bar {
  background-color: #F97316 !important;
}

/* Radio & Checkbox Primary */
.radio-primary:checked,
.checkbox-primary:checked {
  background-color: #F97316 !important;
  border-color: #F97316 !important;
}

/* Toggle Primary */
.toggle-primary:checked {
  background-color: #F97316 !important;
  border-color: #F97316 !important;
}

/* Range Primary */
.range-primary::-webkit-slider-thumb {
  background-color: #F97316 !important;
}

.range-primary::-moz-range-thumb {
  background-color: #F97316 !important;
}

/* Link Primary */
.link-primary {
  color: #F97316 !important;
}

.link-primary:hover {
  color: #EA580C !important;
}

/* Dropdown Primary (cuando se use con clases primary) */
.dropdown-content .active {
  background-color: rgba(249, 115, 22, 0.1) !important;
  color: #F97316 !important;
}

/* Input Primary (cuando tenga focus) */
.input-primary:focus,
.select-primary:focus,
.textarea-primary:focus {
  border-color: #F97316 !important;
  box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.2) !important;
}

/* Divider Primary */
.divider-primary {
  color: #F97316 !important;
}

.divider-primary::before,
.divider-primary::after {
  background-color: #F97316 !important;
}

/* Step Primary */
.step-primary {
  background-color: #F97316 !important;
  border-color: #F97316 !important;
  color: white !important;
}

/* Tooltip Primary */
.tooltip-primary {
  background-color: #F97316 !important;
  color: white !important;
}

/* Modal Primary (cuando se use con accent-primary) */
.modal-box[data-accent="primary"] {
  border-color: #F97316 !important;
}

/* Card Primary (cuando se use con border-primary) */
.card-bordered.border-primary {
  border-color: #F97316 !important;
}

/* Text Primary Colors */
.text-primary {
  color: #F97316 !important;
}

.bg-primary {
  background-color: #F97316 !important;
}

.border-primary {
  border-color: #F97316 !important;
}

/* Ring Primary (para focus states) */
.ring-primary {
  --tw-ring-color: #F97316 !important;
}

/* Gradient Primary */
.from-primary {
  --tw-gradient-from: #F97316 !important;
}

.to-primary {
  --tw-gradient-to: #F97316 !important;
}

.via-primary {
  --tw-gradient-via: #F97316 !important;
}

/* DaisyUI Theme Color Override - Nivel raíz */
[data-theme="night"],
[data-theme="dark"],
[data-theme="winter"],
[data-theme="light"] {
  --p: 24 100% 53%;        /* #F97316 en HSL */
  --pf: 22 100% 46%;       /* #EA580C en HSL (primary-focus) */
  --pc: 0 0% 100%;         /* white (primary-content) */
}

/* Override específico para tabs que usan color primary de DaisyUI */
[data-theme] .tabs-lifted .tab:checked,
[data-theme] .tabs-lifted .tab-active {
  --tab-border-color: #F97316 !important;
  --tab-bg: var(--cb-bg-secondary) !important;
  --tab-color: #F97316 !important;
}
