/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --gold-light: #f5d98b;
  --gold: #c9943a;
  --gold-dark: #7a5a1a;
  --cream: #fdf8ed;
  --parchment: #f0e6c8;
  --deep: #0b0a12;
  --deep-2: #13111f;
  --deep-3: #1c1930;
  --mid: #2a2545;
  --text-primary: #fdf6e3;
  --text-muted: #b8a88a;
  --text-dim: #7a6e58;
  --glow: rgba(197,160,60,0.35);
  --glow-strong: rgba(197,160,60,0.6);
  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: 'Crimson Text', Georgia, serif;
  background: var(--deep);
  color: var(--text-primary);
}

/* ===== PARTICLES ===== */
#particles-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 0;
}

/* ===== LIGHT RAYS ===== */
.light-rays {
  position: fixed;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.ray {
  position: absolute;
  top: -10%;
  left: 50%;
  width: 2px;
  height: 120%;
  opacity: 0.04;
  background: linear-gradient(to bottom, #f5d98b, transparent);
  transform-origin: top center;
}

.ray-1 { transform: rotate(-35deg); animation: ray-pulse 8s ease-in-out infinite; }
.ray-2 { transform: rotate(-15deg); animation: ray-pulse 10s ease-in-out infinite 1s; opacity: 0.06; }
.ray-3 { transform: rotate(0deg); animation: ray-pulse 7s ease-in-out infinite 2s; opacity: 0.08; }
.ray-4 { transform: rotate(15deg); animation: ray-pulse 9s ease-in-out infinite 0.5s; opacity: 0.06; }
.ray-5 { transform: rotate(35deg); animation: ray-pulse 11s ease-in-out infinite 1.5s; }

@keyframes ray-pulse {
  0%, 100% { opacity: 0.03; }
  50% { opacity: 0.09; }
}

/* ===== INTRO SCREEN ===== */
.intro-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 30%, #1e1530 0%, #0b0a12 70%);
  transition: opacity 0.9s ease, transform 0.9s ease;
}

.intro-screen.fade-out {
  opacity: 0;
  transform: scale(1.04);
  pointer-events: none;
}

.intro-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 2rem;
  position: relative;
}

.halo-ring {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  width: 260px;
  height: 260px;
  border-radius: 50%;
  border: 1px solid rgba(197,160,60,0.2);
  box-shadow:
    0 0 40px rgba(197,160,60,0.1),
    0 0 100px rgba(197,160,60,0.05),
    inset 0 0 40px rgba(197,160,60,0.05);
  animation: halo-breathe 5s ease-in-out infinite;
}

@keyframes halo-breathe {
  0%, 100% { transform: translateX(-50%) scale(1); box-shadow: 0 0 40px rgba(197,160,60,0.1), 0 0 100px rgba(197,160,60,0.05); }
  50% { transform: translateX(-50%) scale(1.05); box-shadow: 0 0 60px rgba(197,160,60,0.2), 0 0 140px rgba(197,160,60,0.1); }
}

.intro-portrait {
  width: 220px;
  height: 220px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center top;
  border: 2px solid rgba(197,160,60,0.4);
  box-shadow:
    0 0 0 6px rgba(197,160,60,0.08),
    0 0 60px rgba(197,160,60,0.25),
    0 30px 80px rgba(0,0,0,0.7);
  animation: portrait-glow 5s ease-in-out infinite;
  transition: transform 0.6s ease;
}

.intro-portrait:hover {
  transform: scale(1.03);
}

@keyframes portrait-glow {
  0%, 100% { box-shadow: 0 0 0 6px rgba(197,160,60,0.08), 0 0 60px rgba(197,160,60,0.25), 0 30px 80px rgba(0,0,0,0.7); }
  50% { box-shadow: 0 0 0 10px rgba(197,160,60,0.12), 0 0 90px rgba(197,160,60,0.4), 0 30px 80px rgba(0,0,0,0.7); }
}

