/* ==========================================================================
   Let's Do. – AI Chat Interface
   Premium glasmorphism chat
   ========================================================================== */

/* ── Section ── */
.chat-section {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  height: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(2rem, 4vh, 4rem) clamp(1.5rem, 4vw, 4rem);
  background: transparent;
}

.chat-section__glasbox {
  max-width: 850px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-lg);
}

.chat-section__header {
  text-align: center;
}

.chat-section__tag {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(0.85rem, 1.4vw, 1.1rem);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ld-red);
  text-shadow: 0 2px 8px rgba(0,0,0,0.9), 0 0 30px rgba(0,0,0,0.7);
  opacity: 0;
  transform: translateY(20px);
}

.chat-section__sub {
  font-family: var(--font-display);
  font-size: clamp(1rem, 1.6vw, 1.3rem);
  color: rgba(255, 255, 255, 0.5);
  font-weight: 300;
  letter-spacing: 0.06em;
  text-shadow: 0 2px 8px rgba(0,0,0,0.9), 0 0 30px rgba(0,0,0,0.7);
  opacity: 0;
  transform: translateY(20px);
}

.chat-section__footer {
  font-family: var(--font-body);
  font-size: 0.7rem;
  color: rgba(255,255,255,0.2);
  text-align: center;
  letter-spacing: 0.03em;
}
.chat-section__footer a {
  color: rgba(255,255,255,0.3);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.chat-section__noscript {
  font-size: var(--text-sm);
  color: var(--text-muted);
  text-align: center;
  margin-top: var(--space-md);
}

/* ── Chat Container ── */
.chat {
  width: 100%;
  height: clamp(450px, 58vh, 640px);
  background: rgba(5, 5, 8, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 1px 0 0 rgba(228,28,34,0.06), 0 30px 60px -15px rgba(0,0,0,0.4);
}

/* ── Chat Header Bar ── */
.chat__interface::before {
  content: '';
  display: block;
  height: 36px;
  flex-shrink: 0;
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid rgba(255,255,255,0.04);
  background-image:
    radial-gradient(circle at 16px 18px, rgba(228,28,34,0.4) 3px, transparent 3px),
    radial-gradient(circle at 30px 18px, rgba(255,200,0,0.3) 3px, transparent 3px),
    radial-gradient(circle at 44px 18px, rgba(68,255,136,0.3) 3px, transparent 3px);
  background-repeat: no-repeat;
  border-radius: 20px 20px 0 0;
}

/* ── Chat Interface ── */
.chat__interface {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Messages ── */
.chat__messages {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  padding: var(--space-lg) clamp(1.2rem, 2vw, 2rem) var(--space-sm);
  display: flex;
  flex-direction: column;
  gap: clamp(0.8rem, 1.5vh, 1.2rem);
  scrollbar-width: thin;
  scrollbar-color: rgba(228,28,34,0.12) transparent;
}
.chat__messages::-webkit-scrollbar { width: 3px; }
.chat__messages::-webkit-scrollbar-track { background: transparent; }
.chat__messages::-webkit-scrollbar-thumb { background: rgba(228,28,34,0.12); border-radius: 2px; }

/* ── Message Bubbles ── */
.chat__msg {
  max-width: 82%;
  padding: clamp(0.7rem, 1.2vh, 1rem) clamp(1rem, 1.5vw, 1.4rem);
  border-radius: 16px;
  font-family: var(--font-body);
  font-size: clamp(0.85rem, 1vw, 0.95rem);
  line-height: 1.65;
  overflow: visible;
  overflow-wrap: break-word;
  word-break: break-word;
  flex-shrink: 0;
  animation: msg-in 0.35s var(--ease-out);
}

@keyframes msg-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* AI message */
.chat__msg--ai {
  align-self: flex-start;
  display: flex;
  flex-direction: column;
  background: rgba(228, 28, 34, 0.03);
  border: 1px solid rgba(228, 28, 34, 0.06);
  border-radius: 4px 16px 16px 16px;
  color: var(--text-primary);
}

.chat__msg-icon {
  width: 20px;
  height: 20px;
  margin-bottom: 0.5rem;
  opacity: 0.35;
  filter: drop-shadow(0 0 4px rgba(228,28,34,0.2));
}

.chat__msg-body p {
  margin: 0 0 0.5rem;
}
.chat__msg-body p:last-child { margin-bottom: 0; }

.chat__msg-body strong {
  color: rgba(255,255,255,0.95);
  font-weight: 600;
}

.chat__msg-body em {
  font-style: italic;
  opacity: 0.85;
}

.chat__msg-body code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: rgba(228,28,34,0.08);
  padding: 2px 6px;
  border-radius: 4px;
}

/* Lists */
.chat__list {
  margin: 0.5rem 0;
  padding-left: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.chat__list li {
  font-size: inherit;
  line-height: 1.5;
}

ol.chat__list { list-style: decimal; }
ul.chat__list { list-style: disc; }

.chat__list li::marker {
  color: var(--ld-red);
  opacity: 0.5;
}

/* User message */
.chat__msg--user {
  align-self: flex-end;
  background: rgba(228, 28, 34, 0.08);
  border: 1px solid rgba(228, 28, 34, 0.12);
  border-radius: 16px 4px 16px 16px;
  color: var(--text-primary);
}

/* Typing indicator */
.chat__typing {
  display: flex;
  gap: 6px;
  padding: 0.6rem 1.2rem;
  align-self: flex-start;
  background: rgba(228,28,34,0.03);
  border-radius: 4px 12px 12px 12px;
  border: 1px solid rgba(228,28,34,0.06);
}
.chat__typing span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: rgba(228,28,34,0.5);
  animation: chat-dot-pulse 1.4s ease-in-out infinite;
}
.chat__typing span:nth-child(2) { animation-delay: 0.2s; }
.chat__typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes chat-dot-pulse {
  0%, 60%, 100% { opacity: 0.3; transform: scale(1); }
  30%           { opacity: 1; transform: scale(1.3); }
}

/* ── Input Area ── */
.chat__input-area {
  padding: clamp(0.6rem, 1vh, 0.8rem) clamp(0.8rem, 1.5vw, 1.2rem);
  border-top: 1px solid rgba(255,255,255,0.03);
  flex-shrink: 0;
  background: rgba(255,255,255,0.01);
}

.chat__input-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 14px;
  padding: clamp(0.5rem, 0.7vh, 0.7rem) clamp(0.8rem, 1.2vw, 1.2rem);
  transition: border-color 0.25s var(--ease-out), box-shadow 0.25s var(--ease-out);
}

.chat__input-wrap:focus-within {
  border-color: rgba(228, 28, 34, 0.25);
  box-shadow: 0 0 20px rgba(228, 28, 34, 0.06);
}

.chat__input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  font-family: var(--font-body);
  font-size: clamp(0.88rem, 1.1vw, 1rem);
  color: var(--text-primary);
  line-height: 1.5;
  max-height: 100px;
  scrollbar-width: none;
}
.chat__input::-webkit-scrollbar { display: none; }
.chat__input::placeholder {
  color: rgba(255,255,255,0.25);
  font-weight: 300;
}

