/* Club Almacén - Estilos principales con Bootstrap */
@import url("chat.css");

/* Prevent FOUC (Flash of Unstyled Content) - Critical CSS that runs first */
[data-theme="dark"] {
  background-color: #1a1a1a !important;
  color: #e9ecef !important;
}

[data-theme="dark"] body {
  background-color: #1a1a1a !important;
  color: #e9ecef !important;
}

/* Variables CSS */
:root {
  --club-blue: #2563eb;
  --club-green: #16a34a;
  --club-purple: #9333ea;
  --club-orange: #ea580c;
  --club-red: #dc2626;
  
  /* Light mode colors */
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-tertiary: #e9ecef;
  --text-primary: #212529;
  --text-secondary: #6c757d;
  --text-muted: #adb5bd;
  --border-color: #dee2e6;
  --shadow-color: rgba(0, 0, 0, 0.1);
  --card-bg: #ffffff;
  --sidebar-bg: #ffffff;
  --header-bg: #ffffff;
  --input-bg: #ffffff;
  --dropdown-bg: #ffffff;
}

/* Dark mode colors */
[data-theme="dark"] {
  --bg-primary: #1a1a1a;
  --bg-secondary: #2d2d2d;
  --bg-tertiary: #404040;
  --text-primary: #e9ecef;
  --text-secondary: #adb5bd;
  --text-muted: #6c757d;
  --border-color: #495057;
  --shadow-color: rgba(0, 0, 0, 0.3);
  --card-bg: #2d2d2d;
  --sidebar-bg: #2d2d2d;
  --header-bg: #2d2d2d;
  --input-bg: #404040;
  --dropdown-bg: #2d2d2d;
}

/* Utilidades */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.focus:not-sr-only {
  position: static;
  width: auto;
  height: auto;
  padding: inherit;
  margin: inherit;
  overflow: visible;
  clip: auto;
  white-space: inherit;
}

/* Layout fixes */
body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Sidebar styles */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: 280px;
  background: var(--sidebar-bg);
  box-shadow: 0 0 20px var(--shadow-color);
  z-index: 1050;
  transform: translateX(-100%);
  transition: none;
  will-change: auto;
  border-right: 1px solid var(--border-color);
}

/* Enable transitions only after page load */
.sidebar.loaded {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}

/* Tablet styles */
@media (min-width: 768px) and (max-width: 991.98px) {
  .sidebar {
    width: 260px;
  }
}

/* Desktop styles */
@media (min-width: 992px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    transform: translateX(0);
    box-shadow: none;
    border-right: 1px solid #e2e8f0;
    height: 100vh;
    z-index: 1000;
    transition: none;
  }
  
  .sidebar.loaded {
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  /* Collapsed sidebar state */
  .sidebar.collapsed {
    width: 70px;
  }
  
  .sidebar.collapsed .sidebar-item {
    justify-content: center;
    padding: 0.75rem;
    gap: 0;
  }
  
  .sidebar.collapsed .sidebar-item span:not(.icon-only) {
    display: none;
  }
  
  .sidebar.collapsed .sidebar-item .icon-only {
    font-size: 1.25rem;
    margin: 0;
  }
  
  .sidebar.collapsed .user-info {
    display: none;
  }
  
  .sidebar.collapsed .logo-text {
    display: none;
  }
  
  .sidebar.collapsed .d-flex.align-items-center.gap-3 {
    justify-content: center;
    gap: 0 !important;
  }
  
  .sidebar.collapsed .border-top {
    display: none;
  }
  
  .sidebar.collapsed .text-uppercase {
    display: none;
  }
  
  .sidebar.collapsed .bg-light.rounded {
    background: transparent !important;
    padding: 0.5rem !important;
    border-radius: 0.5rem !important;
  }
  
  .sidebar.collapsed .btn-primary.btn-sm.w-100 {
    width: auto !important;
    padding: 0.5rem !important;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
  }
  
  .sidebar.collapsed .btn-primary.btn-sm.w-100 .me-2 {
    margin-right: 0 !important;
  }
  
  .sidebar.collapsed .btn-primary.btn-sm.w-100 span {
    display: none;
  }
}

