/* Variables */
:root {

  /* Button (light theme) */
  --button-bg: rgba(128, 128, 128, 0.15);
  --button-bg-hover: rgba(255, 242, 0, 0.2);
  --button-border: rgba(60, 60, 70, 0.1);
  --button-border-hover: rgba(255, 255, 255, 0.8);
  --button-text: #222;
  --button-text-hover: rgba(0, 0, 0, 0.8);
  --button-danger-bg: rgba(191, 32, 44, 0.2);
  --button-neutral-bg: #f0f0f0;

  /* Text */
  --text-muted: #666;
  --sidebar-title: #333;
}

/* Dark theme overrides */
.dark {

  /* Buttons */
  --button-bg: rgba(60, 60, 70, 0.6);
  --button-bg-hover: rgba(80, 80, 90, 0.8);
  --button-border: rgba(60, 60, 70, 0.1);
  --button-border-hover: rgba(60, 60, 70, 0.3);
  --button-text: #e0e0e0;
  --button-danger-bg: rgba(220, 53, 69, 0.25);
  --button-neutral-bg: rgba(90, 90, 100, 0.5);

  /* Text */
  --text-muted: #a0a0a0;
  --sidebar-title: #f0f0f0;
}

/* Hide default Chainlit elements */

/* Built with Chainlit text in the footer */
.watermark,

/* Readme button in the header */
#readme-button,

/* Placeholder text in the input box */
#chat-input::before,

/* Thread share link */
#share-thread,

/* User nav button when in iframe */
body.in-iframe #user-nav-button {

  display: none !important;
}


/*******************************
 * Chat Messages
 *******************************/

/* Message spacing */
.ai-message .message-content {
  margin-bottom: 0.5rem !important;
}

/* Assistant message avatar */
.ai-message>.inline-block>span {
  width: 2.5rem !important;
  height: 1.5rem !important;
}

/* Hide copy-to-clipboard buttons on assistant messages */
.ai-message button:has(.lucide-copy),
.ai-message button[aria-label*="Copy"],
.ai-message button[data-testid="copy-button"] {
  display: none !important;
}

/* Feedback button styling */
.positive-feedback-off,
.positive-feedback-on,
.negative-feedback-off,
.negative-feedback-on,
button:has(.lucide-message-circle) {
  background-color: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0.15rem 0.25rem !important;
  font-size: 0.75em !important;
  margin: 0 0.15rem !important;
  width: 1.5rem !important;
  height: 1.5rem !important;
  min-width: 1.5rem !important;
  min-height: 1.5rem !important;
  opacity: 0.5 !important;
}

.positive-feedback-off::after,
.positive-feedback-on::after,
.negative-feedback-off::after,
.negative-feedback-on::after,
button:has(.lucide-message-circle)::after {
  display: none !important;
}

.positive-feedback-on {
  color: #22c55e !important;
}

.negative-feedback-on {
  color: #ef4444 !important;
}

button:has(.lucide-message-circle):hover {
  background-color: transparent !important;
}

/* Message links styling */
.message-link {
  /* border-radius: 10px; */
  /* color: #bf202c !important; */
  /* text-decoration: none !important; */
  /* line-height: 1.3 !important; */
  padding: 0.1rem 1rem !important;
  /* background-color: rgba(255, 242, 0, 0.3) !important; */
  /* border: 2px solid #bf202c !important; */
  /* font-family: "Montserrat Alternates", sans-serif !important; */
  /* font-weight: normal !important; */
  /* margin-left: 0 !important; */
  /* margin-right: 0 !important; */
}

/*******************************
 * Global Button Styles
 *******************************/

/* === Base Button Styles === */
button {
  color: var(--button-text) !important;
  position: relative;
  background-color: rgba(255, 255, 255, 0.15) !important;
  backdrop-filter: blur(2px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.8) !important;
  border-radius: 2rem !important;
  box-shadow: 0 1px 8px rgba(31, 38, 135, 0.2),
    inset 0 2px 0 rgba(255, 255, 255, 0.3) !important;
  margin: 0 0.4rem !important;
}

