/* Custom CSS for UBI Chatbot - Minimal changes to accent colors */

:root {
  /* UBI Dark Blue for accents (light theme) */
  --ubi-accent: #0d2240;
  --ubi-accent-hover: #1a3557;
  
  /* Override Chainlit's primary color HSL values */
  /* Converting #0d2240 to HSL: 213° 71% 15% */
  --primary: 213 71% 15% !important;
  --primary-foreground: 0 0% 100% !important; /* White text on primary */
}

/* Logo styling - ensure proper display and consistent size */
.logo-container img,
img[alt="logo"],
img[alt*="ubi" i] {
  max-height: 80px !important;
  width: auto !important;
  object-fit: contain !important;
}

/* Header logo specific styling - keep same size */
header img,
.header-logo {
  max-height: 80px !important;
  width: auto !important;
}

/* Fix logo display */
img[alt="logo"] {
  max-height: 80px !important;
  width: auto !important;
}

/* Dark theme adjustments - use brighter UBI colors */
.dark {
  /* Brighter UBI blue for dark theme - better visibility */
  --ubi-accent: #4A90E2;
  --ubi-accent-hover: #5BA0F2;
  
  /* Override primary for dark theme with brighter blue */
  /* Converting #4A90E2 to HSL: 210° 74% 59% */
  --primary: 210 74% 59% !important;
  --primary-foreground: 0 0% 100% !important;
}

/* Additional override for any CSS using the primary color */
.bg-primary {
  background-color: var(--ubi-accent) !important;
}

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

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

/* Override Chainlit's pink/red accent color (#f5135e) with UBI dark blue */

/* Send button */
button[type="submit"],
button[aria-label="Send"],
.send-button {
  background-color: var(--ubi-accent) !important;
  border-color: var(--ubi-accent) !important;
}

button[type="submit"]:hover,
button[aria-label="Send"]:hover,
.send-button:hover {
  background-color: var(--ubi-accent-hover) !important;
  border-color: var(--ubi-accent-hover) !important;
}

/* User avatar/profile icon */
.user-avatar,
.avatar-user {
  background-color: var(--ubi-accent) !important;
  border-color: var(--ubi-accent) !important;
}

/* Assistant avatar background */
.assistant-avatar,
.avatar-assistant {
  background-color: var(--ubi-accent) !important;
  border-color: var(--ubi-accent) !important;
}

/* Primary buttons and actions */
.primary-button,
.action-button {
  background-color: var(--ubi-accent) !important;
  border-color: var(--ubi-accent) !important;
}

.primary-button:hover,
.action-button:hover {
  background-color: var(--ubi-accent-hover) !important;
  border-color: var(--ubi-accent-hover) !important;
}

/* Links and interactive elements */
a {
  color: var(--ubi-accent) !important;
}

a:hover {
  color: var(--ubi-accent-hover) !important;
}

/* Focus states */
input:focus,
textarea:focus {
  border-color: var(--ubi-accent) !important;
  box-shadow: 0 0 0 2px rgba(13, 34, 64, 0.2) !important;
}

/* Loading spinner */
.loading-spinner,
.spinner {
  color: var(--ubi-accent) !important;
}

/* Progress bars */
.progress-bar {
  background-color: var(--ubi-accent) !important;
}

/* Selection highlight - better visibility */
::selection {
  background-color: rgba(74, 144, 226, 0.3); /* Light blue with good contrast */
  color: inherit; /* Keep text color readable */
}

/* Dark mode selection - more visible */
.dark ::selection {
  background-color: rgba(74, 144, 226, 0.5); /* Brighter blue for dark mode */
  color: #ffffff; /* White text for better contrast */
}

/* Firefox compatibility */
::-moz-selection {
  background-color: rgba(74, 144, 226, 0.3);
  color: inherit;
}

.dark ::-moz-selection {
  background-color: rgba(74, 144, 226, 0.5);
  color: #ffffff;
}

/* Specific selection for message content */
.message-content ::selection,
.cl-message ::selection,
[class*="message"] ::selection {
  background-color: rgba(74, 144, 226, 0.4) !important;
  color: inherit !important;
}

.dark .message-content ::selection,
.dark .cl-message ::selection,
.dark [class*="message"] ::selection {
  background-color: rgba(74, 144, 226, 0.6) !important;
  color: #ffffff !important;
}

/* Input and textarea selection */
input::selection,
textarea::selection {
  background-color: rgba(74, 144, 226, 0.4) !important;
  color: inherit !important;
}

.dark input::selection,
.dark textarea::selection {
  background-color: rgba(74, 144, 226, 0.6) !important;
  color: #ffffff !important;
}

