/* ═══════════════════════════════════════════
   Lumiq — style.css
═══════════════════════════════════════════ */

:root {
  --bg:           #F3EFE7;
  --bg-card:      #ffffff;
  --accent:       #B5611A;
  --accent-soft:  #c8722a;
  --img-accent:   #1a1706;
  --img-soft:     #3a3520;
  --text-dark:    #1a1706;
  --text-mid:     #5a5549;
  --text-soft:    #9a9080;
  --border:       rgba(0,0,0,0.08);
  --shadow-sm:    0 2px 12px rgba(0,0,0,0.06);
  --shadow-md:    0 8px 32px rgba(0,0,0,0.09);
  --sb-open:      260px;
  --sb-closed:    52px;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body:    'DM Sans', sans-serif;
  --radius:       16px;
  --radius-sm:    10px;
  --radius-pill:  999px;
  /* Centered chat layout */
  --chat-max-width: 760px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text-dark);
  display: flex;
  min-height: 100vh;
  overflow: hidden;
}

/* ══════════════════════════════
   SIDEBAR
══════════════════════════════ */
.sidebar {
  width: var(--sb-open);
  min-height: 100vh;
  background: #B5611A;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 12px 8px 20px;
  gap: 2px;
  flex-shrink: 0;
  z-index: 100;
  overflow: hidden;
  transition: width 0.28s cubic-bezier(.4,0,.2,1);
}

/* Collapsed state */
.sidebar.collapsed {
  width: var(--sb-closed);
}
.sidebar.collapsed .sidebar-btn-label,
.sidebar.collapsed .sidebar-label,
.sidebar.collapsed .sidebar-section-label,
.sidebar.collapsed .history-panel,
.sidebar.collapsed .history-list,
.sidebar.collapsed .sidebar-divider,
.sidebar.collapsed .coming-soon-tag {
  display: none;
}
.sidebar.collapsed .sidebar-top-row {
  justify-content: center;
}
.sidebar.collapsed .sidebar-logo {
  display: none;
}

/* top row */
.sidebar-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 4px 10px;
  margin-bottom: 4px;
}
.sidebar-logo {
  width: 28px; height: 28px;
  border-radius: 6px;
  background: rgba(255,255,255,0.2);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sidebar-logo svg { color: #fff; }

.sidebar-collapse-btn {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.75);
  cursor: pointer;
  padding: 5px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
  flex-shrink: 0;
}
.sidebar-collapse-btn:hover { background: rgba(255,255,255,0.15); }

/* nav buttons */
.sidebar-btn {
  width: 100%;
  height: 40px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 10px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 400;
  white-space: nowrap;
  transition: background 0.13s;
  flex-shrink: 0;
  text-align: left;
}
.sidebar-btn:hover { background: rgba(255,255,255,0.15); }
.sidebar-btn.active { background: rgba(255,255,255,0.2); }
.sidebar-btn svg { flex-shrink: 0; color: #fff; min-width: 17px; }

.sidebar-btn-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar.collapsed .sidebar-btn {
  justify-content: center;
  padding: 0;
  width: 36px;
  margin: 0 auto;
}

.sidebar-section-label {
  font-size: 11.5px;
  font-weight: 500;
  color: rgba(255,255,255,0.55);
  padding: 10px 10px 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.sidebar-divider {
  width: calc(100% - 16px);
  margin: 6px 8px;
  height: 1px;
  background: rgba(255,255,255,0.15);
  flex-shrink: 0;
}

/* History panel */
.history-panel {
  display: flex;
  flex-direction: column;
  width: 100%;
  flex: 1;
  overflow: hidden;
  padding: 4px 0 0;
}

.history-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.5);
  padding: 6px 10px 4px;
  white-space: nowrap;
}

.history-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 4px 12px;
}
.history-list::-webkit-scrollbar { width: 3px; }
.history-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }

