/* ChatGPT Light Theme Replica + Gestiweb Corporate Colors */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600&family=Inter:wght@400;500;600&display=swap');

:root {
  --bg-main: #ffffff;
  --bg-sidebar: #f9f9f9;
  --bg-input: #ffffff;
  --bg-hover: #ececec;
  --text-primary: #0d0d0d;
  --text-secondary: #666666;
  --text-tertiary: #8e8e8e;
  --accent: #b90e2b;
  /* Gestiweb Corporate Red */
  --accent-hover: #900b22;
  --border-light: rgba(0, 0, 0, 0.1);
  --border-focus: rgba(0, 0, 0, 0.15);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  margin: 0;
  padding: 0;
  background-color: var(--bg-main);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3,
h4,
.font-outfit {
  font-family: 'Outfit', sans-serif;
}

/* Background Overrides for Light Theme */
.bg-gray-900 {
  background-color: var(--bg-sidebar);
}

.bg-gray-800 {
  background-color: var(--bg-main);
}

.bg-gray-700 {
  background-color: #f4f4f4;
}

.bg-gray-50 {
  background-color: #f8f9fb;
}

.bg-gray-100 {
  background-color: #f0f1f5;
}

.bg-white {
  background-color: #ffffff;
}

/* Thin Light Scrollbars */
.hidden-scrollbar::-webkit-scrollbar {
  display: none;
}

.hidden-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

#chat-messages::-webkit-scrollbar {
  width: 8px;
}

#chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

#chat-messages::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 10px;
}

#chat-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.25);
}

/* Header */
header {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 20;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

#chat-messages {
  padding-bottom: 2rem;
}

/* Chat Layout - Premium */
.message-row {
  display: flex;
  width: 100%;
  max-width: 48rem;
  margin: 0 auto;
  gap: 1rem;
  padding: 0.75rem 0;
  animation: messageSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes messageSlideIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

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

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.message-avatar {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 600;
  font-size: 0.85rem;
  transition: transform 0.2s ease;
}

.message-row:hover .message-avatar {
  transform: scale(1.05);
}

.avatar-user {
  background: linear-gradient(135deg, #b90e2b 0%, #d4213e 100%);
  color: #ffffff;
  box-shadow: 0 3px 12px rgba(185, 14, 43, 0.25);
}

.avatar-bot {
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fb 100%);
  border: 1.5px solid rgba(185, 14, 43, 0.12);
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.avatar-bot img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.user-row {
  flex-direction: row-reverse;
  justify-content: flex-start;
}

.user-row .message-bubble {
  background: linear-gradient(135deg, #b90e2b 0%, #d4213e 100%);
  color: #ffffff;
  padding: 0.85rem 1.15rem;
  border-radius: 18px 18px 4px 18px;
  box-shadow: 0 3px 15px rgba(185, 14, 43, 0.2);
  line-height: 1.55;
}

.user-row .message-bubble a {
  color: #ffd1d9;
  text-decoration: underline;
}

.bot-row {
  justify-content: flex-start;
}

.bot-row .message-bubble {
  background: rgba(248, 249, 251, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 0.85rem 1.15rem;
  border-radius: 18px 18px 18px 4px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

/* Message Bubbles */
.message-bubble {
  max-width: 85%;
  line-height: 1.6;
  font-size: 0.95rem;
  color: var(--text-primary);
  transition: box-shadow 0.2s ease;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.bot-row .message-bubble {
  max-width: 100%;
  flex: 1;
}

.message-row:hover .message-bubble {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

.model-badge {
  display: block;
  font-size: 0.7rem;
  color: var(--text-tertiary);
  text-align: right;
  margin-top: 0.5rem;
  font-family: 'Inter', sans-serif;
  opacity: 0.7;
  font-style: italic;
}

.user-row .model-badge {
  color: rgba(255, 255, 255, 0.8);
}

.user-row:hover .message-bubble {
  box-shadow: 0 4px 20px rgba(185, 14, 43, 0.25);
}

.message-bubble p {
  margin-top: 0;
  margin-bottom: 1rem;
}

.message-bubble p:last-child {
  margin-bottom: 0;
}

.message-bubble pre {
  background-color: #1e1e2e;
  color: #cdd6f4;
  padding: 1rem 1.25rem;
  border-radius: 12px;
  overflow-x: auto;
  margin: 1em 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-family: 'ui-monospace', 'SFMono-Regular', Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.65;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  position: relative;
}

.message-bubble code {
  font-family: 'ui-monospace', 'SFMono-Regular', Consolas, monospace;
  background-color: rgba(185, 14, 43, 0.08);
  padding: 0.2em 0.45em;
  border-radius: 6px;
  font-size: 0.88em;
  color: #b90e2b;
  border: 1px solid rgba(185, 14, 43, 0.12);
}

.user-row .message-bubble code {
  background-color: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.2);
}

.message-bubble pre code {
  background-color: transparent;
  padding: 0;
  color: #cdd6f4;
  border: none;
}

.message-bubble ul,
.message-bubble ol {
  margin-top: 0;
  margin-bottom: 1em;
  padding-left: 1.5em;
}

.message-bubble strong {
  font-weight: 600;
  color: #111;
}

/* History Search */
.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg-main);
  border: 1.5px solid rgba(0, 0, 0, 0.08);
  border-radius: 0;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.search-wrapper:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(185, 14, 43, 0.08), 0 2px 8px rgba(185, 14, 43, 0.06);
}

.search-wrapper .search-icon {
  position: absolute;
  left: 10px;
  width: 16px;
  height: 16px;
  color: var(--text-tertiary);
  pointer-events: none;
  transition: color 0.2s ease;
  flex-shrink: 0;
}

.search-wrapper:focus-within .search-icon {
  color: var(--accent);
}

#search-conversations {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 0.82rem;
  font-family: inherit;
  padding: 9px 32px 9px 32px;
  line-height: 1.4;
}

#search-conversations::placeholder {
  color: var(--text-tertiary);
  opacity: 0.65;
}

.search-clear-btn {
  position: absolute;
  right: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: none;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 6px;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
}

.search-clear-btn svg {
  width: 12px;
  height: 12px;
}

.search-clear-btn:hover {
  background: rgba(185, 14, 43, 0.1);
  color: var(--accent);
}

.search-results-label {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  padding: 6px 2px 0;
  letter-spacing: 0.02em;
  font-weight: 500;
}

.search-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 2rem 1rem;
  color: var(--text-tertiary);
  text-align: center;
}

.search-empty-state svg {
  width: 28px;
  height: 28px;
  opacity: 0.4;
}

.search-empty-state span {
  font-size: 0.78rem;
  opacity: 0.7;
}

/* History Sidebar Items */
.history-item {
  position: relative;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 400;
  color: var(--text-primary);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.history-item:hover,
.history-item.active {
  background-color: rgba(185, 14, 43, 0.06) !important;
  border-left: 3px solid var(--accent);
  padding-left: calc(0.75rem - 3px);
}

/* Chat Input Container - Floating and Centered */
#chat-form {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(185, 14, 43, 0.1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  border-radius: 1.5rem;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  width: 100%;
}

#chat-form:focus-within {
  border-color: rgba(185, 14, 43, 0.2);
  box-shadow: 0 4px 24px rgba(185, 14, 43, 0.08);
}

