:root {
  /* Light Theme Palette - Blue & White */
  --bg-body: #f4f6f8;
  /* Very light gray/blue tint for background */
  --bg-sidebar: #ffffff;
  /* White sidebar */
  --bg-card: #ffffff;
  /* White cards */
  --border-color: #e2e8f0;
  /* Light slate border */

  --primary-accent: #10b981;
  /* Emerald 500 / Primary Green */
  --primary-hover: #059669;
  /* Emerald 600 */

  --text-primary: #1e293b;
  /* Slate 800 */
  --text-secondary: #64748b;
  /* Slate 500 */
  --text-muted: #94a3b8;
  /* Slate 400 */

  --font-heading: "Inter", sans-serif;
  --font-body: "Inter", sans-serif;

  --sidebar-width: 220px;
}

body {
  background-color: var(--bg-body);
  color: var(--text-primary);
  font-family: var(--font-body);
  overflow-x: hidden;
  min-height: 100vh;
}

body.details-view {
  overflow: hidden;
}

body.details-view .main-content-logged {
  height: calc(100vh - 64px);
  overflow: hidden;
  padding: 0;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text-primary);
}

.text-primary-accent {
  color: var(--primary-accent) !important;
}

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

/* Navbar */
.navbar {
  background-color: #ffffff;
  border-bottom: 1px solid var(--border-color);
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  height: 64px;
  z-index: 1030;
}

.navbar-brand span {
  color: var(--text-primary);
}

.navbar-toggler {
  border-color: var(--border-color);
}

.navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(30, 41, 59, 0.75)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* Primary Button */
.btn-primary-accent {
  background-color: var(--primary-accent);
  color: #ffffff;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.btn-primary-accent:hover {
  background-color: var(--primary-hover);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  height: calc(100vh - 64px);
  /* Subtract navbar height */
  position: fixed;
  top: 64px;
  left: 0;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  padding: 1.25rem 0.75rem;
  z-index: 1020;
  /* Ensure it stays above content if needed, below navbar dropdowns */
  transition: width 0.3s ease;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar.collapsed {
  width: 72px;
  padding: 1.25rem 0.5rem;
}

.nav-link {
  color: var(--text-secondary);
  font-weight: 500;
  padding: 0.6rem 0.75rem;
  border-radius: 0.5rem;
  transition: all 0.2s;
  margin-bottom: 0.2rem;
  display: flex;
  align-items: center;
  white-space: nowrap;
  /* Prevent text wrapping during transition */
}

.sidebar.collapsed .nav-link {
  justify-content: center;
  padding: 0.6rem 0;
}

.nav-link i {
  font-size: 1.2rem;
  margin-right: 0.75rem;
  color: var(--text-muted);
  transition: margin 0.3s;
  flex-shrink: 0;
  /* Prevent icon shrinking */
}

.sidebar.collapsed .nav-link i {
  margin-right: 0;
}

.nav-link span {
  transition: opacity 0.2s;
}

.sidebar.collapsed .nav-link span {
  opacity: 0;
  width: 0;
  display: none;
}

.nav-link:hover {
  color: var(--primary-accent);
  background-color: #f0f9ff;
  /* Light blue hover */
}

.nav-link:hover i {
  color: var(--primary-accent);
}

.nav-link.active {
  background-color: #e0f2fe;
  /* Stronger light blue */
  color: var(--primary-accent);
  font-weight: 600;
}

.nav-link.active i {
  color: var(--primary-accent);
}

/* Main Content Area */
.main-content-logged {
  margin-left: var(--sidebar-width);
  margin-top: 64px;
  padding: 1.5rem;
  min-height: calc(100vh - 64px);
  background-color: var(--bg-body);
  transition: margin-left 0.3s ease;
}

.main-content-logged.collapsed {
  margin-left: 72px;
}

/* Details Page Layout */
.detail-page {
  height: calc(100vh - 64px);
  padding: 1.5rem 1rem 1.5rem;
  overflow: hidden;
  box-sizing: border-box;
}

.detail-grid {
  align-items: stretch;
}

.detail-col {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.detail-panel {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 0;
}

.detail-left-fixed {
  flex: 0 0 auto;
}

.detail-left-flex {
  flex: 1 1 auto;
  min-height: 0;
}

.detail-card {
  border-radius: 18px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
  border: 1px solid var(--border-color);
}

.detail-audio {
  background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
}

.detail-kpi-card .card-header {
  background: linear-gradient(90deg, #f8fafc 0%, #ffffff 100%);
  padding: 0.75rem 1rem;
}

.detail-kpi-summary {
  padding-top: 1.25rem;
  padding-bottom: 1.25rem;
  gap: 0.5rem;
}

.detail-chat-body {
  background: #ffffff;
  min-height: 0;
}

.detail-chat-scroll {
  padding: 1.25rem;
  max-height: 62vh;
  overflow-y: auto;
  min-height: 0;
}

.detail-score-value {
  font-size: 2.1rem;
  line-height: 1.1;
  margin-top: 0.4rem;
  margin-bottom: 0.15rem;
}

.detail-status-wrap {
  margin-top: 1.35rem;
}

@media (min-width: 992px) {
  .detail-page {
    padding: 1.75rem 1.25rem 1.75rem;
    height: calc(100vh - 64px);
  }

  .detail-grid {
    height: 100%;
  }

  .detail-col {
    height: 100%;
  }

  .detail-panel {
    flex: 1 1 auto;
    height: 100%;
  }

  .detail-chat-card {
    flex: 1 1 auto;
    height: 100%;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  .detail-chat-body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
  }

  .detail-chat-scroll {
    flex: 1 1 auto;
    max-height: none;
    overflow-y: auto;
    min-height: 0;
  }
}

@media (max-width: 575.98px) {
  .detail-page {
    padding: 1rem 0.5rem 1.25rem;
  }
}

/* Details Components */
.custom-scrollbar::-webkit-scrollbar {
  width: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
  background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 10px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.bubble-agent {
  background-color: #eef2ff;
  color: #374151;
  border-bottom-right-radius: 0.2rem;
}

.bubble-customer {
  background-color: #ffffff;
  color: #374151;
  border: 1px solid #e2e8f0;
  border-bottom-left-radius: 0.2rem;
}

.gauge-container {
  position: relative;
  width: 170px;
  height: 90px;
  margin: 0 auto;
}

.gauge-bg,
.gauge-arc {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
  transform: rotate(180deg);
  transform-origin: 50% 100%;
}

.gauge-bg {
  stroke: #f1f5f9;
}

.gauge-arc {
  stroke: currentColor;
  stroke-dasharray: 126;
  stroke-dashoffset: var(--gauge-offset, 126);
  transition: stroke-dashoffset 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.kpi-progress-track {
  height: 10px;
  background-color: #f1f5f9;
  border-radius: 20px;
  overflow: hidden;
  width: 100%;
}

.kpi-progress-fill {
  height: 100%;
  border-radius: 20px;
  width: var(--progress-width, 0%);
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 0.55rem 0.4rem;
  text-align: center;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  border-color: var(--primary-accent);
}

.main-content-landing {
  margin-top: 64px;
  padding: 0;
  background-color: #ffffff;
}

/* Cards */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  box-shadow:
    0 1px 3px 0 rgba(0, 0, 0, 0.1),
    0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

.card-header {
  background-color: transparent;
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 1.25rem;
}

.card-header h5,
.card-header h6 {
  margin-bottom: 0;
  color: var(--text-primary);
}

.card-body {
  padding: 1.25rem;
}

/* Tables */
.table {
  display: table;
  /* Ensure table display for structure */
  width: 100%;
  margin-bottom: 1rem;
  vertical-align: top;
  border-color: var(--border-color);
  color: var(--text-primary);
}

.table th {
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-color);
  background-color: #f8fafc;
}

.table td {
  vertical-align: middle;
  border-bottom: 1px solid var(--border-color);
}

/* Forms */
.form-control,
.form-select {
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--primary-accent);
  box-shadow: 0 0 0 0.25rem rgba(2, 132, 199, 0.15);
  /* Blue ring */
}

.input-group-text {
  background-color: #f8fafc;
  border-color: var(--border-color);
  color: var(--text-secondary);
}

/* Landing Page Hero */
.hero-section {
  padding: 6rem 0;
  background: linear-gradient(135deg, #eff6ff 0%, #ffffff 100%);
  text-align: center;
}

.hero-title {
  font-size: 3rem;
  font-weight: 800;
  margin-bottom: 1.5rem;
  color: #1e293b;
}

.hero-subtitle {
  font-size: 1.25rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 2.5rem;
}

/* Feature Grid */
.feature-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 1rem;
  background-color: #e0f2fe;
  color: var(--primary-accent);
  margin-bottom: 1rem;
  font-size: 1.75rem;
}

/* Helpers */
.bg-dark-subtle {
  background-color: #f1f5f9 !important;
  /* Slate 100 override */
}

.border-dark-subtle {
  border-color: #e2e8f0 !important;
}

.text-white {
  color: var(--text-primary) !important;
}

.text-dark-force {
  color: #000000 !important;
}

.text-white-force {
  color: #ffffff !important;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-in {
  animation: fadeIn 0.6s ease-out forwards;
}

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

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* User Selection Cards (Audios Page) */
.user-card {
  transition: all 0.2s ease;
  border-width: 1px;
}

.user-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  border-color: var(--primary-accent);
}

.user-card.selected-card {
  border-color: var(--primary-accent) !important;
  background-color: #f0f9ff !important;
  /* Light blue bg */
  border-width: 2px !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 6px -1px rgba(2, 132, 199, 0.2);
}

.cursor-pointer {
  cursor: pointer;
}

/* SVG Stroke Utilities */
.stroke-success {
  stroke: #10b981 !important;
}

.stroke-warning {
  stroke: #f59e0b !important;
}

.stroke-danger {
  stroke: #ef4444 !important;
}

.stroke-info {
  stroke: #3b82f6 !important;
}
