/* ==========================================================================
   SUITE IP ENTERPRISE BRANDING OVERRIDE (PRODUCTION GRADED)
   ========================================================================== */
@import url('https://googleapis.com');

:root {
  --suiteip-deep-navy: #1B365D;
  --suiteip-muted-blue: #4B6B94;
  --suiteip-light-ice: #F0F4F8;
  --suiteip-white: #FFFFFF;
  --suiteip-border: #D7E2EC;
  --suiteip-text: #1B365D;
}

/* ==========================================================================
   1. GLOBAL & TYPOGRAPHY CORE
   ========================================================================== */
html, body, #root, button, input, textarea, select {
  font-family: 'Inter', sans-serif !important;
}

body, #root, main, .bg-chat-background, .bg-presentation, .bg-surface-primary, .bg-token-main-surface {
  background-color: var(--suiteip-light-ice) !important;
  color: var(--suiteip-text) !important;
}

/* Global typography baseline */
h1, h2, h3, h4, h5, h6, p, strong, a, li, label, input, textarea, select, em {
  color: var(--suiteip-text) !important;
}

.text-text-primary {
    color: var(--suiteip-text) !important; 
}
.text-text-secondary {
    color: var(--suiteip-muted-blue) !important; 
}
.bg-surface-secondary {
    background-color: var(--suiteip-light-ice) !important; 
}
table th.bg-surface-secondary {
    background-color: var(--suiteip-muted-blue) !important; 
}
nav .rounded-lg > div.overflow-hidden {
    border-top-left-radius: 0.5rem !important; 
    border-top-right-radius: 0.5rem !important;
}
.markdown table th {
    background-color: var(--suiteip-muted-blue) !important; 
}
.markdown table td {
    color: var(--suiteip-text) !important; 
}
#root > div {
  background-color: var(--suiteip-light-ice) !important;
}
/* ==========================================================================
   3. CHAT WORKSPACE & CONTAINERS (Surfaces)
   ========================================================================== */
.bg-surface-chat,
.bg-surface-tertiary,
.bg-surface-hover,
.bg-surface-active-alt {
  background-color: var(--suiteip-white) !important;
}

/* Fix text contrast inside white surface containers */
.bg-surface-chat *, .bg-surface-tertiary *, .bg-surface-hover * {
  color: var(--suiteip-text) !important;
}

/* ==========================================================================
   3b. HEADER OVERRIDES (Linear Gradient Customization)
   ========================================================================== */
/* Overrides the native Tailwind linear gradient rule for the Suite IP theme */
.bg-gradient-to-b {
  background-image: linear-gradient(
    to bottom, 
    var(--suiteip-light-ice) 0%, 
    var(--suiteip-light-ice) 100%
  ) !important;
  border-bottom: 1px solid var(--suiteip-border) !important;
}

/* ==========================================================================
   2. NAVIGATION SIDEBAR OVERRIDES (Deep Navy Layer)
   ========================================================================== */
/* Force the main container, the inner wrappers and the alt surface to Deep Navy */
nav.bg-surface-primary-alt,
.bg-surface-primary-alt,
[data-testid="sidebar"],
.fixed.left-0.top-0.z-\[110\],
aside {
  background-color: var(--suiteip-deep-navy) !important;
}

/* Specific text, span and button descriptor targeting inside the sidebar to force white */
nav.bg-surface-primary-alt h1, nav.bg-surface-primary-alt h2, nav.bg-surface-primary-alt h3,
nav.bg-surface-primary-alt p, nav.bg-surface-primary-alt span, nav.bg-surface-primary-alt a,
nav.bg-surface-primary-alt div, [data-testid="sidebar"] span, [data-testid="sidebar"] p,
[data-testid="sidebar"] a, [data-testid="sidebar"] div, aside span, aside p, aside a,
.bg-surface-primary-alt button, .bg-surface-primary-alt a {
  color: var(--suiteip-white) !important;
}

/* Force all SVG vector lines, text-primary/secondary icons inside the sidebar to pure white */
nav.bg-surface-primary-alt svg, 
[data-testid="sidebar"] svg, 
aside svg,
.bg-surface-primary-alt .text-text-primary,
.bg-surface-primary-alt .text-text-secondary {
  color: var(--suiteip-white) !important;
  fill: transparent !important; /* Prevents unwanted solid block color fills on Lucide paths */
  stroke: var(--suiteip-white) !important;
}

/* Fix specific solid-filled paths (like the close-sidebar-button SVG configuration) */
.bg-surface-primary-alt svg path[fill-rule="evenodd"] {
  fill: var(--suiteip-white) !important;
  stroke: none !important;
}