textarea#message-input,
textarea#message-input-welcome {
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text-primary);
}

textarea#message-input::placeholder {
  color: var(--text-tertiary);
}

textarea#message-input:focus {
  outline: none;
}

.mic-btn {
  position: absolute;
  right: 3.5rem;
  bottom: 0.8rem;
  width: 2.2rem;
  height: 2.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #a3a3a3;
  background: transparent;
  transition: all 0.2s ease;
  border: none;
  cursor: pointer;
  z-index: 10;
}

.mic-btn:hover {
  color: #b90e2b;
  background-color: rgba(185, 14, 43, 0.05);
}

#btn-send,
#btn-send-welcome {
  background: linear-gradient(135deg, #b90e2b 0%, #d4213e 100%);
  color: white;
  border-radius: 50%;
  padding: 0.45rem;
  right: 0.8rem;
  bottom: 0.8rem;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(185, 14, 43, 0.3);
  border: none;
  position: absolute;
  z-index: 10;
}

#btn-send:hover:not(:disabled),
#btn-send-welcome:hover:not(:disabled) {
  background: linear-gradient(135deg, #d4213e 0%, #b90e2b 100%);
  box-shadow: 0 4px 16px rgba(185, 14, 43, 0.4);
  transform: scale(1.08);
}

#btn-send:active:not(:disabled),
#btn-send-welcome:active:not(:disabled) {
  transform: scale(0.95);
}

#btn-send:disabled,
#btn-send-welcome:disabled {
  background: #e5e5e5;
  color: #a3a3a3;
  cursor: not-allowed;
  box-shadow: none;
}

/* Mic animation */
.mic-btn.recording {
  color: #b90e2b;
  background-color: rgba(185, 14, 43, 0.1);
  animation: bgPulse 1.5s infinite ease-in-out;
}

@keyframes bgPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(185, 14, 43, 0.4);
  }

  70% {
    box-shadow: 0 0 0 6px rgba(185, 14, 43, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(185, 14, 43, 0);
  }
}

/* Typing animation */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 0;
}

.typing-indicator span {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: linear-gradient(135deg, #b90e2b, #d4213e);
  border-radius: 50%;
  animation: typingPulse 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) {
  animation-delay: -0.32s;
}

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

@keyframes typingPulse {

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

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

/* ===== PREMIUM LOGIN SCREEN ===== */

/* Split layout container */
.login-split {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  font-family: 'Outfit', sans-serif;
}

/* Left brand panel */
.login-brand {
  flex: 1;
  background: linear-gradient(135deg, #b90e2b 0%, #8a0a20 40%, #4a0510 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.login-brand-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 2rem;
  animation: fadeSlideUp 0.8s ease-out;
}

/* Mascot */
.login-mascot {
  width: 120px;
  height: 120px;
  margin: 0 auto 1.5rem;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.2);
  animation: float 6s ease-in-out infinite;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.login-mascot img {
  width: 80px;
  height: 80px;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.15));
}

/* Brand text */
.login-brand-title {
  font-size: 2.5rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0 0 0.5rem;
  letter-spacing: -0.02em;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

.login-brand-title span {
  font-weight: 300;
  opacity: 0.85;
}

.login-brand-subtitle {
  font-size: 1.15rem;
  color: rgba(255, 255, 255, 0.75);
  margin: 0 0 2.5rem;
  font-weight: 300;
  letter-spacing: 0.03em;
}

/* Brand features list */
.login-brand-features {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: flex-start;
  max-width: 260px;
  margin: 0 auto;
}

.brand-feature {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.95rem;
  font-weight: 400;
}

.brand-feature svg {
  flex-shrink: 0;
  opacity: 0.9;
}

/* Floating decorative shapes */
.floating-shape {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  pointer-events: none;
}

.shape-1 {
  width: 300px;
  height: 300px;
  top: -100px;
  right: -80px;
  animation: floatShape1 20s ease-in-out infinite;
}

.shape-2 {
  width: 200px;
  height: 200px;
  bottom: -60px;
  left: -40px;
  background: rgba(255, 255, 255, 0.04);
  animation: floatShape2 15s ease-in-out infinite;
}

.shape-3 {
  width: 100px;
  height: 100px;
  top: 40%;
  left: 15%;
  background: rgba(255, 255, 255, 0.08);
  animation: floatShape1 12s ease-in-out infinite reverse;
}

.shape-4 {
  width: 60px;
  height: 60px;
  bottom: 25%;
  right: 20%;
  background: rgba(255, 255, 255, 0.05);
  animation: floatShape2 18s ease-in-out infinite;
}

.shape-5 {
  width: 150px;
  height: 150px;
  top: 15%;
  left: 60%;
  border-radius: 30%;
  background: rgba(255, 255, 255, 0.03);
  animation: floatShape1 25s ease-in-out infinite;
  transform: rotate(45deg);
}

/* Right form panel */
.login-form-panel {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8f9fb;
  position: relative;
  padding: 2rem;
}

/* Glassmorphism card */
.login-card {
  width: 100%;
  max-width: 420px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.08),
    0 1px 3px rgba(0, 0, 0, 0.04);
  padding: 2.5rem 2.5rem 2rem;
  animation: fadeSlideUp 0.6s ease-out 0.15s both;
}

.login-card-header {
  text-align: center;
  margin-bottom: 2rem;
}

.login-avatar-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 1rem;
  background: linear-gradient(135deg, #fce4e4 0%, #fdd5d5 100%);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #b90e2b;
  box-shadow: 0 4px 12px rgba(185, 14, 43, 0.15);
}

.login-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.75rem;
  font-weight: 600;
  color: #1a1a2e;
  margin: 0 0 0.35rem;
  letter-spacing: -0.01em;
}

