/* ================================================
   AI Sales Enablement Platform - Custom Styles
   ================================================ */

:root {
  --primary-color: #4f46e5;
  --primary-dark: #4338ca;
  --primary-light: #818cf8;
  --secondary-color: #0ea5e9;
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --danger-color: #ef4444;
  --dark-color: #1e293b;
  --light-color: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --sidebar-width: 250px;
  --header-height: 60px;
  --border-radius: 8px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 13px;
  line-height: 1.5;
  color: var(--gray-700);
  background-color: var(--gray-100);
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  color: var(--gray-800);
  line-height: 1.3;
}

h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.1rem; }
h4 { font-size: 1rem; }
h5 { font-size: 0.9rem; }
h6 { font-size: 0.85rem; }

p {
  margin-bottom: 0.75rem;
}

a {
  color: var(--primary-color);
  text-decoration: none;
}

a:hover {
  color: var(--primary-dark);
}

/* Login Page */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
}

.login-container {
  background: white;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
}

.login-logo {
  text-align: center;
  margin-bottom: 1.5rem;
}

.login-logo h1 {
  font-size: 1.25rem;
  color: var(--primary-color);
  margin-bottom: 0.25rem;
}

.login-logo p {
  font-size: 0.8rem;
  color: var(--gray-500);
  margin-bottom: 0;
}

.sso-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--gray-200);
  border-radius: var(--border-radius);
  background: white;
  color: var(--gray-700);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  margin-bottom: 0.75rem;
}

.sso-btn:hover {
  background: var(--gray-100);
  border-color: var(--gray-300);
}

.sso-btn img {
  width: 20px;
  height: 20px;
}

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

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--gray-800);
  color: white;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 1000;
  transition: all 0.3s;
}

.sidebar-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--gray-700);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-header .logo {
  width: 32px;
  height: 32px;
  background: var(--primary-color);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 0.9rem;
}

.sidebar-header h1 {
  font-size: 0.9rem;
  color: white;
  margin: 0;
}

.sidebar-nav {
  padding: 0.75rem 0;
}

.nav-section {
  padding: 0.5rem 1rem;
}

.nav-section-title {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-500);
  margin-bottom: 0.5rem;
  padding-left: 0.5rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  color: var(--gray-400);
  border-radius: 6px;
  margin-bottom: 2px;
  font-size: 0.8rem;
  transition: all 0.2s;
  cursor: pointer;
}

.nav-item:hover {
  background: var(--gray-700);
  color: white;
}

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

.nav-item i {
  width: 18px;
  text-align: center;
  font-size: 0.9rem;
}

/* Main Content */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
}

/* Header */
.header {
  background: white;
  height: var(--header-height);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-title h2 {
  font-size: 1rem;
  margin: 0;
}

.header-title p {
  font-size: 0.75rem;
  color: var(--gray-500);
  margin: 0;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-search {
  position: relative;
}

.header-search input {
  width: 200px;
  padding: 0.4rem 0.75rem 0.4rem 2rem;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  font-size: 0.8rem;
}

.header-search i {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  font-size: 0.8rem;
}

.header-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-600);
  cursor: pointer;
  position: relative;
}

.header-icon:hover {
  background: var(--gray-100);
}

.header-icon .badge {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 16px;
  height: 16px;
  background: var(--danger-color);
  color: white;
  border-radius: 50%;
  font-size: 0.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-dropdown {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
}

.user-dropdown:hover {
  background: var(--gray-100);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-color);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
}

.user-info {
  text-align: left;
}

.user-info .name {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--gray-700);
}

.user-info .role {
  font-size: 0.7rem;
  color: var(--gray-500);
}

/* Page Content */
.page-content {
  padding: 1.25rem 1.5rem;
}

/* Cards */
.card {
  background: white;
  border-radius: var(--border-radius);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
}

.card-header {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h3 {
  font-size: 0.9rem;
  margin: 0;
}

.card-body {
  padding: 1rem;
}

/* Stat Cards */
.stat-card {
  padding: 1rem;
}

.stat-card .stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  margin-bottom: 0.75rem;
}

.stat-card .stat-icon.primary {
  background: rgba(79, 70, 229, 0.1);
  color: var(--primary-color);
}

.stat-card .stat-icon.success {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success-color);
}

.stat-card .stat-icon.warning {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning-color);
}