/* Sidebar interaction: Active button state (e.g. Chat History pressed tab) */
.bg-surface-primary-alt .bg-surface-active-alt {
  background-color: var(--suiteip-muted-blue) !important;
  color: var(--suiteip-white) !important;
}

/* Sidebar item interaction: Hover transitions to Muted Blue */
nav.bg-surface-primary-alt .hover\:bg-surface-active-alt:hover,
nav.bg-surface-primary-alt .hover\:bg-surface-hover:hover,
nav.bg-surface-primary-alt button:hover,
nav.bg-surface-primary-alt a:hover,
.bg-surface-primary-alt button:hover,
.bg-surface-primary-alt a:hover,
[data-testid="close-sidebar-button"]:hover,
[data-testid="new-chat-button"]:hover {
  background-color: var(--suiteip-muted-blue) !important;
}


/* ==========================================================================
   4. PRIMARY ACTIONS, UTILITIES & BUTTONS
   ========================================================================== */
button.bg-black,
button.bg-token-main-surface-inverse,
.bg-brand-primary,
button[type="submit"],
[data-testid="send-button"],
[data-testid="model-selector-button"] {
  background-color: var(--suiteip-deep-navy) !important;
  color: var(--suiteip-white) !important;
  border-color: var(--suiteip-deep-navy) !important;
}

/* Enforce white text for primary action buttons to counter universal rules */
button.bg-black *, .bg-brand-primary *, button[type="submit"] * {
  color: var(--suiteip-white) !important;
}

button.bg-black:hover,
button[type="submit"]:hover,
[data-testid="send-button"]:hover {
  background-color: var(--suiteip-muted-blue) !important;
}

/* Corrected syntax for Tailwind escaped hover utilities */
button.hover\:bg-surface-hover:hover,
button.hover\:bg-surface-active-alt:hover,
button.premium-scroll-button > svg {
  background-color: var(--suiteip-deep-navy) !important;
  color: var(--suiteip-white) !important;
}

/* ==========================================================================
   5. BORDERS & STRUCTURAL LINES
   ========================================================================== */
.border-border-light,
.border,
hr,
div.border-b {
  border-color: var(--suiteip-border) !important;
}

/* ==========================================================================
   6. BRANDING CLEANUP & WHITELABELING
   ========================================================================== */
footer,
.text-token-text-secondary a,
[data-testid="footer"],
svg[data-testid="librechat-logo"] {
  display: none !important;
}

/* Top brand logo only: target the actual SVG used in the shell header, not the login form */
#root > div > div:first-child > img[src*="logo.svg"],
#root > div > div:first-child >img[src*="logo"] {
  display: block !important;
  width: 120px !important;
  height: 120px !important;
  max-width: 120px !important;
  max-height: 120px !important;
  object-fit: contain !important;
  margin: 0 auto !important;
}

#root > div > div.bg-cover {
  height: 120px !important;
  min-height: 120px !important;
}

/* ==========================================================================
   7. POPUPS, DROPDOWNS & TOOLTIPS (Share Modals & Context Menus)
   ========================================================================== */
div[role="menu"],
div[role="dialog"],
.bg-popover,
.bg-dropdown,
[data-radix-popper-content-wrapper] > div {
  background-color: var(--suiteip-white) !important;
  color: var(--suiteip-text) !important;
  border: 1px solid var(--suiteip-border) !important;
  box-shadow: 0 4px 12px rgba(27, 54, 93, 0.12) !important;
  border-radius: 8px !important;
}

/* Ensure all text and labels inside popups/share modals are readable (Dark Blue) */
div[role="menu"] *,
div[role="dialog"] *,
.bg-popover *,
.bg-dropdown * {
  color: var(--suiteip-text) !important;
}

/* Hover state for items inside the Share/Context menus */
div[role="menuitem"]:hover,
div[role="option"]:hover,
.bg-popover button:hover,
.bg-dropdown button:hover {
  background-color: var(--suiteip-light-ice) !important;
}

/* Floating Tooltips (The small informational bubbles on hover) */
div[role="tooltip"],
.bg-tooltip,
[data-state][id^="radix-"] {
  background-color: var(--suiteip-deep-navy) !important;
  border: 1px solid var(--suiteip-muted-blue) !important;
  border-radius: 4px !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
}

/* Force tooltip text and arrows to contrast white */
div[role="tooltip"] *,
.bg-tooltip *,
[data-state][id^="radix-"] * {
  color: var(--suiteip-white) !important;
}

/* Target Radix UI specific tooltips that might not have children elements */
div[role="tooltip"],
[data-state][id^="radix-"] {
  color: var(--suiteip-white) !important;
}

/* ==========================================================================
   8. ATTACHMENT & TOOLS BUTTON HOVER STATES (EXCLUSIVE OVERRIDE)
   ========================================================================== */