.intro-title {
  font-family: 'Cinzel', serif;
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 700;
  color: var(--gold-light);
  margin-top: 2rem;
  letter-spacing: 0.08em;
  text-shadow: 0 0 40px rgba(197,160,60,0.5);
  animation: title-appear 1.2s ease forwards;
  opacity: 0;
}

@keyframes title-appear {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.intro-subtitle {
  font-family: 'Crimson Text', serif;
  font-size: 1.25rem;
  font-style: italic;
  color: var(--text-muted);
  margin-top: 0.75rem;
  line-height: 1.7;
  animation: title-appear 1.4s ease 0.3s forwards;
  opacity: 0;
}

.begin-btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 2.5rem;
  padding: 0.85rem 2.2rem;
  background: linear-gradient(135deg, rgba(197,160,60,0.15), rgba(197,160,60,0.05));
  border: 1px solid rgba(197,160,60,0.5);
  border-radius: 50px;
  color: var(--gold-light);
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  cursor: pointer;
  transition: all 0.35s ease;
  box-shadow: 0 0 30px rgba(197,160,60,0.1);
  animation: title-appear 1.4s ease 0.6s forwards;
  opacity: 0;
  position: relative;
  overflow: hidden;
}

.begin-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(197,160,60,0.2), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}

.begin-btn:hover {
  border-color: rgba(197,160,60,0.9);
  box-shadow: 0 0 50px rgba(197,160,60,0.3), 0 8px 30px rgba(0,0,0,0.4);
  transform: translateY(-2px);
}

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

.begin-btn:active { transform: translateY(0); }

.btn-icon {
  font-size: 0.7rem;
  opacity: 0.7;
}

.intro-verse {
  font-family: 'Crimson Text', serif;
  font-style: italic;
  font-size: 0.95rem;
  color: var(--text-dim);
  margin-top: 2rem;
  animation: title-appear 1.4s ease 0.9s forwards;
  opacity: 0;
}

/* ===== APP LAYOUT ===== */
.app {
  display: flex;
  height: 100vh;
  position: relative;
  z-index: 10;
}

.app.hidden { display: none; }

/* ===== SIDEBAR ===== */
.sidebar {
  width: 280px;
  min-width: 280px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(20,16,40,0.97) 0%, rgba(13,11,22,0.98) 100%);
  border-right: 1px solid rgba(197,160,60,0.12);
  overflow-y: auto;
  position: relative;
  backdrop-filter: blur(20px);
}

.sidebar::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 1px; height: 100%;
  background: linear-gradient(to bottom, transparent, rgba(197,160,60,0.3), rgba(197,160,60,0.1), transparent);
}

.sidebar-top {
  padding: 2rem 1.5rem 1rem;
  text-align: center;
}

.avatar-wrap {
  position: relative;
  display: inline-block;
  margin-bottom: 1rem;
}

.avatar-halo {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 1px solid rgba(197,160,60,0.25);
  animation: halo-breathe 5s ease-in-out infinite;
}

.sidebar-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center top;
  border: 2px solid rgba(197,160,60,0.45);
  box-shadow: 0 0 30px rgba(197,160,60,0.2), 0 8px 24px rgba(0,0,0,0.5);
  display: block;
}

.status-dot {
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 12px;
  height: 12px;
  background: #4cdf8a;
  border-radius: 50%;
  border: 2px solid var(--deep-2);
  animation: status-pulse 2.5s ease-in-out infinite;
  box-shadow: 0 0 8px #4cdf8a;
}

@keyframes status-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 8px #4cdf8a; }
  50% { transform: scale(1.15); box-shadow: 0 0 16px #4cdf8a; }
}

.sidebar-name {
  font-family: 'Cinzel', serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--gold-light);
  letter-spacing: 0.05em;
  text-shadow: 0 0 20px rgba(197,160,60,0.3);
}

.sidebar-sub {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 0.25rem;
  letter-spacing: 0.03em;
}

.sidebar-divider {
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(197,160,60,0.25), transparent);
  margin: 1.2rem 0;
}

.sidebar-bio {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.65;
  font-style: italic;
}

