/* Ominis theme for LibreChat — outline buttons, translucent bubbles, molecular background */
:root {
  --background: #0a1628;
  --background-end: #0f172a;
  --foreground: #f8fafc;
  --foreground-muted: #94a3b8;
  --primary: #1e3a5f;
  --primary-dark: #0f2744;
  --primary-glass: rgba(15, 39, 68, 0.6);
  --accent: #3b82f6;
  --accent-light: #60a5fa;
  --accent-dim: rgba(59, 130, 246, 0.15);
  --border-subtle: rgba(248, 250, 252, 0.12);
  --border-accent: rgba(59, 130, 246, 0.4);
  --bubble-user: rgba(59, 130, 246, 0.25);
  --bubble-assistant: rgba(255, 255, 255, 0.07);
  /* Prevent Tailwind backdrop-blur from blurring the page background */
  --tw-backdrop-blur: 0;
}

/* ---- 1. Background: sharp, no blur — same image as ia.ominis.org (molecular mesh) ---- */
html,
body {
  filter: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

html {
  background: var(--background) !important;
}

body {
  background-color: var(--background) !important;
  background-image: url("https://ia.ominis.org/_next/image?url=%2Fbackground.jpg&w=3840&q=75") !important;
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  background-attachment: fixed !important;
  color: var(--foreground) !important;
  min-height: 100vh !important;
}

/* Light overlay so text contrast is OK; no blur — background stays sharp */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: linear-gradient(180deg, rgba(10, 22, 40, 0.35) 0%, rgba(10, 22, 40, 0.15) 50%, rgba(10, 22, 40, 0.4) 100%);
  pointer-events: none;
  z-index: 0;
  filter: none !important;
  backdrop-filter: none !important;
}

/* Let body background show through: force all app content transparent by default */
#root,
[data-testid="app-container"],
main {
  position: relative;
  z-index: 1;
}

/* No blur anywhere under body (catches any wrapper/overlay LibreChat adds); pseudo-elements too */
body *,
body *::before,
body *::after {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  filter: none !important;
}

/* LibreChat background overlay: remove blur so our body background stays sharp */
[class*="background-root"],
[class*="_next-static-media-bg"],
[class*="static-media-bg"],
[class*="tw-backdrop-blur"] {
  filter: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* Transparent so body background shows */
#root,
#root * {
  background-color: transparent !important;
}

/* ---- 2. Buttons: outline only, no solid fill ---- */
button,
[role="button"],
a[role="button"],
[class*="Button"],
[class*="button"] {
  background: transparent !important;
  border: 1px solid var(--border-subtle) !important;
  color: var(--foreground) !important;
}

button:hover,
[role="button"]:hover,
[class*="Button"]:hover,
[class*="button"]:hover {
  background: rgba(255, 255, 255, 0.06) !important;
  border-color: rgba(248, 250, 252, 0.2) !important;
}

/* Primary action (e.g. send): outline accent */
button[class*="primary"],
button[class*="Primary"],
[role="button"][class*="primary"],
[class*="btn-primary"],
button[type="submit"] {
  border-color: var(--border-accent) !important;
  color: var(--accent-light) !important;
}

button[class*="primary"]:hover,
[role="button"][class*="primary"]:hover,
[class*="btn-primary"]:hover,
button[type="submit"]:hover {
  background: rgba(59, 130, 246, 0.12) !important;
  border-color: var(--accent) !important;
}

/* Icon-only / round buttons: keep outline */
button svg,
[role="button"] svg {
  color: inherit;
}

/* ---- 3. Chat bubbles: translucent + blur + padding (higher specificity to override #root *) ---- */
#root [class*="message-content"],
#root [class*="MessageContent"],
#root [class*="message-group"],
#root [class*="bubble"],
#root [class*="Bubble"],
#root [data-message-id] > div,
#root [class*="conversation"] [class*="group"] > div {
  background: var(--bubble-assistant) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  border: 1px solid var(--border-subtle) !important;
  border-radius: 1rem !important;
  padding: 1rem 1.25rem !important;
}

#root [class*="message"][class*="user"] > div,
#root [class*="Message"][class*="user"] > div,
#root [class*="group"][class*="user"] [class*="message-content"],
#root [class*="group"][class*="user"] [class*="bubble"],
#root [data-sender="user"] [class*="message-content"],
#root [data-sender="user"] [class*="bubble"],
#root [class*="justify-end"] [class*="message-content"],
#root [class*="justify-end"] [class*="bubble"],
#root [class*="justify-end"] > div[class*="rounded"] {
  background: var(--bubble-user) !important;
  border-color: rgba(59, 130, 246, 0.25) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  padding: 1rem 1.25rem !important;
}

/* Message row content (user or assistant): generous padding like ia.ominis.org */
[class*="justify-end"] > div:first-child,
[class*="justify-start"] > div:first-child {
  padding: 1rem 1.25rem !important;
}

/* Glass panels: sidebar, header (higher specificity) */
#root aside,
#root [data-testid="sidebar"],
#root nav,
#root .nav,
#root [class*="sidebar"],
#root [class*="Sidebar"],
#root .bg-gray-50,
#root .bg-white,
#root [class*="panel"],
#root [class*="card"] {
  background: var(--primary-glass) !important;
  backdrop-filter: saturate(180%) blur(12px) !important;
  -webkit-backdrop-filter: saturate(180%) blur(12px) !important;
  border: 1px solid var(--border-subtle) !important;
  color: var(--foreground) !important;
}