.login-subtitle {
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  color: #8e8e9e;
  margin: 0;
  font-weight: 400;
}

/* Error box */
.login-error {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
  font-size: 0.85rem;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  margin-bottom: 1.5rem;
  font-family: 'Inter', sans-serif;
}

.login-error svg {
  flex-shrink: 0;
}

/* Form body */
.login-form-body {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.login-input-group label {
  display: block;
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  color: #4a4a5a;
  margin-bottom: 0.4rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.login-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.login-input-icon {
  position: absolute;
  left: 14px;
  color: #b0b0c0;
  pointer-events: none;
  transition: color 0.2s;
}

.login-input-wrapper input {
  width: 100%;
  padding: 0.85rem 1rem 0.85rem 2.75rem;
  background: #f0f1f5;
  border: 2px solid transparent;
  border-radius: 14px;
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  color: #1a1a2e;
  transition: all 0.25s ease;
  outline: none;
  box-sizing: border-box;
}

.login-input-wrapper input::placeholder {
  color: #b0b0c0;
}

.login-input-wrapper input:focus {
  background: #ffffff;
  border-color: #b90e2b;
  box-shadow: 0 0 0 4px rgba(185, 14, 43, 0.1);
}

.login-input-wrapper input:focus~.login-input-icon,
.login-input-wrapper input:focus+.login-input-icon {
  color: #b90e2b;
}

.login-input-wrapper:focus-within .login-input-icon {
  color: #b90e2b;
}

/* Submit button */
.login-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.9rem 1.5rem;
  margin-top: 0.5rem;
  background: linear-gradient(135deg, #b90e2b 0%, #d4213e 50%, #b90e2b 100%);
  background-size: 200% 200%;
  color: #ffffff;
  font-family: 'Outfit', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(185, 14, 43, 0.35);
  letter-spacing: 0.02em;
  position: relative;
  overflow: hidden;
}

.login-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, transparent 50%, rgba(255, 255, 255, 0.1) 100%);
  opacity: 0;
  transition: opacity 0.3s;
}

.login-btn:hover {
  background-position: 100% 100%;
  box-shadow: 0 6px 25px rgba(185, 14, 43, 0.45);
  transform: translateY(-2px);
}

.login-btn:hover::before {
  opacity: 1;
}

.login-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 10px rgba(185, 14, 43, 0.3);
}

.login-btn svg {
  transition: transform 0.3s;
}

.login-btn:hover svg {
  transform: translateX(4px);
}

/* Footer */
.login-footer {
  text-align: center;
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.login-footer p {
  font-family: 'Inter', sans-serif;
  font-size: 0.75rem;
  color: #a0a0b0;
  margin: 0;
}

/* ===== LOGIN ANIMATIONS ===== */

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

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

@keyframes float {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-12px);
  }
}

@keyframes floatShape1 {

  0%,
  100% {
    transform: translate(0, 0) rotate(0deg);
  }

  33% {
    transform: translate(15px, -20px) rotate(5deg);
  }

  66% {
    transform: translate(-10px, 10px) rotate(-3deg);
  }
}

@keyframes floatShape2 {

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

  50% {
    transform: translate(20px, -15px) scale(1.05);
  }
}

/* ===== LOGIN RESPONSIVE ===== */

@media (max-width: 900px) {
  .login-split {
    flex-direction: column;
  }

  .login-brand {
    flex: 0 0 auto;
    padding: 2rem 1.5rem;
    min-height: auto;
  }

  .login-mascot {
    width: 80px;
    height: 80px;
    margin-bottom: 1rem;
  }

  .login-mascot img {
    width: 55px;
    height: 55px;
  }

  .login-brand-title {
    font-size: 1.75rem;
    margin-bottom: 0.25rem;
  }

  .login-brand-subtitle {
    font-size: 0.95rem;
    margin-bottom: 0;
  }

  .login-brand-features {
    display: none;
  }

  .floating-shape {
    display: none;
  }

  .login-form-panel {
    flex: 1;
    padding: 1.5rem;
  }

  .login-card {
    padding: 2rem 1.5rem 1.5rem;
  }
}

/* Mobile Adjustments */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    height: 100%;
    z-index: 50;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.1);
  }

  #sidebar-overlay {
    z-index: 45;
  }

  .flex-1.flex.flex-col {
    height: 100dvh;
  }
}

/* Inline Class overrides for text colors on light background */
.text-gray-100 {
  color: #111111;
}

.text-gray-200 {
  color: #222222;
}

.text-gray-300 {
  color: #333333;
}

.text-gray-400 {
  color: var(--text-secondary);
}

.text-gray-500 {
  color: var(--text-tertiary);
}

.text-white {
  color: #ffffff;
}

.text-red-500 {
  color: #ef4444;
}

.bg-teal-600 {
  background-color: var(--accent);
}

.bg-teal-700,
.hover\:bg-teal-700:hover {
  background-color: var(--accent-hover);
}

.border-white\/10 {
  border-color: var(--border-light);
}

.bg-white\/10 {
  background-color: transparent;
}

.hover\:bg-white\/20:hover {
  background-color: var(--bg-hover) !important;
}