.sidebar.show {
  transform: translateX(0);
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  text-decoration: none;
  color: var(--text-secondary);
  border-radius: 0.5rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.sidebar-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.1), transparent);
  transition: left 0.3s ease;
}

.sidebar-item:hover::before {
  left: 100%;
}

.sidebar-item:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  transform: translateX(4px);
}

.sidebar-item.active {
  background-color: var(--club-blue);
  color: white;
  border-left: 3px solid var(--club-blue);
  font-weight: 500;
}

/* Icon-only mode for collapsed sidebar */
.icon-only {
  display: inline-flex !important;
  min-width: 1.5rem;
  text-align: center;
}

/* Tooltip styles for collapsed sidebar */
.sidebar.collapsed .sidebar-item {
  position: relative;
}

.sidebar.collapsed .sidebar-item::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  margin-left: 0.5rem;
  background: #1f2937;
  color: white;
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  z-index: 1000;
  pointer-events: none;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.sidebar.collapsed .sidebar-item:hover::after {
  opacity: 1;
  visibility: visible;
  margin-left: 0.75rem;
}

.sidebar.collapsed .sidebar-item::before {
  content: '';
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  margin-left: -6px;
  border: 6px solid transparent;
  border-right-color: #1f2937;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  z-index: 999;
}

.sidebar.collapsed .sidebar-item:hover::before {
  opacity: 1;
  visibility: visible;
}

.logo-text {
  transition: opacity 0.3s ease;
}

.user-info {
  transition: opacity 0.3s ease;
}

/* Main content layout */
.main-content {
  min-height: 100vh;
  padding-top: 64px; /* Space for fixed header */
  transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Tablet styles */
@media (min-width: 768px) and (max-width: 991.98px) {
  .main-content {
    padding-top: 64px;
  }
}

@media (min-width: 992px) {
  .main-content {
    padding-top: 64px; /* Keep padding for header in desktop */
    margin-left: 280px; /* Space for sidebar */
    width: calc(100% - 280px); /* Prevent overflow */
  }
  
  /* Adjust for collapsed sidebar */
  .sidebar.collapsed ~ .main-content {
    margin-left: 70px;
    width: calc(100% - 70px);
  }
  
  /* Remove extra padding from main in desktop */
  main.container-fluid {
    padding: 1rem !important;
  }
}

/* Header */
.top-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 64px;
  background-color: var(--header-bg);
  border-bottom: 1px solid var(--border-color);
  z-index: 1030; /* Lower than sidebar but above content */
  box-shadow: 0 1px 3px var(--shadow-color);
  opacity: 0;
  animation: fadeInTop 0.3s ease-out forwards;
  transition: opacity 0.2s ease-in-out;
}

/* Fade-in animation for top header */
@keyframes fadeInTop {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Tablet styles */
@media (min-width: 768px) and (max-width: 991.98px) {
  .top-header {
    left: 0;
    width: 100%;
    animation: fadeInTop 0.4s ease-out forwards;
  }
}

@media (min-width: 992px) {
  .top-header {
    left: 280px; /* Start after sidebar */
    width: calc(100% - 280px); /* Prevent overflow */
    animation: fadeInTop 0.5s ease-out forwards;
  }
  
  /* Adjust for collapsed sidebar */
  .sidebar.collapsed ~ .main-content .top-header {
    left: 70px;
    width: calc(100% - 70px);
    transition: left 0.3s ease-in-out, width 0.3s ease-in-out;
  }
}

/* Mobile bottom navigation */
.mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background-color: var(--header-bg);
  border-top: 1px solid var(--border-color);
  z-index: 1030;
  opacity: 0;
  animation: fadeInBottom 0.3s ease-out 0.1s forwards;
  transition: opacity 0.2s ease-in-out;
}

