/* ==========================================================================
   Automated Calling Platform - Core Styles & Premium Aesthetics
   ========================================================================== */

:root {
  /* Light Mode Colors (Default) */
  --bg-app: 210 20% 97%;
  --bg-sidebar: 215 15% 91%;
  --bg-card: 0 0% 100%;
  --border-glass: 214 15% 85%;
  --text-main: 222 15% 15%;
  --text-muted: 215 12% 48%;
  --text-dark: 215 15% 15%;
  
  --primary: 250 84% 54%;       /* Royal Indigo */
  --primary-hover: 250 84% 62%;
  --primary-glow: rgba(99, 102, 241, 0.08);
  
  --success: 142 71% 40%;       /* Emerald */
  --success-glow: rgba(16, 185, 129, 0.08);
  
  --warning: 38 92% 40%;        /* Amber */
  --warning-glow: rgba(245, 158, 11, 0.08);
  
  --danger: 350 89% 55%;        /* Rose */
  --danger-glow: rgba(244, 63, 94, 0.08);

  --info: 199 89% 45%;          /* Sky Blue */

  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-headings: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  
  --shadow-sm: 0 2px 8px -1px rgba(0,0,0,0.08);
  --shadow-lg: 0 12px 30px -4px rgba(0,0,0,0.12);
  --shadow-glow: 0 0 15px 1px rgba(99, 102, 241, 0.15);
  
  --border-radius-sm: 8px;
  --border-radius-md: 12px;
  --border-radius-lg: 16px;
  
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Mode Colors (Activated via class) */
body.dark-theme {
  color-scheme: dark;
  --bg-app: 224 25% 6%;
  --bg-sidebar: 224 25% 4%;
  --bg-card: 224 20% 10%;
  --border-glass: 220 15% 16%;
  --text-main: 210 20% 98%;
  --text-muted: 217 10% 68%;
  
  --primary: 250 84% 54%;
  --primary-hover: 250 84% 64%;
  --primary-glow: rgba(99, 102, 241, 0.15);
  
  --success: 142 71% 45%;
  --success-glow: rgba(16, 185, 129, 0.15);
  
  --warning: 38 92% 50%;
  --warning-glow: rgba(245, 158, 11, 0.15);
  
  --danger: 350 89% 60%;
  --danger-glow: rgba(244, 63, 94, 0.15);

  --info: 199 89% 48%;
  
  --shadow-sm: 0 2px 8px -1px rgba(0,0,0,0.4);
  --shadow-lg: 0 12px 30px -4px rgba(0,0,0,0.6);
  --shadow-glow: 0 0 15px 1px rgba(99, 102, 241, 0.25);
}

/* Base resets & structural styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  color-scheme: light;
  font-family: var(--font-main);
  background-color: hsl(var(--bg-app));
  color: hsl(var(--text-main));
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
}

/* Ambient Background decorations */
.background-decorations {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.circle-grad-1, .circle-grad-2 {
  position: absolute;
  border-radius: 50%;
  filter: blur(140px);
  opacity: 0.45;
}

.circle-grad-1 {
  top: -10%;
  left: 20%;
  width: 40vw;
  height: 40vw;
  background: radial-gradient(circle, hsla(var(--primary), 0.35) 0%, transparent 70%);
}

.circle-grad-2 {
  bottom: -15%;
  right: 15%;
  width: 50vw;
  height: 50vw;
  background: radial-gradient(circle, hsla(var(--success), 0.2) 0%, transparent 70%);
}

/* App Shell Layout */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar Navigation */
.sidebar {
  width: 260px;
  background-color: hsl(var(--bg-sidebar));
  border-right: 1px solid hsl(var(--border-glass));
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 10;
}

.sidebar-brand {
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid hsl(var(--border-glass));
}

.brand-logo {
  background: linear-gradient(135deg, hsl(var(--primary)), hsl(var(--info)));
  width: 40px;
  height: 40px;
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}

.brand-icon {
  width: 22px;
  height: 22px;
  color: #fff;
}

.brand-info h2 {
  font-family: var(--font-headings);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.brand-badge {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  background-color: hsla(var(--primary), 0.15);
  color: hsl(var(--primary-hover));
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid hsla(var(--primary), 0.2);
}

.sidebar-menu {
  flex: 1;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.menu-item {
  background: none;
  border: none;
  color: hsl(var(--text-muted));
  padding: 12px 16px;
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  font-family: var(--font-main);
  font-size: 0.95rem;
  font-weight: 500;
  text-align: left;
  transition: var(--transition-fast);
}

.menu-item:hover {
  background-color: hsla(var(--text-main), 0.04);
  color: hsl(var(--text-main));
}

.menu-item.active {
  background-color: hsla(var(--primary), 0.12);
  color: hsl(var(--text-main));
  box-shadow: inset 3px 0 0 0 hsl(var(--primary));
  font-weight: 600;
}

.menu-icon {
  width: 18px;
  height: 18px;
  transition: var(--transition-fast);
}

.menu-item.active .menu-icon {
  color: hsl(var(--primary-hover));
}

.sidebar-footer {
  padding: 20px;
  border-top: 1px solid hsl(var(--border-glass));
}

.telephony-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: hsl(var(--text-muted));
}

.status-indicator-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-indicator-dot.online {
  background-color: hsl(var(--success));
  box-shadow: 0 0 8px 1px hsla(var(--success), 0.6);
}

/* Main Content Area */
.main-content {
  flex: 1;
  margin-left: 260px;
  padding: 40px;
}

.tab-pane {
  display: none;
  animation: fadeIn var(--transition-normal);
}

.tab-pane.active {
  display: block;
}

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

/* Content Header */
.content-header {
  margin-bottom: 32px;
}

.content-header.align-between {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.content-header h1 {
  font-family: var(--font-headings);
  font-size: 2.2rem;
  font-weight: 700;
  margin-bottom: 6px;
  background: linear-gradient(135deg, hsl(var(--text-main)) 30%, hsla(var(--text-main), 0.65));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.content-header p {
  color: hsl(var(--text-muted));
  font-size: 0.95rem;
}

/* Standard Premium Glass Cards */
.glass {
  background: hsla(var(--bg-card), 0.65);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid hsl(var(--border-glass));
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-sm);
}

.card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid hsl(var(--border-glass));
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-header h2 {
  font-family: var(--font-headings);
  font-size: 1.15rem;
  font-weight: 600;
}

.card-body {
  padding: 24px;
}

/* Grid Layout definitions */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px;
  margin-bottom: 32px;
}

.metric-card {
  padding: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.metric-card:hover {
  transform: translateY(-2px);
  border-color: hsla(var(--primary), 0.3);
}

.metric-title {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  color: hsl(var(--text-muted));
  letter-spacing: 0.5px;
  display: block;
  margin-bottom: 8px;
}

.metric-info h3 {
  font-family: var(--font-headings);
  font-size: 1.8rem;
  font-weight: 700;
}

.metric-icon {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.metric-icon svg {
  width: 22px;
  height: 22px;
}

.metric-icon.blue { background-color: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.metric-icon.purple { background-color: hsla(var(--primary), 0.15); color: hsl(var(--primary-hover)); }
.metric-icon.green { background-color: hsla(var(--success), 0.15); color: hsl(var(--success)); }
.metric-icon.orange { background-color: hsla(var(--warning), 0.15); color: hsl(var(--warning)); }

/* Grid Rows */
.content-row {
  display: flex;
  margin-bottom: 24px;
}

.gap-6 { gap: 24px; }
.w-full { width: 100%; }
.w-1-2 { width: 50%; }
.w-1-3 { width: 33.333%; }
.w-2-3 { width: 66.666%; }

/* Buttons */
.btn {
  font-family: var(--font-main);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 10px 20px;
  border-radius: var(--border-radius-sm);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition-fast);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 0.95rem;
  font-weight: 600;
}

.btn-primary {
  background-color: hsl(var(--primary));
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled) {
  background-color: hsl(var(--primary-hover));
  box-shadow: var(--shadow-glow);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  background-color: hsla(var(--text-main), 0.08);
  color: hsl(var(--text-main));
  border: 1px solid hsl(var(--border-glass));
}

.btn-secondary:hover {
  background-color: hsla(var(--text-main), 0.12);
}

.btn-danger {
  background-color: hsla(var(--danger), 0.15);
  color: hsl(var(--danger));
  border: 1px solid hsla(var(--danger), 0.2);
}

.btn-danger:hover {
  background-color: hsla(var(--danger), 0.25);
}

/* Forms & inputs */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 8px;
  color: hsl(var(--text-main));
}

.form-control {
  width: 100%;
  background-color: hsla(var(--text-main), 0.04);
  border: 1px solid hsl(var(--border-glass));
  color: hsl(var(--text-main));
  padding: 10px 14px;
  border-radius: var(--border-radius-sm);
  font-family: var(--font-main);
  font-size: 0.9rem;
  transition: var(--transition-fast);
}

.form-control:focus {
  outline: none;
  border-color: hsl(var(--primary));
  box-shadow: 0 0 0 2px hsla(var(--primary), 0.2);
  background-color: hsla(var(--text-main), 0.06);
}

.required {
  color: hsl(var(--danger));
  margin-left: 2px;
}

.field-hint {
  font-size: 0.75rem;
  color: hsl(var(--text-muted));
  margin-top: 5px;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* Tables Styling */
.table-container {
  overflow-x: auto;
  width: 100%;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.88rem;
}

.data-table th, .data-table td {
  padding: 14px 20px;
  border-bottom: 1px solid hsl(var(--border-glass));
}

.data-table th {
  background-color: hsla(var(--text-main), 0.02);
  color: hsl(var(--text-muted));
  font-weight: 500;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.data-table tbody tr {
  transition: var(--transition-fast);
}

.data-table tbody tr:hover {
  background-color: hsla(var(--text-main), 0.02);
}

.checkbox-col {
  width: 40px;
  padding-right: 0 !important;
}

.loading-cell {
  padding: 40px !important;
  color: hsl(var(--text-muted));
}

.table-actions {
  display: flex;
  gap: 16px;
  padding: 16px 24px;
}

.search-box {
  flex: 1;
}

.search-box input {
  width: 100%;
  background-color: hsla(var(--text-main), 0.04);
  border: 1px solid hsl(var(--border-glass));
  border-radius: var(--border-radius-sm);
  color: hsl(var(--text-main));
  padding: 8px 16px;
  font-size: 0.85rem;
}

.search-box input:focus {
  outline: none;
  border-color: hsl(var(--primary));
}

.filter-box select {
  background-color: hsla(var(--text-main), 0.04);
  border: 1px solid hsl(var(--border-glass));
  border-radius: var(--border-radius-sm);
  color: hsl(var(--text-main));
  padding: 8px 12px;
  font-size: 0.85rem;
  outline: none;
}

.table-footer {
  padding: 16px 24px;
  border-top: 1px solid hsl(var(--border-glass));
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: hsl(var(--text-muted));
}

.pagination-buttons {
  display: flex;
  gap: 8px;
}

/* Status Badges */
.badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
}

.badge-success { background-color: hsla(var(--success), 0.15); color: hsl(var(--success)); border: 1px solid hsla(var(--success), 0.2); }
.badge-warning { background-color: hsla(var(--warning), 0.15); color: hsl(var(--warning)); border: 1px solid hsla(var(--warning), 0.2); }
.badge-danger { background-color: hsla(var(--danger), 0.15); color: hsl(var(--danger)); border: 1px solid hsla(var(--danger), 0.2); }
.badge-info { background-color: hsla(var(--info), 0.15); color: hsl(var(--info)); border: 1px solid hsla(var(--info), 0.2); }
.badge-secondary { background-color: hsla(var(--text-muted), 0.15); color: hsl(var(--text-muted)); border: 1px solid hsla(var(--text-muted), 0.2); }

/* Text configurations */
.text-center { text-align: center; }
.text-monospace { font-family: monospace; }
.font-semibold { font-weight: 600; }

/* CSV Drag and Drop Zone */
.csv-upload-zone {
  border: 2px dashed hsl(var(--border-glass));
  border-radius: var(--border-radius-md);
  padding: 40px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-normal);
  background-color: hsla(var(--text-main), 0.01);
}

.csv-upload-zone:hover, .csv-upload-zone.dragover {
  border-color: hsl(var(--primary));
  background-color: hsla(var(--primary), 0.03);
}

.upload-icon {
  width: 42px;
  height: 42px;
  color: hsl(var(--text-muted));
  margin-bottom: 16px;
  transition: var(--transition-fast);
}

.csv-upload-zone:hover .upload-icon {
  color: hsl(var(--primary-hover));
  transform: translateY(-2px);
}

.zone-text {
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 8px;
}

.zone-or {
  font-size: 0.8rem;
  color: hsl(var(--text-muted));
  margin: 6px 0;
}

.csv-template-download {
  margin-top: 16px;
  font-size: 0.72rem;
  color: hsl(var(--text-muted));
  line-height: 1.4;
}

/* Upload Progress */
.upload-progress-card {
  margin-top: 20px;
  padding: 16px;
  border-radius: var(--border-radius-sm);
  background-color: hsla(var(--text-main), 0.02);
  border: 1px solid hsl(var(--border-glass));
}

.progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  margin-bottom: 8px;
}

.progress-bar-container {
  width: 100%;
  height: 6px;
  background-color: hsla(var(--text-main), 0.08);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background-color: hsl(var(--primary));
  border-radius: 3px;
  transition: width 0.1s linear;
}

/* Call Dialer / Campaign Layout */
.selected-recipients-box {
  background-color: hsla(var(--text-main), 0.03);
  border: 1px solid hsl(var(--border-glass));
  border-radius: var(--border-radius-sm);
  padding: 16px;
  font-size: 0.85rem;
  min-height: 50px;
}

.variables-map-preview {
  background-color: hsla(var(--text-main), 0.02);
  border: 1px dashed hsl(var(--border-glass));
  border-radius: var(--border-radius-sm);
  padding: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.var-tag {
  background-color: hsla(var(--primary), 0.12);
  border: 1px solid hsla(var(--primary), 0.2);
  color: hsl(var(--primary-hover));
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-family: monospace;
}

.placeholder-text {
  font-size: 0.8rem;
  color: hsl(var(--text-muted));
}

/* Dialer Progress Section */
.console-progress-container {
  padding: 16px 20px;
  border-top: 1px solid hsl(var(--border-glass));
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  margin-bottom: 8px;
}

/* Console Logger Box */
.console-box {
  background-color: #03060a;
  border-bottom: 1px solid hsl(var(--border-glass));
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  padding: 20px;
  height: 250px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.console-line {
  line-height: 1.4;
}

.console-line.system { color: #8b949e; }
.console-line.success { color: #39d353; }
.console-line.error { color: #f85149; }
.console-line.info { color: #58a6ff; }
.console-line.dial { color: #d3b339; }

/* Voice Agent Cards */
.agents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
}

.agent-card {
  padding: 24px;
  border-radius: var(--border-radius-md);
  border: 1px solid hsl(var(--border-glass));
  background-color: hsla(var(--bg-card), 0.3);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 200px;
}

.agent-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.agent-card-header h3 {
  font-family: var(--font-headings);
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.agent-desc {
  font-size: 0.8rem;
  color: hsl(var(--text-muted));
  line-height: 1.4;
  margin-bottom: 16px;
}

.agent-meta {
  background-color: hsla(var(--text-main), 0.02);
  border-radius: var(--border-radius-sm);
  padding: 12px;
  font-size: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.agent-meta-item {
  display: flex;
  justify-content: space-between;
}

.agent-meta-label {
  color: hsl(var(--text-muted));
}

.agent-meta-val {
  font-family: monospace;
}

/* Modals overlays & windows */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: none;
  animation: fadeIn var(--transition-fast);
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  background-color: hsl(var(--bg-card));
  border: 1px solid hsl(var(--border-glass));
  border-radius: var(--border-radius-md);
  width: 500px;
  max-width: 90%;
  z-index: 101;
  display: none;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transition: transform var(--transition-fast);
}

.modal.open, .modal-overlay.open {
  display: block;
}

.modal.open {
  transform: translate(-50%, -50%) scale(1);
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid hsl(var(--border-glass));
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  font-family: var(--font-headings);
  font-size: 1.2rem;
  font-weight: 600;
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 1.6rem;
  color: hsl(var(--text-muted));
  cursor: pointer;
  line-height: 1;
}

.modal-close-btn:hover {
  color: hsl(var(--text-main));
}

.modal-body {
  padding: 24px;
  max-height: 70vh;
  overflow-y: auto;
}

.modal-footer {
  margin-top: 24px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Sliding Side Drawer Detail Panel */
.sliding-drawer-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0,0,0,0.5);
  z-index: 90;
  display: none;
  animation: fadeIn var(--transition-fast);
}

.sliding-drawer {
  position: fixed;
  top: 0;
  right: -420px;
  bottom: 0;
  width: 420px;
  background-color: hsl(var(--bg-card));
  border-left: 1px solid hsl(var(--border-glass));
  z-index: 91;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  transition: right var(--transition-normal);
}

.sliding-drawer.open {
  right: 0;
}

.sliding-drawer-overlay.open {
  display: block;
}

.drawer-header {
  padding: 20px 24px;
  border-bottom: 1px solid hsl(var(--border-glass));
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.drawer-header-title h2 {
  font-family: var(--font-headings);
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.drawer-close-btn {
  background: none;
  border: none;
  font-size: 1.8rem;
  color: hsl(var(--text-muted));
  cursor: pointer;
}

.drawer-body {
  padding: 24px;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.drawer-details-card {
  background-color: hsla(var(--text-main), 0.02);
  border: 1px solid hsl(var(--border-glass));
  border-radius: var(--border-radius-sm);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
}

.detail-label {
  color: hsl(var(--text-muted));
}

.detail-value {
  text-align: right;
}

.drawer-section h3 {
  font-family: var(--font-headings);
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: hsl(var(--text-muted));
}

.ai-summary-text {
  font-size: 0.88rem;
  line-height: 1.5;
  background-color: hsla(var(--primary), 0.05);
  border: 1px solid hsla(var(--primary), 0.15);
  border-left: 3px solid hsl(var(--primary));
  padding: 14px;
  border-radius: var(--border-radius-sm);
}

/* Chat Transcript Bubble styles */
.transcript-chat-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 4px 0;
}

.chat-bubble {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: var(--border-radius-md);
  font-size: 0.85rem;
  line-height: 1.4;
  display: flex;
  flex-direction: column;
}

.chat-bubble.assistant {
  background-color: hsla(var(--text-main), 0.04);
  border: 1px solid hsl(var(--border-glass));
  align-self: flex-start;
  border-bottom-left-radius: 2px;
}

.chat-bubble.user {
  background-color: hsla(var(--primary), 0.15);
  border: 1px solid hsla(var(--primary), 0.2);
  color: hsl(var(--text-main));
  align-self: flex-end;
  border-bottom-right-radius: 2px;
}

.chat-sender {
  font-size: 0.7rem;
  font-weight: 600;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.chat-bubble.assistant .chat-sender { color: hsl(var(--info)); }
.chat-bubble.user .chat-sender { color: hsl(var(--primary-hover)); }

.chat-text {
  word-break: break-word;
}

/* Notification Toast */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  padding: 14px 20px;
  background-color: hsl(var(--bg-card));
  border: 1px solid hsl(var(--border-glass));
  border-radius: var(--border-radius-sm);
  color: hsl(var(--text-main));
  font-size: 0.85rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-lg);
  min-width: 280px;
  animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.success { border-left: 4px solid hsl(var(--success)); }
.toast.error { border-left: 4px solid hsl(var(--danger)); }
.toast.info { border-left: 4px solid hsl(var(--info)); }

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

/* Loader elements */
.btn-loader {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 1s linear infinite;
  display: inline-block;
}

.hidden {
  display: none !important;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Responsive Media Queries */
@media (max-width: 1024px) {
  .w-1-2, .w-1-3, .w-2-3 {
    width: 100% !important;
  }
  .content-row.gap-6 {
    flex-direction: column;
  }
  .form-grid-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .app-layout {
    flex-direction: column;
  }
  
  .sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    top: auto;
    width: 100%;
    height: 65px;
    flex-direction: row;
    border-right: none;
    border-top: 1px solid hsl(var(--border-glass));
    z-index: 100;
  }

  .sidebar-brand {
    display: none;
  }

  .sidebar-menu {
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
    padding: 0;
    flex: 1;
    gap: 0;
  }

  .menu-item {
    flex-direction: column;
    padding: 8px 4px;
    gap: 4px;
    justify-content: center;
    width: 100%;
    height: 100%;
    border-radius: 0;
    text-align: center;
  }

  .menu-item.active {
    box-shadow: inset 0 3px 0 0 hsl(var(--primary));
  }

  .menu-item span {
    display: block !important;
    font-size: 0.65rem;
  }

  .sidebar-footer {
    padding: 0 16px;
    border-top: none;
    border-left: 1px solid hsl(var(--border-glass));
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .telephony-status {
    display: none;
  }

  .theme-toggle-btn {
    margin-top: 0;
  }

  .main-content {
    margin-left: 0;
    margin-bottom: 65px;
    padding: 20px 16px;
  }

  .content-header h1 {
    font-size: 1.6rem;
  }

  .content-header.align-between {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .action-buttons {
    width: 100%;
  }

  .action-buttons .btn {
    width: 100%;
    justify-content: center;
  }

  .metrics-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  
  .metric-card {
    padding: 16px;
  }
  
  .metric-info h3 {
    font-size: 1.4rem;
  }

  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .card-header > div {
    width: 100%;
    flex-direction: column;
    align-items: stretch !important;
  }

  #dashboard-agent-filter {
    width: 100% !important;
  }

  .table-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .search-box, .filter-box {
    width: 100%;
  }

  .filter-box select {
    width: 100%;
  }
  
  .table-footer {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }

  .sliding-drawer {
    width: 100%;
    right: -100%;
  }
  
  .drawer-header {
    padding: 16px;
  }
  
  .drawer-header-title {
    max-width: 80%;
  }

  .modal {
    width: 95%;
    max-height: 90vh;
  }
}

@media (max-width: 480px) {
  .metrics-grid {
    grid-template-columns: 1fr;
  }
  
  .content-header h1 {
    font-size: 1.4rem;
  }
}

/* Dropdown Option Theme Overrides (Fixes white-on-white dark mode options bug) */
select option {
  background-color: hsl(var(--bg-card)) !important;
  color: hsl(var(--text-main)) !important;
}

body.dark-theme select option {
  background-color: #1e293b !important;
  color: #ffffff !important;
}

body:not(.dark-theme) select option {
  background-color: #ffffff !important;
  color: #1e293b !important;
}


/* Theme Toggle Button in Sidebar Footer */
.theme-toggle-btn {
  background: none;
  border: none;
  color: hsl(var(--text-muted));
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: 50%;
  margin-top: 10px;
  width: 34px;
  height: 34px;
  transition: var(--transition-fast);
}

.theme-toggle-btn:hover {
  background-color: hsla(var(--text-main), 0.08);
  color: hsl(var(--text-main));
}

.theme-icon {
  width: 20px;
  height: 20px;
  transition: transform var(--transition-normal);
}

.theme-toggle-btn:hover .theme-icon {
  transform: rotate(30deg);
}

/* Dialer Searchable Customer Selector Container */
.dialer-customer-selector {
  border: 1px solid hsl(var(--border-glass));
  border-radius: var(--border-radius-sm);
  padding: 12px;
  background-color: hsla(var(--text-main), 0.01);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dialer-customer-list-box {
  max-height: 180px;
  overflow-y: auto;
  border: 1px solid hsl(var(--border-glass));
  border-radius: 4px;
  background-color: hsl(var(--bg-card));
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dialer-customer-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  padding: 6px 8px;
  border-radius: 4px;
  transition: var(--transition-fast);
  cursor: pointer;
  color: hsl(var(--text-main));
}

.dialer-customer-item:hover {
  background-color: hsla(var(--primary), 0.08);
}

.dialer-customer-item input[type="checkbox"] {
  cursor: pointer;
  accent-color: hsl(var(--primary));
}

.dialer-customer-item-info {
  display: flex;
  justify-content: space-between;
  width: 100%;
  gap: 10px;
}

.dialer-customer-item-name {
  font-weight: 500;
}

.dialer-customer-item-phone {
  font-family: monospace;
  color: hsl(var(--text-muted));
}

/* Collapsible Header style for sliding drawer */
.collapsible-header {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  padding: 6px 0;
  border-bottom: 1px dashed hsla(var(--text-main), 0.1);
  margin-bottom: 12px;
}

.collapsible-header:hover {
  color: hsl(var(--primary)) !important;
}

.toggle-arrow {
  font-size: 0.8rem;
  transition: transform 0.3s ease;
  color: hsl(var(--text-muted));
}

.collapsible-header:hover .toggle-arrow {
  color: hsl(var(--primary));
}

.transcript-chat-container {
  max-height: 500px;
  overflow-y: auto;
  transition: max-height 0.3s ease, opacity 0.2s ease, padding 0.3s ease;
  opacity: 1;
}

.transcript-chat-container.collapsed {
  max-height: 0;
  opacity: 0;
  padding: 0;
  overflow: hidden;
}

