﻿:root {
  color-scheme: light;
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-border: 1px solid rgba(255, 255, 255, 0.4);
  --glass-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.1);
  --blur: 16px;
  --accent-blue: #2563eb;
  --text-main: #111827;
  --text-muted: #4b5563;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  background: linear-gradient(135deg, #c7d2fe 0%, #f1f5f9 100%);
  background-attachment: fixed;
  overflow: hidden;
}

body {
  padding: 16px;
}

.dashboard-shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  height: calc(100vh - 32px);
  background: var(--glass-bg);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border: var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: 24px;
  overflow: hidden;
}

.sidebar {
  border-right: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(255, 255, 255, 0.5);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
}

.logo-container {
  margin-bottom: 32px;
  text-align: center;
}

.logo {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
  letter-spacing: -0.8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.slogan {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.nav-buttons {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 6px;
}

.nav-button {
  width: 100%;
  padding: 12px 16px;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-button:hover {
  background: rgba(255, 255, 255, 0.4);
  color: var(--text-main);
  transform: translateX(4px);
}

.nav-button.active {
  background: white;
  color: var(--accent-blue);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
  font-weight: 600;
}

/* Login Screen Styles */
.login-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: linear-gradient(135deg, #c7d2fe 0%, #f1f5f9 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.login-card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border: var(--glass-border);
  box-shadow: var(--glass-shadow);
  padding: 48px;
  border-radius: 32px;
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.login-card .logo {
  font-size: 32px;
  margin-bottom: 8px;
}

.login-card h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 32px;
}

.login-card p {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.input-group {
  margin-bottom: 24px;
}

.input-group input {
  width: 100%;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  font-family: inherit;
  font-size: 15px;
  background: rgba(255, 255, 255, 0.5);
}

.login-card button {
  width: 100%;
  padding: 16px;
  border-radius: 12px;
  border: none;
  background: var(--accent-blue);
  color: white;
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s;
}

.login-card button:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.error-message {
  color: #ef4444;
  font-size: 13px;
  margin-top: 16px;
  min-height: 20px;
}


.sidebar-quota {
  margin: 24px 0;
  padding: 16px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.4);
}

.quota-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

#quota-percentage {
  color: var(--accent-blue);
}

.quota-chart-container {
  position: relative;
  height: 100px;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.quota-center-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -40%);
  text-align: center;
  pointer-events: none;
}

#quota-used {
  display: block;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1;
}

.quota-center-text small {
  font-size: 10px;
  color: var(--text-muted);
  display: block;
  margin-top: 2px;
}