.stat-card .stat-icon.info {
  background: rgba(14, 165, 233, 0.1);
  color: var(--secondary-color);
}

.stat-card .stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 0.25rem;
}

.stat-card .stat-label {
  font-size: 0.75rem;
  color: var(--gray-500);
  margin-bottom: 0.5rem;
}

.stat-card .stat-trend {
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.stat-card .stat-trend.up {
  color: var(--success-color);
}

.stat-card .stat-trend.down {
  color: var(--danger-color);
}

/* Score Display */
.score-display {
  text-align: center;
  padding: 1.5rem;
}

.score-circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 8px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  position: relative;
}

.score-circle.grade-a { border-color: var(--success-color); }
.score-circle.grade-b { border-color: var(--primary-color); }
.score-circle.grade-c { border-color: var(--warning-color); }
.score-circle.grade-d { border-color: var(--danger-color); }

.score-circle .score-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--gray-800);
  line-height: 1;
}

.score-circle .score-grade {
  font-size: 0.8rem;
  color: var(--gray-500);
}

.score-trend {
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
}

/* Score Breakdown */
.score-breakdown {
  padding: 0.75rem 0;
}

.score-breakdown-item {
  display: flex;
  align-items: center;
  margin-bottom: 0.75rem;
}

.score-breakdown-item .label {
  width: 130px;
  font-size: 0.75rem;
  color: var(--gray-600);
}

.score-breakdown-item .bar-container {
  flex: 1;
  height: 6px;
  background: var(--gray-200);
  border-radius: 3px;
  overflow: hidden;
  margin: 0 0.75rem;
}

.score-breakdown-item .bar {
  height: 100%;
  border-radius: 3px;
  background: var(--primary-color);
}

.score-breakdown-item .value {
  width: 30px;
  text-align: right;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray-700);
}

/* Tables */
.table {
  font-size: 0.8rem;
}

.table th {
  font-weight: 600;
  color: var(--gray-600);
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.03em;
  padding: 0.75rem;
  border-bottom: 2px solid var(--gray-200);
}

.table td {
  padding: 0.75rem;
  vertical-align: middle;
  border-bottom: 1px solid var(--gray-100);
}

.table tbody tr:hover {
  background: var(--gray-50);
}

/* Badges */
.badge {
  padding: 0.25rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 500;
  border-radius: 4px;
}

.badge-success { background: rgba(16, 185, 129, 0.1); color: var(--success-color); }
.badge-warning { background: rgba(245, 158, 11, 0.1); color: var(--warning-color); }
.badge-danger { background: rgba(239, 68, 68, 0.1); color: var(--danger-color); }
.badge-primary { background: rgba(79, 70, 229, 0.1); color: var(--primary-color); }
.badge-info { background: rgba(14, 165, 233, 0.1); color: var(--secondary-color); }

/* Buttons */
.btn {
  font-size: 0.8rem;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-sm {
  font-size: 0.75rem;
  padding: 0.35rem 0.75rem;
}

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

.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.btn-outline-primary {
  color: var(--primary-color);
  border-color: var(--primary-color);
}

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

/* Forms */
.form-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: 0.35rem;
}

.form-control, .form-select {
  font-size: 0.8rem;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  border: 1px solid var(--gray-300);
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-text {
  font-size: 0.7rem;
  color: var(--gray-500);
}

/* Chat Interface */
.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--header-height) - 2.5rem);
  background: white;
  border-radius: var(--border-radius);
  border: 1px solid var(--gray-200);
  overflow: hidden;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}

.chat-message {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
  max-width: 85%;
}

.chat-message.user {
  margin-left: auto;
  flex-direction: row-reverse;
}

.chat-message .avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.chat-message.assistant .avatar {
  background: var(--primary-color);
  color: white;
}

.chat-message.user .avatar {
  background: var(--gray-300);
  color: var(--gray-700);
}

.chat-message .content {
  background: var(--gray-100);
  padding: 0.75rem 1rem;
  border-radius: 12px;
  font-size: 0.85rem;
  line-height: 1.5;
}

.chat-message.user .content {
  background: var(--primary-color);
  color: white;
}

.chat-message .content h4 {
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}

.chat-message .content ul {
  margin: 0.5rem 0;
  padding-left: 1.25rem;
}

.chat-message .content li {
  margin-bottom: 0.25rem;
}