button::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2rem;
  backdrop-filter: blur(1px);
  box-shadow: inset -10px -8px 0px -11px rgba(255, 255, 255, 1),
    inset 0px -5px 0px -4px rgba(255, 255, 255, 1);
  opacity: 0.5;
  z-index: -1;
  filter: blur(1px) drop-shadow(2px 4px 15px black) brightness(115%);
}

button:hover,
button[data-active="true"] {
  background-color: var(--button-bg-hover) !important;
  border-color: var(--button-border-hover) !important;
  color: var(--button-text-hover) !important;
}

/* === Special buttons ===*/

/* Sidebar rail button */
button[data-sidebar="rail"] {
  background: none !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
  height: auto !important;
  min-width: auto !important;
  right: initial !important;
  transform: initial !important;

  &::after {
    display: none !important;
  }
}

/* Sidebar thread button */
button[data-sidebar="menu-button"] {
  box-shadow: none !important;
  font-size: 0.8rem !important;
  font-weight: 500 !important;
  border-radius: 0 !important;
  border: none !important;
}

button[data-sidebar="menu-button"]::after {
  display: none !important;
}

/* Settings popin dropdown */
button[role="combobox"] {
  /* background: none !important; */
  /* border-width: 1px !important; */
  margin: 0 !important;
}

/* Profiles dropdown menu */
#chat-profiles {
  margin-left: 0.5rem !important;
}

/* New chat button */
#new-chat-button {
  margin-right: 1.5rem !important;
}

/* === Button Variants === */

/* Danger buttons */
button.danger {
  background-color: var(--button-danger-bg) !important;
}

/* === Sidebar Button Styles === */

/* Sidebar action buttons - positioning */
aside #reset-button,
aside #show-facts-button,
aside #exit-button,
aside #ai-respond-button {
  zoom: 0.75 !important;
  position: absolute;
  bottom: 1rem;
}

aside #reset-button {
  right: 5.5rem;
}

aside #exit-button {
  right: 1.4rem;
}

aside #show-facts-button {
  right: 12.4rem;
}

aside #ai-respond-button {
  right: 21.5rem;
}

/* === Special Button Behaviors === */

/* Copy to clipboard buttons are already hidden above */

/* =====================================
 * Global interaction lock during AI play
 * Disables all button elements while the AI is "playing",
 * except the control button itself (#ai-respond-button).
 * ===================================== */
.ai-playing button {
  pointer-events: none !important;
}

.ai-playing button#ai-respond-button {
  pointer-events: auto !important;
}

/* Explicitly disable sidebar menu buttons during AI play */
.ai-playing button[data-sidebar="menu-button"] {
  pointer-events: none !important;
}


/*******************************
 * Language Switcher
 *
 * Displays language selection buttons (EN, ES) at the top right of the sidebar.
 *
 * Implementation Notes:
 * - Uses fixed positioning to overlay at top right of sidebar
 * - Scaled down to 75% size via zoom property
 * - Inherits button styles from global button definitions
 * - Component source: /app/public/elements/LanguageSwitcher.jsx
 * - Backend action: /app/actions/language.py (change_language)
 *
 * Related Files:
 * - Translation files: /app/.chainlit/translations/*.json
 * - UI config: /app/ui.toml (element: language_switcher)
 *******************************/

/* Base Container Styles */
#language-switcher {
  display: flex !important;
  gap: 0.2rem !important;
  /* Space between buttons */
}

/* Button Styles */
#language-switcher button {
  font-family: Arial, sans-serif !important;
  font-weight: 400 !important;
  font-size: 0.875rem !important;
  padding: 0.5rem 0.75rem !important;
}

/* Header Positioning - next to chat profiles */
#header #language-switcher {
  display: flex !important;
  align-items: center !important;
  margin-left: 0.5rem !important;
}

/* Hide in sidebar (legacy positioning) */
aside #language-switcher {
  display: none !important;
}

