/* ===========================================================
   Chat IA — CatólicosGPT · builds on styles.css tokens
   =========================================================== */

.chat-shell { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }

/* nav stays from styles.css .nav, but here it's not sticky-overlaying scroll */
.chat-shell .nav { flex-shrink: 0; }
.nav-left { display: flex; align-items: center; gap: 14px; }
.icon-btn {
  width: 40px; height: 40px; display: grid; place-items: center; cursor: pointer;
  background: var(--cream-2); border: 1px solid var(--hairline-2); border-radius: 11px;
  color: var(--ink-2); transition: .18s var(--ease);
}
.icon-btn:hover { color: var(--espresso); border-color: var(--gold); }

/* ---------- body row ---------- */
.chat-body { flex: 1; display: flex; min-height: 0; }

/* ---------- sidebar ---------- */
.side {
  width: 286px; flex-shrink: 0; display: flex; flex-direction: column;
  background: linear-gradient(180deg, #F1E8D6, #EFE6D2);
  border-right: 1px solid var(--hairline); transition: margin-left .28s var(--ease);
}
.side.closed { margin-left: -286px; }
.side-top { padding: 18px 16px 10px; }
.btn-new {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 9px;
  font-family: var(--font-ui); font-weight: 600; font-size: 14.5px; color: #3a2a0c;
  background: var(--grad-gold); border: 1px solid rgba(154,110,38,.4); border-radius: var(--r-md);
  padding: 13px; cursor: pointer; box-shadow: var(--shadow-sm); transition: .18s var(--ease);
}
.btn-new:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.side-scroll { flex: 1; overflow-y: auto; padding: 8px 10px; }
.side-group { margin: 14px 4px 6px; font-size: 10.5px; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
.side-item {
  display: flex; align-items: center; gap: 9px; padding: 10px 12px; border-radius: 10px;
  font-size: 14px; color: var(--ink-2); cursor: pointer; transition: .14s var(--ease);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border: 1px solid transparent;
}
.side-item .ic { color: var(--gold-deep); flex-shrink: 0; opacity: .7; }
.side-item:hover { background: rgba(255,255,255,.6); color: var(--ink); }
.side-item.active { background: var(--cream-2); color: var(--espresso); border-color: var(--hairline-2); box-shadow: var(--shadow-sm); }
.side-foot { padding: 12px 14px; border-top: 1px solid var(--hairline); display: flex; align-items: center; justify-content: space-between; }
.side-user { display: flex; align-items: center; gap: 10px; }
.side-user .av { width: 32px; height: 32px; border-radius: 50%; background: var(--grad-gold); color: #3a2a0c; font-weight: 700; font-size: 13px; display: grid; place-items: center; }
.side-user .nm { font-weight: 600; font-size: 14px; color: var(--espresso); }
.side-user .pl { font-size: 11.5px; color: var(--ink-3); }
.side-cta { font-size: 11px; font-weight: 600; color: var(--gold-deep); cursor: pointer; }

/* sidebar backdrop on mobile */
.side-backdrop { display: none; }

/* ---------- main chat column ---------- */
.chat-main { flex: 1; display: flex; flex-direction: column; min-width: 0; position: relative; }
.chat-scroll { flex: 1; overflow-y: auto; scroll-behavior: smooth; }
.chat-inner { max-width: 800px; margin: 0 auto; padding: 30px clamp(18px, 4vw, 40px) 24px; }

/* ---------- empty state ---------- */
.empty-chat { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 30px 20px 10px; }
.empty-emblem {
  width: 70px; height: 70px; border-radius: 20px; display: grid; place-items: center;
  background: var(--grad-cream); border: 1px solid var(--hairline-2); box-shadow: var(--shadow-md);
  color: var(--gold-deep); margin-bottom: 26px;
}
.empty-h { font-family: var(--font-display); font-weight: 700; font-size: clamp(32px, 5vw, 50px); color: var(--espresso); line-height: 1.02; }
.empty-h .it { font-style: italic; color: transparent; background: var(--grad-gold); -webkit-background-clip: text; background-clip: text; }
.empty-sub { font-family: var(--font-display); font-style: italic; font-size: clamp(16px, 2.2vw, 21px); color: var(--ink-2); margin-top: 12px; }

.sugg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 34px auto 0; max-width: 620px; width: 100%; }
.sugg {
  text-align: left; background: var(--cream-2); border: 1px solid var(--hairline); border-radius: var(--r-lg);
  padding: 16px 18px; cursor: pointer; transition: .18s var(--ease); display: flex; gap: 13px; align-items: flex-start;
}
.sugg:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--gold); }
.sugg-ic { width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0; display: grid; place-items: center; background: linear-gradient(160deg, rgba(188,138,54,.16), rgba(94,27,34,.1)); color: var(--gold-deep); }
.sugg-t { display: block; font-weight: 600; font-size: 14.5px; color: var(--espresso); }
.sugg-ex { display: block; font-family: var(--font-display); font-style: italic; font-size: 15px; color: var(--ink-2); margin-top: 3px; line-height: 1.3; }

.quick-row { display: flex; flex-wrap: wrap; gap: 9px; justify-content: center; margin: 26px auto 0; max-width: 640px; }
.quick { font-size: 13px; color: var(--ink-2); background: var(--cream-2); border: 1px solid var(--hairline-2); border-radius: 99px; padding: 8px 16px; cursor: pointer; transition: .15s var(--ease); }
.quick:hover { border-color: var(--gold); color: var(--espresso); background: var(--cream); }