.history-empty {
  font-size: 12px;
  color: rgba(255,255,255,0.45);
  padding: 10px 8px;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 7px 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.13s;
  white-space: nowrap;
}
.history-item:hover { background: rgba(255,255,255,0.12); }
.history-item.active-chat { background: rgba(255,255,255,0.18); }
.history-item-text {
  font-size: 13px;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.history-del {
  flex-shrink: 0;
  border: none;
  background: transparent;
  color: rgba(255,255,255,0.45);
  font-size: 16px;
  cursor: pointer;
  padding: 0 2px;
  border-radius: 4px;
  transition: color 0.15s;
}
.history-del:hover { color: #ffcccc; }

/* ══════════════════════════════
   BRAND MARK
══════════════════════════════ */
.brand-mark {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;   /* remove underline when it's an <a> */
  color: inherit;           /* don't go blue                      */
  cursor: pointer;
}
.brand-mark:hover .brand-name {
  color: var(--accent);
  transition: color 0.15s;
}
.brand-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
  flex-shrink: 0;
}
.brand-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-dark);
  letter-spacing: 0.01em;
  user-select: none;
}

/* ══════════════════════════════
   INPUT CARD
══════════════════════════════ */
.input-card {
  background: #F3EFE7;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 14px 16px 10px;
  border: 1.5px solid rgba(0,0,0,0.07);
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
}
.input-card.focused {
  border-color: rgba(181,97,26,0.3);
  box-shadow: 0 8px 40px rgba(181,97,26,0.1), var(--shadow-md);
}
.input-card.img-mode {
  border-color: rgba(124,58,237,0.25);
  box-shadow: 0 8px 40px rgba(124,58,237,0.1), var(--shadow-md);
}

/* ── BASE: shared by both <input> (landing) and <textarea> (chat) ── */
.main-input {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--text-dark);
  line-height: 1.5;
  padding: 0 0 10px;
}
.main-input::placeholder { color: var(--text-soft); }

/* ── TEXTAREA-SPECIFIC: auto-resize behaviour ── */
textarea.main-input {
  display: block;
  resize: none;           /* no manual drag handle          */
  overflow-y: hidden;     /* hide scrollbar until max-height */
  min-height: 24px;       /* single-line resting height      */
  max-height: 200px;      /* cap before scrollbar appears    */
  line-height: 1.5;
  /* smooth height transition feels natural */
  transition: height 0.05s ease;
}

.input-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  flex-wrap: nowrap;
}

.toolbar-btn {
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.toolbar-btn:hover { background: rgba(0,0,0,0.05); color: var(--text-mid); }

/* Story mode pill */
.story-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border: 1.5px solid var(--img-accent);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--img-accent);
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.story-pill:hover { background: rgba(26,23,6,0.06); }
.story-pill.active {
  background: var(--img-accent);
  color: white;
  border-color: var(--img-accent);
}

/* Image mode pill */
.image-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border: 1.5px solid var(--img-accent);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--img-accent);
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.image-pill:hover { background: rgba(26,23,6,0.06); }
.image-pill.active {
  background: var(--img-accent);
  color: white;
  border-color: var(--img-accent);
}

/* Send button */
.send-btn {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: none;
  background: #1A1706;
  color: white;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, transform 0.1s;
  flex-shrink: 0;
  /* keep it pinned to the bottom of the toolbar row as textarea grows */
  align-self: flex-end;
}
.send-btn:hover  { background: #333; }
.send-btn:active { transform: scale(0.93); }
.send-btn:disabled { background: #bbb; cursor: not-allowed; transform: none; }

/* ══════════════════════════════
   DROPDOWN
══════════════════════════════ */
.dropdown-wrapper { position: relative; flex-shrink: 0; }
.dropdown-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  min-width: 200px;
  overflow: hidden;
  z-index: 200;
  animation: fade-up 0.18s ease both;
}
.dropdown-menu.hidden { display: none !important; }
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-dark);
  cursor: pointer;
  transition: background 0.13s;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}
.dropdown-item:hover { background: rgba(0,0,0,0.05); }
.dropdown-item + .dropdown-item { border-top: 1px solid var(--border); }
.dropdown-item svg { flex-shrink: 0; color: var(--text-mid); }

/* ══════════════════════════════
   MODE BADGE
══════════════════════════════ */
.mode-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: rgba(26,23,6,0.08);
  color: var(--img-accent);
  border: 1px solid rgba(26,23,6,0.2);
  border-radius: var(--radius-pill);
  font-size: 12.5px;
  font-weight: 600;
}
.mode-badge.hidden { display: none; }