[data-testid="attachment-button"],
button[aria-label*="attach" i],
button[aria-label*="file" i],
[data-testid="more-options-button"],
button[aria-label*="tool" i],
button[aria-label*="option" i] {
  transition: all 0.2s ease-in-out !important;
}

[data-testid="attachment-button"]:hover,
button[aria-label*="attach" i]:hover,
button[aria-label*="file" i]:hover,
[data-testid="more-options-button"]:hover,
button[aria-label*="tool" i]:hover,
button[aria-label*="option" i]:hover {
  background-color: var(--suiteip-deep-navy) !important;
  border-color: var(--suiteip-deep-navy) !important;
}

[data-testid="attachment-button"]:hover svg, [data-testid="attachment-button"]:hover svg *,
button[aria-label*="attach" i]:hover svg, button[aria-label*="attach" i]:hover svg *,
button[aria-label*="file" i]:hover svg, button[aria-label*="file" i]:hover svg *,
[data-testid="more-options-button"]:hover svg, [data-testid="more-options-button"]:hover svg *,
button[aria-label*="tool" i]:hover svg, button[aria-label*="tool" i]:hover svg *,
button[aria-label*="option" i]:hover svg, button[aria-label*="option" i]:hover svg * {
  color: var(--suiteip-white) !important;
  fill: var(--suiteip-white) !important;
  stroke: var(--suiteip-white) !important;
}

[data-testid="attachment-button"]:hover svg,
button[aria-label*="attach" i]:hover svg,
button[aria-label*="file" i]:hover svg,
[data-testid="more-options-button"]:hover svg,
button[aria-label*="tool" i]:hover svg,
button[aria-label*="option" i]:hover svg {
  filter: brightness(0) invert(1) !important;
}

/* ==========================================================================
   SIDEBAR TEXT FADE OVERRIDE (Horizontal Gradient Correction)
   ========================================================================== */
/* Overrides the horizontal fade effect for long chat titles in the sidebar */
.bg-gradient-to-l {
  background-image: linear-gradient(
    to left, 
    transparent 0%
    var(--suiteip-muted-blue) 100%, 
  ) !important;
}

/* ==========================================================================
   10. AUTHENTICATION & LOGIN PAGE OVERRIDES
   ========================================================================== */
/* Targets the global full-screen login page background container */
.flex.min-h-screen.flex-col.justify-center.bg-surface-primary,
div:has(> .w-authPageWidth) {
  background-color: var(--suiteip-light-ice) !important;
}

/* Targets the main auth card panel container (bg-white / dark:bg-gray-900) */
.w-authPageWidth {
  background-color: var(--suiteip-white) !important;
  border: 1px solid var(--suiteip-border) !important;
  box-shadow: 0 10px 25px rgba(27, 54, 93, 0.08) !important;
  border-radius: 12px !important;
}

/* Ensure all login typography (headers, labels, links) uses Deep Navy */
.w-authPageWidth h2,
.w-authPageWidth h3,
.w-authPageWidth label,
.w-authPageWidth p,
.w-authPageWidth a,
.w-authPageWidth span {
  color: var(--suiteip-text) !important;
}

/* Links inside login (e.g., "Forgot Password", "Sign Up") custom styling */
.w-authPageWidth a {
  font-weight: 500 !important;
}
.w-authPageWidth a:hover {
  color: var(--suiteip-muted-blue) !important;
  text-decoration: underline !important;
}

/* Input credentials fields (Email and Password input boxes) */
.w-authPageWidth input[type="text"],
.w-authPageWidth input[type="email"],
.w-authPageWidth input[type="password"] {
  background-color: var(--suiteip-white) !important;
  color: var(--suiteip-text) !important;
  border: 1px solid var(--suiteip-border) !important;
  border-radius: 6px !important;
}

/* Focus state for login input boxes */
.w-authPageWidth input:focus {
  border-color: var(--suiteip-muted-blue) !important;
  outline: none !important;
  box-shadow: 0 0 0 2px rgba(75, 107, 148, 0.2) !important;
}

/* Login/Submit Action Buttons inside the authentication block */
.w-authPageWidth button[type="submit"],
.w-authPageWidth .bg-green-600,
.w-authPageWidth button.bg-brand-primary {
  background-color: var(--suiteip-deep-navy) !important;
  color: var(--suiteip-white) !important;
  border: 1px solid var(--suiteip-deep-navy) !important;
  border-radius: 6px !important;
}

/* Login Button Hover State */
.w-authPageWidth button[type="submit"]:hover,
.w-authPageWidth .bg-green-600:hover,
.w-authPageWidth button.bg-brand-primary:hover {
  background-color: var(--suiteip-muted-blue) !important;
  border-color: var(--suiteip-muted-blue) !important;
}
