/* ============================================
   BOTICA AI — SIDEBAR CSS
   ============================================ */

.sidebar {
  width: var(--sidebar-width);
  background: var(--sb-bg);
  display: flex;
  flex-direction: column;
  transition: all var(--transition-slow);
  flex-shrink: 0;
  z-index: 100;
  position: relative;
  color: var(--sb-txt);
}
.sidebar::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 200% 35% at 50% 0%,
    rgba(53,88,240,.10) 0%, transparent 70%);
  pointer-events: none;
}
.sidebar > * { position: relative; z-index: 1; }

/* ---- Header ---- */
.sidebar-header {
  padding: 18px 14px 14px;
  border-bottom: 1px solid var(--sb-border);
  flex-shrink: 0;
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: var(--gradient-primary);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 12px var(--color-primary-glow);
  flex-shrink: 0;
}

.logo-icon .material-icons {
  color: white;
  font-size: 22px;
}

.logo-icon img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  border-radius: 6px;
}

.logo-text {
  font-size: 14.5px;
  font-weight: 600;
  color: #fff;
  letter-spacing: -0.01em;
}

/* ---- New Chat Button ---- */
.new-chat-btn {
  width: 100%;
  background: var(--color-primary);
  color: white;
  border: none;
  padding: 9px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: 500;
  font-size: 13.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: background .14s, box-shadow .14s, transform .12s;
  box-shadow: var(--shadow-primary-sm);
  font-family: inherit;
}

.new-chat-btn:hover {
  background: var(--color-primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-primary-md);
}

.new-chat-btn:active {
  transform: translateY(0);
}

.new-chat-btn .material-icons {
  font-size: 16px;
}

/* ---- Navigation ---- */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  scrollbar-width: none;
}
.sidebar-nav::-webkit-scrollbar { display: none; }

.nav-section {
  margin-bottom: 2px;
}

.nav-section-title {
  font-size: 9.5px;
  font-weight: 700;
  color: rgba(123, 139, 173, 0.4);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  padding: 10px 8px 5px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  margin-bottom: 0;
  border-radius: 8px;
  cursor: pointer;
  transition: background .12s, color .12s;
  color: #E4E9F5;            /* near-white — high contrast on the dark menu */
  user-select: none;
  position: relative;
  line-height: 1;
  font-size: 13px;
  font-weight: 400;
}

.nav-item:hover {
  background: var(--sb-hover);
  color: #FFFFFF;
}

.nav-item.active {
  background: var(--sb-active);
  color: #FFFFFF;
  font-weight: 500;
}
.nav-item.active::after {
  content: '';
  position: absolute;
  right: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 16px;
  background: var(--color-primary);
  border-radius: 0 0 0 3px;
}

.nav-item .material-icons {
  font-size: 15px;
  flex-shrink: 0;
  opacity: .85;
  transition: opacity .12s;
}
.nav-item:hover .material-icons,
.nav-item.active .material-icons { opacity: 1; }

.nav-item-text {
  flex: 1;
  font-size: 13px;
}

.nav-item-badge {
  background: var(--color-primary);
  color: white;
  padding: 1.5px 6px;
  border-radius: 20px;
  font-size: 9.5px;
  font-weight: 600;
  min-width: 22px;
  text-align: center;
}

/* Red attention badge — items needing the user's response (awaiting replies + open tasks) */
.nav-item-badge--alert {
  background: #ef4444;
  color: #fff;
}

/* ---- KMS (Knowledge Management) section — collapsible, elevated ---- */
.kms-section { margin: 2px 0; }
.kms-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 8px 4px 6px;
}
.kms-head {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  text-align: right;
  background: rgba(53, 88, 240, 0.14);
  transition: background .12s;
}
.kms-head:hover { background: rgba(53, 88, 240, 0.22); }
.kms-head.exp  { background: rgba(53, 88, 240, 0.22); }
.kms-head .kms-ico {
  width: 22px; height: 22px;
  border-radius: 6px;
  background: var(--color-primary);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.kms-head .kms-ico .material-icons { font-size: 14px; color: #fff; opacity: 1; }
.kms-head .kms-lbl { flex: 1; color: #fff; font-weight: 600; font-size: 13px; }
.kms-head .kms-tag {
  font-size: 9px; font-weight: 700;
  color: #8AB0F7; background: rgba(53, 88, 240, 0.30);
  padding: 1px 6px; border-radius: 8px;
}
.kms-head .kms-chev {
  font-size: 18px;
  color: rgba(255, 255, 255, 0.5);
  transition: transform 0.2s;
  flex-shrink: 0;
}
.kms-head.exp .kms-chev { transform: rotate(180deg); }
.kms-sub { margin-top: 2px; }
.kms-sub .nav-item { padding-right: 26px; }

/* ---- User Profile (sidebar dark) ---- */
.user-profile {
  padding: 6px 4px;
  border-top: none;
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  border-radius: 8px;
  transition: background .12s;
  flex-shrink: 0;
}

.user-profile:hover {
  background: var(--sb-hover);
}

.user-avatar {
  width: 30px;
  height: 30px;
  background: linear-gradient(135deg, #E8774A, #F0A05A);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 12px;
  flex-shrink: 0;
}

.user-info {
  flex: 1;
  min-width: 0;
  text-align: right;
}

.user-name {
  font-size: 12.5px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-status {
  font-size: 10.5px;
  color: var(--sb-txt);
  display: flex;
  align-items: center;
  gap: 4px;
}

.status-dot {
  width: 6px;
  height: 6px;
  background: var(--color-success);
  border-radius: 50%;
  animation: pulse 2s infinite;
  flex-shrink: 0;
}

.user-profile .material-icons {
  color: rgba(255, 255, 255, 0.3);
  font-size: 14px;
  flex-shrink: 0;
}

/* ---- Logout ---- */
.sidebar-logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: calc(100% - 40px);
  margin: 0 20px 16px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-secondary);
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: color var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast);
}

.sidebar-logout-btn:hover {
  color: var(--color-error);
  background: rgba(220, 53, 69, 0.08);
  border-color: rgba(220, 53, 69, 0.3);
}

.sidebar-logout-btn .material-icons {
  font-size: 18px;
}

/* ---- Budget Widget (credits card) ---- */
.budget-widget {
  margin: 0 12px 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 9px;
  flex-shrink: 0;
}

.budget-widget:empty { display: none; }

.budget-widget-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 4px;
  font-size: 10.5px;
  font-weight: 400;
  color: var(--sb-txt);
}

.budget-widget-header .material-icons {
  display: none;
}

.budget-pct {
  font-size: 10px;
  color: rgba(34, 199, 115, 0.6);
  font-weight: 400;
}

.budget-track {
  height: 2.5px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 0;
}

.budget-fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--color-success), #1EAE65);
  transition: width 0.4s ease, background 0.4s ease;
}

