/* ==========================================================================
   OmniAudit Styling System
   Core styling using Vanilla CSS with Glassmorphism and Sleek Dark Mode.
   ========================================================================== */

/* Design Tokens & Variables */
:root {
  --font-primary: 'Inter', sans-serif;
  --font-display: 'Outfit', sans-serif;

  /* Color Palette (HSL for harmony) */
  --bg-main: #0b0f19;
  --bg-gradient: radial-gradient(circle at 50% 0%, #151f32 0%, #0b0f19 70%);
  
  /* Glassmorphism Panel styles */
  --glass-bg: rgba(17, 24, 39, 0.65);
  --glass-border: rgba(255, 255, 255, 0.07);
  --glass-border-glow: rgba(56, 189, 248, 0.2);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  
  /* Accent Colors */
  --color-primary: #38bdf8; /* Cyan */
  --color-primary-hover: #0ea5e9;
  --color-secondary: rgba(255, 255, 255, 0.08);
  --color-secondary-hover: rgba(255, 255, 255, 0.15);
  
  /* Status Colors */
  --status-open-text: #34d399; /* Green */
  --status-open-bg: rgba(52, 211, 153, 0.1);
  --status-waiting-text: #fbbf24; /* Yellow */
  --status-waiting-bg: rgba(251, 191, 36, 0.1);
  --status-resolved-text: #9ca3af; /* Gray */
  --status-resolved-bg: rgba(156, 163, 175, 0.1);
  
  /* Sentiment Colors */
  --sentiment-positive: #10b981;
  --sentiment-neutral: #6b7280;
  --sentiment-negative: #f97316;
  --sentiment-alert: #ef4444; /* Enojo, Frustración, Urgente */
  
  /* Text Colors */
  --text-primary: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dark: #6b7280;
}

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

body {
  font-family: var(--font-primary);
  background-color: var(--bg-main);
  background-image: var(--bg-gradient);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(11, 15, 25, 0.5);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Layout Wrapper */
.app-container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* DB Alert Banner */
.db-alert-banner {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  backdrop-filter: blur(12px);
  border-radius: 12px;
  padding: 16px 20px;
  animation: fadeIn 0.4s ease-out;
}
.db-alert-content {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}
.db-alert-content .alert-icon {
  width: 28px;
  height: 28px;
  color: #ef4444;
  flex-shrink: 0;
}
.db-alert-content h4 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  color: #f87171;
  margin-bottom: 4px;
}
.db-alert-content p {
  font-size: 14px;
  color: var(--text-muted);
}
.code-filepath {
  background: rgba(0, 0, 0, 0.4);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  color: var(--color-primary);
}

/* Header Component */
.main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding: 12px 0;
}
.header-logo {
  display: flex;
  align-items: center;
  gap: 14px;
}
.logo-orb {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0284c7 0%, #38bdf8 50%, #06b6d4 100%);
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.5);
  position: relative;
}
.logo-orb::after {
  content: '';
  position: absolute;
  top: 4px;
  left: 4px;
  right: 4px;
  bottom: 4px;
  border-radius: 50%;
  background: var(--bg-main);
}
.header-logo h1 {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(to right, #ffffff, #93c5fd);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.header-logo p {
  font-size: 13px;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Status Badges */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 500;
  backdrop-filter: blur(8px);
}
.badge-status.connected {
  color: #34d399;
  background: rgba(52, 211, 153, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.2);
}
.badge-status.connected .status-dot {
  background-color: #10b981;
  box-shadow: 0 0 8px #10b981;
}
.badge-status.disconnected {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.2);
}
.badge-status.disconnected .status-dot {
  background-color: #ef4444;
  box-shadow: 0 0 8px #ef4444;
}
.badge-status.loading {
  color: #e5e7eb;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.badge-status.loading .status-dot {
  background-color: #9ca3af;
  animation: pulse 1.5s infinite;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* Buttons */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background-color: var(--color-primary);
  color: #0b0f19;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgba(56, 189, 248, 0.3);
}
.btn-primary:hover {
  background-color: var(--color-primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(56, 189, 248, 0.45);
}
.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  display: block;
  width: 100%;
  text-align: center;
  background-color: var(--color-secondary);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 10px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-secondary:hover {
  background-color: var(--color-secondary-hover);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Generic Glassmorphism Card style */
.card-glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: 16px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: border-color 0.3s ease;
}
.card-glass:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

/* KPIs Metric Cards */
.kpis-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}
.kpi-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  backdrop-filter: blur(16px);
  box-shadow: var(--glass-shadow);
}
.kpi-details h3 {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.kpi-value {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  color: #ffffff;
  line-height: 1;
}
.kpi-val-group {
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.kpi-unit {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
}
.kpi-description {
  font-size: 12px;
  color: var(--text-dark);
  margin-top: 4px;
}

.kpi-icon-wrapper {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
}
.kpi-icon-wrapper svg {
  width: 24px;
  height: 24px;
}

/* Accent KPI styles */
.kpi-card.highlight-open {
  border-left: 4px solid var(--status-open-text);
}
.kpi-card.highlight-open .kpi-icon-wrapper {
  background: rgba(52, 211, 153, 0.1);
  color: var(--status-open-text);
}

.kpi-card.highlight-danger {
  border-left: 4px solid var(--sentiment-alert);
}
.kpi-card.highlight-danger .kpi-icon-wrapper {
  background: rgba(239, 68, 68, 0.1);
  color: var(--sentiment-alert);
}
.kpi-icon-wrapper.waiting {
  color: var(--status-waiting-text);
  background: rgba(251, 191, 36, 0.1);
}
.kpi-icon-wrapper.avg-time {
  color: var(--color-primary);
  background: rgba(56, 189, 248, 0.1);
}

/* Collapsible Charts Panel */
.charts-section {
  overflow: hidden;
}
.charts-section.collapsed .section-body {
  max-height: 0;
  padding: 0 24px;
  opacity: 0;
  pointer-events: none;
}
.charts-section.collapsed .toggle-icon svg {
  transform: rotate(0deg);
}
.charts-section .toggle-icon svg {
  transform: rotate(180deg);
  transition: transform 0.3s ease;
  width: 20px;
  height: 20px;
}
.section-header {
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}
.section-header h2 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #ffffff;
}
.header-icon {
  width: 20px;
  height: 20px;
  color: var(--color-primary);
}
.section-body {
  max-height: 500px;
  padding: 24px;
  opacity: 1;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
}
.chart-container {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  padding: 16px;
}
.chart-container h3 {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 16px;
  text-align: center;
}
.canvas-wrapper {
  position: relative;
  height: 220px;
  width: 100%;
}

/* Workspace Layout */
.workspace-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
}