.hover\:bg-white\/10:hover {
  background-color: var(--bg-hover);
}

/* Remove bottom gradient for clean chatgpt style */
.bg-gradient-to-t {
  background: var(--bg-main);
}

.from-gray-800 {
  background: var(--bg-main);
}

.to-transparent {
  background: var(--bg-main);
}

/* Welcome Screen Large Input Style overriding layout */
#chat-messages {
  display: flex;
  flex-direction: column;
  padding-top: 5rem;
  background: linear-gradient(180deg, #ffffff 0%, #faf9fb 50%, #f5f3f7 100%);
}

.centered-search-container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  flex: 1;
  width: 100%;
  max-width: 48rem;
  margin: 0 auto;
  animation: fadeIn 0.6s ease-out;
}

/* Welcome mascot */
.welcome-mascot {
  width: 80px;
  height: 80px;
  margin-bottom: 1rem;
  animation: float 4s ease-in-out infinite;
  filter: drop-shadow(0 6px 20px rgba(185, 14, 43, 0.15));
}

.welcome-mascot img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Welcome title gradient */
.welcome-title {
  font-family: 'Outfit', sans-serif;
  font-size: 2rem;
  font-weight: 600;
  background: linear-gradient(135deg, #1a1a2e 0%, #b90e2b 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.35rem;
  letter-spacing: -0.02em;
}

.welcome-subtitle {
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

/* Suggestion chips */
.suggestion-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  justify-content: center;
  margin-bottom: 2rem;
  max-width: 600px;
  padding: 0 1rem;
}

.suggestion-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(185, 14, 43, 0.1);
  border-radius: 14px;
  font-family: 'Inter', sans-serif;
  font-size: 0.82rem;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.suggestion-chip:hover {
  background: linear-gradient(135deg, #fce4e4 0%, #fff0f2 100%);
  border-color: rgba(185, 14, 43, 0.25);
  box-shadow: 0 4px 16px rgba(185, 14, 43, 0.12);
  transform: translateY(-2px);
}

.suggestion-chip svg {
  width: 16px;
  height: 16px;
  color: var(--accent);
  flex-shrink: 0;
}

/* Fallback utilities (keep spacing and flex) */
.w-full {
  width: 100%
}

.h-full {
  height: 100%
}

.flex {
  display: flex
}

.flex-col {
  flex-direction: column
}

.items-center {
  align-items: center
}

.items-end {
  align-items: flex-end
}

.justify-center {
  justify-content: center
}

.justify-between {
  justify-content: space-between
}

.flex-1 {
  flex: 1 1 0%
}

.flex-shrink-0 {
  flex-shrink: 0
}

.hidden {
  display: none !important
}

.block {
  display: block
}

.fixed {
  position: fixed
}

.absolute {
  position: absolute
}

.left-1\/2 {
  left: 50% !important;
}

.-translate-x-1\/2 {
  --tw-translate-x: -50% !important;
}

.top-1\/2 {
  top: 50% !important;
}

.relative {
  position: relative
}

.inset-0 {
  top: 0;
  right: 0;
  bottom: 0;
  left: 0
}

.z-50 {
  z-index: 50
}

.z-40 {
  z-index: 40
}

.z-30 {
  z-index: 30
}

.bg-transparent {
  background-color: transparent
}

.border {
  border-width: 1px;
  border-style: solid
}

.border-b {
  border-bottom-width: 1px;
  border-style: solid
}

.border-r {
  border-right-width: 1px;
  border-style: solid
}

.border-t {
  border-top-width: 1px;
  border-style: solid
}

.border-0 {
  border-width: 0
}

.rounded-lg {
  border-radius: 0.75rem
}

.rounded-md {
  border-radius: 0.5rem
}

.rounded-xl {
  border-radius: 1rem
}

.rounded-full {
  border-radius: 9999px
}

.rounded-2xl {
  border-radius: 1rem
}

.p-8 {
  padding: 2.5rem
}

.p-4 {
  padding: 1rem
}

.p-3 {
  padding: 0.75rem
}

.p-2 {
  padding: 0.5rem
}

.px-4 {
  padding-left: 1.25rem;
  padding-right: 1.25rem
}

.px-3 {
  padding-left: 0.75rem;
  padding-right: 0.75rem
}

.py-3 {
  padding-top: 0.75rem;
  padding-bottom: 0.75rem
}

.py-2 {
  padding-top: 0.5rem;
  padding-bottom: 0.5rem
}

.py-4 {
  padding-top: 1rem;
  padding-bottom: 1rem
}

.py-6 {
  padding-top: 1.5rem;
  padding-bottom: 1.5rem
}

.px-12 {
  padding-left: 3rem;
  padding-right: 3rem
}

.pr-12 {
  padding-right: 3.5rem
}

.pl-4 {
  padding-left: 1rem
}

.pb-6 {
  padding-bottom: 1.5rem
}

.pt-2 {
  padding-top: 0.5rem
}

.m-0 {
  margin: 0
}

.m-1 {
  margin: 0.25rem
}

.mb-6 {
  margin-bottom: 1.5rem
}

.mb-4 {
  margin-bottom: 1rem
}

.mb-2 {
  margin-bottom: 0.5rem
}

.mb-1 {
  margin-bottom: 0.25rem
}

.mt-2 {
  margin-top: 0.5rem
}

.mt-3 {
  margin-top: 0.75rem
}

.mx-auto {
  margin-left: auto;
  margin-right: auto
}

.max-w-sm {
  max-width: 26rem
}

.max-w-3xl {
  max-width: 48rem
}

.w-\[260px\] {
  width: 260px
}

.w-8 {
  width: 2rem
}

.h-8 {
  height: 2rem
}

.w-16 {
  width: 4rem
}

.h-16 {
  height: 4rem
}

.w-6 {
  width: 1.5rem
}

.h-6 {
  height: 1.5rem
}

.w-5 {
  width: 1.25rem
}

.h-5 {
  height: 1.25rem
}

.w-4 {
  width: 1rem
}

.h-4 {
  height: 1rem
}

.gap-3 {
  gap: 0.75rem
}

.gap-2 {
  gap: 0.5rem
}

.space-y-4>* {
  margin-top: 1rem
}

.space-y-6>* {
  margin-top: 1.5rem
}

.text-2xl {
  font-size: 1.5rem;
  line-height: 2rem
}

.text-3xl {
  font-size: 1.875rem;
  line-height: 2.25rem
}

.text-sm {
  font-size: 0.875rem;
  line-height: 1.25rem
}

.text-xs {
  font-size: 0.75rem;
  line-height: 1rem
}

.font-semibold {
  font-weight: 600
}

.font-medium {
  font-weight: 500
}

.font-bold {
  font-weight: 700
}

.text-center {
  text-align: center
}

.text-left {
  text-align: left
}

.cursor-pointer {
  cursor: pointer
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap
}

.shadow-xl {
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1)
}

.shadow-lg {
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1)
}