/* Fade-in animation for mobile bottom nav */
@keyframes fadeInBottom {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Cards */
.card {
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px var(--shadow-color);
  background-color: var(--card-bg);
  transition: box-shadow 0.2s;
}

.card:hover {
  box-shadow: 0 4px 6px var(--shadow-color);
}

/* Buttons */
.btn-club-primary {
  background-color: var(--club-blue);
  border-color: var(--club-blue);
  color: white;
}

.btn-club-primary:hover {
  background-color: #1d4ed8;
  border-color: #1d4ed8;
}

.btn-club-success {
  background-color: var(--club-green);
  border-color: var(--club-green);
  color: white;
}

.btn-club-success:hover {
  background-color: #15803d;
  border-color: #15803d;
}

/* Hero section */
.hero-section {
  background: linear-gradient(135deg, var(--club-blue), var(--club-purple));
  color: white;
  padding: 3rem 2rem;
  border-radius: 0.5rem;
}

/* Text truncation */
.text-truncate-2 {
  display: -webkit-box;
  display: -moz-box;
  display: box;
  -webkit-line-clamp: 2;
  -moz-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  -moz-box-orient: vertical;
  box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.text-truncate-3 {
  display: -webkit-box;
  display: -moz-box;
  display: box;
  -webkit-line-clamp: 3;
  -moz-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  -moz-box-orient: vertical;
  box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Loading animations */
.animate-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: .5;
  }
}

/* Responsive adjustments */
@media (max-width: 991.98px) {
  .main-content {
    padding-bottom: 60px; /* Space for mobile bottom nav */
  }
}

/* Overlay for mobile sidebar */
.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1045;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

.sidebar-overlay.show {
  opacity: 1;
  visibility: visible;
}

/* Mobile-specific overlay improvements */
@media (max-width: 767.98px) {
  .sidebar-overlay {
    background-color: rgba(0, 0, 0, 0.6);
    -webkit-tap-highlight-color: transparent;
  }
  
  /* Prevent bounce scrolling on iOS when sidebar is open */
  body.sidebar-open {
    position: fixed;
    width: 100%;
    overflow: hidden;
  }
}

/* Toggle button for collapsed sidebar */
.sidebar-toggle {
  display: none;
  position: absolute;
  top: 1.5rem;
  right: -18px;
  width: 36px;
  height: 36px;
  background: var(--club-blue);
  color: white;
  border: 3px solid white;
  border-radius: 50%;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  z-index: 1040; /* Above top-header (1030) and sidebar (1050) */
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.sidebar-toggle:hover {
  background-color: #1d4ed8;
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.sidebar.collapsed .sidebar-toggle {
  right: -18px;
}

.sidebar-toggle i {
  font-size: 0.875rem;
  transition: transform 0.3s ease;
}

.sidebar-toggle:hover i {
  transform: scale(1.1);
}

@media (min-width: 992px) {
  .sidebar-toggle {
    display: flex;
  }
}

/* Mobile optimizations */
@media (max-width: 767.98px) {
  .sidebar {
    width: 85vw;
    max-width: 320px;
    height: 100dvh; /* Use dynamic viewport height for mobile browsers */
    height: -webkit-fill-available; /* Safari fallback */
    max-height: 100vh; /* Fallback for older browsers */
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1050;
    overflow-y: auto; /* Allow scrolling if content is too tall */
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
  }
  
  /* Ensure sidebar covers entire screen on mobile */
  .sidebar.show {
    transform: translateX(0);
    height: 100dvh;
    height: -webkit-fill-available;
    max-height: 100vh;
  }
  
  .sidebar-item {
    padding: 1rem;
    font-size: 0.95rem;
  }
  
  .sidebar .d-flex.gap-3 {
    gap: 1rem !important;
  }
  
  /* Hide toggle button on mobile */
  .sidebar-toggle {
    display: none !important;
  }
  
  /* Better touch targets for mobile */
  .sidebar-item {
    min-height: 44px; /* iOS touch target minimum */
    padding: 0.875rem 1rem;
  }
  
  /* Prevent zoom on focus */
  .sidebar-item:focus {
    outline: 2px solid var(--club-blue);
    outline-offset: -2px;
  }
}

/* Touch optimizations for tablets */
@media (min-width: 768px) and (max-width: 991.98px) {
  .sidebar-item {
    padding: 0.875rem 1.25rem;
    font-size: 0.975rem;
  }
  
  .sidebar .d-flex.gap-3 {
    gap: 1.25rem !important;
  }
}

/* Animaciones de aparición para elementos */

/* Fade in animation */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Fade in up animation */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Fade in down animation */
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Fade in left animation */
@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Fade in right animation */
@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Scale in animation */
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Rotate in animation */
@keyframes rotateIn {
  from {
    opacity: 0;
    transform: rotate(-10deg) scale(0.8);
  }
  to {
    opacity: 1;
    transform: rotate(0) scale(1);
  }
}

/* Slide in up animation */
@keyframes slideInUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

/* Slide in down animation */
@keyframes slideInDown {
  from {
    transform: translateY(-100%);
  }
  to {
    transform: translateY(0);
  }
}

/* Bounce in animation */
@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  50% {
    opacity: 1;
    transform: scale(1.05);
  }
  70% {
    transform: scale(0.9);
  }
  100% {
    transform: scale(1);
  }
}

/* Clases de animación para elementos */
.animate-fade-in {
  animation: fadeIn 0.6s ease-out;
}

.animate-fade-in-up {
  animation: fadeInUp 0.6s ease-out;
}

.animate-fade-in-down {
  animation: fadeInDown 0.6s ease-out;
}

.animate-fade-in-left {
  animation: fadeInLeft 0.6s ease-out;
}

.animate-fade-in-right {
  animation: fadeInRight 0.6s ease-out;
}

.animate-scale-in {
  animation: scaleIn 0.5s ease-out;
}

.animate-rotate-in {
  animation: rotateIn 0.6s ease-out;
}

.animate-slide-in-up {
  animation: slideInUp 0.5s ease-out;
}

.animate-slide-in-down {
  animation: slideInDown 0.5s ease-out;
}

.animate-bounce-in {
  animation: bounceIn 0.7s ease-out;
}

/* Animaciones con retraso para aparición escalonada */
.animate-fade-in-stagger-1 {
  animation: fadeIn 0.6s ease-out 0.1s both;
}

.animate-fade-in-stagger-2 {
  animation: fadeIn 0.6s ease-out 0.2s both;
}

.animate-fade-in-stagger-3 {
  animation: fadeIn 0.6s ease-out 0.3s both;
}

.animate-fade-in-stagger-4 {
  animation: fadeIn 0.6s ease-out 0.4s both;
}

.animate-fade-in-up-stagger-1 {
  animation: fadeInUp 0.6s ease-out 0.1s both;
}

.animate-fade-in-up-stagger-2 {
  animation: fadeInUp 0.6s ease-out 0.2s both;
}

.animate-fade-in-up-stagger-3 {
  animation: fadeInUp 0.6s ease-out 0.3s both;
}

.animate-fade-in-up-stagger-4 {
  animation: fadeInUp 0.6s ease-out 0.4s both;
}

/* Animaciones para cards específicamente */
.card-animate {
  animation: fadeInUp 0.6s ease-out;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card-animate:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* Animaciones para botones */
.btn-animate {
  animation: scaleIn 0.4s ease-out;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-animate:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* Animaciones para imágenes */
.img-animate {
  animation: fadeIn 0.8s ease-out;
}

.img-animate-scale {
  animation: scaleIn 0.6s ease-out;
}

/* Animaciones para texto */
.text-animate {
  animation: fadeInUp 0.6s ease-out;
}

.text-animate-slide {
  animation: slideInLeft 0.6s ease-out;
}

/* Animaciones para elementos de lista */
.list-item-animate {
  animation: fadeInLeft 0.5s ease-out;
}

/* Animaciones para elementos de formulario */
.form-control-animate {
  animation: fadeInUp 0.5s ease-out;
}

.form-group-animate {
  animation: fadeIn 0.6s ease-out;
}

/* Animaciones para alertas/mensajes */
.alert-animate {
  animation: slideInDown 0.4s ease-out;
}

/* Animaciones para modales */
.modal-animate {
  animation: scaleIn 0.3s ease-out;
}

/* Animaciones para navegación */
.nav-item-animate {
  animation: fadeInDown 0.5s ease-out;
}

/* Animaciones para elementos del sidebar */
.sidebar-item-animate {
  animation: fadeInRight 0.4s ease-out;
}

/* Animaciones para contenido principal */
.main-content-animate {
  animation: fadeIn 0.8s ease-out;
}

/* Animaciones para elementos de estadísticas */
.stat-card-animate {
  animation: bounceIn 0.7s ease-out;
}

/* Animaciones para elementos de productos */
.product-card-animate {
  animation: fadeInUp 0.6s ease-out;
  transition: transform 0.3s ease;
}

.product-card-animate:hover {
  transform: translateY(-8px);
}

/* Animaciones para eventos */
.event-card-animate {
  animation: rotateIn 0.6s ease-out;
}

/* Animaciones para noticias */
.news-item-animate {
  animation: slideInUp 0.5s ease-out;
}

/* Clases para controlar la visibilidad inicial */
.animate-hidden {
  opacity: 0;
  visibility: hidden;
}

.animate-visible {
  opacity: 1;
  visibility: visible;
}

/* Animaciones de hover mejoradas */
.hover-lift {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
  transform: translateY(-10px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
}

.hover-grow {
  transition: transform 0.3s ease;
}

.hover-grow:hover {
  transform: scale(1.08);
}

.hover-rotate {
  transition: transform 0.3s ease;
}

.hover-rotate:hover {
  transform: rotate(5deg);
}

/* Animaciones para loading states */
.loading-shimmer {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

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

/* Animación de entrada para secciones completas */
.section-animate {
  animation: fadeInUp 0.8s ease-out;
}

/* Animaciones responsivas */
@media (max-width: 767.98px) {
  .animate-fade-in,
  .animate-fade-in-up,
  .animate-scale-in {
    animation-duration: 0.4s;
  }
}

@media (prefers-reduced-motion: reduce) {
  .animate-fade-in,
  .animate-fade-in-up,
  .animate-fade-in-down,
  .animate-fade-in-left,
  .animate-fade-in-right,
  .animate-scale-in,
  .animate-rotate-in,
  .animate-slide-in-up,
  .animate-slide-in-down,
  .animate-bounce-in,
  .card-animate,
  .btn-animate,
  .img-animate,
  .text-animate,
  .hover-lift,
  .hover-grow,
  .hover-rotate {
    animation: none;
    transition: none;
  }
}

/* Dark mode component styles */
[data-theme="dark"] {
  color: var(--text-primary);
}

[data-theme="dark"] body {
  color: var(--text-primary);
}

[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5,
[data-theme="dark"] h6 {
  color: var(--text-primary);
}

[data-theme="dark"] p {
  color: var(--text-primary);
}

[data-theme="dark"] .form-control {
  background-color: var(--input-bg);
  border-color: var(--border-color);
  color: var(--text-primary);
}

[data-theme="dark"] .form-control:focus {
  background-color: var(--input-bg);
  border-color: var(--club-blue);
  color: var(--text-primary);
  box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.25);
}

[data-theme="dark"] .form-select {
  background-color: var(--input-bg);
  border-color: var(--border-color);
  color: var(--text-primary);
}

[data-theme="dark"] .dropdown-menu {
  background-color: var(--dropdown-bg);
  border-color: var(--border-color);
}

[data-theme="dark"] .dropdown-item {
  color: var(--text-primary);
}

[data-theme="dark"] .dropdown-item:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

[data-theme="dark"] .dropdown-header {
  color: var(--text-secondary);
}

[data-theme="dark"] .modal-content {
  background-color: var(--card-bg);
  border-color: var(--border-color);
  color: var(--text-primary);
}

[data-theme="dark"] .modal-header {
  border-bottom-color: var(--border-color);
}

[data-theme="dark"] .modal-footer {
  border-top-color: var(--border-color);
}

[data-theme="dark"] .table {
  color: var(--text-primary);
}

[data-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd) > td,
[data-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd) > th {
  background-color: var(--bg-tertiary);
}

[data-theme="dark"] .table-hover > tbody > tr:hover > td,
[data-theme="dark"] .table-hover > tbody > tr:hover > th {
  background-color: var(--bg-tertiary);
}

[data-theme="dark"] .alert {
  border-color: var(--border-color);
}

[data-theme="dark"] .badge {
  color: var(--text-primary);
}

[data-theme="dark"] .btn-outline-primary {
  border-color: var(--club-blue);
  color: var(--club-blue);
}

[data-theme="dark"] .btn-outline-primary:hover {
  background-color: var(--club-blue);
  border-color: var(--club-blue);
  color: white;
}

[data-theme="dark"] .btn-outline-secondary {
  border-color: var(--border-color);
  color: var(--text-secondary);
}

[data-theme="dark"] .btn-outline-secondary:hover {
  background-color: var(--bg-tertiary);
  border-color: var(--border-color);
  color: var(--text-primary);
}

[data-theme="dark"] .text-muted {
  color: var(--text-muted) !important;
}

[data-theme="dark"] .bg-light {
  background-color: var(--bg-secondary) !important;
}

[data-theme="dark"] .bg-white {
  background-color: var(--card-bg) !important;
}

[data-theme="dark"] .border {
  border-color: var(--border-color) !important;
}

[data-theme="dark"] .input-group-text {
  background-color: var(--bg-tertiary);
  border-color: var(--border-color);
  color: var(--text-secondary);
}

[data-theme="dark"] .sidebar-item {
  color: var(--text-secondary);
}

[data-theme="dark"] .sidebar-item:hover {
  color: var(--text-primary);
}

[data-theme="dark"] .sidebar-item.active {
  color: white;
}

[data-theme="dark"] .user-info p {
  color: var(--text-primary);
}

[data-theme="dark"] .user-info p.text-muted {
  color: var(--text-muted) !important;
}

[data-theme="dark"] .logo-text h1,
[data-theme="dark"] .logo-text p {
  color: var(--text-primary);
}

[data-theme="dark"] .logo-text p.text-muted {
  color: var(--text-muted) !important;
}

[data-theme="dark"] .btn-link {
  color: var(--text-secondary);
}

[data-theme="dark"] .btn-link:hover {
  color: var(--text-primary);
}

[data-theme="dark"] .form-text {
  color: var(--text-muted) !important;
}

[data-theme="dark"] .form-label {
  color: var(--text-primary) !important;
}

[data-theme="dark"] .form-check-label {
  color: var(--text-primary) !important;
}

[data-theme="dark"] label {
  color: var(--text-primary) !important;
}

[data-theme="dark"] strong {
  color: var(--text-primary) !important;
}

[data-theme="dark"] b {
  color: var(--text-primary) !important;
}

[data-theme="dark"] span {
  color: var(--text-primary) !important;
}

[data-theme="dark"] .text-primary {
  color: var(--text-primary) !important;
}

[data-theme="dark"] .text-secondary {
  color: var(--text-secondary) !important;
}

[data-theme="dark"] .text-success {
  color: var(--club-green) !important;
}

[data-theme="dark"] .text-danger {
  color: var(--club-red) !important;
}

[data-theme="dark"] .text-warning {
  color: var(--club-orange) !important;
}

[data-theme="dark"] .text-info {
  color: var(--club-blue) !important;
}

/* Dark mode toggle button */
.theme-toggle {
  position: relative;
  width: 40px;
  height: 40px;
  background-color: transparent;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}

.theme-toggle:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  transform: scale(1.1);
}

.theme-toggle i {
  font-size: 1.2rem;
  transition: all 0.3s ease;
}

[data-theme="dark"] .theme-toggle {
  color: var(--text-secondary);
}

[data-theme="dark"] .theme-toggle:hover {
  color: var(--text-primary);
}

/* Smooth transitions for theme switching */
* {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

        /* Animaciones para la barra de exclusiones */
        @keyframes slideInRight {
            from {
                transform: translateX(100%);
                opacity: 0;
            }
            to {
                transform: translateX(0);
                opacity: 1;
            }
        }
        
        @keyframes slideOutRight {
            from {
                transform: translateX(0);
                opacity: 1;
            }
            to {
                transform: translateX(100%);
                opacity: 0;
            }
        }

:root {
    --primary-color: #4f46e5;
    --secondary-color: #7c3aed;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
    --dark-color: #1f2937;
    --light-color: #f9fafb;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.chat-container {
    height: calc(100vh - 80px) !important;
    min-height: 600px !important;
    max-height: none !important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    border-radius: 20px !important;
    overflow: hidden !important;
    box-shadow: var(--shadow-xl) !important;
    display: flex !important;
    flex-direction: column !important;
}

.chat-sidebar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-right: 1px solid var(--border-color);
    height: 100%;
    overflow-y: auto;
}

.chat-main {
    background: white !important;
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    min-height: 0 !important;
}

.chat-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color)) !important;
    color: white !important;
    padding: 1.5rem !important;
    border-radius: 20px 20px 0 0 !important;
    flex-shrink: 0 !important;
}

.chat-messages {
    flex: 1 !important;
    overflow-y: auto !important;
    padding: 1.5rem !important;
    background: var(--light-color) !important;
    scroll-behavior: smooth !important;
    min-height: 0 !important;
    display: flex !important;
    flex-direction: column !important;
}

.chat-input {
    padding: 1.5rem !important;
    background: white !important;
    border-top: 1px solid var(--border-color) !important;
    border-radius: 0 0 20px 20px !important;
    flex-shrink: 0 !important;
    position: relative !important;
    z-index: 10 !important;
}

.chat-input textarea,
.chat-input .message-input-field {
    max-height: 120px !important;
    resize: none !important;
    overflow-y: auto !important;
}

.chat-messages .message-bubble {
    max-width: 70% !important;
    padding: 0.875rem 1.25rem !important;
    border-radius: 20px !important;
    margin-bottom: 0.75rem !important;
    position: relative;
    animation: messageSlide 0.3s ease-out;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
    font-size: 0.95rem !important;
    line-height: 1.5 !important;
    word-wrap: break-word;
    transition: all 0.2s ease;
    background: white !important;
    color: var(--dark-color) !important;
}

.chat-messages .message-bubble.message-own {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color)) !important;
    color: white !important;
    margin-left: auto !important;
    border-bottom-right-radius: 6px !important;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.15) !important;
    border: none !important;
}

