/* CSS Variables - Updated 2025-10-25 */
:root {
  --primary-color: #6366f1;
  --primary-hover: #4f46e5;
  --secondary-color: #8b5cf6;
  --success-color: #10b981;
  --error-color: #ef4444;
  --warning-color: #f59e0b;
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --bg-primary: #ffffff;
  --bg-secondary: #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);
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
}

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

/* Base Styles */
html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  max-width: 100vw;
  /* Enable pull-to-refresh on mobile */
  overscroll-behavior-y: auto;
}

/* Hide scrollbars everywhere while keeping scroll functionality */
body::-webkit-scrollbar,
#app::-webkit-scrollbar,
*::-webkit-scrollbar {
  display: none;
}

body,
#app,
* {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  max-width: 100vw;
}

/* Loading Screen */
.loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  gap: var(--spacing-md);
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.spin {
  animation: spin 0.8s linear infinite;
}

/* Typography */
h1 {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: var(--spacing-md);
}

h2 {
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: var(--spacing-md);
}

h3 {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: var(--spacing-sm);
}

p {
  margin-bottom: var(--spacing-md);
  color: var(--text-secondary);
}

/* Container */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing-md);
}

/* Card */
.card {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-md);
}

@media (max-width: 768px) {
  .card {
    box-shadow: none;
  }
}

/* Button */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  gap: var(--spacing-xs);
}

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

.btn-primary {
  background-color: var(--primary-color);
  color: white;
}

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

.btn-secondary {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
  background-color: var(--border-color);
}

.btn-danger {
  background-color: var(--error-color);
  color: white;
}

.btn-danger:hover:not(:disabled) {
  background-color: #dc2626;
}

.btn-full {
  width: 100%;
}

/* Form Elements */
.form-group {
  margin-bottom: 1rem;
}

@media (min-width: 768px) {
  .agent-config-card {
    padding-bottom: 1rem !important;
  }
}

.form-label {
  display: block;
  margin-bottom: var(--spacing-xs);
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--text-primary);
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  transition: border-color 0.2s ease;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-input:disabled,
.form-textarea:disabled,
.form-select:disabled {
  background-color: var(--bg-secondary);
  cursor: not-allowed;
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

.form-error {
  margin-top: var(--spacing-xs);
  font-size: 0.75rem;
  color: var(--error-color);
}

.form-help {
  margin-top: var(--spacing-xs);
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Alert */
.alert {
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  margin-bottom: var(--spacing-md);
  border-left: 4px solid;
  position: fixed;
  bottom: 70px; /* Position above bottom nav (60px nav + 10px spacing) */
  left: 1rem;
  right: 1rem;
  z-index: 1100; /* Above bottom nav (z-index: 1000) */
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  animation: slideUp 0.3s ease-out;
}

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

.alert-success {
  background-color: #d1fae5;
  border-color: var(--success-color);
  color: #065f46;
}

.alert-error {
  background-color: #fee2e2;
  border-color: var(--error-color);
  color: #991b1b;
}

.alert-warning {
  background-color: #fef3c7;
  border-color: var(--warning-color);
  color: #92400e;
}

.alert-info {
  background-color: #dbeafe;
  border-color: #3b82f6;
  color: #1e40af;
}

/* Utility Classes */
.text-center {
  text-align: center;
}

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

.text-sm {
  font-size: 0.875rem;
}

.text-xs {
  font-size: 0.75rem;
}

.text-muted {
  color: var(--text-secondary);
}

.mt-1 { margin-top: var(--spacing-xs); }
.mt-2 { margin-top: var(--spacing-sm); }
.mt-3 { margin-top: var(--spacing-md); }
.mt-4 { margin-top: var(--spacing-lg); }

.mb-1 { margin-bottom: var(--spacing-xs); }
.mb-2 { margin-bottom: var(--spacing-sm); }
.mb-3 { margin-bottom: var(--spacing-md); }
.mb-4 { margin-bottom: var(--spacing-lg); }

.hidden {
  display: none !important;
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    padding: 0 var(--spacing-sm);
  }

  h1 {
    font-size: 1.75rem;
  }

  h2 {
    font-size: 1.25rem;
  }
}

/* Mobile Bottom Navigation */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-primary);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 0.5rem 0;
  padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
  z-index: 1000;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  min-width: 60px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s;
  cursor: pointer;
  background: none;
  border: none;
  font-size: 0.75rem;
}