/* User profile button styling - override the red background */
#header button[aria-haspopup="menu"] span.bg-primary,
#header button span span.bg-primary {
  background: rgba(128, 128, 128, 0.15) !important;
  color: transparent !important;
  position: relative !important;
}

/* Hide the letter in user button */
#header button[aria-haspopup="menu"] span span.bg-primary {
  font-size: 0 !important;
}

/* Add user icon to profile button */
#header button[aria-haspopup="menu"] span span.bg-primary::before {
  content: "👤" !important;
  position: absolute !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  font-size: 16px !important;
  color: rgba(0, 0, 0, 0.75) !important;
}

/* Dark theme user icon */
.dark #header button[aria-haspopup="menu"] span span.bg-primary::before {
  color: rgba(255, 255, 255, 0.85) !important;
}

/*******************************
 * Admin Launcher - Header Integration
 *******************************/

/* Hide launcher until it's moved into the header */
#admin-launcher {
  display: none !important;
}

/* Display in the header, adjacent to the language switcher */
#header #admin-launcher {
  display: flex !important;
  align-items: center !important;
  margin-left: 0.2rem !important;
}

/* Icon button styling */
#header #admin-launcher .admin-launcher__button {
  min-height: 2.25rem !important;
  min-width: 2.25rem !important;
  padding: 0 !important;
  margin: 0 0.4rem !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* Icon sizing */
#header #admin-launcher .admin-launcher__button svg {
  width: 1.1rem !important;
  height: 1.1rem !important;
}

/*******************************
 * Feedback Button - Header Integration
 *******************************/

/* Hide feedback button until it's moved into the header */
#feedback-button {
  display: none !important;
}

/* Display in the header, adjacent to admin-launcher or language-switcher */
#header #feedback-button {
  display: flex !important;
  align-items: center !important;
  margin-left: 0.2rem !important;
}

/* Button styling with orange accent */
#header #feedback-button .feedback-button__button {
  min-height: 2.25rem !important;
  padding: 0 0.75rem !important;
  margin: 0 0.4rem !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.4rem !important;
  background-color: rgba(249, 115, 22, 0.15) !important;
  border: 1px solid rgba(249, 115, 22, 0.5) !important;
  color: rgb(194, 65, 12) !important;
  font-size: 0.8rem !important;
  font-weight: 500 !important;
  text-decoration: none !important;
  border-radius: 2rem !important;
  backdrop-filter: blur(2px) saturate(180%);
  box-shadow: 0 1px 8px rgba(31, 38, 135, 0.2),
    inset 0 2px 0 rgba(255, 255, 255, 0.3) !important;
}

#header #feedback-button .feedback-button__button:hover {
  background-color: rgba(249, 115, 22, 0.25) !important;
  border: 1px solid rgba(249, 115, 22, 0.7) !important;
}

/* Dark theme adjustments */
.dark #header #feedback-button .feedback-button__button {
  background-color: rgba(249, 115, 22, 0.2) !important;
  border: 1px solid rgba(249, 115, 22, 0.4) !important;
  color: rgb(251, 146, 60) !important;
}

.dark #header #feedback-button .feedback-button__button:hover {
  background-color: rgba(249, 115, 22, 0.3) !important;
  border: 1px solid rgba(249, 115, 22, 0.6) !important;
}

/* Icon sizing */
#header #feedback-button .feedback-button__button svg {
  width: 1rem !important;
  height: 1rem !important;
  flex-shrink: 0 !important;
}

/*******************************
 * Right Sidebar
 *******************************/

/* Sidebar container */
aside>div {
  background: linear-gradient(to right, rgba(255, 255, 255, 0.1), rgba(255, 242, 0, 0.2)) !important;
  border: 0 !important;
  position: relative !important;
  padding-top: 3rem !important;
  /* Extra top padding for language switcher overlay */
}

