/* Lilo & Stitch Theme Overrides */

:root {
  /* New Lilo and Stitch Color Palette */
  --color-sand: #F5E8D3; /* Primary background */
  --color-white: #FFFFFF; /* Container backgrounds */
  --color-deep-ocean: #1D2D44; /* Main text color (AAA contrast on sand/white) */
  --color-stitch-blue: #005B9A; /* Links, buttons (AA contrast on sand/white) */
  --color-lilo-red: #C11B2E; /* Accent (Darkened to meet AA contrast on sand bg) */
  --color-sand-darker: #E0D5C1; /* For borders and dividers */
  --color-stitch-blue-dark: #004b80; /* Darker hover for stitch blue */
  --color-lilo-red-dark: #9A1624; /* Darker hover for lilo red */
  
  /* Text colors for contrast */
  --text-on-light: #1D2D44; /* Dark text for light backgrounds */
  --text-on-dark: #FFFFFF; /* White text for dark backgrounds */
  --text-on-dark-soft: #F8F8F8; /* Slightly off-white for dark backgrounds */
  --text-muted-light: #5C4F42; /* Muted text for light backgrounds */
  --text-muted-dark: rgba(255, 255, 255, 0.8); /* Muted text for dark backgrounds */
  
  /* Legacy color variables for backwards compatibility during transition */
  --sand: var(--color-sand);
  --sand-dark: #F4E6D3;
  --ocean: var(--color-stitch-blue);
  --ocean-light: #4F9FBE;
--ocean-dark: var(--color-stitch-blue-dark);
  --brown: var(--text-on-light);
  --brown-light: var(--text-muted-light);
  --hibiscus: var(--color-lilo-red);
  --hibiscus-light: #D81B60;
  --lilo-red: var(--color-lilo-red);
  --lilo-red-light: #C62828;
  --tropical-green: #4CAF50;
  --sunset-orange: #FF7043;
}

html, body {
  font-family: "Patrick Hand", "Nunito", ui-sans-serif, system-ui, sans-serif;
}

body {
  background-color: var(--color-sand);
  color: var(--color-deep-ocean); /* Dark text for light sand background */
  line-height: 1.6;
}

/* Sidebar */
#sidebar {
  background: linear-gradient(180deg, var(--color-stitch-blue) 0%, var(--color-stitch-blue-dark) 100%);
  border-right: 2px solid var(--color-sand-darker);
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  height: 100vh;
}

#sidebar .flex {
  height: 100%;
}

#sidebar nav {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

#sidebar nav::-webkit-scrollbar {
  width: 4px;
}

#sidebar nav::-webkit-scrollbar-track {
  background: transparent;
}

#sidebar nav::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
}

#sidebar nav::-webkit-scrollbar-thumb:hover {
  background-color: rgba(255, 255, 255, 0.5);
}

#sidebar h1 {
  color: var(--text-on-dark); /* White text for dark sidebar */
}

#sidebar nav a {
  color: var(--text-muted-dark); /* Muted white text for dark sidebar */
  border-radius: 8px;
  margin: 2px 0;
  transition: all 0.2s ease;
}

#sidebar nav a:hover {
  background-color: rgba(255, 255, 255, 0.2);
  color: var(--text-on-dark); /* Full white on hover */
  transform: translateX(4px);
}

#sidebar nav a.active {
  background: linear-gradient(135deg, var(--color-lilo-red) 0%, var(--hibiscus-light) 100%);
  color: var(--text-on-dark); /* White text for dark button */
  box-shadow: 0 2px 8px rgba(215, 38, 56, 0.3);
}

#sidebar nav a .icon {
  margin-right: 0.75rem;
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.25rem;
  color: var(--text-on-dark); /* White text for dark sidebar */
  display: inline-block;
  min-width: 2ch;
  text-align: center;
}

/* New badge styling for navigation */
.new-badge {
  background: linear-gradient(135deg, var(--color-lilo-red) 0%, #FF1744 100%);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  margin-left: 6px;
  animation: pulse 2s infinite;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.05); }
}

/* Dashboard background */
#choiceScreen {
  background-image: 
    linear-gradient(
      color-mix(in srgb, var(--color-sand) 85%, transparent),
      color-mix(in srgb, var(--color-sand) 85%, transparent)
    ),
    url("/assets/lilo_and_stitch_by_teddybearlove501_dfkas04-fullview.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border-radius: 0.75rem;
  min-height: 100%;
  backdrop-filter: blur(1px);
}

/* Buttons */
button {
  background-color: var(--color-stitch-blue);
  color: var(--color-white);
  border: none;
}
button:hover,
button:focus {
  background-color: var(--color-stitch-blue-dark);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  font-weight: 700;
  border: none;
  color: var(--text-on-dark); /* White text for dark button backgrounds */
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.25);
}