.bottom-nav-item:hover {
  color: var(--primary-color);
}

.bottom-nav-item.active {
  color: var(--primary-color);
}

.bottom-nav-item svg {
  width: 24px;
  height: 24px;
  margin-bottom: 0.25rem;
}

.bottom-nav-item span {
  font-size: 0.625rem;
  font-weight: 500;
}

.nav-badge {
  position: absolute;
  top: 4px;
  right: 8px;
  background: var(--error-color);
  color: white;
  font-size: 0.625rem;
  font-weight: 600;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Add padding to content to account for bottom nav */
.with-bottom-nav {
  padding-bottom: 70px !important;
}

/* Ensure containers have proper spacing on mobile */
@media (max-width: 768px) {
  .with-bottom-nav {
    padding-bottom: calc(70px + env(safe-area-inset-bottom, 0px)) !important;
  }

  .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

/* Inbox / Messaging UI */
.inbox-container {
  display: grid;
  grid-template-columns: 380px 1fr;
  height: calc(100vh - 60px);
  max-height: calc(100vh - 60px);
  overflow: hidden;
}

.conversation-list {
  border-right: 1px solid var(--border-color);
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.inbox-header {
  padding: calc(0.8rem * 0.94) calc(1.5rem * 1.05);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

#conversations {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.conversation-item {
  display: flex;
  gap: 0.75rem;
  padding: 1rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border-color);
  transition: background 0.15s ease;
}

.conversation-item:hover {
  background: var(--bg-secondary);
}

.conversation-item.selected {
  background: #EEF2FF;
  border-left: 3px solid var(--primary-color);
}

.conversation-item.selected:hover {
  background: #E0E7FF;
}

.conversation-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.875rem;
  flex-shrink: 0;
  position: relative;
}

.unread-badge {
  background: var(--primary-color);
  color: white;
  font-size: 0.875rem;
  font-weight: 700;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.conversation-content {
  flex: 1;
  min-width: 0;
}

.conversation-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.25rem;
}

.conversation-name {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--text-primary);
}

.conversation-time {
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.conversation-unread-badge {
  background: var(--primary-color);
  color: white;
  font-size: 0.625rem;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
}

.conversation-preview {
  font-size: 0.875rem;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-thread {
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  overflow: hidden;
}

.thread-header {
  padding: calc(1.13rem * 0.8 * 1.10) 1.5rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-primary);
}

.thread-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}


.message-bubble {
  max-width: 70%;
  padding: 0.75rem 1rem;
  border-radius: 1.125rem;
  word-wrap: break-word;
}

.message-bubble.inbound {
  align-self: flex-start;
  background: var(--bg-primary);
  border-bottom-left-radius: 0.375rem;
  box-shadow: var(--shadow-sm);
}

.message-bubble.outbound {
  align-self: flex-end;
  background: var(--primary-color);
  color: white;
  border-bottom-right-radius: 0.375rem;
}

.message-content {
  font-size: 0.9375rem;
  line-height: 1.5;
  margin-bottom: 0.25rem;
}

.message-time {
  font-size: 0.6875rem;
  opacity: 0.7;
}

.message-bubble.outbound .message-time {
  text-align: right;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.25rem;
}

/* SMS Delivery Status Indicators */
.delivery-status {
  display: inline-flex;
  align-items: center;
  margin-left: 0.25rem;
}

.delivery-status.delivered svg {
  color: rgba(255, 255, 255, 0.9);
}

.delivery-status.sent svg {
  color: rgba(255, 255, 255, 0.7);
}

.delivery-status.pending svg {
  color: rgba(255, 255, 255, 0.5);
}

.delivery-status.failed svg {
  color: #ff6b6b;
}