.chat-messages .message-bubble.message-own:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.2) !important;
}

.chat-messages .message-bubble.message-other {
    background: white !important;
    color: var(--dark-color) !important;
    border: 1px solid rgba(229, 231, 235, 0.8) !important;
    border-bottom-left-radius: 6px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
}

.chat-messages .message-bubble.message-other:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
    border-color: rgba(229, 231, 235, 1) !important;
}

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

.chat-sidebar .user-avatar,
.chat-messages .user-avatar {
    width: 42px !important;
    height: 42px !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    border: 3px solid white !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
    transition: all 0.2s ease;
}

.chat-sidebar .user-avatar:hover,
.chat-messages .user-avatar:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}

.online-indicator {
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.online-indicator.online {
    background: #10b981;
    animation: pulse 2s infinite;
}

.online-indicator.offline {
    background: #9ca3af;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    70% {
        box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

.typing-indicator {
    padding: 0.5rem 1rem;
    background: var(--light-color);
    border-radius: 18px;
    margin-bottom: 0.5rem;
    display: none;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--info-color);
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.participant-item {
    padding: 1rem;
    border-radius: 12px;
    transition: all 0.2s ease;
    cursor: pointer;
    border: 1px solid transparent;
}

.participant-item:hover {
    background: var(--light-color);
    border-color: var(--border-color);
    transform: translateX(4px);
}

.participant-item.active {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-color: var(--primary-color);
}

.room-info-card {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.room-type-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    gap: 0.5rem;
}

.room-type-badge.negocio {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: white;
}

.room-type-badge.grupo {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
}

.room-type-badge.directo {
    background: linear-gradient(135deg, #6b7280, #4b5563);
    color: white;
}

.connection-status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}

.connection-status.connected {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success-color);
}

.connection-status.connecting {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning-color);
}