.sidebar-topics {
  padding: 0.5rem 1.5rem 1rem;
  flex: 1;
}

.topics-label {
  font-family: 'Inter', sans-serif;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 0.75rem;
}

.topic-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.6rem 0.85rem;
  margin-bottom: 0.4rem;
  background: rgba(197,160,60,0.04);
  border: 1px solid rgba(197,160,60,0.1);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: 'Crimson Text', serif;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.25s ease;
}

.topic-btn:hover {
  background: rgba(197,160,60,0.1);
  border-color: rgba(197,160,60,0.35);
  color: var(--gold-light);
  transform: translateX(3px);
  box-shadow: 0 0 16px rgba(197,160,60,0.08);
}

.sidebar-footer {
  padding: 1rem 1.5rem 1.5rem;
  border-top: 1px solid rgba(197,160,60,0.08);
}

.clear-btn {
  width: 100%;
  padding: 0.55rem;
  background: transparent;
  border: 1px solid rgba(197,160,60,0.15);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all 0.25s ease;
}

.clear-btn:hover {
  border-color: rgba(197,160,60,0.4);
  color: var(--text-muted);
  background: rgba(197,160,60,0.06);
}

/* ===== CHAT PANEL ===== */
.chat-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 0%, rgba(30,21,60,0.6) 0%, transparent 60%);
}

/* ===== CHAT HEADER ===== */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid rgba(197,160,60,0.1);
  background: rgba(13,11,22,0.7);
  backdrop-filter: blur(10px);
  flex-shrink: 0;
}

.chat-header-left { flex: 1; }
.chat-header-center { text-align: center; }
.chat-header-right { flex: 1; text-align: right; }

.back-btn {
  background: transparent;
  border: 1px solid rgba(197,160,60,0.2);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  padding: 0.35rem 0.7rem;
  cursor: pointer;
  transition: all 0.25s ease;
  display: none;
}

.back-btn:hover {
  border-color: rgba(197,160,60,0.5);
  color: var(--gold-light);
}

.chat-title {
  font-family: 'Cinzel', serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--gold-light);
  letter-spacing: 0.08em;
}

.header-verse {
  font-family: 'Crimson Text', serif;
  font-style: italic;
  font-size: 0.82rem;
  color: var(--text-dim);
}

/* ===== MESSAGES ===== */
.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 2rem 2rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  scroll-behavior: smooth;
}

.messages-container::-webkit-scrollbar {
  width: 4px;
}
.messages-container::-webkit-scrollbar-track {
  background: transparent;
}
.messages-container::-webkit-scrollbar-thumb {
  background: rgba(197,160,60,0.2);
  border-radius: 4px;
}

/* Welcome message */
.welcome-msg {
  text-align: center;
  padding: 3rem 1rem;
  animation: title-appear 0.8s ease;
}

.welcome-msg .welcome-icon {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 1rem;
  animation: halo-breathe 4s ease-in-out infinite;
}

.welcome-msg h3 {
  font-family: 'Cinzel', serif;
  font-size: 1.4rem;
  color: var(--gold-light);
  margin-bottom: 0.5rem;
  text-shadow: 0 0 20px rgba(197,160,60,0.3);
}

.welcome-msg p {
  font-family: 'Crimson Text', serif;
  font-style: italic;
  color: var(--text-muted);
  font-size: 1.05rem;
}

/* Message bubbles */
.msg-row {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  animation: msg-appear 0.4s ease;
}

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

.msg-row.user-row { flex-direction: row-reverse; }

.msg-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
  object-position: center top;
  border: 1px solid rgba(197,160,60,0.3);
  box-shadow: 0 0 14px rgba(197,160,60,0.15);
}

.msg-avatar.user-avatar {
  background: linear-gradient(135deg, var(--mid), var(--deep-3));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  border-color: rgba(120,100,180,0.4);
  box-shadow: 0 0 14px rgba(120,100,180,0.15);
  color: #b0a0e0;
  width: 38px;
  height: 38px;
}

.bubble-wrap {
  max-width: 72%;
}