/* Dark theme sidebar container */
.dark aside>div {
  background: linear-gradient(135deg, rgba(30, 30, 40, 0.95), rgba(50, 50, 60, 0.9)) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

/* Sidebar background image */
aside>div::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background-image: url("sidebar_bg.png") !important;
  background-position: bottom right !important;
  background-repeat: no-repeat !important;
  background-size: 70% !important;
  opacity: 0.2;
  z-index: 0;
}

/* Dark theme background image adjustment */
.dark aside>div::before {
  opacity: 0.08 !important;
  filter: invert(1) !important;
}

/* Ensure sidebar content appears above background */
aside>div>* {
  position: relative;
  z-index: 1;
}

/* Sidebar icon color */
aside .icon {
  /* color: #bf202c; */
}

/* Sidebar title styling */
#side-view-title {
  background-image: url("sidebar_title_bg.png") !important;
  background-repeat: no-repeat !important;
  background-size: 10% !important;
  background-position: 1rem center !important;
  color: var(--sidebar-title) !important;
  font-family: "Montserrat Alternates", sans-serif !important;
  font-size: 1.1rem !important;
  font-weight: bold !important;
  line-height: 1.2 !important;
  margin-left: 2rem !important;
  margin-bottom: 1rem !important;
  padding-left: 6rem !important;
}

/* Dark theme title filter */
.dark #side-view-title {
  filter: brightness(1.2) !important;
}

/* Hide sidebar close button */
#side-view-title>button {
  display: none !important;
}

/* Sidebar content area */
#side-view-content {
  padding-bottom: 2.3rem 0 !important;
}

/*******************************
 * Action Cards
 *******************************/

.card-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin: 30px 0;
}

.action-card {
  background: white;
  border-radius: 12px;
  padding: 25px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  border: 1px solid #e2e8f0;
  transition: transform 0.3s ease;
  margin: 20px auto;
  max-width: 300px;
}

.action-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.card-icon {
  font-size: 32px;
  margin-bottom: 15px;
}

.card-title {
  font-size: 18px;
  font-weight: 600;
  color: #2d3748;
  margin-bottom: 10px;
  font-family: "Montserrat Alternates", sans-serif !important;
}

.card-description {
  font-size: 14px;
  color: #718096;
  margin-bottom: 20px;
}

.card-btn {
  padding: 12px 24px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  display: block !important;
  transition: all 0.3s ease;
  background-color: rgba(255, 242, 0, 0.3) !important;
  color: #222 !important;
  border: 2px solid #bf202c !important;
  margin: 0 auto !important;
  min-width: 160px;
  font-family: "Montserrat Alternates", sans-serif !important;
}

.card-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
  background-color: rgba(255, 242, 0, 0.6) !important;
  color: #222 !important;
}

/*******************************
 * Executive Debrief Styling
 *******************************/

.debrief-report {
  background: white;
  border-radius: 12px;
  padding: 25px;
  margin: 20px 0;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

/* H1 - Executive Report */
.debrief-report h1 {
  font-size: 22px !important;
  font-weight: 700 !important;
  color: #1a202c !important;
  margin: 0 0 20px 0 !important;
  padding: 0 !important;
  border: none !important;
}

/* H2 - Main section headers */
.debrief-report h2 {
  font-size: 18px !important;
  font-weight: 700 !important;
  color: #1a202c !important;
  margin: 20px 0 12px 0 !important;
  padding-bottom: 10px !important;
  border-bottom: 2px solid #bf202c !important;
}

/* H3 - Subsection headers */
.debrief-report h3 {
  font-size: 16px !important;
  font-weight: 600 !important;
  color: #2d3748 !important;
  margin: 15px 0 10px 0 !important;
}

/* Paragraphs */
.debrief-report p {
  color: #4a5568 !important;
  line-height: 1.6 !important;
  margin: 10px 0 !important;
}

.debrief-report ul {
  margin: 12px 0 !important;
  padding-left: 20px !important;
}

.debrief-report ul > li {
  color: #4a5568 !important;
  line-height: 1.6 !important;
  margin: 8px 0 !important;
}

#side-view-content>.inline-custom {
  flex: 0 1 auto !important;
}