.img-hint {
  margin-top: 8px;
  padding: 8px 14px;
  background: rgba(26,23,6,0.05);
  border: 1px solid rgba(26,23,6,0.12);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  color: var(--img-accent);
}
.img-hint.hidden { display: none; }

/* ══════════════════════════════
   LANDING PAGE
══════════════════════════════ */
body.landing-page { overflow: hidden; }

.hero {
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 0; /* Changed from 24px to 0 for side padding to let content handle it */
  position: relative;
  min-width: 0;
  overflow: hidden;
  background: var(--bg);
  box-sizing: border-box;
}

.brand-mark {
  position: relative; /* Changed from absolute to fix header flow */
  z-index: 1;
}

.hero-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: var(--chat-max-width);
  width: 100%;
  padding: 0 16px;
  box-sizing: border-box;
  position: relative;
  z-index: 1;
  margin: 0 auto;
}

.hero-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(34px, 5vw, 56px);
  line-height: 1.12;
  color: var(--text-dark);
  margin-bottom: 20px;
  letter-spacing: -0.02em;
  min-height: 1.25em;
  user-select: none;
}
.hero-highlight { font-style: italic; color: var(--accent); }
.typing-cursor {
  display: inline-block;
  width: 3px; height: 0.82em;
  background: var(--accent);
  margin-left: 3px;
  vertical-align: middle;
  border-radius: 2px;
  animation: cursor-blink 0.8s steps(1) infinite;
}

.hero-sub {
  font-size: 18px;
  color: var(--text-mid);
  line-height: 1.7;
  margin-bottom: 36px;
  font-weight: 300;
  user-select: none;
  animation: fade-up 0.6s 0.1s ease both;
}

.hero-content .input-card {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  animation: fade-up 0.6s 0.2s ease both;
}

.landing-footer {
  position: absolute;
  bottom: 20px;
  font-size: 12px;
  color: var(--text-soft);
  letter-spacing: 0.02em;
  z-index: 1;
  user-select: none;
}

/* ══════════════════════════════
   CHAT PAGE
══════════════════════════════ */
body.chat-page { overflow: hidden; }

.page {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
  position: relative;
  background: var(--bg);
}

.chat-container {
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center; /* Center all sections horizontally */
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
  min-width: 0;
}

/* ── CENTERED CHAT HEADER ── */
.chat-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0; /* Let inner handle vertical padding */
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
  height: 60px; /* Consistent header height */
}

.chat-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: var(--chat-max-width);
  padding: 0 20px;
  margin: 0 auto;
  gap: 12px;
  height: 100%;
}

.new-chat-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-mid);
  background: rgba(0,0,0,0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 6px 16px;
  cursor: pointer;
  font-family: var(--font-body);
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  white-space: nowrap;
  flex-shrink: 0;
}
.new-chat-link:hover { 
  background: rgba(0,0,0,0.05); 
  color: var(--text-dark);
  border-color: rgba(0,0,0,0.2);
}

/* ── CENTERED CHAT BOX ── */
#chat-box {
  width: 100%;
  flex: 1;
  overflow-y: auto;
  padding: 28px 0 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  scroll-behavior: smooth;
}
#chat-box::-webkit-scrollbar { width: 4px; }
#chat-box::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.1); border-radius: 4px; }

/* ── MESSAGE ROW ── */
.message-row {
  width: 100%;
  max-width: var(--chat-max-width);
  padding: 0 16px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  margin-bottom: 8px;
}
.message-row.user-row { align-items: flex-end; }
.message-row.bot-row { align-items: flex-start; }

/* ── MESSAGE BUBBLE BASE ── */
.message {
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 14.5px;
  line-height: 1.5;
  word-break: break-word;
  animation: msg-in 0.22s ease both;
  font-family: var(--font-body);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  position: relative;
  width: fit-content;
  max-width: 75%;
}

.message-content {
  text-align: left;
  margin-bottom: 4px;
}

.message-meta {
  display: flex;
  justify-content: flex-end;
  margin-top: 2px;
}

.timestamp {
  font-size: 10.5px;
  opacity: 0.6;
  font-weight: 400;
  white-space: nowrap;
}