.shadow-sm {
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05)
}

.transition-colors {
  transition-property: background-color, border-color, color, fill, stroke;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 200ms
}

.transition-all {
  transition-property: all;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 200ms
}

.duration-200 {
  transition-duration: 200ms
}

.duration-300 {
  transition-duration: 300ms
}

.transform {
  transform: translateX(var(--tw-translate-x)) translateY(var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))
}

.-translate-x-full {
  --tw-translate-x: -100%;
  transform: translateX(-100%)
}

.focus\:outline-none:focus {
  outline: 2px solid transparent;
  outline-offset: 2px
}

.focus\:ring-2:focus {
  box-shadow: 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color)
}

.focus\:border-transparent:focus {
  border-color: transparent
}

.disabled\:opacity-50:disabled {
  opacity: 0.5;
  cursor: not-allowed
}

.right-2 {
  right: 0.5rem
}

.bottom-2 {
  bottom: 0.5rem
}

@media (min-width: 768px) {
  .md\:translate-x-0 {
    --tw-translate-x: 0px;
    transform: translateX(0);
  }

  .md\:relative {
    position: relative;
  }

  .md\:hidden {
    display: none !important;
  }

  .md\:block {
    display: block;
  }

  .md\:px-12 {
    padding-left: 3rem;
    padding-right: 3rem;
  }

  .md\:bottom-3 {
    bottom: 0.75rem;
  }

  .md\:py-4 {
    padding-top: 1rem;
    padding-bottom: 1rem;
  }

  .md\:w-0 {
    width: 0;
  }

  .md\:flex {
    display: flex !important;
  }
}


/* Layout & Scroll Utilities */
.h-screen {
  height: 100vh;
}

.overflow-hidden {
  overflow: hidden !important;
}

.overflow-y-auto {
  overflow-y: auto !important;
}

.scroll-smooth {
  scroll-behavior: smooth;
}

/* Prevent scroll chaining */
html,
body {
  overscroll-behavior-y: none;
}

#chat-history-list,
#chat-messages {
  overscroll-behavior: contain;
}

/* Delete Button & Utility Classes */
.group {
  position: relative;
}

.opacity-0 {
  opacity: 0;
}

.opacity-100 {
  opacity: 1;
}

.transition-opacity {
  transition: opacity 0.2s ease;
}

.flex-1 {
  flex: 1 1 0%;
}

.shrink-0 {
  flex-shrink: 0;
}

.ml-2 {
  margin-left: 0.5rem;
}

.p-1 {
  padding: 0.25rem;
}

/* Tailwind-style group-hover */
.group:hover .group-hover\:opacity-100 {
  opacity: 1 !important;
}

/* Colors & Hover states */
.text-red-500 {
  color: #ef4444 !important;
}

.hover\:text-red-500:hover {
  color: #b91c1c !important;
}

.hover\:bg-red-50:hover {
  background-color: #fef2f2 !important;
}

/* Mobile visibility for delete button */
@media (max-width: 768px) {
  .opacity-0 {
    opacity: 1 !important;
    color: #9ca3af !important;
  }
}

/* User menu dropdown animation */
@keyframes dropdownFadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

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

#user-menu-trigger:hover .text-gray-400 svg {
  color: #666;
}

#user-menu-dropdown:not(.hidden) {
  animation: dropdownFadeIn 0.15s ease-out;
}

/* ===== PREMIUM USER PILL MENU ===== */

.user-pill-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.7rem 0.3rem 0.3rem;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.user-pill-btn:hover {
  background: #ffffff;
  border-color: rgba(185, 14, 43, 0.15);
  box-shadow: 0 4px 16px rgba(185, 14, 43, 0.1);
  transform: translateY(-1px);
}

.user-pill-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

/* Avatar wrapper with status dot */
.user-pill-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}

.user-pill-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
}

.user-pill-status {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  background: #22c55e;
  border: 2px solid #ffffff;
  border-radius: 50%;
  display: block;
}

/* Email shown in pill (hidden on mobile) */
.user-pill-email {
  font-family: 'Inter', sans-serif;
  font-size: 0.82rem;
  font-weight: 500;
  color: #4a4a5a;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Chevron with rotation on open */
.user-pill-chevron {
  width: 14px;
  height: 14px;
  color: #a0a0b0;
  transition: transform 0.25s ease, color 0.25s ease;
  flex-shrink: 0;
}

.user-pill-btn:hover .user-pill-chevron {
  color: #666;
}

.user-pill-btn[aria-expanded="true"] .user-pill-chevron {
  transform: rotate(180deg);
}

/* Hide email on mobile, keep pill compact */
@media (max-width: 768px) {
  .user-pill-email {
    display: none;
  }

  .user-pill-btn {
    padding: 0.25rem 0.4rem 0.25rem 0.25rem;
  }
}

/* ===== PREMIUM DROPDOWN ===== */

.user-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 240px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 16px;
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.1),
    0 2px 6px rgba(0, 0, 0, 0.04);
  z-index: 60;
  overflow: hidden;
  animation: userDropdownIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes userDropdownIn {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.97);
  }

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

/* Dropdown profile card header */
.user-dropdown-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1rem 0.85rem;
}