/* ---------- messages ---------- */
.msg { display: flex; gap: 14px; margin-bottom: 30px; animation: rise .45s var(--ease) both; }
.msg.user { flex-direction: row-reverse; }
.msg-av { width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0; display: grid; place-items: center; }
.msg-av.ai { background: var(--grad-cream); border: 1px solid var(--hairline-2); color: var(--gold-deep); box-shadow: var(--shadow-sm); }
.msg-av.me { background: var(--espresso); color: #f3e4c6; font-weight: 700; font-size: 12px; font-family: var(--font-ui); }
.msg-col { min-width: 0; max-width: 100%; }
.msg.user .msg-col { display: flex; flex-direction: column; align-items: flex-end; }

.bubble-user {
  background: var(--grad-maroon); color: #f6ead2; border-radius: 18px 18px 6px 18px;
  padding: 13px 18px; font-size: 15.5px; line-height: 1.5; max-width: 560px; box-shadow: var(--shadow-sm);
}

.msg-name { display: flex; align-items: center; gap: 8px; white-space: nowrap; font-family: var(--font-brand); font-weight: 600; font-size: 14px; color: var(--espresso); margin-bottom: 9px; }
.msg-name .time { font-family: var(--font-ui); font-weight: 400; font-size: 12px; color: var(--ink-3); letter-spacing: 0; }

/* assistant typeset body */
.ai-body { font-size: inherit; line-height: 1.72; color: var(--ink); }
.ai-body p { margin: 0 0 15px; text-wrap: pretty; }
.ai-body .ai-h { font-family: var(--font-display); font-weight: 700; font-size: 21px; color: var(--espresso); margin: 22px 0 12px; }
.ai-list { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.ai-list li { position: relative; padding-left: 28px; line-height: 1.55; }
.ai-list li::before {
  content: ''; position: absolute; left: 4px; top: 9px; width: 9px; height: 9px;
  background: var(--accent); border-radius: 2px; transform: rotate(45deg);
}
.ai-quote {
  margin: 4px 0 18px; padding: 16px 22px; border-left: 3px solid var(--gold);
  background: linear-gradient(120deg, rgba(188,138,54,.08), transparent);
  border-radius: 0 var(--r-md) var(--r-md) 0;
}
.ai-quote .q { font-family: var(--font-display); font-style: italic; font-size: 20px; line-height: 1.4; color: var(--coffee); }
.ai-quote .r { font-family: var(--font-ui); font-weight: 600; font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--gold-deep); margin-top: 10px; }

.ai-sources { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; margin-top: 4px; }
.ai-sources .lbl { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); margin-right: 2px; }
.src { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--ink-2); background: var(--cream-2); border: 1px solid var(--hairline-2); border-radius: 99px; padding: 5px 11px; }
.src .ic { color: var(--gold-deep); }

.ai-actions { display: flex; gap: 6px; margin-top: 16px; flex-wrap: wrap; }
.act-btn {
  display: inline-flex; align-items: center; gap: 7px; font-family: var(--font-ui); font-weight: 500;
  font-size: 13px; color: var(--ink-2); background: transparent; border: 1px solid var(--hairline-2);
  border-radius: 99px; padding: 8px 14px; cursor: pointer; transition: .15s var(--ease);
}
.act-btn:hover { color: var(--espresso); border-color: var(--gold); background: var(--cream-2); }
.act-btn.feat { color: var(--gold-deep); border-color: var(--gold); }
.act-btn.feat:hover { background: var(--grad-gold); color: #3a2a0c; border-color: transparent; }

/* typing indicator */
.typing { display: flex; gap: 6px; padding: 6px 2px; }
.typing span { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); opacity: .4; animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-4px); } }

/* ---------- composer ---------- */
.composer-wrap { flex-shrink: 0; padding: 14px clamp(14px, 4vw, 30px) 16px; background: linear-gradient(0deg, var(--cream) 60%, transparent); }
.composer { max-width: 800px; margin: 0 auto; }
.composer-bar {
  display: flex; align-items: flex-end; gap: 10px; background: var(--cream-2);
  border: 1.5px solid var(--hairline-2); border-radius: 20px; padding: 8px 8px 8px 18px;
  box-shadow: var(--shadow-md); transition: .18s var(--ease);
}
.composer-bar:focus-within { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(188,138,54,.13), var(--shadow-md); }
.composer-input {
  flex: 1; border: none; outline: none; background: transparent; resize: none;
  font-family: var(--font-display); font-size: 18px; color: var(--ink); line-height: 1.5;
  padding: 9px 0; max-height: 160px; min-height: 24px;
}
.composer-input::placeholder { color: var(--ink-3); font-style: italic; }
.composer-send {
  width: 44px; height: 44px; border-radius: 13px; border: none; flex-shrink: 0; cursor: pointer;
  background: var(--grad-gold); color: #3a2a0c; display: grid; place-items: center;
  box-shadow: 0 4px 12px rgba(154,110,38,.3); transition: .16s var(--ease);
}
.composer-send:hover { transform: translateY(-2px); }
.composer-send:disabled { opacity: .45; cursor: default; transform: none; box-shadow: none; }
.composer-foot { text-align: center; font-size: 12px; color: var(--ink-3); margin-top: 10px; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .side { position: absolute; top: 0; bottom: 0; left: 0; z-index: 30; box-shadow: var(--shadow-lg); }
  .side.closed { margin-left: -286px; }
  .side-backdrop { display: block; position: absolute; inset: 0; z-index: 25; background: rgba(43,24,10,.3); backdrop-filter: blur(2px); }
  .side-backdrop.hidden { display: none; }
  .sugg-grid { grid-template-columns: 1fr; }
  .nav-links { display: none; }
}