.sidebar-user {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 20px 0;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.sidebar-user-name {
  font-size: 14px;
  color: var(--text-main);
  font-weight: 600;
}

.sidebar-avatar {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: white;
  color: var(--accent-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.content-section {
  display: none;
  height: 100%;
  overflow-y: auto;
}

.content-section.active {
  display: block;
}

.assistant-layout.active {
  display: flex !important;
  flex-direction: column;
}

.chats-layout.active {
  display: flex !important;
  flex-direction: column;
}

.assistant-layout {
  height: 100%;
}

.assistant-header, .insights-header {
  position: sticky;
  top: 0;
  height: 60px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(8px);
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.insights-header {
  grid-template-columns: repeat(7, 1fr);
}

.header-col {
  border-right: 1px solid rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

.header-col:last-child {
  border-right: none;
}

.header-col span {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 600;
  transition: color 0.2s;
}

.assistant-tab, .insights-tab {
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.assistant-tab:hover, .insights-tab:hover {
  background: rgba(255, 255, 255, 0.5);
  color: var(--text-main);
}

.assistant-tab.active, .insights-tab.active {
  background: rgba(255, 255, 255, 0.8);
  border-bottom-color: var(--accent-blue);
  color: var(--accent-blue);
}

.assistant-tab.active span, .insights-tab.active span {
  color: var(--accent-blue);
}

.assistant-content {
  flex: 1;
  background: rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(8px);
  display: flex;
  height: 100%;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 20px;
  margin: 16px;
  box-shadow: var(--glass-shadow);
  overflow: hidden;
}

#instruction-content {
  padding: 16px;
}

.assistant-tab-content {
  display: none;
  width: 100%;
  height: 100%;
}

.assistant-tab-content.active {
  display: flex;
  width: 100%;
  height: 100%;
}

.instruction-textarea {
  width: 100%;
  height: 100%;
  padding: 16px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 14px;
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.5);
  resize: none;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.instruction-textarea:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
  background: white;
}

/* Test Chat Styles */
.test-chat-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  padding: 16px;
  background: rgba(255, 255, 255, 0.2);
}

.test-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 16px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

.test-message {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.test-message.user {
  align-self: flex-end;
  background: var(--accent-blue);
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.test-message.ai {
  align-self: flex-start;
  background: white;
  color: var(--text-main);
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-bottom-left-radius: 4px;
}

.test-message.system {
  align-self: center;
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
  font-size: 12px;
  max-width: 90%;
  text-align: center;
}

.test-chat-input-area {
  display: flex;
  gap: 8px;
}

#test-chat-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
}

#test-chat-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.chats-layout {
  height: 100%;
}

.chats-header {
  position: sticky;
  top: 0;
  height: 60px;
  border-bottom: 1px solid #e5e7eb;
  background: #ffffff;
  z-index: 1;
  width: 100%;
}

.chats-content, .dept-content, .insights-content {
  display: flex;
  height: calc(100vh - 60px);
  margin: 16px;
  background: rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 20px;
  box-shadow: var(--glass-shadow);
  overflow: hidden;
}

.chats-sidebar, .dept-sidebar, .knowledge-sidebar {
  width: 300px;
  border-right: 1px solid #e5e7eb;
  background: #f9fafb;
  display: flex;
  flex-direction: column;
}

.chats-main, .dept-main, .knowledge-main {
  flex: 1;
  background: transparent;
}

.main-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.topbar {
  position: sticky;
  top: 0;
  height: 72px;
  border-bottom: 1px solid #e5e7eb;
  background: rgba(249, 250, 251, 0.95);
  z-index: 1;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 0 16px;
  gap: 16px;
}

.notification-btn {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #374151;
  padding: 8px;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.notification-btn:hover {
  background: rgba(0, 0, 0, 0.05);
}

.user-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: 14px;
  color: #374151;
  font-weight: 500;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #3b82f6;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
}

.content-area {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.home-grid {
  display: grid;
  grid-template-rows: auto auto auto auto 1fr;
  gap: 16px;
  height: 100%;
  padding: 24px;
}

.grid-header {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 16px 0 4px 0;
}

.grid-row {
  display: block; /* Default to block since children are grids or containers */
}

.recent-activity-container {
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 16px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
  margin-top: 16px;
}

.row-5-col,
.row-2-col {
  display: grid !important;
  gap: 12px;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
}

.row-5-col {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.row-2-col {
  grid-template-columns: repeat(2, 1fr);
}

.grid-col {
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 16px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
  min-height: 80px;
}

.grid-col:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.grid-col span {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 4px;
}

.grid-col h3 {
  margin: 0;
  font-size: 22px;
  color: var(--text-main);
  font-weight: 700;
}

.dept-layout.active {
  display: flex !important;
  flex-direction: column;
}

.dept-header {
  position: sticky;
  top: 0;
  height: 60px;
  border-bottom: 1px solid #e5e7eb;
  background: #ffffff;
  z-index: 1;
  width: 100%;
  display: flex;
  align-items: center;
  padding: 0 24px;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.header-content h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #111827;
}

.search-input {
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.875rem;
  width: 240px;
}

.user-list {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
}

.user-item {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.03);
  border-left: 4px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
}

.avatar-small {
  width: 32px;
  height: 32px;
  background: var(--accent-blue);
  color: white;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.user-item:hover {
  background: rgba(255, 255, 255, 0.5);
}

.user-item.active {
  background: white;
  border-left: 4px solid var(--accent-blue);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.user-name {
  display: block;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.2px;
  width: 100%;
}

.user-phone {
  font-size: 0.75rem;
  color: #6b7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

.dept-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
}

.dept-badge.general { background: #f3f4f6; color: #374151; }
.dept-badge.bi { background: #dcfce7; color: #166534; }
.dept-badge.finance { background: #fee2e2; color: #991b1b; }
.dept-badge.it { background: #dbeafe; color: #1e40af; }
.dept-badge.sales { background: #fef9c3; color: #854d0e; }
.dept-badge.hr { background: #fce7f3; color: #9d174d; }
.dept-badge.marketing { background: #ffedd5; color: #9a3412; }
.dept-badge.operational { background: #f0fdf4; color: #166534; }
.dept-badge.management { background: #ede9fe; color: #5b21b6; }

.user-detail-view {
  padding: 24px;
  height: 100%;
  overflow-y: auto;
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
}

.user-profile-info {
  display: flex;
  align-items: center;
  gap: 20px;
}

.large-avatar {
  width: 64px;
  height: 64px;
  background: #3b82f6;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 600;
}

.detail-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 32px;
}

.detail-card {
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(4px);
  padding: 24px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
}

.detail-card h4 {
  margin-bottom: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  margin-bottom: 6px;
}

.form-group input, .form-group select {
  width: 100%;
  padding: 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 0.875rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.readonly-input {
  background: #f3f4f6;
  cursor: not-allowed;
}

.stats-row {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.stat-item {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.75rem;
  color: #6b7280;
}

.stat-value {
  font-size: 1.125rem;
  font-weight: 600;
  color: #111827;
}

.activity-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

.activity-item {
  padding: 12px;
  border-left: 3px solid #e5e7eb;
  background: #ffffff;
  border-radius: 0 8px 8px 0;
}

.activity-msg {
  font-size: 0.875rem;
  color: #1f2937;
  margin-bottom: 4px;
}

.activity-time {
  font-size: 0.75rem;
  color: #9ca3af;
}

.empty-state {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
  text-align: center;
  padding: 40px;
}

.empty-state i {
  font-size: 4rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

.primary-button, .save-button, .action-button {
  background: var(--accent-blue);
  color: white;
  padding: 12px 24px;
  border-radius: 12px;
  border: none;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.primary-button:hover, .save-button:hover, .action-button:hover {
  background: #2563eb;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.35);
}

.danger-button {
  background: #fee2e2;
  color: #dc2626;
  padding: 12px 24px;
  border-radius: 12px;
  border: 1px solid #fecaca;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.danger-button:hover {
  background: #fecaca;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.1);
}

.secondary-button {
  padding: 12px 24px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.5);
  color: var(--text-main);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.secondary-button:hover {
  background: white;
  border-color: rgba(0, 0, 0, 0.15);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.loading-placeholder {
  padding: 20px;
  text-align: center;
  color: #6b7280;
}

/* Modal Styling */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none; /* Hidden by default */
  align-items: center;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(16px);
  width: 480px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
  overflow: hidden;
}

.modal-header {
  padding: 24px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  margin: 0;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.5px;
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 24px;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background: rgba(255, 255, 255, 0.3);
}

.secondary-button {
  padding: 8px 16px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: white;
  cursor: pointer;
}

.dept-content {
  flex: 1;
  margin: 16px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
  display: flex;
  overflow: hidden;
}

.dept-sidebar {
  width: 300px;
  border-right: 1px solid #e5e7eb;
  background: #f9fafb;
}

.dept-main {
  flex: 1;
  background: #ffffff;
}

.insights-layout.active {
  display: flex !important;
  flex-direction: column;
}

.insights-header {
  position: sticky;
  top: 0;
  height: 60px;
  border-bottom: 1px solid #e5e7eb;
  background: #ffffff;
  z-index: 1;
  width: 100%;
  display: flex;
  overflow-x: auto;
  scrollbar-width: none; /* Firefox */
}

.insights-header::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

.insights-tab {
  flex: 1;
  min-width: 120px;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  padding: 0 16px;
}

.insights-content {
  flex: 1;
  margin: 16px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.insights-tab {
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
}

.insights-tab:hover {
  background: rgba(0, 0, 0, 0.02);
}

.insights-tab.active {
  border-bottom-color: #3b82f6;
  color: #3b82f6;
}

.insights-tab.active span {
  color: #3b82f6;
}

.insights-tab-content {
  display: none;
  width: 100%;
  height: 100%;
}

.insights-tab-content.active {
  display: block;
}

.insights-split-layout.active {
  display: flex !important;
  height: 100%;
}

.insights-split-left {
  width: 400px;
  border-right: 1px solid #e5e7eb;
  padding: 20px;
  background: #f9fafb;
}

.insights-split-right {
  flex: 1;
  padding: 20px;
  background: #ffffff;
}

/* Modern Insights Styling */
.insight-card-header {
  margin-bottom: 20px;
  position: relative;
}

.reset-filter-btn {
  position: absolute;
  right: 0;
  top: 0;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  color: #4b5563;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.reset-filter-btn:hover {
  background: #e5e7eb;
  color: #111827;
}

.insight-card-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: #111827;
}

.insight-subtitle {
  font-size: 0.85rem;
  color: #6b7280;
}

.insights-single-layout {
  padding: 24px;
}

.insights-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: calc(100vh - 200px); /* Adjust based on your layout */
  overflow-y: auto;
  padding-right: 8px; /* Room for scrollbar */
}

/* Custom Scrollbar for better look */
.insights-list::-webkit-scrollbar {
  width: 6px;
}
.insights-list::-webkit-scrollbar-track {
  background: transparent;
}
.insights-list::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 10px;
}
.insights-list::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.2);
}

.insight-item {
  background: rgba(255, 255, 255, 0.5);
  padding: 16px 20px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

.insight-item:hover {
  background: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  border-color: var(--accent-blue);
}

.insight-item.active {
  background: rgba(59, 130, 246, 0.05);
  border: 1px solid var(--accent-blue);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.1);
}

.insight-item-info {
  display: flex;
  flex-direction: column;
}

.insight-item-label {
  font-weight: 600;
  font-size: 0.9rem;
  color: #1f2937;
}

.insight-item-sub {
  font-size: 0.75rem;
  color: #6b7280;
  margin-top: 2px;
}

.insight-item-value {
  font-weight: 700;
  color: #3b82f6;
  font-size: 1rem;
}

.insight-badge {
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 600;
}

.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-green { background: #dcfce7; color: #166534; }
.badge-yellow { background: #fef9c3; color: #854d0e; }
.badge-red { background: #fee2e2; color: #991b1b; }

.chart-container {
  position: relative;
  height: 300px;
  width: 100%;
}

.insights-list.full-width {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.empty-insight-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: #9ca3af;
  font-size: 0.9rem;
}

.settings-layout.active {
  display: flex !important;
  flex-direction: column;
}

.settings-content {
  flex: 1;
  margin: 16px;
  background: rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 20px;
  box-shadow: var(--glass-shadow);
  display: flex;
  overflow: hidden;
}

.settings-sidebar {
  width: 240px;
  border-right: 1px solid rgba(0, 0, 0, 0.05);
  background: rgba(255, 255, 255, 0.2);
  padding: 16px 0;
}

.settings-nav-item {
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s;
}

.settings-nav-item:hover {
  background: rgba(255, 255, 255, 0.5);
  color: var(--text-main);
}

.settings-nav-item.active {
  background: white;
  color: var(--accent-blue);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.settings-main {
  flex: 1;
  background: #ffffff;
  overflow-y: auto;
}

.settings-tab-pane {
  display: none;
  padding: 32px;
  max-width: 800px;
}

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

.settings-header {
  margin-bottom: 32px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  padding-bottom: 16px;
}

.settings-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0 0 8px 0;
  letter-spacing: -0.5px;
}

.settings-header p {
  color: var(--text-muted);
  font-size: 14px;
  margin: 0;
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.field-hint {
  display: block;
  font-size: 12px;
  color: #9ca3af;
  margin-top: 4px;
}

.save-button {
  background: #3b82f6;
  color: white;
  padding: 10px 24px;
  border-radius: 8px;
  border: none;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  align-self: flex-start;
  transition: background 0.2s;
}

.save-button:hover {
  background: #2563eb;
}

/* Status Cards & Indicators */
.status-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.status-card {
  padding: 16px;
  background: #f9fafb;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
}

.status-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
}

.status-indicator::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.status-indicator.online { color: #059669; }
.status-indicator.online::before { background: #10b981; }

.status-indicator.offline { color: #dc2626; }
.status-indicator.offline::before { background: #ef4444; }

.status-indicator.loading { color: #9ca3af; }
.status-indicator.loading::before { background: #e5e7eb; }

/* Switch Toggle Styling */
.toggle-group {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  margin-bottom: 12px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

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

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.1);
  transition: .4s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

input:checked + .slider {
  background-color: var(--accent-blue);
}

input:checked + .slider:before {
  transform: translateX(20px);
}

.slider.round {
  border-radius: 34px;
}

.slider.round:before {
  border-radius: 50%;
}

.settings-main {
  flex: 1;
  background: #ffffff;
}

.knowledge-sidebar {
  width: 280px;
  border-right: 1px solid #e5e7eb;
  background: #f9fafb;
  display: flex;
  flex-direction: column;
}

.knowledge-file-item:hover {
  background: #eff6ff;
  cursor: default;
}

.knowledge-file-list {
  scrollbar-width: thin;
  scrollbar-color: #d1d5db transparent;
}

.knowledge-file-list::-webkit-scrollbar {
  width: 6px;
}

.knowledge-file-list::-webkit-scrollbar-thumb {
  background-color: #d1d5db;
  border-radius: 10px;
}

.knowledge-main {
  flex: 1;
  padding: 20px;
  background: #ffffff;
}

.knowledge-main h3 {
  margin-top: 0;
  margin-bottom: 10px;
  color: #1f2937;
}

.knowledge-main p {
  margin-bottom: 20px;
  color: #374151;
  line-height: 1.5;
}

#knowledge-upload-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
  max-width: 400px; /* Limit form width */
}

#knowledge-file-input {
  border: 1px solid #d1d5db;
  padding: 10px;
  border-radius: 8px;
  background: #f9fafb;
  color: #374151;
}

#knowledge-file-input::file-selector-button {
  background: #3b82f6;
  color: #ffffff;
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  margin-right: 10px;
  transition: background-color 0.2s;
}

#knowledge-file-input::file-selector-button:hover {
  background: #2563eb;
}

.action-button {
  width: auto;
  padding: 12px 20px;
  border: none;
  border-radius: 8px;
  background: #3b82f6;
  color: #ffffff;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
  align-self: flex-start; /* Align button to the start if in a flex container */
}

.action-button:hover {
  background-color: #2563eb;
}

#upload-status {
  margin-top: 15px;
  font-size: 14px;
  color: #374151;
}

/* Toast Notification Styles */
.toast-notification {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background-color: #333;
  color: #fff;
  padding: 10px 20px;
  border-radius: 5px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
  z-index: 1000;
  font-size: 14px;
  text-align: center;
}

.toast-notification.show {
  opacity: 1;
  visibility: visible;
}

.toast-notification.success {
  background-color: #4CAF50; /* Green for success */
}

.toast-notification.error {
  background-color: #f44336; /* Red for error */
}

.action-button {
  width: auto;
  padding: 12px 20px;
  border: none;
  border-radius: 8px;
  background: #3b82f6;
  color: #ffffff;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
  align-self: flex-start; /* Align button to the start if in a flex container */
}

.action-button:hover {
  background-color: #2563eb;
}

.delete-file-btn:hover {
  background-color: #fee2e2 !important;
  color: #dc2626 !important;
}