/* Filters Sidebar */
.filters-sidebar {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  height: fit-content;
}
.filters-sidebar h3 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 4px;
}
.filter-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.filter-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Search Box */
.search-box {
  position: relative;
  display: flex;
  align-items: center;
}
.search-box input {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 10px 12px 10px 38px;
  color: #ffffff;
  font-size: 13px;
  transition: all 0.2s ease;
}
.search-box input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.15);
  background: rgba(0, 0, 0, 0.4);
}
.search-icon {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  color: var(--text-dark);
}

/* Segmented Buttons */
.filter-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.btn-filter {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-filter:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}
.btn-filter.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #0b0f19;
  font-weight: 600;
}
.btn-filter.highlight.active {
  background: var(--sentiment-alert);
  border-color: var(--sentiment-alert);
  color: #ffffff;
}

/* Main Audit Panel */
.audit-main {
  padding: 24px;
}
.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.table-header h2 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: #ffffff;
}
.badge-count {
  font-size: 12px;
  background: rgba(255, 255, 255, 0.07);
  padding: 4px 10px;
  border-radius: 6px;
  color: var(--text-muted);
}

/* Audit Table Styles */
.table-wrapper {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  background: rgba(0, 0, 0, 0.15);
}
.audit-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}
.audit-table th {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-muted);
  font-weight: 600;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.audit-table td {
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
  color: var(--text-primary);
}
.audit-table tbody tr {
  transition: background-color 0.2s ease;
}
.audit-table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.02);
}

/* Client Table Details */
.client-cell {
  display: flex;
  flex-direction: column;
}
.client-name {
  font-weight: 600;
  color: #ffffff;
}
.client-sub {
  font-size: 11px;
  color: var(--text-dark);
}

/* Channel Icons */
.channel-cell {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}
.channel-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
}
.channel-badge.whatsapp {
  color: #25d366;
  background: rgba(37, 211, 102, 0.1);
}
.channel-badge.email {
  color: #3b82f6;
  background: rgba(59, 130, 246, 0.1);
}
.channel-badge.webchat {
  color: #06b6d4;
  background: rgba(6, 182, 212, 0.1);
}

/* State pills */
.pill {
  display: inline-flex;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
}
.pill.abierto {
  color: var(--status-open-text);
  background: var(--status-open-bg);
}
.pill.en_espera {
  color: var(--status-waiting-text);
  background: var(--status-waiting-bg);
}
.pill.resuelto {
  color: var(--status-resolved-text);
  background: var(--status-resolved-bg);
}

/* Time alerts progress */
.duration-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 140px;
}
.duration-text {
  font-weight: 500;
}
.duration-bar {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
}
.duration-progress {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease;
}
.duration-progress.ok {
  background: #10b981;
}
.duration-progress.warning {
  background: #fbbf24;
}
.duration-progress.alert {
  background: #ef4444;
  animation: pulse 1.5s infinite;
}

/* Sentiment UI Elements */
.sentiment-cell {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}
.sentiment-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.sentiment-dot.positivo { background-color: var(--sentiment-positive); box-shadow: 0 0 8px var(--sentiment-positive); }
.sentiment-dot.neutral { background-color: var(--sentiment-neutral); }
.sentiment-dot.negativo { background-color: var(--sentiment-negative); box-shadow: 0 0 8px var(--sentiment-negative); }
.sentiment-dot.enojado, 
.sentiment-dot.frustrado, 
.sentiment-dot.urgente { 
  background-color: var(--sentiment-alert); 
  box-shadow: 0 0 10px var(--sentiment-alert);
}
.sentiment-text {
  text-transform: capitalize;
  font-size: 12px;
}
.sentiment-text.alerta {
  color: #f87171;
  font-weight: 600;
}