.user-dropdown-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.user-dropdown-info {
  min-width: 0;
  flex: 1;
}

.user-dropdown-name {
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: #1a1a2e;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-dropdown-role {
  font-family: 'Inter', sans-serif;
  font-size: 0.72rem;
  font-weight: 500;
  color: #22c55e;
  margin: 0.15rem 0 0;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.user-dropdown-role::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
}

/* Gradient divider */
.user-dropdown-divider {
  height: 1px;
  margin: 0 0.75rem;
  background: linear-gradient(90deg, transparent, rgba(185, 14, 43, 0.15), transparent);
}

/* Actions section */
.user-dropdown-actions {
  padding: 0.35rem;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.65rem 0.85rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: 10px;
  text-align: left;
  color: #4a4a5a;
}

.dropdown-item:hover {
  background: #f3f4f6;
}

.dropdown-item svg {
  flex-shrink: 0;
  opacity: 0.7;
}

.dropdown-item-danger {
  color: #dc2626;
}

.dropdown-item-danger:hover {
  background: #fef2f2;
  color: #b91c1c;
}

.dropdown-item-danger:hover svg {
  opacity: 1;
}

/* Adjust header for new items */
header .flex {
  display: flex;
  align-items: center;
}

#current-chat-title-mobile {
  max-width: 150px;
  flex: 1;
}

/* ===== EDIT MESSAGE UI ===== */

/* Edit button: hidden by default, shown on hover */
.user-msg-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 4px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.message-row:hover .user-msg-actions {
  opacity: 1;
}

.edit-user-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: none;
  background: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(4px);
}

.edit-user-btn:hover {
  background: rgba(255, 255, 255, 0.35);
  color: #ffffff;
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.edit-user-btn:active {
  transform: scale(0.95);
}

.edit-user-btn svg {
  width: 14px;
  height: 14px;
}

/* Edit Mode Container */
.edit-mode-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  animation: editModeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes editModeIn {
  from {
    opacity: 0;
    transform: scale(0.96);
  }

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

/* The textarea inside user bubble (override red background) */
.user-row .message-bubble.is-editing {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1.5px solid rgba(185, 14, 43, 0.15);
  box-shadow:
    0 8px 32px rgba(185, 14, 43, 0.12),
    0 2px 8px rgba(0, 0, 0, 0.06);
  border-radius: 18px;
  color: var(--text-primary);
  padding: 0.75rem;
  max-width: 90%;
}

.edit-textarea {
  width: 100%;
  min-width: 280px;
  resize: none;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1.5px solid rgba(185, 14, 43, 0.12);
  background: #fafbfc;
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 0.92rem;
  line-height: 1.55;
  outline: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.04);
}

.edit-textarea:focus {
  border-color: var(--accent);
  background: #ffffff;
  box-shadow:
    inset 0 1px 2px rgba(0, 0, 0, 0.02),
    0 0 0 3px rgba(185, 14, 43, 0.08);
}

.edit-textarea::placeholder {
  color: var(--text-tertiary);
}

/* Edit action buttons row */
.edit-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

.edit-cancel-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 16px;
  font-family: 'Inter', sans-serif;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: #ffffff;
  border: 1.5px solid rgba(0, 0, 0, 0.1);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.edit-cancel-btn:hover {
  background: #f5f5f5;
  border-color: rgba(0, 0, 0, 0.15);
  color: var(--text-primary);
}

.edit-cancel-btn:active {
  transform: scale(0.97);
}

.edit-save-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 18px;
  font-family: 'Inter', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  color: #ffffff;
  background: linear-gradient(135deg, #b90e2b 0%, #d4213e 100%);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 3px 12px rgba(185, 14, 43, 0.3);
  letter-spacing: 0.01em;
}

.edit-save-btn:hover {
  background: linear-gradient(135deg, #d4213e 0%, #b90e2b 100%);
  box-shadow: 0 5px 20px rgba(185, 14, 43, 0.4);
  transform: translateY(-1px);
}

.edit-save-btn:active {
  transform: translateY(0) scale(0.97);
  box-shadow: 0 2px 8px rgba(185, 14, 43, 0.25);
}

.edit-save-btn svg,
.edit-cancel-btn svg {
  width: 14px;
  height: 14px;
}

/* Hint label under textarea */
.edit-hint {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  text-align: right;
  padding-right: 2px;
  opacity: 0.7;
  font-family: 'Inter', sans-serif;
}

/* Responsive tweaks */
@media (max-width: 640px) {
  .edit-textarea {
    min-width: 200px;
    font-size: 0.88rem;
  }

  .edit-save-btn,
  .edit-cancel-btn {
    padding: 6px 12px;
    font-size: 0.78rem;
  }

  .user-row .message-bubble.is-editing {
    max-width: 95%;
  }
}

/* Image Attachment Styles */
.attach-btn {
  position: absolute;
  right: 6.2rem;
  bottom: 0.8rem;
  width: 2.2rem;
  height: 2.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #a3a3a3;
  background: transparent;
  transition: all 0.2s ease;
  border: none;
  cursor: pointer;
  z-index: 10;
}

.attach-btn:hover {
  color: #b90e2b;
  background-color: rgba(185, 14, 43, 0.05);
}

.suggest-btn {
  position: absolute;
  right: 8.9rem;
  bottom: 0.8rem;
  width: 2.2rem;
  height: 2.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--accent);
  background: transparent;
  transition: all 0.2s ease;
  border: none;
  cursor: pointer;
  z-index: 10;
}

.suggest-btn:hover {
  color: var(--accent-hover);
  background-color: rgba(185, 14, 43, 0.05);
}

.image-preview-container {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(5px);
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-bottom: none;
}

.preview-item {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.remove-preview {
  position: absolute;
  top: 2px;
  right: 2px;
  background: rgba(0, 0, 0, 0.5);
  color: white;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  cursor: pointer;
}

.chat-image {
  max-width: 100%;
  max-height: 300px;
  border-radius: 12px;
  margin-bottom: 10px;
  display: block;
  cursor: pointer;
  transition: transform 0.2s;
}

.chat-image:hover {
  transform: scale(1.02);
}

.user-row .chat-image {
  border: 2px solid rgba(255, 255, 255, 0.3);
}

/* Adjust message-bubble for images */
.message-bubble.has-image {
  padding-top: 0.5rem;
}

/* Message Action Dropdown */
.message-actions-dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12), 0 4px 10px rgba(0, 0, 0, 0.04);
  z-index: 100;
  min-width: 200px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px) scale(0.98);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: bottom right;
}