.message.user {
  background: #1A1706;
  color: #FFFFFF;
  border-bottom-right-radius: 4px;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

.message.bot {
  background: var(--bg-card);
  color: var(--text-dark);
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.message.bot.error {
  background: #fff5f5;
  color: #b00020;
  border-color: #ffc5c5;
}

/* Image bubbles */
.message.image-bubble {
  max-width: min(420px, 85%);
  width: auto;
  padding: 12px;
  background: var(--bg-card);
  border: 1px solid rgba(26,23,6,0.15);
  box-shadow: 0 4px 20px rgba(26,23,6,0.06);
  align-self: flex-start;
}
.img-caption {
  font-size: 12px;
  color: var(--img-accent);
  margin-bottom: 8px;
  font-style: italic;
  line-height: 1.4;
}
.message img { max-width: 100%; border-radius: 10px; display: block; }

.dl-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 10px;
  padding: 6px 14px;
  background: var(--img-accent);
  color: white;
  border-radius: var(--radius-pill);
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  font-family: var(--font-body);
  transition: background 0.15s, transform 0.1s;
}
.dl-btn:hover  { background: var(--img-soft); }
.dl-btn:active { transform: scale(0.96); }

/* ── TYPEWRITER CURSOR ── */
.tw-cursor {
  display: inline-block;
  color: var(--text-soft);
  animation: tw-blink 0.7s steps(1) infinite;
  font-weight: 300;
  margin-left: 1px;
}

/* ── COPY BUTTON ── */
.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  padding: 4px 10px;
  background: transparent;
  color: var(--text-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 500;
  font-family: var(--font-body);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.copy-btn:hover {
  background: rgba(0,0,0,0.05);
  color: var(--text-dark);
  border-color: rgba(0,0,0,0.15);
}
.copy-btn.copied {
  color: var(--accent);
  border-color: var(--accent);
}
.copy-btn svg { flex-shrink: 0; }

/* ── TYPING INDICATOR ── */
.typing-indicator {
  padding: 4px 0 8px;
  flex-shrink: 0;
  display: flex;
  justify-content: center;
}
.typing-indicator.hidden { display: none; }

.typing-indicator-inner {
  width: 100%;
  max-width: var(--chat-max-width);
  padding: 0 16px;
  box-sizing: border-box;
  display: flex;
}
.typing-bubble {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  padding: 10px 14px;
  box-shadow: var(--shadow-sm);
}
.typing-bubble span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-soft);
  animation: dot-bounce 1.1s ease-in-out infinite;
}
.typing-bubble span:nth-child(2) { animation-delay: 0.18s; }
.typing-bubble span:nth-child(3) { animation-delay: 0.36s; }
.typing-label { font-size: 12px; color: var(--text-soft); margin-left: 4px; font-family: var(--font-body); }

/* ── CENTERED INPUT WRAPPER ── */
.chat-input-wrapper {
  width: 100%;
  padding: 10px 0 20px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.chat-input-inner {
  width: 100%;
  max-width: var(--chat-max-width);
  padding: 0 16px;
}

.hidden { display: none !important; }

/* ══════════════════════════════
   COMING SOON
══════════════════════════════ */
.coming-soon-tag {
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  background: rgba(255,255,255,0.18);
  color: rgba(255,255,255,0.8);
  letter-spacing: 0.03em;
  white-space: nowrap;
  flex-shrink: 0;
}

.sidebar-btn.coming-soon-btn {
  opacity: 0.7;
  cursor: default;
}
.sidebar-btn.coming-soon-btn:hover {
  background: rgba(255,255,255,0.08);
}

.dropdown-item-soon {
  opacity: 0.6;
  cursor: default;
  justify-content: flex-start;
}
.dropdown-item-soon:hover {
  background: rgba(0,0,0,0.02);
}
.dropdown-soon-tag {
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  background: rgba(181,97,26,0.1);
  color: var(--accent);
  letter-spacing: 0.03em;
  white-space: nowrap;
  flex-shrink: 0;
}

.reason-pill.coming-soon-btn {
  opacity: 0.55;
  cursor: default;
}
.reason-pill.coming-soon-btn:hover {
  background: transparent;
}

/* Toast notification */
.cs-toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--text-dark);
  color: #fff;
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 500;
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-md);
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  white-space: nowrap;
}
.cs-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.cs-toast.hidden { display: block; }