/* Detail indicator */
.badge-detail {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  color: var(--text-muted);
}
.badge-detail.has-alerts {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.25);
  color: #f87171;
}

.last-msg-cell {
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-muted);
}

.btn-audit {
  background: var(--color-secondary);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--color-primary);
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-audit:hover {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.3);
}

/* Loading & Empty states */
.table-loading {
  text-align: center;
  color: var(--text-muted);
}
.table-loading td {
  padding: 40px;
}
.table-empty {
  text-align: center;
  color: var(--text-dark);
}
.table-empty td {
  padding: 40px;
}

/* Slide-out Sidebar Drawer */
.detail-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 100%;
  height: 100vh;
  z-index: 1000;
  display: flex;
  justify-content: flex-end;
  pointer-events: none;
}
.drawer-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.drawer-content {
  width: 100%;
  max-width: 580px;
  height: 100%;
  background: rgba(15, 23, 42, 0.95);
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(20px);
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: auto;
}

/* Drawer open states */
.detail-drawer.open {
  pointer-events: auto;
}
.detail-drawer.open .drawer-overlay {
  opacity: 1;
  pointer-events: auto;
}
.detail-drawer.open .drawer-content {
  transform: translateX(0);
}

/* Drawer Header */
.drawer-header {
  padding: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.drawer-title-group h2 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: #ffffff;
  margin-top: 6px;
}
.drawer-title-group p {
  font-size: 12px;
  color: var(--text-muted);
}
.drawer-canal-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: #25d366;
  background: rgba(37, 211, 102, 0.1);
  padding: 2px 8px;
  border-radius: 4px;
}
.btn-close {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-close:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}
.btn-close svg {
  width: 16px;
  height: 16px;
}

/* Drawer Metadata bar */
.drawer-metadata {
  padding: 16px 24px;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.meta-item {
  display: flex;
  flex-direction: column;
}
.meta-label {
  font-size: 11px;
  color: var(--text-dark);
  font-weight: 600;
  text-transform: uppercase;
}
.meta-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
.duration-highlight {
  color: var(--status-open-text);
}

.state-control {
  display: flex;
  align-items: center;
  gap: 8px;
}
.state-control label {
  font-size: 11px;
  color: var(--text-dark);
  font-weight: 600;
  text-transform: uppercase;
}
.state-control select {
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #ffffff;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
}
.state-control select:focus {
  outline: none;
  border-color: var(--color-primary);
}

/* Transcript / Messages area */
.transcript-section {
  flex: 1;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
}
.transcript-section h3 {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
}
.chat-history {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Chat Message Bubbles */
.chat-bubble-group {
  display: flex;
  flex-direction: column;
  width: 100%;
}
.chat-bubble-group.cliente {
  align-items: flex-start;
}
.chat-bubble-group.agente_humano,
.chat-bubble-group.ia_bot {
  align-items: flex-end;
}

.bubble-meta {
  font-size: 10px;
  color: var(--text-dark);
  margin-bottom: 4px;
  display: flex;
  gap: 8px;
}
.bubble-content {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13px;
  color: #ffffff;
  position: relative;
  word-break: break-word;
}

/* Distinct message styles based on sender */
.cliente .bubble-content {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-top-left-radius: 2px;
}
.agente_humano .bubble-content {
  background: rgba(59, 130, 246, 0.2);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-top-right-radius: 2px;
}
.ia_bot .bubble-content {
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-top-right-radius: 2px;
}

/* Bubble sentiment tags */
.bubble-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 1px 5px;
  border-radius: 4px;
  margin-top: 6px;
}
.bubble-tag.positivo { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.bubble-tag.neutral { background: rgba(156, 163, 175, 0.15); color: #9ca3af; }
.bubble-tag.negativo { background: rgba(249, 115, 22, 0.15); color: #fb923c; }
.bubble-tag.urgente,
.bubble-tag.enojado,
.bubble-tag.frustrado { 
  background: rgba(239, 68, 68, 0.2); 
  color: #f87171; 
  animation: pulse 2s infinite;
}

.bubble-intent {
  display: block;
  font-size: 10px;
  font-style: italic;
  color: var(--text-dark);
  margin-top: 4px;
}

/* Drawer Footer */
.drawer-footer {
  padding: 16px 24px;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-dark);
  font-weight: 500;
}

/* Common Animations */
@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.spinning {
  animation: spin 0.8s linear infinite;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.badge-pulse {
  position: relative;
}
.badge-pulse::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  border-radius: 50%;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.5);
  animation: pulse 2s infinite;
  pointer-events: none;
}

.hidden {
  display: none !important;
}

/* Media Queries for Responsiveness */
@media (max-width: 1024px) {
  .workspace-layout {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 768px) {
  .app-container {
    padding: 12px;
  }
  .main-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .header-actions {
    width: 100%;
    justify-content: space-between;
  }
  .drawer-content {
    max-width: 100%;
  }
}