.btn:active { 
  transform: translateY(1px);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.btn-primary {
  background-color: var(--color-stitch-blue);
}
.btn-primary:hover {
  background-color: var(--color-stitch-blue-dark);
}

.btn-logout {
  background-color: var(--color-lilo-red);
}

/* Emoji Picker Styles */
.emoji-picker {
  border: 2px solid rgba(236, 72, 153, 0.5) !important;
  background-color: rgb(30, 41, 59) !important;
  backdrop-filter: blur(8px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3) !important;
  width: calc(100% - 4px) !important;
  max-height: 280px !important;
  left: 2px !important;
  right: 2px !important;
}

.emoji-picker-header {
  border-bottom: 1px solid rgba(236, 72, 153, 0.3) !important;
}

.emoji-category-btn {
  transition: all 0.2s ease !important;
  font-size: 0.75rem !important;
  font-weight: 500 !important;
}

.emoji-category-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.emoji-btn {
  transition: all 0.15s ease !important;
  min-height: 32px;
  min-width: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.emoji-btn:hover {
  transform: scale(1.2);
  background-color: rgba(236, 72, 153, 0.3) !important;
  border-radius: 6px;
}

.emoji-picker-content::-webkit-scrollbar {
  width: 6px;
}

.emoji-picker-content::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 3px;
}

.emoji-picker-content::-webkit-scrollbar-thumb {
  background: rgba(236, 72, 153, 0.4);
  border-radius: 3px;
}

.emoji-picker-content::-webkit-scrollbar-thumb:hover {
  background: rgba(236, 72, 153, 0.6);
}

/* Ensure proper grid layout */
#emojiGrid {
  display: grid !important;
  grid-template-columns: repeat(12, 1fr) !important;
  gap: 8px !important;
  width: 100% !important;
  max-height: 192px !important;
  overflow-y: auto !important;
}

/* Responsive emoji grid */
@media (min-width: 640px) {
  #emojiGrid {
    grid-template-columns: repeat(16, 1fr) !important;
  }
}

@media (min-width: 768px) {
  #emojiGrid {
    grid-template-columns: repeat(20, 1fr) !important;
  }
}

@media (min-width: 1024px) {
  #emojiGrid {
    grid-template-columns: repeat(24, 1fr) !important;
  }
}

.emoji-picker-content {
  max-height: 200px !important;
  overflow: hidden !important;
}
.btn-logout:hover {
  background-color: var(--color-lilo-red-dark);
}

/* Content Areas */
.page-content {
  color: var(--color-deep-ocean); /* Dark text for light backgrounds */
}

.page-content h1, .page-content h2, .page-content h3, .page-content h4 {
  color: var(--color-deep-ocean); /* Dark text for light backgrounds */
}

/* Card styles for content sections */
.bg-white\/20 {
  background-color: var(--color-white) !important;
  border: 1px solid var(--color-sand-darker);
}

.bg-ocean\/20 {
  background-color: color-mix(in srgb, var(--color-stitch-blue) 15%, transparent) !important;
  border: 1px solid color-mix(in srgb, var(--color-stitch-blue) 20%, transparent);
}

.bg-red-500\/10 {
  background-color: color-mix(in srgb, var(--color-lilo-red) 8%, transparent) !important;
  border: 1px solid color-mix(in srgb, var(--color-lilo-red) 15%, transparent);
}

/* Status indicators */
.border-hibiscus {
  border-color: var(--color-lilo-red) !important;
}

.border-lilo-red {
  border-color: var(--color-lilo-red) !important;
}

.text-brown {
  color: var(--color-deep-ocean) !important; /* Dark text for light backgrounds */
}

.text-hibiscus {
  color: var(--color-lilo-red) !important;
}

/* Mobile nav toggle */
.mobile-nav-toggle {
  background-color: var(--color-stitch-blue) !important;
  color: var(--text-on-dark) !important; /* White text for dark background */
  border: 2px solid var(--color-stitch-blue);
}

.mobile-nav-toggle:hover {
  background-color: var(--color-stitch-blue-dark) !important;
}

/* Input Fields - High Visibility */
input[type="text"],
input[type="password"],
input[type="email"],
input[type="search"],
textarea,
select {
  background-color: var(--color-white) !important;
  color: var(--color-deep-ocean) !important; /* Dark text for white input backgrounds */
  border: 2px solid var(--color-sand-darker) !important;
  border-radius: 8px !important;
  padding: 12px 16px !important;
  font-size: 16px !important;
  font-weight: 500 !important;
  line-height: 1.5 !important;
  transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1) !important;
}

/* Input focus states */
input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="search"]:focus,
textarea:focus,
select:focus {
  outline: none !important;
  border-color: var(--color-lilo-red) !important;
  box-shadow: 
    inset 0 1px 3px rgba(0, 0, 0, 0.1),
    0 0 0 3px color-mix(in srgb, var(--color-lilo-red) 20%, transparent) !important;
  background-color: var(--color-white) !important;
  color: var(--color-deep-ocean) !important; /* Ensure dark text remains on white background */
}

