/* ==========================================================================
   LUC GPT - DESIGN SYSTEM (ChatGPT & Gemini Parody Edition)
   Ultra-realistic ChatGPT & Gemini UI with dark mode, sleek typography,
   clean pill components, responsive drawer, and authentic AI micro-interactions.
   ========================================================================== */

:root {
  /* ChatGPT Dark Palette */
  --bg-app: #212121;
  --bg-sidebar: #171717;
  --bg-surface: #2f2f2f;
  --bg-surface-hover: #383838;
  --bg-input: #2f2f2f;
  --bg-input-focus: #343434;
  --bg-card: #262626;
  --bg-card-hover: #2f2f2f;
  --bg-badge: #383838;
  --bg-modal-backdrop: rgba(0, 0, 0, 0.78);

  --text-main: #ececec;
  --text-muted: #b4b4b4;
  --text-subtle: #737373;
  --text-inverse: #171717;

  --border-subtle: #2f2f2f;
  --border-strong: #424242;
  --border-focus: #10a37f;

  /* Brand Accents */
  --openai-green: #10a37f;
  --openai-green-hover: #1a7f64;
  --gemini-blue: #4285f4;
  --gemini-purple: #9b72cf;
  --gemini-pink: #d96570;
  --drawing-accent: #f59e0b;

  --user-bubble: #2f2f2f;
  --luc-bubble: transparent;

  /* Elevation */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 24px rgba(16, 163, 127, 0.25);

  /* Dimensions */
  --sidebar-width: 260px;
  --header-height: 56px;
  --input-max-width: 768px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Light Theme Variables */
[data-theme="light"] {
  --bg-app: #ffffff;
  --bg-sidebar: #f9f9f9;
  --bg-surface: #f4f4f4;
  --bg-surface-hover: #eaeaea;
  --bg-input: #ffffff;
  --bg-input-focus: #ffffff;
  --bg-card: #f9f9f9;
  --bg-card-hover: #f0f0f0;
  --bg-badge: #e8e8e8;
  --bg-modal-backdrop: rgba(0, 0, 0, 0.45);

  --text-main: #0d0d0d;
  --text-muted: #555555;
  --text-subtle: #8a8a8a;
  --text-inverse: #ffffff;

  --border-subtle: #e5e5e5;
  --border-strong: #cccccc;
  --user-bubble: #f4f4f4;
  --luc-bubble: transparent;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.12);
}

/* Base Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  width: 100%;
  font-family: var(--font-family);
  background-color: var(--bg-app);
  color: var(--text-main);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input, textarea, select {
  font-family: inherit;
  color: inherit;
}

/* ==========================================================================
   APP SHELL
   ========================================================================== */
.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
  position: relative;
  overflow: hidden;
}

/* ==========================================================================
   SIDEBAR (ChatGPT style)
   ========================================================================== */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100%;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  transition: transform var(--transition), margin-left var(--transition);
  z-index: 100;
  user-select: none;
}

.sidebar.collapsed {
  margin-left: calc(-1 * var(--sidebar-width));
}

.sidebar-header {
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.btn-new-chat {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  font-size: 0.875rem;
  font-weight: 500;
  transition: var(--transition);
}

.btn-new-chat:hover {
  background-color: var(--bg-surface-hover);
  border-color: var(--border-strong);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: var(--transition);
}

.icon-btn:hover {
  background-color: var(--bg-surface-hover);
  color: var(--text-main);
}

/* Sidebar Search */
.sidebar-search-box {
  padding: 0 14px 10px;
}

.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
}

.search-input-wrap input {
  background: transparent;
  border: none;
  outline: none;
  font-size: 0.8125rem;
  width: 100%;
  color: var(--text-main);
}

.search-input-wrap svg {
  color: var(--text-subtle);
  flex-shrink: 0;
}

/* Sidebar Content / History */
.sidebar-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px 10px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sidebar-content::-webkit-scrollbar {
  width: 4px;
}
.sidebar-content::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: 4px;
}