.dropdown-menu.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.dropdown-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 14px;
  font-size: 0.88rem;
  font-weight: 500;
  color: #374151;
  text-align: left;
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.dropdown-menu-item:hover {
  background: rgba(185, 14, 43, 0.06);
  color: #b90e2b;
}

.dropdown-menu-item svg {
  flex-shrink: 0;
  color: #6b7280;
  transition: color 0.2s ease;
}

.dropdown-menu-item:hover svg {
  color: #b90e2b;
}

/* ===== TICKET MODAL PREMIUM STYLES ===== */
#ticket-modal .ticket-modal-content {
  background: #ffffff;
  border-radius: 24px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(0, 0, 0, 0.05);
  animation: modalScaleUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  width: 100%;
}

@keyframes modalScaleUp {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }

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

.ticket-header-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(185, 14, 43, 0.08);
  color: var(--accent);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ticket-container {
  background: #fafafa;
  border-radius: 16px;
  padding: 24px;
  border: 1px solid rgba(0, 0, 0, 0.03);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.ticket-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #b90e2b, #d4213e);
  border-radius: 16px 16px 0 0;
}

.ticket-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  display: block;
}

.ticket-value-box {
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 0.92rem;
  color: #1e293b;
  line-height: 1.5;
  transition: all 0.2s ease;
  position: relative;
  width: 100%;
}

.ticket-value-box:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(185, 14, 43, 0.08);
}

.ticket-value-box.is-body {
  min-height: 250px;
  white-space: pre-wrap;
  font-family: inherit;
  resize: none;
}

.copy-badge-btn {
  position: absolute;
  top: -12px;
  right: 12px;
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  padding: 4px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  z-index: 5;
}

.copy-badge-btn:hover {
  background: #f8fafc;
  color: var(--accent);
  border-color: rgba(185, 14, 43, 0.2);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.copy-badge-btn.copied {
  background: #f0fdf4 !important;
  color: #16a34a !important;
  border-color: #bbf7d0 !important;
  pointer-events: none;
}

.btn-premium-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 14px;
  font-weight: 600;
  font-size: 0.92rem;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
  border: none;
}

.btn-premium-primary {
  background: linear-gradient(135deg, #b90e2b 0%, #d4213e 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(185, 14, 43, 0.2);
}

.btn-premium-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(185, 14, 43, 0.3);
}

.btn-premium-secondary {
  background: white;
  color: #475569;
  border: 1.5px solid #e2e8f0;
}

.btn-premium-secondary:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #1e293b;
}

.ticket-footer {
  padding: 20px 24px;
  background: #f8fafc;
  border-top: 1px solid #f1f5f9;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Admin Prompt Selector — discreet inline pill */
.admin-prompt-selector-container {
  display: flex;
  width: fit-content;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  padding: 3px 10px;
  animation: fadeIn 0.4s ease-out;
  max-width: 48rem;
  margin-left: 0;
  margin-right: auto;
  background: rgba(248, 249, 251, 0.7);
  border-radius: 20px;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.admin-label {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--text-tertiary);
  text-transform: none;
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
  white-space: nowrap;
}

.admin-label svg {
  display: none;
}

.admin-prompt-select {
  background: transparent;
  border: none;
  padding: 2px 4px;
  font-size: 0.72rem;
  color: var(--text-secondary);
  outline: none;
  cursor: pointer;
  transition: color 0.2s ease;
  font-weight: 500;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  padding-right: 14px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%238e8e8e' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0 center;
  background-size: 10px;
}

.admin-prompt-select:hover {
  color: var(--text-primary);
}

.admin-prompt-select:focus {
  color: var(--accent);
}

.admin-prompt-select option {
  background: white;
  color: var(--text-primary);
  font-size: 0.82rem;
}

/* =====================================================================
   LAVADO DE CARA — refresh moderno y minimalista (2026-06)
   Bloque de override autocontenido y reversible: no modifica reglas
   anteriores; va al final para ganar en la cascada. Usa !important solo
   donde hay que vencer estilos inline del HTML o utilidades Tailwind.
   Para revertir: borra desde este comentario hasta el final del archivo.
   ===================================================================== */

:root {
  /* Tokens tomados del tema de la web (tema/css/default.css) para que el chat use su mismo lenguaje */
  --gw-accent: #b90e2b;          /* --colorppal */
  --gw-accent-hover: #900b22;    /* --colorppal-hover */
  --gw-line: #e2e8f0;            /* --color-border (Slate 200) */
  --gw-light: #f8fafc;           /* --color-light (Slate 50) */
  --gw-ink: #18181b;
  --gw-muted: #6b6b72;
  --gw-surface: #fcfcfd;
  --gw-radius: 0.75rem;          /* --radius de la web */
  --gw-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --gw-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --gw-ring: 0 0 0 3px rgba(185, 14, 43, 0.1);
}

/* Tipografía base un poco más suave */
body {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* --- Sidebar --- */
.sidebar {
  background: var(--gw-surface) !important;
  border-right: 1px solid var(--gw-line) !important;
}

/* Botón "Nuevo chat": de barra cuadrada a botón redondeado y plano */
#btn-new-chat {
  margin: 14px 12px 4px !important;
  width: calc(100% - 24px) !important;
  border-radius: var(--gw-radius) !important;
  background: var(--gw-accent) !important;
  color: #fff !important;
  box-shadow: var(--gw-shadow-sm) !important;
  padding: 0.7rem 1rem !important;
  font-weight: 600 !important;
  font-size: 0.875rem !important;
  transition: all .2s ease !important;
}
#btn-new-chat:hover {
  background: var(--gw-accent-hover) !important;
  box-shadow: var(--gw-shadow-md) !important;
  transform: translateY(-1px);
}
#btn-new-chat:active { transform: translateY(0); }