.connection-status.disconnected {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger-color);
}

.message-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chat-input .message-input-field {
    flex: 1 !important;
    padding: 0.875rem 3.5rem 0.875rem 1.25rem !important;
    border: 2px solid var(--border-color) !important;
    border-radius: 28px !important;
    outline: none !important;
    font-size: 0.95rem !important;
    transition: all 0.3s ease;
    background: white !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
    color: var(--dark-color) !important;
}

.chat-input .message-input-field:focus {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1), 0 2px 8px rgba(0, 0, 0, 0.08) !important;
    transform: translateY(-1px);
}

.message-input-field::placeholder {
    color: #9ca3af;
    font-style: italic;
}

.char-counter {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.75rem;
    color: #9ca3af;
    font-weight: 500;
}

.char-counter.warning {
    color: var(--warning-color);
}

.char-counter.danger {
    color: var(--danger-color);
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
}

.chat-input .action-btn {
    width: 44px !important;
    height: 44px !important;
    border-radius: 50% !important;
    border: none !important;
    background: var(--light-color) !important;
    color: var(--dark-color) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.1rem !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
    position: relative;
    overflow: hidden;
}

.action-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.action-btn:active {
    transform: scale(0.98);
}

.action-btn.send-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    position: relative;
}

.action-btn.send-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 50%;
}