.msg-name {
  font-family: 'Inter', sans-serif;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 0.3rem;
  padding-left: 0.5rem;
}

.user-row .msg-name { text-align: right; padding-right: 0.5rem; padding-left: 0; }

.bubble {
  padding: 0.9rem 1.2rem;
  border-radius: var(--radius-md);
  font-family: 'Crimson Text', serif;
  font-size: 1.1rem;
  line-height: 1.7;
  position: relative;
}

.jesus-bubble {
  background: linear-gradient(135deg, rgba(30,24,52,0.9), rgba(20,16,40,0.95));
  border: 1px solid rgba(197,160,60,0.2);
  border-radius: 4px var(--radius-md) var(--radius-md) var(--radius-md);
  color: var(--text-primary);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3), 0 0 30px rgba(197,160,60,0.05);
}

.user-bubble {
  background: linear-gradient(135deg, rgba(50,40,90,0.85), rgba(35,28,65,0.9));
  border: 1px solid rgba(120,100,200,0.25);
  border-radius: var(--radius-md) 4px var(--radius-md) var(--radius-md);
  color: var(--text-primary);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.bubble-scripture {
  display: block;
  margin-top: 0.75rem;
  font-style: italic;
  font-size: 0.9rem;
  color: var(--gold);
  padding-top: 0.6rem;
  border-top: 1px solid rgba(197,160,60,0.15);
}

/* Typing indicator */
.typing-row { align-items: center; }
.typing-bubble {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 0.8rem 1.1rem;
  background: linear-gradient(135deg, rgba(30,24,52,0.9), rgba(20,16,40,0.95));
  border: 1px solid rgba(197,160,60,0.2);
  border-radius: 4px var(--radius-md) var(--radius-md) var(--radius-md);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.typing-dot {
  width: 7px;
  height: 7px;
  background: rgba(197,160,60,0.6);
  border-radius: 50%;
  animation: typing-bounce 1.4s ease-in-out infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-bounce {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* ===== INPUT AREA ===== */
.input-area {
  padding: 1rem 2rem 1.5rem;
  background: rgba(13,11,22,0.7);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(197,160,60,0.08);
  flex-shrink: 0;
}

.input-wrap {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  background: rgba(25,20,45,0.9);
  border: 1px solid rgba(197,160,60,0.2);
  border-radius: var(--radius-lg);
  padding: 0.75rem 0.75rem 0.75rem 1.2rem;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.input-wrap:focus-within {
  border-color: rgba(197,160,60,0.5);
  box-shadow: 0 0 30px rgba(197,160,60,0.08);
}

.user-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  font-family: 'Crimson Text', serif;
  font-size: 1.05rem;
  color: var(--text-primary);
  line-height: 1.5;
  max-height: 140px;
  overflow-y: auto;
}

.user-input::placeholder { color: var(--text-dim); font-style: italic; }

.send-btn {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(197,160,60,0.25), rgba(197,160,60,0.1));
  border: 1px solid rgba(197,160,60,0.4);
  color: var(--gold-light);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
}

.send-btn svg { width: 16px; height: 16px; }

.send-btn:hover {
  background: linear-gradient(135deg, rgba(197,160,60,0.4), rgba(197,160,60,0.2));
  box-shadow: 0 0 20px rgba(197,160,60,0.3);
  transform: scale(1.07);
}

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

.send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.input-note {
  font-family: 'Inter', sans-serif;
  font-size: 0.68rem;
  color: var(--text-dim);
  text-align: center;
  margin-top: 0.6rem;
  letter-spacing: 0.04em;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: -280px;
    top: 0;
    z-index: 50;
    transition: left 0.35s ease;
    box-shadow: 4px 0 30px rgba(0,0,0,0.6);
  }

  .sidebar.open { left: 0; }

  .chat-panel { width: 100%; }

  .back-btn { display: inline-block; }

  .header-verse { display: none; }

  .messages-container { padding: 1.25rem 1rem 0.75rem; }

  .input-area { padding: 0.75rem 1rem 1rem; }

  .bubble-wrap { max-width: 85%; }
}