.message-bubble.ai-message {
  position: relative;
  background: linear-gradient(135deg, #f0f4ff 0%, #e8eeff 100%);
  border: 1px solid rgba(99, 102, 241, 0.1);
  color: var(--text-primary);
}

.message-bubble.ai-message .message-content {
  color: var(--text-primary);
}

.message-bubble.ai-message .message-time {
  color: var(--text-secondary);
  opacity: 0.7;
}

.ai-badge {
  position: absolute;
  top: -6px;
  left: 12px;
  background: var(--primary-color);
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(99, 102, 241, 0.3);
}

.ai-badge svg {
  width: 11px;
  height: 11px;
}

.call-indicator {
  align-self: center;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  background: white;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  color: var(--text-secondary);
  box-shadow: var(--shadow-sm);
}

.call-icon {
  font-size: 1rem;
}

/* Call Bubble Styles */
.call-bubble {
  max-width: 75%;
  padding: 0.875rem 1rem;
  border-radius: var(--radius-lg);
  font-size: 0.9375rem;
  line-height: 1.5;
  word-wrap: break-word;
  box-shadow: var(--shadow-sm);
  margin-bottom: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.call-bubble.inbound {
  align-self: flex-start;
  background: white;
  border: 1px solid var(--border-color);
}

.call-bubble.outbound {
  align-self: flex-end;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.call-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.875rem;
}

.call-direction-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.call-bubble.outbound .call-direction-icon svg {
  stroke: white;
}

.call-type {
  flex: 1;
}

.call-duration {
  font-family: 'SF Mono', 'Monaco', 'Courier New', monospace;
  font-size: 0.8125rem;
  padding: 0.125rem 0.375rem;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 0.25rem;
}

.call-bubble.outbound .call-duration {
  background: rgba(255, 255, 255, 0.2);
}

.call-status {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
  padding: 0.375rem 0.5rem;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 0.375rem;
}

.call-bubble.outbound .call-status {
  background: rgba(255, 255, 255, 0.15);
}

.call-status-icon {
  font-weight: 700;
}

.call-status.status-completed {
  color: var(--success-color);
  background: rgba(16, 185, 129, 0.1);
}

.call-bubble.outbound .call-status.status-completed {
  color: #a7f3d0;
  background: rgba(167, 243, 208, 0.2);
}

.call-status.status-missed,
.call-status.status-failed,
.call-status.status-busy {
  color: var(--error-color);
  background: rgba(239, 68, 68, 0.1);
}

.call-bubble.outbound .call-status.status-missed,
.call-bubble.outbound .call-status.status-failed,
.call-bubble.outbound .call-status.status-busy {
  color: #fca5a5;
  background: rgba(252, 165, 165, 0.2);
}

.call-status.status-progress {
  color: var(--primary-color);
  background: rgba(99, 102, 241, 0.1);
}

.call-bubble.outbound .call-status.status-progress {
  color: #c7d2fe;
  background: rgba(199, 210, 254, 0.2);
}

.call-transcript-preview {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  padding: 0.5rem;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 0.375rem;
  font-size: 0.8125rem;
}

.call-bubble.outbound .call-transcript-preview {
  background: rgba(255, 255, 255, 0.15);
}

.call-transcript-label {
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.7;
}

.call-transcript-content {
  line-height: 1.5;
  font-size: 0.8125rem;
}

.call-recording {
  margin-top: 0.25rem;
}

.call-recording audio {
  width: 100%;
  height: 32px;
  border-radius: 0.375rem;
}

.call-bubble.outbound audio::-webkit-media-controls-panel {
  background-color: rgba(255, 255, 255, 0.2);
}

/* Call Avatar */
.call-avatar {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
}

.call-avatar svg {
  stroke: white;
}

/* SMS Avatar */
.sms-avatar {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sms-avatar svg {
  stroke: white;
}

.call-status-indicator {
  display: inline-block;
  margin-right: 0.25rem;
  font-size: 0.875rem;
}

.call-detail-recording {
  padding: 1rem 1.5rem;
  background: var(--bg-secondary);
}

.recording-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}

.call-detail-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.sentiment-positive {
  color: var(--success-color);
}

.sentiment-neutral {
  color: var(--text-secondary);
}

.sentiment-negative {
  color: var(--error-color);
}

.call-info-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.call-info-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}

.call-info-value {
  font-size: 0.9375rem;
  color: var(--text-primary);
  font-weight: 500;
}

.call-detail-transcript {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

.transcript-header {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.transcript-messages {
  display: flex;
  flex-direction: column;
  gap: 0.3125rem;
}

.transcript-bubble {
  display: flex;
  flex-direction: column;
  gap: 0.09375rem;
  max-width: 75%;
  padding: 0.25rem 6px;
  border-radius: 12px;
  box-shadow: none;
}

.transcript-bubble.agent {
  align-self: flex-start;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.transcript-bubble.user {
  align-self: flex-end;
  background: #e5e5e5;
  border: none;
  color: var(--text-primary);
}

.transcript-speaker-label {
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.7;
}

.transcript-content {
  font-size: 0.875rem;
  line-height: 1.4;
}

.call-detail-no-transcript {
  padding: 3rem 1.5rem;
  text-align: center;
  color: var(--text-secondary);
}

@media (max-width: 768px) {
  .call-detail-content {
    width: 100%;
    max-width: none;
    max-height: 100vh;
    border-radius: 0;
  }

  .call-detail-info {
    grid-template-columns: 1fr;
  }
}

.call-time {
  font-size: 0.75rem;
  opacity: 0.7;
  align-self: flex-end;
}

.empty-thread {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  padding: 2rem;
  text-align: center;
}

.message-input-container {
  padding: 1rem 1rem 0.87rem 1rem;
  margin-bottom: 1rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-primary);
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
}

.message-input {
  flex: 1;
  min-height: 40px;
  max-height: 120px;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--border-color);
  border-radius: 1.25rem;
  font-size: 0.9375rem;
  font-family: inherit;
  resize: none;
  outline: none;
  transition: border-color 0.2s;
}

.message-input:focus {
  border-color: var(--primary-color);
}

.message-input:disabled {
  background: var(--bg-secondary);
  opacity: 0.6;
}

.send-button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary-color);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s;
}