/* Modals & dialogs: distinct blur frame so they stand out from the background */
#root [role="dialog"],
#root [role="dialog"] > div,
#root [class*="Modal"],
#root [class*="modal"],
#root [class*="Dialog"],
#root [class*="dialog"],
#root [class*="DialogContent"],
#root [class*="ModalContent"],
#root [class*="drawer-content"],
#root [class*="DrawerContent"],
#root [data-state="open"][class*="content"] {
  background: rgba(15, 39, 68, 0.88) !important;
  backdrop-filter: saturate(180%) blur(16px) !important;
  -webkit-backdrop-filter: saturate(180%) blur(16px) !important;
  border: 1px solid var(--border-subtle) !important;
  border-radius: 12px !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.06) !important;
  color: var(--foreground) !important;
}

/* Modal/dialog overlay (backdrop) — subtle blur so the modal pops */
#root [role="dialog"]::before,
#root [class*="Modal"][class*="overlay"],
#root [class*="modal"][class*="overlay"],
#root [class*="DialogOverlay"],
#root [class*="dialog-overlay"],
body [data-state="open"] ~ [data-radix-popper-content-wrapper] {
  backdrop-filter: blur(6px) !important;
  -webkit-backdrop-filter: blur(6px) !important;
}

/* Popovers, dropdowns, preset menus (e.g. Configuraciones prestablecidas): same glass frame so content is readable */
#root [role="menu"],
#root [role="listbox"],
#root [class*="Popover"],
#root [class*="popover"],
#root [class*="Dropdown"],
#root [class*="dropdown"],
#root [class*="PopoverContent"],
#root [class*="DropdownContent"],
#root [class*="MenuContent"],
#root [class*="Preset"],
#root [class*="preset"],
#root [data-radix-popper-content-wrapper],
#root [data-state="open"] + [data-radix-popper-content-wrapper],
body [data-radix-popper-content-wrapper] {
  background: rgba(15, 39, 68, 0.92) !important;
  backdrop-filter: saturate(180%) blur(16px) !important;
  -webkit-backdrop-filter: saturate(180%) blur(16px) !important;
  border: 1px solid var(--border-subtle) !important;
  border-radius: 10px !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.06) !important;
  color: var(--foreground) !important;
}

/* Chat area background (let molecular show through) */
[class*="chat"]:not([class*="message"]):not([class*="bubble"]),
[class*="conversation"] {
  background: transparent !important;
}

/* Inputs: translucent + blur (higher specificity) */
#root input,
#root textarea,
#root [contenteditable="true"],
#root [class*="input"],
#root [class*="Input"],
#root .bg-gray-100,
#root .bg-gray-200 {
  background: rgba(15, 39, 68, 0.75) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  border: 1px solid var(--border-subtle) !important;
  color: var(--foreground) !important;
}

input::placeholder,
textarea::placeholder {
  color: var(--foreground-muted) !important;
}

input:focus,
textarea:focus {
  border-color: var(--border-accent) !important;
  box-shadow: 0 0 0 2px var(--accent-dim) !important;
  outline: none !important;
}

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

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

[class*="border"],
hr {
  border-color: var(--border-subtle) !important;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--primary-dark);
}

::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 4px;
}

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

img[alt*="Logo"],
img[alt*="logo"],
[class*="logo"] img,
[class*="Logo"] img {
  max-height: 2rem;
  object-fit: contain;
}

#root header,
#root [role="banner"],
#root [class*="header"],
#root [class*="Header"] {
  background: var(--primary-glass) !important;
  backdrop-filter: saturate(180%) blur(12px) !important;
  -webkit-backdrop-filter: saturate(180%) blur(12px) !important;
  border-bottom: 1px solid var(--border-subtle) !important;
}

/* ---- Ominis footer bar and expandable overlay (replaces LibreChat footer) ---- */
.ominis-footer-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 30;
  text-align: center;
  padding: 6px 12px;
  background: rgba(6, 14, 26, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 11px;
}
.ominis-footer-text {
  color: #6b7280;
}
.ominis-footer-text a {
  color: #9ca3af;
  text-decoration: none;
}
.ominis-footer-text a:hover {
  color: #fff;
}
.ominis-footer-text #ominis-footer-mas-info {
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  font: inherit;
}
.ominis-footer-text #ominis-footer-mas-info:hover {
  color: #fff;
}

.ominis-footer-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.5);
  max-height: 70vh;
  overflow-y: auto;
  display: none;
  align-items: flex-end;
  justify-content: center;
}
.ominis-footer-overlay.ominis-footer-overlay-visible {
  display: flex;
}
.ominis-footer-overlay-inner {
  width: 100%;
  max-width: 1280px;
  background: #060e1a;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  max-height: 70vh;
  overflow-y: auto;
}
.ominis-footer-overlay-inner #ominis-footer-close {
  width: 100%;
  padding: 12px;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  color: #6b7280;
  font-size: 11px;
  cursor: pointer;
}
.ominis-footer-overlay-inner #ominis-footer-close:hover {
  color: #d1d5db;
  background: rgba(255, 255, 255, 0.05);
}
.ominis-footer-content {
  padding: 24px;
  color: #9ca3af;
  font-size: 12px;
}
.ominis-footer-content h3 {
  color: #fff;
  font-size: 14px;
  margin-bottom: 8px;
}
.ominis-footer-content a {
  color: #60a5fa;
  text-decoration: none;
}
.ominis-footer-content a:hover {
  text-decoration: underline;
}
.ominis-footer-content ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.ominis-footer-content li { margin-bottom: 6px; }
.ominis-footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 24px;
  margin-bottom: 20px;
}
.ominis-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #4ade80;
  font-size: 11px;
  margin-top: 8px;
}
.ominis-footer-bottom {
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: #6b7280;
  font-size: 11px;
}