.action-btn.send-btn:hover::before {
    opacity: 1;
}

.action-btn.send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.4);
}

.action-btn.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.scroll-to-bottom {
    position: absolute;
    bottom: 100px;
    right: 30px;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: white;
    border: none;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.8);
}

.scroll-to-bottom.visible {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

.scroll-to-bottom:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.1);
}

/* Chat responsive styles moved to chat.css for consistency */

/* Emoji Picker */
.emoji-picker {
    position: absolute;
    bottom: 60px;
    right: 10px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 1rem;
    display: none;
    z-index: 1000;
    max-width: 300px;
}

.emoji-picker.show {
    display: block;
    animation: fadeIn 0.2s ease-out;
}

.emoji-categories {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.emoji-category {
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s ease;
}

.emoji-category:hover {
    background: var(--light-color);
}

.emoji-category.active {
    background: var(--primary-color);
    color: white;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 0.25rem;
    max-height: 200px;
    overflow-y: auto;
}

.emoji-item {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-size: 1.2rem;
}

.emoji-item:hover {
    background: var(--light-color);
    transform: scale(1.2);
}

@media (max-width: 480px) {
    .emoji-picker {
        right: 5px;
        bottom: 55px;
        max-width: 280px;
        padding: 0.75rem;
    }
    
    .emoji-grid {
        grid-template-columns: repeat(7, 1fr);
    }
    
    .emoji-item {
        width: 28px;
        height: 28px;
        font-size: 1rem;
    }
}

/* Animaciones adicionales */
.fade-in {
    animation: fadeIn 0.5s ease-out;
}

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

.slide-in-right {
    animation: slideInRight 0.3s ease-out;
}

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

.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

            