/* Buttons */
.chat__tts-btn,
.chat__send-btn {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s, transform 0.15s;
  background: transparent;
  border: none;
  cursor: pointer;
}

.chat__tts-btn {
  color: rgba(255,255,255,0.2);
}
.chat__tts-btn:hover { color: rgba(255,255,255,0.45); background: rgba(255,255,255,0.03); }
.chat__tts-btn.active {
  color: var(--ld-red);
  background: rgba(228,28,34,0.1);
}

.chat__send-btn {
  color: white;
  background: rgba(228, 28, 34, 0.8);
  border-radius: 10px;
}
.chat__send-btn:hover {
  background: rgba(228, 28, 34, 0.95);
  transform: scale(1.05);
}
.chat__send-btn:active {
  transform: scale(0.95);
}

/* ── Limit Bar ── */
.chat__limit-bar {
  position: relative;
  height: 20px;
  background: rgba(255,255,255,0.03);
  border-top: 1px solid rgba(255,255,255,0.03);
  flex-shrink: 0;
  overflow: hidden;
}

.chat__limit-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  background: linear-gradient(90deg, rgba(228,28,34,0.15), rgba(228,28,34,0.08));
  transition: width 0.5s var(--ease-out);
  width: 100%;
}

.chat__limit-bar--empty .chat__limit-fill {
  background: linear-gradient(90deg, rgba(228,28,34,0.12), rgba(228,28,34,0.05));
}

.chat__limit-text {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.3);
}

.chat__limit-bar--empty .chat__limit-text {
  color: rgba(228,28,34,0.5);
}

/* ── Consent Overlay ── */
.chat__consent-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  background: rgba(5,5,8,0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding: 1rem;
  opacity: 0;
  transition: opacity 0.3s var(--ease-out);
  border-radius: 20px;
}

.chat__consent-overlay.visible {
  opacity: 1;
}

.chat__consent-box {
  max-width: 420px;
  padding: clamp(1.5rem, 3vh, 2.5rem) clamp(1.5rem, 3vw, 2.5rem);
  text-align: center;
}

.chat__consent-box h3 {
  font-family: var(--font-display);
  font-size: clamp(1rem, 1.3vw, 1.15rem);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.8rem;
}

.chat__consent-box p {
  font-family: var(--font-body);
  font-size: clamp(0.8rem, 1vw, 0.9rem);
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 0.6rem;
}

.chat__consent-box ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin: 0.8rem 0;
  font-family: var(--font-body);
  font-size: clamp(0.75rem, 0.95vw, 0.85rem);
  color: var(--text-muted);
  text-align: left;
  max-width: 320px;
  margin-inline: auto;
}

.chat__consent-box li::before {
  content: '\2022';
  color: rgba(228,28,34,0.5);
  margin-right: 0.5rem;
}

.chat__consent-small {
  font-size: 0.7rem !important;
  color: var(--text-dim) !important;
  margin-bottom: 1rem !important;
}

.chat__consent-small a {
  color: rgba(255,255,255,0.4);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.chat__consent-btns {
  display: flex;
  gap: 0.8rem;
  justify-content: center;
}

.chat__consent-ok {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--text-primary);
  background: rgba(228,28,34,0.12);
  border: 1px solid rgba(228,28,34,0.3);
  padding: 0.5rem 1.5rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.chat__consent-ok:hover {
  background: rgba(228,28,34,0.2);
  border-color: rgba(228,28,34,0.5);
}

.chat__consent-no {
  font-family: var(--font-display);
  font-size: 0.8rem;
  color: var(--text-dim);
  background: transparent;
  border: 1px solid rgba(255,255,255,0.08);
  padding: 0.5rem 1.5rem;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.2s;
}
.chat__consent-no:hover {
  border-color: rgba(255,255,255,0.2);
}