.chat-input-container {
  border-top: 1px solid var(--gray-200);
  padding: 1rem;
  background: white;
}

.chat-input-wrapper {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
}

.chat-input {
  flex: 1;
  border: 1px solid var(--gray-300);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  resize: none;
  max-height: 120px;
}

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

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

.chat-send-btn:hover {
  background: var(--primary-dark);
}

.chat-quick-actions {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.quick-action-btn {
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-radius: 20px;
  color: var(--gray-600);
  cursor: pointer;
  transition: all 0.2s;
}

.quick-action-btn:hover {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

/* Context Form */
.context-form-container {
  background: white;
  border-radius: var(--border-radius);
  border: 1px solid var(--gray-200);
  height: calc(100vh - var(--header-height) - 2.5rem);
  overflow-y: auto;
}

.context-form-header {
  padding: 1rem;
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  background: white;
  z-index: 10;
}

.context-form-body {
  padding: 1rem;
}

.form-section {
  margin-bottom: 1.5rem;
}

.form-section-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.form-section-title i {
  color: var(--primary-color);
}

/* Recommendations Panel */
.recommendation-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--border-radius);
  margin-bottom: 1rem;
}

.recommendation-card .card-header {
  background: var(--gray-50);
}

.recommendation-card .card-header h4 {
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.recommendation-card .card-header h4 i {
  color: var(--primary-color);
}

.product-item {
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  padding: 0.75rem;
  margin-bottom: 0.75rem;
}

.product-item:last-child {
  margin-bottom: 0;
}

.product-item .product-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 0.5rem;
}

.product-item .product-name {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--gray-800);
}

.product-item .relevance-badge {
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  background: var(--success-color);
  color: white;
  border-radius: 4px;
}

.product-item .product-reason {
  font-size: 0.8rem;
  color: var(--gray-600);
  margin-bottom: 0.5rem;
}

.product-item .product-features {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.product-item .feature-tag {
  font-size: 0.7rem;
  padding: 0.15rem 0.4rem;
  background: var(--gray-100);
  color: var(--gray-600);
  border-radius: 3px;
}

.talking-point {
  border-left: 3px solid var(--primary-color);
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.75rem;
  background: var(--gray-50);
  border-radius: 0 6px 6px 0;
}

.talking-point .point-text {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: 0.25rem;
}

.talking-point .point-source {
  font-size: 0.7rem;
  color: var(--gray-500);
}

.objection-item {
  margin-bottom: 0.75rem;
  padding: 0.75rem;
  background: var(--gray-50);
  border-radius: 6px;
}

.objection-item .objection-text {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--danger-color);
  margin-bottom: 0.35rem;
}

.objection-item .response-text {
  font-size: 0.8rem;
  color: var(--gray-600);
}

/* Feedback Form */
.feedback-section {
  background: var(--gray-50);
  padding: 1rem;
  border-radius: var(--border-radius);
  margin-bottom: 1rem;
}

.feedback-section .section-title {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--gray-700);
}

.rating-scale {
  display: flex;
  gap: 0.5rem;
}

.rating-scale .rating-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  background: white;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--gray-600);
  cursor: pointer;
  transition: all 0.2s;
}

.rating-scale .rating-btn:hover,
.rating-scale .rating-btn.active {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

/* Charts (placeholder styling) */
.chart-container {
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-50);
  border-radius: 6px;
  color: var(--gray-400);
  font-size: 0.8rem;
}

.mini-chart {
  height: 60px;
  display: flex;
  align-items: flex-end;
  gap: 4px;
  padding: 0.5rem 0;
}

.mini-chart .bar {
  flex: 1;
  background: var(--primary-color);
  border-radius: 2px;
  opacity: 0.6;
}

.mini-chart .bar:last-child {
  opacity: 1;
}

/* Leaderboard */
.leaderboard-item {
  display: flex;
  align-items: center;
  padding: 0.75rem;
  border-bottom: 1px solid var(--gray-100);
}

.leaderboard-item:last-child {
  border-bottom: none;
}

.leaderboard-item .rank {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  margin-right: 0.75rem;
}