.history-group-title {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-subtle);
  padding: 6px 8px 4px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  color: var(--text-muted);
  text-align: left;
  width: 100%;
  position: relative;
  transition: var(--transition);
  cursor: pointer;
}

.history-item:hover {
  background-color: var(--bg-surface-hover);
  color: var(--text-main);
}

.history-item.active {
  background-color: var(--bg-surface);
  color: var(--text-main);
  font-weight: 500;
}

.history-item-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
}

.history-item-text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.badge-tag {
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 4px;
  background-color: var(--bg-badge);
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}

.badge-tag.tag-drawing {
  background-color: rgba(245, 158, 11, 0.18);
  color: #f59e0b;
}

.badge-tag.tag-pending {
  background-color: rgba(66, 133, 244, 0.18);
  color: #60a5fa;
  animation: pulse-dot 2s infinite;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.creator-profile-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  transition: var(--transition);
}

.creator-profile-card:hover {
  background: var(--bg-surface-hover);
}

.creator-avatar-wrap {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #171717;
}

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

.creator-details {
  flex: 1;
  min-width: 0;
}

.creator-name {
  font-size: 0.84rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-main);
}

.verified-icon {
  color: #38bdf8;
  display: inline-block;
}

.creator-role {
  font-size: 0.72rem;
  color: var(--text-subtle);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-sidebar-action {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  color: var(--text-muted);
  transition: var(--transition);
}

.btn-sidebar-action:hover {
  background-color: var(--bg-surface-hover);
  color: var(--text-main);
}

/* ==========================================================================
   MAIN CHAT CONTAINER
   ========================================================================== */
.main-chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
  background-color: var(--bg-app);
  overflow: hidden;
}

/* Header */
.chat-header {
  height: var(--header-height);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background-color: var(--bg-app);
  z-index: 10;
}

.chat-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.model-picker-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main);
  transition: var(--transition);
}

.model-picker-btn:hover {
  background-color: var(--bg-surface);
}

.model-version-tag {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  background-color: var(--bg-badge);
  padding: 2px 6px;
  border-radius: 4px;
}

.chat-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Status Pill with Humorous Indicator & Marquee Ticker */
.luc-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  font-size: 0.775rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  max-width: 320px;
  min-width: 0;
  overflow: hidden;
  transition: var(--transition);
}

.luc-status-pill:hover {
  border-color: var(--border-focus);
}

.status-text-track {
  display: inline-flex;
  align-items: center;
  overflow: hidden;
  white-space: nowrap;
  position: relative;
  max-width: 100%;
  min-width: 0;
  mask-image: linear-gradient(to right, black calc(100% - 14px), transparent 100%);
  -webkit-mask-image: linear-gradient(to right, black calc(100% - 14px), transparent 100%);
}

#status-text {
  display: inline-block;
  white-space: nowrap;
  will-change: transform;
}

#status-text.ticker-scroll {
  animation: statusTicker 9s cubic-bezier(0.45, 0, 0.55, 1) infinite alternate;
}

@keyframes statusTicker {
  0%, 25% {
    transform: translateX(0);
  }
  75%, 100% {
    transform: translateX(var(--ticker-offset, -50px));
  }
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.online {
  background-color: #22c55e;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
}

.status-dot.busy {
  background-color: #f59e0b;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.6);
}

.status-dot.offline {
  background-color: #818cf8;
  box-shadow: 0 0 8px rgba(129, 140, 248, 0.6);
}

.cloud-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  background-color: var(--bg-badge);
  color: var(--text-subtle);
}

.cloud-status-badge.connected {
  color: #10a37f;
}

/* ==========================================================================
   SCROLLABLE CHAT MESSAGES
   ========================================================================== */
.chat-messages-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px 16px 130px;
  display: flex;
  flex-direction: column;
  align-items: center;
  scroll-behavior: smooth;
}

.chat-messages-scroll::-webkit-scrollbar {
  width: 5px;
}
.chat-messages-scroll::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: 4px;
}