/* Debrief section styling */
aside .debrief {
  background-color: #fff !important;
  position: relative;

  .dark & {
    background-color: #000 !important;
    color: #fff !important;
  }
}

aside .debrief button {
  background-color: #fff !important;
  border: 0 !important;
  position: absolute;
  top: 10px;
  right: 0;
  z-index: 1;
}

/*******************************
 * Step Display Styling
 *******************************/

/* Position step display within the title area */
.step-display {
  position: absolute !important;
  top: -30px !important;
  left: 0 !important;
  right: 0 !important;
  margin: 0 !important;
  padding-left: 5.5rem !important;
}

/* Step display text color */
.step-display .text-muted-foreground {
  color: var(--text-muted) !important;
}

/* Make the content area relative so step display can position relative to it */
#side-view-content {
  position: relative !important;
}

/*******************************
 * Slider Styling
 *******************************/

/* Slider track (unfilled portion) - override bg-secondary */
[data-radix-collection-item] + span,
span.bg-secondary[class*="rounded-full"][class*="h-2"] {
  background-color: #cccccc !important;
}

/* Slider range (filled portion) - override bg-primary */
span.bg-primary[class*="absolute"][class*="h-full"] {
  background-color: #888888 !important;
}

/* Slider thumb (handle) - override border-primary */
span[class*="rounded-full"][class*="h-5"][class*="w-5"][class*="border-2"] {
  border-color: #666666 !important;
  background-color: #ffffff !important;
}

/* Slider thumb hover/focus state */
span[class*="rounded-full"][class*="h-5"][class*="w-5"][class*="border-2"]:hover,
span[class*="rounded-full"][class*="h-5"][class*="w-5"][class*="border-2"]:focus {
  border-color: #555555 !important;
}

/*******************************
 * Switch/Toggle Button Styling
 *******************************/

/* Switch button base styling */
input[type="checkbox"],
.switch,
.toggle,
[role="switch"] {
  background-color: #cccccc !important;
  /* Grey background (unchecked) */
}

/* Switch button checked state */
input[type="checkbox"]:checked,
.switch:checked,
.toggle:checked,
[role="switch"][aria-checked="true"] {
  background-color: #28a745 !important;
  /* Green background when checked */
}

/* Switch handles - always white */
input[type="checkbox"]::before,
.switch::before,
.toggle::before,
[role="switch"]::before {
  background-color: #ffffff !important;
}

/* Switch containers */
.switch-container:has(input:checked),
.toggle-container:has(input:checked) {
  background-color: #28a745 !important;
}

.switch-container:has(input:not(:checked)),
.toggle-container:has(input:not(:checked)) {
  background-color: #cccccc !important;
}

/*******************************
 * Tablet & Small Desktop Responsiveness
 *******************************/
@media (min-width: 769px) and (max-width: 1600px) {

  /* Adjust sidebar width for smaller desktop screens */
  aside {
    /* width: 340px !important; */
  }

  /* Adjust title styling */
  #side-view-title {
    font-size: 1rem !important;
    padding-left: 4.5rem !important;
    margin-left: 1rem !important;
    background-size: 2.5rem !important;
  }

  /* Responsive button adjustments - stack vertically */
  aside #reset-button,
  aside #show-facts-button,
  aside #exit-button,
  aside #ai-respond-button {
    zoom: 0.7 !important;
    right: 1rem !important;
  }

  aside #ai-respond-button {
    bottom: 9rem !important;
  }

  aside #show-facts-button {
    bottom: 6.5rem !important;
  }

  aside #reset-button {
    bottom: 4rem !important;
  }

  aside #exit-button {
    bottom: 1.5rem !important;
  }
}

/*******************************
 * Small Tablet & Large Mobile Responsiveness
 *******************************/