/* Placeholder text */
input::placeholder,
textarea::placeholder {
  color: var(--text-muted-light) !important; /* Muted dark text for light backgrounds */
  opacity: 0.7 !important;
  font-weight: 400 !important;
}

/* Chat input specific styling */
/* Chat messages scroll behavior */
#chatMessages {
  scroll-behavior: smooth;
  overscroll-behavior: contain;
  scrollbar-gutter: stable both-edges;
}
#chatInput,
.chat-input,
[id*="chat"] input,
[class*="chat"] input {
  background-color: var(--color-white) !important;
  color: var(--color-deep-ocean) !important; /* Dark text for white chat input */
  border: 2px solid var(--color-sand-darker) !important;
  font-size: 16px !important;
  font-weight: 500 !important;
}

/* Chat input textarea specific styling */
#chatInput {
  line-height: 1.5 !important;
  max-height: 72px !important; /* 3 lines: 24px per line */
  min-height: 32px !important;
  overflow-y: auto !important;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.3) transparent;
}

#chatInput::-webkit-scrollbar {
  width: 4px;
}

#chatInput::-webkit-scrollbar-track {
  background: transparent;
}

#chatInput::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.3);
  border-radius: 2px;
}

#chatInput::-webkit-scrollbar-thumb:hover {
  background-color: rgba(0, 0, 0, 0.5);
}

#chatInput:focus,
.chat-input:focus,
[id*="chat"] input:focus,
[class*="chat"] input:focus {
  border-color: var(--color-lilo-red) !important;
  box-shadow: 
    inset 0 1px 3px rgba(0, 0, 0, 0.1),
    0 0 0 3px color-mix(in srgb, var(--color-lilo-red) 20%, transparent) !important;
}

/* Login form inputs */
.login-form input {
  background-color: var(--color-white) !important;
  color: var(--color-deep-ocean) !important; /* Dark text for white login inputs */
  border: 2px solid var(--color-sand-darker) !important;
  font-size: 16px !important;
  font-weight: 500 !important;
}

.login-form input:focus {
  border-color: var(--color-lilo-red) !important;
  box-shadow: 
    inset 0 1px 3px rgba(0, 0, 0, 0.1),
    0 0 0 3px color-mix(in srgb, var(--color-lilo-red) 20%, transparent) !important;
}

/* Dark mode override prevention */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
  -webkit-box-shadow: inset 0 0 0 1000px var(--color-white) !important;
  -webkit-text-fill-color: var(--text-on-light) !important; /* Dark text for white autofill */
  box-shadow: inset 0 0 0 1000px var(--color-white) !important;
}

/* Password visibility toggle button */
.password-toggle {
  background: transparent !important;
  border: none !important;
  color: var(--color-stitch-blue) !important;
  cursor: pointer !important;
  padding: 4px !important;
}

.password-toggle:hover {
  color: var(--color-stitch-blue-dark) !important;
}

/* Form labels */
label {
  color: var(--color-deep-ocean) !important; /* Dark text for light backgrounds */
  font-weight: 600 !important;
  font-size: 14px !important;
  margin-bottom: 6px !important;
  display: block !important;
}

/* Textarea specific */
textarea {
  min-height: 120px !important;
  resize: vertical !important;
  font-family: inherit !important;
}


/* Headings - High Contrast */
h1, h2, h3, h4, h5, h6 {
  color: var(--color-deep-ocean) !important; /* Dark text for light backgrounds */
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8) !important;
  font-weight: 700 !important;
}


/* Links */
.page-content a {
  color: var(--color-stitch-blue);
  text-decoration: underline;
}

.page-content a:hover {
  color: var(--color-stitch-blue-dark);
  text-decoration: none;
}











/* Ensure button text stays white for dark button backgrounds */
.btn, .btn * {
  color: var(--text-on-dark) !important; /* White text for dark buttons */
}

/* Profile page specific overrides for dark backgrounds */
#profileContent h2 {
  color: rgb(249 168 212) !important; /* Pink-300 for main headings */
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5) !important;
}

#profileContent label {
  color: rgb(147 197 253) !important; /* Blue-300 for section labels */
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.3) !important;
}

/* Chat message bubble improvements: ensure long messages wrap and preserve line breaks */
.chat-message .chat-bubble {
  /* Expand bubbles up to 80% of the container, but cap at a readable width */
  max-width: min(42rem, 80%) !important;
}
.chat-message p {
  /* Preserve line breaks and wrap long tokens safely */
  white-space: pre-wrap !important;
  overflow-wrap: anywhere !important; /* modern equivalent: break long words/URLs */
  word-break: break-word !important;   /* legacy support */
}
.chat-message a {
  /* Allow very long URLs to wrap if needed */
  word-break: break-all !important;
}