/* Buscador: contenedor más limpio */
.search-wrapper {
  background: #fff !important;
  border: 1px solid var(--gw-line) !important;
  border-radius: 12px !important;
  margin: 8px 12px !important;
  box-shadow: none !important;
}
.search-wrapper:focus-within {
  border-color: var(--gw-accent) !important;
  box-shadow: var(--gw-ring) !important;
}

/* Items del historial: hover/activo neutros y redondeados */
.history-item {
  border-radius: 10px !important;
  margin: 2px 8px !important;
  padding: 9px 12px !important;
  color: var(--gw-muted) !important;
  transition: background .15s ease, color .15s ease;
}
.history-item:hover { background: #f0f0f1 !important; color: var(--gw-ink) !important; }
.history-item.active,
.history-item.bg-gray-100 { background: #ededee !important; color: var(--gw-ink) !important; font-weight: 600 !important; }

/* --- Pantalla de bienvenida --- */
.welcome-mascot { filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.08)) !important; }

/* Título: de degradado rojo a tinta sólida y sobria */
.welcome-title {
  background: none !important;
  -webkit-text-fill-color: var(--gw-ink) !important;
  color: var(--gw-ink) !important;
  font-weight: 600 !important;
  font-size: 1.9rem !important;
  letter-spacing: -0.02em !important;
}
.welcome-subtitle { color: var(--gw-muted) !important; }

/* Chips de sugerencia: neutros, borde fino, hover sutil (sin rosas) */
.suggestion-chip {
  background: #fff !important;
  border: 1px solid var(--gw-line) !important;
  border-radius: var(--gw-radius) !important;
  box-shadow: var(--gw-shadow-sm) !important;
  color: var(--gw-muted) !important;
  font-weight: 500 !important;
  backdrop-filter: none !important;
  transition: all .2s ease !important;
}
.suggestion-chip:hover {
  background: var(--gw-light) !important;
  border-color: var(--gw-accent) !important;
  box-shadow: var(--gw-shadow-md) !important;
  color: var(--gw-ink) !important;
  transform: translateY(-1px) !important;
}
.suggestion-chip svg { color: #9a9aa2 !important; }

/* --- Composer (entrada de mensaje), welcome y barra inferior --- */
#chat-form,
#chat-form-welcome {
  background: #fff !important;
  border: 1px solid var(--gw-line) !important;
  border-radius: 16px !important;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.05) !important;
  transition: border-color .16s ease, box-shadow .16s ease;
}
#chat-form:focus-within,
#chat-form-welcome:focus-within {
  border-color: var(--gw-accent) !important;
  box-shadow: var(--gw-ring) !important;
}

/* Botón de enviar: rojo plano (sin degradado), accent consistente */
#btn-send,
#btn-send-welcome {
  background: var(--gw-accent) !important;
  box-shadow: var(--gw-shadow-sm) !important;
  transition: all .2s ease !important;
}
#btn-send:hover,
#btn-send-welcome:hover {
  background: var(--gw-accent-hover) !important;
  box-shadow: var(--gw-shadow-md) !important;
  transform: translateY(-1px);
}
#btn-send:active,
#btn-send-welcome:active { transform: translateY(0); }

/* Iconos de micro/adjuntar/ticket: gris neutro, acentúa al pasar */
.mic-btn, .attach-btn, .suggest-btn { color: #9a9aa2 !important; transition: color .15s ease, background .15s ease; }
.mic-btn:hover, .attach-btn:hover, .suggest-btn:hover { color: var(--gw-ink) !important; }

/* Selector de prompt: pill sobrio */
.admin-prompt-select {
  border: 1px solid var(--gw-line) !important;
  border-radius: 10px !important;
  background: #fff !important;
}

/* Pastilla de usuario (topbar): borde fino y limpio */
.user-pill-btn {
  border: 1px solid var(--gw-line) !important;
  background: #fff !important;
  box-shadow: none !important;
}
.user-pill-btn:hover { background: #fafafa !important; }

/* Botones de acción del mensaje (escuchar 🔊, menú ⋮, pausa/stop): eran <button> sin
   estilo, así que mostraban el recuadro gris por defecto del navegador. Los dejamos como
   icono limpio con acento rojo de marca al pasar el ratón (lenguaje de la web). */
.tts-btn,
.tts-pause-btn,
.tts-stop-btn,
.dropdown-trigger {
  -webkit-appearance: none !important;
  appearance: none !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  align-items: center;
  justify-content: center;
  padding: 6px !important;
  border-radius: 8px !important;
  cursor: pointer;
  transition: background .15s ease, color .15s ease !important;
}
/* display SOLO cuando no están ocultos: respeta el .hidden que el JS pone/quita
   (pausa y stop solo aparecen mientras suena el audio). */
.tts-btn:not(.hidden),
.tts-pause-btn:not(.hidden),
.tts-stop-btn:not(.hidden),
.dropdown-trigger:not(.hidden) {
  display: inline-flex !important;
}
.tts-btn:hover,
.dropdown-trigger:hover {
  background: var(--gw-light) !important;
  color: var(--gw-accent) !important;
}
.tts-pause-btn:hover,
.tts-stop-btn:hover { background: var(--gw-light) !important; }

/* Botones de cada conversación del historial (exportar y borrar): también eran <button>
   sin estilo y mostraban el recuadro gris por defecto del navegador. Icono limpio que
   se revela al pasar por la conversación (group-hover) y fondo claro al pasar el ratón. */
.history-item button {
  -webkit-appearance: none !important;
  appearance: none !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  border-radius: 8px !important;
  cursor: pointer;
}
.history-item button:hover { background: var(--gw-light) !important; }

/* Scrollbar fina y discreta */
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: rgba(17, 17, 19, 0.14); border-radius: 8px; }
*::-webkit-scrollbar-thumb:hover { background: rgba(17, 17, 19, 0.24); }
*::-webkit-scrollbar-track { background: transparent; }