@media (min-width: 600px) and (max-width: 768px) {

  /* Responsive button adjustments for small tablets */
  aside #reset-button,
  aside #show-facts-button,
  aside #exit-button,
  aside #ai-respond-button {
    zoom: 0.65 !important;
    right: 1rem !important;
  }

  aside #ai-respond-button {
    bottom: 8rem !important;
  }

  aside #show-facts-button {
    bottom: 6rem !important;
  }

  aside #reset-button {
    bottom: 4rem !important;
  }

  aside #exit-button {
    bottom: 2rem !important;
  }
}

/*******************************
 * Mobile Responsiveness
 *******************************/
@media (max-width: 768px) {

  /* Mobile header button adjustments - override base styles */
  #header button:not(#readme-button),
  #language-switcher button {
    height: 36px !important;
    min-width: 36px !important;
    padding: 0 8px !important;
    font-size: 13px !important;
  }

  /* Adjust header spacing for mobile */
  #header div:last-child {
    gap: 4px !important;
  }

  #header div:last-child>button:last-child {
    margin-right: 8px !important;
  }

  /*
     * The mobile sidebar is a div[role="dialog"], not an <aside> element.
     * These styles target the mobile sidebar specifically for a full-screen, clean look.
     */

  /* Make sidebar full screen */
  div[role="dialog"][data-state="open"] {
    width: auto !important;
    height: 100% !important;
    left: 10% !important;
    right: 0 !important;
    padding: 1rem !important;
    border-radius: 0 !important;
    border: none !important;
  }

  #side-view-content {
    gap: 0 !important;
  }

  /* Align title to the left and add space below */
  div[role="dialog"][data-state="open"] #side-view-title {
    padding-left: 3.7rem !important;
    margin-left: 0 !important;
    text-align: left !important;
    margin-bottom: 1rem !important;
  }

  /* Remove backgrounds and borders from all content blocks */
  div[role="dialog"][data-state="open"] .bg-card {
    padding: 0.5rem !important;
  }

  div[role="dialog"][data-state="open"] .debrief {
    background-color: #FFF !important;
    box-shadow: none !important;
    padding: 0.4rem !important;
  }

  /* Clean up inner padding and margins for a seamless look */
  div[role="dialog"][data-state="open"] .bg-card>div[class*="p-"] {
    padding: 0 !important;
  }

  div[role="dialog"][data-state="open"] .space-y-4 {
    margin-top: 0 !important;
  }

  div[role="dialog"][data-state="open"] .mt-8 {
    margin-top: 1.5rem !important;
  }

  /* Hide unnecessary elements on mobile */
  button[data-state="closed"] svg[width="24"][height="24"],
  #new-progress-check-button,
  div[role="dialog"][data-state="open"] #ai-respond-button,
  div[role="dialog"][data-state="open"] #show-facts-button,
  div[role="dialog"][data-state="open"] #send-test-email-button {
    display: none !important;
  }

  /* Position remaining buttons at the bottom of the screen */
  div[role="dialog"][data-state="open"] #exit-button,
  div[role="dialog"][data-state="open"] #reset-button {
    position: fixed;
    bottom: 1.5rem;
    zoom: 0.9;
  }

  div[role="dialog"][data-state="open"] #exit-button {
    right: 1.5rem;
  }

  div[role="dialog"][data-state="open"] #reset-button {
    right: 6rem;
  }
}

/*******************************
 * Splash Screen Styles
 *******************************/

/* Splash screen container */
#ci-splash-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: white;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.7s ease-out;
}

/* Hide splash screen when disabled globally */
body.splash-disabled #ci-splash-screen {
  display: none !important;
}

/* Dark mode splash background */
.dark #ci-splash-screen {
  background: #1a1a1a;
}

/* Fade out animation */
#ci-splash-screen.fade-out {
  opacity: 0;
  pointer-events: none;
}

/* Splash content container */
.splash-content {
  text-align: center;
  animation: fadeInScale 0.8s ease-out;
}

/* Splash logo */
.splash-logo {
  width: 200px;
  height: auto;
  margin: 0 auto 2rem auto;
  display: block;
  animation: pulse 2s infinite;
}