.budget-footer {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  margin-bottom: 7px;
}

.budget-left  {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-success);
  font-variant-numeric: tabular-nums;
}
.budget-total { color: rgba(123, 139, 173, 0.38); }

/* ---- Admin Zone (pinned above user profile) ---- */
.sidebar-admin-zone {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0 12px 8px;
  padding: 6px;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: background .12s, color .12s;
  flex-shrink: 0;
  color: var(--sb-txt);
  font-size: 11.5px;
}

.sidebar-admin-zone:hover {
  background: rgba(255, 255, 255, 0.09);
  color: var(--sb-txt-h);
}

.sidebar-admin-zone.active {
  background: rgba(53, 88, 240, 0.18);
  border-color: rgba(53, 88, 240, 0.35);
  color: var(--sb-txt-a);
}

.sidebar-admin-zone .material-icons {
  font-size: 14px;
  color: inherit;
  flex-shrink: 0;
}

.sidebar-admin-label {
  font-size: 11.5px;
  font-weight: 400;
  color: inherit;
  flex: 0 0 auto;
}

/* logout button — also dark sidebar style */
.sidebar-logout-btn {
  background: rgba(255, 255, 255, 0.04) !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
  color: var(--sb-txt) !important;
}
.sidebar-logout-btn:hover {
  background: rgba(255, 255, 255, 0.09) !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  color: var(--color-error) !important;
}

/* ── Conversation Panel (right side) ──────────────────────────── */
.conv-panel {
  width: 220px;
  background: var(--sb-bg, #0E1525);
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
  overflow: hidden;
}

.cp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 12px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}

.cp-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: rgba(255,255,255,0.45);
}

/* Toggle button replaces + button */
.cp-toggle-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 6px;
  color: rgba(255,255,255,0.5);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  transition: background 0.15s, color 0.15s;
  padding: 0;
  flex-shrink: 0;
}
.cp-toggle-btn:hover { background: rgba(255,255,255,0.12); color: #fff; }
.cp-toggle-btn .material-icons { font-size: 16px; }

/* Collapsed state */
.conv-panel.cp-collapsed { width: 40px; }
.conv-panel.cp-collapsed .cp-body { display: none; }
.conv-panel.cp-collapsed .cp-title { display: none; }
.conv-panel.cp-collapsed .cp-header { justify-content: center; padding: 12px 6px; }

.cp-search-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  flex-shrink: 0;
}
.cp-search-icon {
  font-size: 16px;
  color: rgba(255,255,255,0.35);
  flex-shrink: 0;
}
.cp-search {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: rgba(255,255,255,0.8);
  font-size: 12px;
  font-family: inherit;
}
.cp-search::placeholder { color: rgba(255,255,255,0.3); }

.cp-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
}
.cp-list::-webkit-scrollbar { width: 3px; }
.cp-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 3px; }

.cp-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  cursor: pointer;
  border-radius: 0;
  transition: background 0.12s;
  min-width: 0;
}
.cp-item:hover { background: rgba(255,255,255,0.06); }
.cp-item.active { background: rgba(53,88,240,0.18); }

.cp-item-icon {
  font-size: 14px;
  color: rgba(255,255,255,0.35);
  flex-shrink: 0;
}
.cp-item.active .cp-item-icon { color: #6c8aff; }

.cp-item-title {
  font-size: 12px;
  color: rgba(255,255,255,0.65);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}
.cp-item.active .cp-item-title { color: rgba(255,255,255,0.9); }

.cp-empty {
  padding: 20px 12px;
  font-size: 12px;
  color: rgba(255,255,255,0.3);
  text-align: center;
}