.chat-messages-inner {
  width: 100%;
  max-width: var(--input-max-width);
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* ==========================================================================
   WELCOME HERO (Gemini / ChatGPT Parody Hero)
   ========================================================================== */
.welcome-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin: auto 0;
  padding: 30px 16px 20px;
  width: 100%;
  max-width: 680px;
  animation: fadeIn 0.3s ease-out;
}

.hero-logo-wrap {
  width: 64px;
  height: 64px;
  margin-bottom: 20px;
  position: relative;
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.hero-logo-wrap:hover {
  transform: scale(1.08);
}

.hero-logo-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 0 16px rgba(16, 163, 127, 0.35));
}

.hero-title {
  font-size: 1.85rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
  background: linear-gradient(135deg, #ececec 0%, #b0b0b0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

[data-theme="light"] .hero-title {
  background: linear-gradient(135deg, #171717 0%, #4b5563 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text-muted);
  max-width: 540px;
  margin-bottom: 30px;
}

/* Suggestion Grid */
.suggestion-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  width: 100%;
}

.suggestion-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  padding: 14px 16px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: var(--transition);
  cursor: pointer;
}

.suggestion-card:hover {
  background-color: var(--bg-card-hover);
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.suggestion-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.suggestion-card-icon {
  font-size: 1.15rem;
}

.suggestion-card-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-main);
}

.suggestion-card-desc {
  font-size: 0.775rem;
  color: var(--text-subtle);
  line-height: 1.35;
}

/* ==========================================================================
   MESSAGES
   ========================================================================== */
.message-row {
  display: flex;
  gap: 14px;
  width: 100%;
  animation: messageSlideIn 0.25s ease-out;
}

.message-row.user-row {
  justify-content: flex-end;
}

.message-row.user-row .message-bubble {
  background-color: var(--user-bubble);
  border-radius: 18px 18px 4px 18px;
  padding: 12px 18px;
  max-width: 82%;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-subtle);
}

.message-row.luc-row {
  justify-content: flex-start;
  align-items: flex-start;
}

.luc-avatar-small {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #171717;
  border: 1px solid var(--border-subtle);
  margin-top: 2px;
}

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

.luc-content-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.luc-header-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8125rem;
}

.luc-name-tag {
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 4px;
}

.luc-time-tag {
  font-size: 0.72rem;
  color: var(--text-subtle);
}

.luc-text-body {
  font-size: 0.96rem;
  line-height: 1.65;
  color: var(--text-main);
  word-break: break-word;
}

.luc-text-body p {
  margin-bottom: 12px;
}

.luc-text-body p:last-child {
  margin-bottom: 0;
}

.luc-text-body ul, .luc-text-body ol {
  padding-left: 20px;
  margin-bottom: 12px;
}

.luc-text-body li {
  margin-bottom: 6px;
}

.luc-text-body blockquote {
  border-left: 3px solid var(--openai-green);
  padding-left: 12px;
  margin: 10px 0;
  color: var(--text-muted);
  font-style: italic;
}

/* Luc Drawing Card */
.luc-drawing-card {
  margin: 10px 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  max-width: 480px;
  transition: var(--transition);
}

.luc-drawing-card:hover {
  border-color: var(--drawing-accent);
}

.drawing-image-wrap {
  background: #ffffff;
  padding: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: zoom-in;
}

.drawing-image-wrap img {
  max-width: 100%;
  max-height: 380px;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.drawing-card-footer {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-card);
}

.drawing-info {
  display: flex;
  flex-direction: column;
}

.drawing-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-main);
}

.drawing-sub {
  font-size: 0.7rem;
  color: var(--drawing-accent);
  font-weight: 500;
}

/* Message Actions (ChatGPT / Gemini Minimal Action Toolbar) */
.message-actions-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding-top: 4px;
}

.action-chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border-radius: var(--radius-sm);
  font-size: 0.76rem;
  color: var(--text-subtle);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
}

.action-chip-btn svg {
  stroke: currentColor;
  opacity: 0.75;
  transition: opacity var(--transition);
}

.action-chip-btn:hover {
  background-color: var(--bg-surface-hover);
  color: var(--text-main);
  border-color: var(--border-subtle);
}