/* Splash title */
.splash-title {
  font-family: 'Montserrat Alternates', sans-serif;
  font-size: 2.5rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 2rem;
  animation: slideUp 0.6s ease-out 0.3s both;
}

/* Dark mode title color */
.dark .splash-title {
  color: #f0f0f0;
}

/* Loading dots container */
.splash-loader {
  display: flex;
  gap: 8px;
  justify-content: center;
}

/* Loading dots */
.splash-loader span {
  width: 10px;
  height: 10px;
  background: #E11D48;
  border-radius: 50%;
  animation: bounce 1.4s infinite ease-in-out both;
}

/* Dark mode loading dots */
.dark .splash-loader span {
  background: #FF6B6B;
}

/* Stagger the bounce animation */
.splash-loader span:nth-child(1) {
  animation-delay: -0.32s;
}

.splash-loader span:nth-child(2) {
  animation-delay: -0.16s;
}

.splash-loader span:nth-child(3) {
  animation-delay: 0s;
}

/* Splash screen animations */
@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.9);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.05);
  }
}

@keyframes bounce {

  0%,
  80%,
  100% {
    transform: scale(0);
    opacity: 0.5;
  }

  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Hide "Listening" element (text + canvas) in header during STT recording */
/* Excludes the user nav container which also matches the base selector */
#header .flex.items-center.gap-1:has(.text-muted-foreground):not(:has(#user-nav-button)) {
  display: none !important;
}

/* Pulsating animation for voice recording indicator */
@keyframes voice-recording-pulse {
  0%, 100% {
    opacity: 0.5;
  }
  50% {
    opacity: 0.8;
  }
}

/*******************************
 * Voice Button Icon Replacement
 * Replace VoiceLines with Lucide Mic icon
 * Replace X with Lucide Check icon
 * Uses CSS mask technique for currentColor support
 *******************************/

/* === Start Recording: Replace VoiceLines with Mic === */

/* Hide the original VoiceLines SVG paths */
button:has(svg path[d^="M9.5 4C8.67157"]) svg {
  visibility: hidden !important;
}

/* Position button for pseudo-element */
button:has(svg path[d^="M9.5 4C8.67157"]) {
  position: relative !important;
}

/* Add Mic icon via ::before with mask for currentColor */
button:has(svg path[d^="M9.5 4C8.67157"])::before {
  content: "" !important;
  position: absolute !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  width: 1.25rem !important;
  height: 1.25rem !important;
  background-color: currentColor !important;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 19v3'/%3E%3Cpath d='M19 10v2a7 7 0 0 1-14 0v-2'/%3E%3Crect x='9' y='2' width='6' height='13' rx='3'/%3E%3C/svg%3E") !important;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 19v3'/%3E%3Cpath d='M19 10v2a7 7 0 0 1-14 0v-2'/%3E%3Crect x='9' y='2' width='6' height='13' rx='3'/%3E%3C/svg%3E") !important;
  -webkit-mask-size: contain !important;
  mask-size: contain !important;
  -webkit-mask-repeat: no-repeat !important;
  mask-repeat: no-repeat !important;
  -webkit-mask-position: center !important;
  mask-position: center !important;
  pointer-events: none !important;
}

/* === Stop Recording: Replace X with Check (or X in Live mode) === */
/* Scoped to #message-composer to avoid affecting other X icons */
/* When live mode is enabled (.live-mode-enabled class), show X icon instead of Check */

/* Hide the original X SVG */
#message-composer button:has(svg.lucide-x) svg,
#message-composer button:has(svg path[d^="M18 6"]) svg {
  visibility: hidden !important;
}

/* Position button for pseudo-element */
#message-composer button:has(svg.lucide-x),
#message-composer button:has(svg path[d^="M18 6"]) {
  position: relative !important;
}