.leaderboard-item .rank.gold {
  background: linear-gradient(135deg, #ffd700 0%, #ffb800 100%);
  color: #7c5c00;
}

.leaderboard-item .rank.silver {
  background: linear-gradient(135deg, #c0c0c0 0%, #a0a0a0 100%);
  color: #4a4a4a;
}

.leaderboard-item .rank.bronze {
  background: linear-gradient(135deg, #cd7f32 0%, #b87333 100%);
  color: white;
}

.leaderboard-item .rank.normal {
  background: var(--gray-100);
  color: var(--gray-600);
}

.leaderboard-item .user-info {
  flex: 1;
}

.leaderboard-item .user-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--gray-700);
}

.leaderboard-item .user-team {
  font-size: 0.7rem;
  color: var(--gray-500);
}

.leaderboard-item .score {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--gray-800);
}

/* Activity Timeline */
.activity-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--gray-100);
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-item .activity-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  flex-shrink: 0;
}

.activity-item .activity-icon.query {
  background: rgba(79, 70, 229, 0.1);
  color: var(--primary-color);
}

.activity-item .activity-icon.feedback {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success-color);
}

.activity-item .activity-icon.score {
  background: rgba(14, 165, 233, 0.1);
  color: var(--secondary-color);
}

.activity-item .activity-content {
  flex: 1;
}

.activity-item .activity-text {
  font-size: 0.8rem;
  color: var(--gray-700);
  margin-bottom: 0.15rem;
}

.activity-item .activity-time {
  font-size: 0.7rem;
  color: var(--gray-500);
}

/* KB Management */
.kb-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--border-radius);
  padding: 1rem;
  margin-bottom: 1rem;
}

.kb-card .kb-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 0.75rem;
}

.kb-card .kb-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.kb-card .kb-icon.product {
  background: rgba(79, 70, 229, 0.1);
  color: var(--primary-color);
}

.kb-card .kb-icon.softskills {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success-color);
}

.kb-card .kb-icon.trends {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning-color);
}

.kb-card .kb-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.kb-card .kb-description {
  font-size: 0.75rem;
  color: var(--gray-500);
  margin-bottom: 0.75rem;
}

.kb-card .kb-stats {
  display: flex;
  gap: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--gray-100);
}

.kb-card .kb-stat {
  text-align: center;
}

.kb-card .kb-stat-value {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-800);
}

.kb-card .kb-stat-label {
  font-size: 0.65rem;
  color: var(--gray-500);
  text-transform: uppercase;
}

/* Document List */
.document-item {
  display: flex;
  align-items: center;
  padding: 0.75rem;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  margin-bottom: 0.5rem;
}

.document-item .doc-icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  margin-right: 0.75rem;
}

.document-item .doc-icon.pdf {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger-color);
}

.document-item .doc-icon.doc {
  background: rgba(14, 165, 233, 0.1);
  color: var(--secondary-color);
}

.document-item .doc-info {
  flex: 1;
}

.document-item .doc-name {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: 0.15rem;
}

.document-item .doc-meta {
  font-size: 0.7rem;
  color: var(--gray-500);
}

.document-item .doc-status {
  margin-left: 0.75rem;
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 0.5rem 0;
}

.typing-indicator span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gray-400);
  animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {
  0%, 100% { opacity: 0.3; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-4px); }
}

/* Responsive */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

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

  .main-content {
    margin-left: 0;
  }
}

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

::-webkit-scrollbar-track {
  background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--gray-400);
}

/* ================================================
   Enhanced Chat Interface Styles
   ================================================ */

/* Main Header for Chat Page */
.main-header {
  background: white;
  height: var(--header-height);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

/* Chat Container Full Height */
.chat-container {
  display: flex;
  height: calc(100vh - var(--header-height));
  background: var(--gray-50);
  position: relative;
}

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

/* Welcome Screen */
.chat-welcome {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Quick Action Buttons */
.quick-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  min-height: 80px;
}

.quick-action-btn:hover {
  border-color: var(--primary-color);
  background: rgba(79, 70, 229, 0.05);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.quick-action-btn i {
  font-size: 1.25rem;
  color: var(--primary-color);
}

.quick-action-btn span {
  font-size: 0.75rem;
  color: var(--gray-600);
  font-weight: 500;
}

/* Chat Messages */
.chat-message {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  max-width: 80%;
  animation: messageIn 0.3s ease-out;
}

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

.chat-message.user-message {
  margin-left: auto;
  flex-direction: row-reverse;
}

.chat-message.ai-message {
  margin-right: auto;
}

.message-avatar .avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  flex-shrink: 0;
  background: var(--primary-color);
  color: white;
}

.message-avatar .ai-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #4f46e5 0%, #0ea5e9 100%);
  color: white;
  font-size: 1rem;
}