.action-chip-btn:hover svg {
  opacity: 1;
}

/* ==========================================================================
   HUMOROUS WAITING & PENDING CARD
   ========================================================================== */
.pending-banner {
  background: rgba(37, 99, 235, 0.06);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: pulse-border 3s infinite ease-in-out;
}

.pending-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.pending-status-live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #60a5fa;
}

.humor-meta-badge {
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background-color: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  font-weight: 600;
}

.pending-desc {
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.pending-wait-time {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  font-size: 0.775rem;
  color: var(--text-subtle);
}

.pending-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.btn-luc-answer-now {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background-color: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 500;
  transition: var(--transition);
}

.btn-luc-answer-now:hover {
  background-color: var(--bg-surface-hover);
  border-color: var(--openai-green);
}

/* Typing / Thinking Indicator */
.typing-indicator-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background-color: var(--bg-surface);
  border-radius: var(--radius-md);
  width: fit-content;
  border: 1px solid var(--border-subtle);
  animation: fadeIn 0.3s ease-out;
}

.typing-dots {
  display: flex;
  gap: 4px;
  align-items: center;
}

.typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--text-muted);
  animation: bounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

.typing-text {
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ==========================================================================
   INPUT BAR (ChatGPT Floating Capsule)
   ========================================================================== */
.chat-input-wrapper {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(180deg, transparent 0%, var(--bg-app) 45%);
  padding: 12px 16px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 20;
}

.chat-answered-footer {
  display: none;
  width: 100%;
  max-width: var(--input-max-width);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 12px 18px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: var(--shadow-md);
  animation: fadeIn 0.25s ease;
}

.btn-filter-tab {
  transition: all 0.15s ease;
}
.btn-filter-tab.active {
  background: var(--bg-surface) !important;
  color: var(--text-main) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.chat-input-box {
  width: 100%;
  max-width: var(--input-max-width);
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.chat-input-box:focus-within {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-lg), 0 0 0 1px var(--border-strong);
}

.chat-input-box.drawing-mode-active {
  border-color: var(--drawing-accent);
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.25);
}

.input-active-badge {
  display: none;
  align-items: center;
  gap: 6px;
  background-color: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  width: fit-content;
}

.chat-input-box.drawing-mode-active .input-active-badge {
  display: inline-flex;
}

.chat-textarea {
  width: 100%;
  max-height: 200px;
  min-height: 24px;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text-main);
  padding: 4px 0;
}

.chat-textarea::placeholder {
  color: var(--text-subtle);
}

.input-controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 4px;
}

.input-tools-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tool-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-surface);
  transition: var(--transition);
}

.tool-toggle-btn:hover {
  background-color: var(--bg-surface-hover);
  color: var(--text-main);
  border-color: var(--border-strong);
}

.tool-toggle-btn.active {
  background-color: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
  border-color: #f59e0b;
}

.btn-send-message {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: var(--openai-green);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  opacity: 0.4;
}

.btn-send-message.can-send {
  opacity: 1;
  cursor: pointer;
}

.btn-send-message.can-send:hover {
  transform: scale(1.05);
  box-shadow: 0 0 12px rgba(16, 163, 127, 0.4);
}

.input-footer-disclaimer {
  font-size: 0.72rem;
  color: var(--text-subtle);
  margin-top: 8px;
  text-align: center;
  max-width: 650px;
}

/* ==========================================================================
   MODALS
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: var(--bg-modal-backdrop);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
  animation: fadeIn 0.2s ease-out;
}

.modal-overlay.open,
.modal-overlay.active {
  display: flex;
}

.modal-dialog {
  background-color: var(--bg-sidebar);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: scaleUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-main);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  background-color: var(--bg-app);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
}

.form-input, .form-textarea, .form-select {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 0.875rem;
  color: var(--text-main);
  outline: none;
  transition: var(--transition);
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--openai-green);
  background-color: var(--bg-surface-hover);
}

.form-textarea {
  min-height: 90px;
  resize: vertical;
}

/* Canvas Drawer */
.canvas-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px;
}