/* Default: Check icon (non-live mode) */
#message-composer button:has(svg.lucide-x)::before,
#message-composer button:has(svg path[d^="M18 6"])::before {
  content: "" !important;
  position: absolute !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  width: 1.25rem !important;
  height: 1.25rem !important;
  background-color: currentColor !important;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") !important;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") !important;
  -webkit-mask-size: contain !important;
  mask-size: contain !important;
  -webkit-mask-repeat: no-repeat !important;
  mask-repeat: no-repeat !important;
  -webkit-mask-position: center !important;
  mask-position: center !important;
  pointer-events: none !important;
}

/* Live mode: X icon (cancel/stop without sending) */
#message-composer.live-mode-enabled button:has(svg.lucide-x)::before,
#message-composer.live-mode-enabled button:has(svg path[d^="M18 6"])::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 6 6 18'/%3E%3Cpath d='m6 6 12 12'/%3E%3C/svg%3E") !important;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 6 6 18'/%3E%3Cpath d='m6 6 12 12'/%3E%3C/svg%3E") !important;
}

/* === Recording State: Pulsating Red Ring === */
#message-composer button:has(svg.lucide-x)::after,
#message-composer button:has(svg path[d^="M18 6"])::after {
  content: "" !important;
  position: absolute !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  width: 1.5rem !important;
  height: 1.5rem !important;
  background-color: transparent !important;
  border-radius: 50% !important;
  outline: 3px solid #dc2626 !important;
  outline-offset: 0 !important;
  box-shadow: none !important;
  z-index: -1 !important;
  animation: voice-recording-pulse 2s ease-in-out infinite !important;
  pointer-events: none !important;
}

/*******************************
 * Voice Recording UI Collapse
 * Hide text input elements when recording
 * Animated transitions for smooth UX
 *******************************/

/* === Base Transitions for Smooth Animation === */

#message-composer {
  transition: min-height 0.3s ease, padding 0.3s ease,
              width 0.4s ease, margin 0.4s ease !important;
}

/* Textarea container */
#message-composer > div:first-child {
  transition: height 0.3s ease, max-height 0.3s ease, opacity 0.2s ease,
              margin 0.3s ease, padding 0.3s ease !important;
  overflow: hidden !important;
}

/* Settings button */
#chat-settings-open-modal {
  transition: opacity 0.2s ease, width 0.3s ease,
              margin 0.3s ease, padding 0.3s ease !important;
  overflow: hidden !important;
}

/* Submit button */
#chat-submit {
  transition: opacity 0.2s ease, width 0.3s ease,
              margin 0.3s ease, padding 0.3s ease !important;
  overflow: hidden !important;
}

/* === Recording State: Collapse UI === */
/* Detect recording via X/Check icon in voice button */

/* Shrink composer and center it */
#message-composer:has(button svg.lucide-x),
#message-composer:has(button svg path[d^="M18 6"]) {
  min-height: auto !important;
  width: fit-content !important;
  margin-left: auto !important;
  margin-right: auto !important;
  padding: 0.35rem 0.5rem !important;
  gap: 0 !important;
}

/* Center the button row when recording */
#message-composer:has(button svg.lucide-x) > div:last-child,
#message-composer:has(button svg path[d^="M18 6"]) > div:last-child {
  justify-content: center !important;
}

/* Collapse textarea container */
#message-composer:has(button svg.lucide-x) > div:first-child,
#message-composer:has(button svg path[d^="M18 6"]) > div:first-child {
  height: 0 !important;
  max-height: 0 !important;
  opacity: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  pointer-events: none !important;
}

/* Hide settings button */
#message-composer:has(button svg.lucide-x) #chat-settings-open-modal,
#message-composer:has(button svg path[d^="M18 6"]) #chat-settings-open-modal {
  opacity: 0 !important;
  width: 0 !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  pointer-events: none !important;
}

/* Hide submit button */
#message-composer:has(button svg.lucide-x) #chat-submit,
#message-composer:has(button svg path[d^="M18 6"]) #chat-submit {
  opacity: 0 !important;
  width: 0 !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  pointer-events: none !important;
}