.message-content {
  background: white;
  padding: 1rem 1.25rem;
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
}

.user-message .message-content {
  background: var(--primary-color);
  color: white;
  border: none;
}

.message-text {
  font-size: 0.85rem;
  line-height: 1.6;
}

.message-text strong {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  color: var(--gray-800);
}

.user-message .message-text strong {
  color: white;
}

.message-text p {
  margin-bottom: 0.75rem;
}

.message-text ul, .message-text ol {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
}

.message-text li {
  margin-bottom: 0.35rem;
}

.message-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--gray-100);
}

.user-message .message-meta {
  border-top-color: rgba(255,255,255,0.2);
}

.message-time {
  font-size: 0.7rem;
  color: var(--gray-400);
}

.user-message .message-time {
  color: rgba(255,255,255,0.7);
}

.message-actions {
  display: flex;
  gap: 0.5rem;
}

.message-actions button {
  opacity: 0.5;
  transition: opacity 0.2s;
}

.message-actions button:hover {
  opacity: 1;
}

.message-sources {
  margin-top: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--gray-100);
}

/* Recommendation Cards in Chat */
.recommendation-card {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 1rem;
  margin: 0.75rem 0;
}

.recommendation-card h6 {
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
  color: var(--gray-800);
}

.recommendation-card ul, .recommendation-card ol {
  margin: 0;
  padding-left: 1.25rem;
}

.recommendation-card li {
  margin-bottom: 0.35rem;
  font-size: 0.8rem;
}

.recommendation-card blockquote {
  font-style: italic;
  color: var(--gray-600);
}

/* Product Recommendation in Chat */
.product-recommendation {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 1rem;
  margin: 0.75rem 0;
}

/* Trend Card in Chat */
.trend-card {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin: 0.5rem 0;
}

.trend-card p {
  margin-bottom: 0.25rem;
}

/* Alert styling in chat */
.message-text .alert {
  margin: 0.75rem 0 0 0;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  font-size: 0.8rem;
}

/* Context Panel */
.context-panel {
  width: 280px;
  background: white;
  border-left: 1px solid var(--gray-200);
  overflow-y: auto;
  transition: all 0.3s;
}

.context-panel.collapsed {
  width: 50px;
}

.context-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  border-bottom: 1px solid var(--gray-200);
  background: var(--gray-50);
  font-size: 0.85rem;
}

.context-panel-body {
  padding: 1rem;
}

.form-check-sm {
  padding-left: 1.5rem;
  margin-bottom: 0.35rem;
}

.form-check-sm .form-check-input {
  width: 0.9rem;
  height: 0.9rem;
  margin-top: 0.2rem;
}

.form-check-sm .form-check-label {
  font-size: 0.8rem;
}

/* Chat Input Area */
.chat-input-area {
  background: white;
  border-top: 1px solid var(--gray-200);
  padding: 1rem 1.5rem;
}

.chat-input-container {
  max-width: 900px;
  margin: 0 auto;
}

.chat-input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  padding: 0.5rem;
}

.chat-input-wrapper:focus-within {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.chat-input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 0.5rem;
  font-size: 0.85rem;
  resize: none;
  max-height: 120px;
  min-height: 24px;
  line-height: 1.5;
}

.chat-input:focus {
  outline: none;
}

.chat-input::placeholder {
  color: var(--gray-400);
}

.chat-send-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 8px;
}

.chat-input-footer {
  text-align: center;
  margin-top: 0.5rem;
}

.chat-input-footer small {
  font-size: 0.7rem;
}

/* Sidebar Footer */
.sidebar-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  border-top: 1px solid var(--gray-700);
  background: var(--gray-800);
}

/* Avatar Sizes */
.avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 600;
  background: var(--primary-color);
  color: white;
}

.avatar-sm {
  width: 32px;
  height: 32px;
  font-size: 0.75rem;
}

.avatar-md {
  width: 40px;
  height: 40px;
  font-size: 0.85rem;
}

.avatar-lg {
  width: 48px;
  height: 48px;
  font-size: 1rem;
}