.drawing-canvas {
  display: block;
  background-color: #ffffff;
  border-radius: var(--radius-sm);
  cursor: crosshair;
  touch-action: none;
  width: 100%;
  height: 260px;
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.1);
}

.canvas-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
}

.color-palette {
  display: flex;
  align-items: center;
  gap: 6px;
}

.color-swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s;
}

.color-swatch.active {
  transform: scale(1.2);
  border-color: var(--text-main);
}

.btn-secondary {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 500;
  background-color: var(--bg-surface);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  transition: var(--transition);
}

.btn-secondary:hover {
  background-color: var(--bg-surface-hover);
  color: var(--text-main);
}

.btn-primary {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 600;
  background-color: var(--openai-green);
  color: #ffffff;
  transition: var(--transition);
}

.btn-primary:hover {
  background-color: var(--openai-green-hover);
  box-shadow: 0 2px 8px rgba(16, 163, 127, 0.4);
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 2000;
  pointer-events: none;
}

.toast {
  background-color: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 0.84rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: auto;
}


/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleUp {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@keyframes messageSlideIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

@keyframes pulse-border {
  0%, 100% { border-color: rgba(59, 130, 246, 0.4); }
  50% { border-color: rgba(59, 130, 246, 0.8); }
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    box-shadow: var(--shadow-lg);
    transform: translateX(-100%);
    margin-left: 0 !important;
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(2px);
    z-index: 99;
  }

  .sidebar-backdrop.active {
    display: block;
  }

  .suggestion-grid {
    grid-template-columns: 1fr;
  }

  .chat-messages-scroll {
    padding-bottom: 140px;
  }

  .luc-status-pill {
    max-width: 62vw;
    padding: 4px 10px;
    font-size: 0.73rem;
  }
}

/* ==========================================================================
   SHARE MODAL & SOCIAL BUTTONS
   ========================================================================== */
.share-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.btn-social-share {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 500;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-main);
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition);
}

.btn-social-share:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.btn-social-share.whatsapp:hover {
  background: rgba(37, 211, 102, 0.12);
  border-color: #25D366;
  color: #25D366;
}

.btn-social-share.twitter:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: #ffffff;
}

.btn-social-share.linkedin:hover {
  background: rgba(10, 102, 194, 0.12);
  border-color: #0A66C2;
  color: #0A66C2;
}

.btn-social-share.native:hover {
  background: rgba(225, 48, 108, 0.12);
  border-color: #E1306C;
  color: #E1306C;
}


/* ==========================================================================
   PWA INSTALL BUTTONS & GUIDE MODAL
   ========================================================================== */
.btn-install-app {
  border-color: rgba(16, 163, 127, 0.35);
  background: rgba(16, 163, 127, 0.08);
  color: #10a37f;
}

.btn-install-app:hover {
  background: rgba(16, 163, 127, 0.16);
  border-color: #10a37f;
  color: #10a37f;
}

.header-install-btn {
  color: var(--text-muted);
}

.header-install-btn:hover {
  color: #10a37f;
}

/* Auto-hide install buttons when already running as an installed standalone app */
@media all and (display-mode: standalone) {
  .btn-install-app,
  .header-install-btn {
    display: none !important;
  }
}

.install-preview-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  margin-bottom: 16px;
}

.install-app-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.install-app-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.install-app-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-main);
}

.install-app-sub {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.install-guide-heading {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 12px;
}

.install-steps-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.install-step-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 0.8125rem;
  color: var(--text-main);
  line-height: 1.45;
}

.step-badge {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg-surface-hover);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: #10a37f;
  flex-shrink: 0;
  margin-top: 1px;
}

.step-info {
  flex: 1;
}

.ios-share-icon-wrap,
.ios-add-icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  background: var(--bg-surface-hover);
  border: 1px solid var(--border-subtle);
  padding: 2px 4px;
  border-radius: 4px;
  color: #38bdf8;
  margin: 0 2px;
}

.install-ios-simple-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 16px 14px;
  text-align: center;
}

.ios-instruction-text {
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--text-main);
}