.send-button:hover:not(:disabled) {
  background: var(--primary-hover);
}

.send-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.agent-reply-button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
}

.agent-reply-button:hover {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
  border-color: transparent;
}

.agent-reply-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@media (max-width: 768px) {
  .inbox-container {
    grid-template-columns: 1fr;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: calc(60px + env(safe-area-inset-bottom, 0px)); /* Position above bottom nav */
    height: auto;
    max-height: none;
  }

  .conversation-list {
    border-right: none;
  }

  .message-thread {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .message-thread.show {
    transform: translateX(0);
  }

  .thread-header {
    display: flex;
    align-items: center;
    padding: calc(1rem * 0.8) 1rem !important;
    flex-wrap: wrap;
    flex-shrink: 0;
  }

  .thread-header h2 {
    font-size: 0.95rem !important;
  }

  .thread-header > div:last-child {
    font-size: 0.75rem !important;
    flex-wrap: wrap;
  }

  .back-button {
    display: block !important;
  }

  .thread-messages {
    flex: 1;
    min-height: 0; /* Important for flex child scrolling */
    padding: 1rem !important;
    padding-bottom: 1rem !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  .call-detail-info,
  .call-detail-transcript {
    padding: 1rem !important;
  }

  .call-detail-transcript {
    padding-bottom: 2rem !important;
  }

  .message-input-container {
    padding: 0.75rem 1rem;
    padding-bottom: 1.5rem;
    margin-bottom: 0;
    flex-shrink: 0;
    background: var(--bg-primary);
  }

  .message-bubble {
    max-width: 85%;
    padding-bottom: calc(0.75rem + 4px);
  }

  .transcript-bubble {
    padding-bottom: calc(0.25rem + 4px);
  }
}

/* Desktop-only styles */
@media (min-width: 769px) {
  .message-bubble {
    padding: 0.5rem 0.5625rem;
  }

  .transcript-bubble {
    padding: 0.5rem 0.5625rem;
  }
}

/* Toggle Switch Styles */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: .3s;
  border-radius: 26px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--primary-color);
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(22px);
}

.toggle-switch input:disabled + .toggle-slider {
  opacity: 0.5;
  cursor: not-allowed;
}