/* Code block selection */
pre ::selection,
code ::selection {
  background-color: rgba(74, 144, 226, 0.4) !important;
}

.dark pre ::selection,
.dark code ::selection {
  background-color: rgba(74, 144, 226, 0.6) !important;
  color: #ffffff !important;
}

/* Scrollbar thumb */
::-webkit-scrollbar-thumb {
  background: var(--ubi-accent);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--ubi-accent-hover);
}

/* Toggle switches and checkboxes */
input[type="checkbox"]:checked,
input[type="radio"]:checked {
  background-color: var(--ubi-accent) !important;
  border-color: var(--ubi-accent) !important;
}

/* Slider handles */
.slider-handle,
input[type="range"]::-webkit-slider-thumb {
  background-color: var(--ubi-accent) !important;
}

/* Active/selected states */
.active,
.selected {
  color: var(--ubi-accent) !important;
  border-color: var(--ubi-accent) !important;
}

/* Icon colors - override any pink/red icons */
svg path[fill*="f5135e"],
svg path[stroke*="f5135e"] {
  fill: var(--ubi-accent) !important;
  stroke: var(--ubi-accent) !important;
}

/* Override any remaining pink/red colors */
[style*="background-color: rgb(245, 19, 94)"],
[style*="background: rgb(245, 19, 94)"],
[style*="background-color:#f5135e"],
[style*="background:#f5135e"] {
  background-color: var(--ubi-accent) !important;
}

[style*="color: rgb(245, 19, 94)"],
[style*="color:#f5135e"] {
  color: var(--ubi-accent) !important;
}

[style*="border-color: rgb(245, 19, 94)"],
[style*="border-color:#f5135e"] {
  border-color: var(--ubi-accent) !important;
}

/* UBI Login Page Customization */

/* Clean background - panel handles right side */
body {
  background: #f8fafc !important;
}

/* Dark theme version */
.dark body {
  background: #0f172a !important;
}

/* Targeted approach: Remove the specific Chainlit background div */
div.relative.hidden.bg-muted.lg\:block.overflow-hidden,
.bg-muted.lg\:block,
div[class*="bg-muted"][class*="lg:block"],
img[src*="/favicon"][alt="Image"],
.cl-login-image,
.login-background {
  display: none !important;
}

/* Simple dark panel styling */
.ubi-demo-info-panel h4 {
  color: #94a3b8 !important;
  font-size: 1.1em !important;
  margin: 20px 0 10px 0 !important;
}

.ubi-demo-info-panel ul {
  margin: 0 0 20px 20px !important;
}

.ubi-demo-info-panel li {
  color: #cbd5e1 !important;
  margin: 5px 0 !important;
  line-height: 1.4 !important;
}

.ubi-demo-info-panel .demo-footer {
  margin-top: 30px !important;
  padding-top: 20px !important;
  border-top: 1px solid rgba(255, 255, 255, 0.2) !important;
  text-align: center !important;
  color: #94a3b8 !important;
  font-style: italic !important;
}

/* Add "Powered by DeepNeuronic" to login page */
.login-container::after,
form[action="/login"]::after,
.auth-form::after {
  content: "Powered by DeepNeuronic";
  display: block;
  text-align: center;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid rgba(13, 34, 64, 0.2);
  color: #666;
  font-size: 0.9em;
  font-style: italic;
}

/* Add footer to chat page only (not login) */
body:has(.cl-main)::before,
body:has([id*="chat"])::before,
body:has(.cl-chatPage)::before {
  content: "Powered by DeepNeuronic";
  position: fixed;
  bottom: 10px;
  right: 20px;
  color: #666;
  font-size: 0.85em;
  font-style: italic;
  opacity: 0.8;
  pointer-events: none;
  z-index: 100;
}

/* Font configuration */
* {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Helvetica Neue", Arial, sans-serif !important;
}

/* ===== UBI LOGO IN CHAT HEADER (Top Left) ===== */

/* Target the header's first child div (left side with new chat and model selector) */
#header > div:first-child::before {
  content: "";
  display: inline-block;
  width: 240px;
  height: 80px;
  background-image: url('/public/logo_light.png');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: left center;
  margin-right: 20px;
  flex-shrink: 0;
}

/* Dark mode logo */
.dark #header > div:first-child::before {
  background-image: url('/public/logo_dark.png');
}

/* Ensure the header's left div has proper flex layout for logo */
#header > div:first-child {
  gap: 12px !important;
  align-items: center !important;
  min-height: 80px !important;
}