:root{
  --bg:#f6f7fb; --card:#ffffff; --muted:#6b7280; --accent:#3b82f6; --max:1000px; --border-color:#e6edf6;
}
*{box-sizing:border-box}
body.blue-mode {
  --bg: #eef2ff;
  --card: #ffffff;
  --muted: #4338ca;
  --accent: #4f46e5;
  --border-color: #c7d2fe;
}

body{font-family:Nunito,system-ui,Segoe UI,Arial,Helvetica,sans-serif;background:var(--bg);color:#111;margin:0}
.container{max-width:var(--max);margin:0 auto;padding:24px}
.site-header{background:linear-gradient(90deg,#fff,#f8fafc);border-bottom:1px solid #e6edf6;position:sticky;top:0;z-index:100}
.site-header .container{display:flex;align-items:center;justify-content:space-between}
.site-header h1{margin:0;font-size:20px}
.top-links a{margin-left:12px;color:var(--accent);text-decoration:none}
.intro{padding:28px 0}
.intro .lead{color:var(--muted);max-width:70%}
.notice{margin-top:10px;color:var(--muted);font-size:14px}
.portal{display:flex;gap:24px}
.portal .left{flex:1}
.portal .right{width:320px}

/* --- Forms & Buttons --- */
.confession-form label{display:block;margin-bottom:8px;font-weight:600}
.confession-form textarea, .bible-reader-notes textarea, .search-bar-section input, .bible-reader-controls select {
  width: 100%;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  font-size: 15px;
  background-color: var(--card);
  color: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.confession-form textarea:focus, .bible-reader-notes textarea:focus, .search-bar-section input:focus, .bible-reader-controls select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}
.confession-form textarea { height: 160px; resize: vertical; }

.form-row{display:flex;justify-content:space-between;align-items:center;margin-top:8px}
.char-counter { flex-grow: 1; text-align: center; }

.btn {
  display: inline-block;
  border: 1px solid transparent;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s, transform 0.1s;
}
.btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 30%, transparent); outline-offset: 2px; }

.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:disabled { background: #a5b4fc; border-color: #a5b4fc; color: white; cursor: default; }
.btn-primary:hover:not(:disabled) { background-color: color-mix(in srgb, var(--accent) 85%, black); }

.btn-outline{background:transparent;color:var(--accent);border-color:var(--accent);}
.btn-outline:hover:not(:disabled) { background-color: color-mix(in srgb, var(--accent) 10%, transparent); }
.btn-outline:disabled { background: transparent; border-color: #a5b4fc; color: #a5b4fc; }

/* --- Components --- */
.prompts{margin-top:18px;background:var(--card);padding:16px;border-radius:10px;border:1px solid var(--border-color)}
.prompts ul{margin:0;padding-left:18px;color:var(--muted)}
.prompts ul li { cursor: pointer; margin-bottom: 4px; }
.prompts ul li:hover { color: var(--accent); }
.card{background:var(--card);padding:12px;border-radius:10px;margin-bottom:12px;border:1px solid var(--border-color)}
.card h4, .right h4 {margin-top: 0;}
.card blockquote {margin: 10px 0 0; padding-left: 12px; border-left: 3px solid var(--border-color); color: var(--muted);}
.testimony-meta {font-size: 13px; color: var(--muted); margin: -4px 0 0;}
.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
}
.card ul {padding-left: 18px; color: var(--muted);}
.pray-count { font-size: 13px; color: var(--muted); }
.card-link {text-decoration: none; color: inherit;}
.image-card img{width:100%;height:auto;border-radius:8px}
.resources{margin-top:28px}
.resource-list{display:flex;gap:12px;list-style:none;padding:0;margin:0}
.resource-list li a{background:var(--card);padding:10px 12px;border-radius:8px;border:1px solid var(--border-color);text-decoration:none;color:#111}
.resource-list li a:hover { border-color: var(--accent); color: var(--accent); }
.resource-list li a:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 30%, transparent); outline-offset: 2px; }
.site-footer{border-top:1px solid #e6edf6;margin-top:28px;padding:18px 0;background:#fff}

/* WhatsApp contact styling */
.contact-whatsapp{display:inline-flex;align-items:center;gap:8px;background:linear-gradient(90deg,#f0fdf4,#ecfdf1);padding:6px 10px;border-radius:16px;color:#166534;text-decoration:none;border:1px solid #bbf7d0;font-weight:700}
.contact-whatsapp img{width:18px;height:18px;display:inline-block}
.support-availability{color:#6b7280;font-size:13px;margin-left:8px}

@media(max-width:480px){.contact-whatsapp{padding:6px 8px;font-size:14px}}

/* Hover / focus states */
.contact-whatsapp{transition:transform .12s ease, box-shadow .12s ease, background .12s ease, color .12s ease}
.contact-whatsapp:hover,.contact-whatsapp:focus{transform:translateY(-2px);box-shadow:0 6px 18px rgba(16,185,129,0.12);color:#0f5132}
.contact-whatsapp:focus{outline:3px solid rgba(16,185,129,0.15);outline-offset:2px}
.contact-whatsapp svg{width:18px;height:18px;fill:currentColor;transition:transform .12s ease}
.contact-whatsapp:hover svg{transform:translateY(-1px) scale(1.03)}
.support-availability{font-style:italic}

@media(max-width:900px){.portal{flex-direction:column}.portal .right{width:100%}}
.testimony-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }

/* About page specific */
.pastor-profile {display: flex; align-items: flex-start; gap: 16px;}
.pastor-profile img {width: 100px; height: 100px; border-radius: 50%; object-fit: cover;}
.pastor-profile p {margin-bottom: 4px;}

/* Scripture Library Search */
.search-bar-section { display: flex; gap: 8px; margin-bottom: 24px; }
.search-bar-section input { flex-grow: 1; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Chat simulation styles */
.chat-log {
  height: 300px;
  overflow-y: auto;
  margin-bottom: 16px;
  padding: 10px;
  background-color: color-mix(in srgb, var(--bg) 50%, var(--card));
  border: 1px solid var(--border-color);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.chat-message { max-width: 85%; padding: 10px 14px; border-radius: 12px; line-height: 1.5; animation: fadeIn 0.4s ease-out; }
.chat-message p { margin: 0; }
.chat-message blockquote { font-style: italic; margin: 8px 0 0; padding-left: 10px; border-left: 2px solid #93c5fd; color: var(--muted); font-size: 14px; }
.user-message { background-color: var(--accent); color: white; align-self: flex-end; border-bottom-right-radius: 2px; }
.ai-message { background-color: var(--card); border: 1px solid var(--border-color); align-self: flex-start; border-bottom-left-radius: 2px; }

@keyframes typing-dots {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1.0); }
}

.ai-message.thinking {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 14px;
}

.ai-message.thinking span {
  width: 8px;
  height: 8px;
  background-color: #9ca3af;
  border-radius: 50%;
  animation: typing-dots 1.4s infinite ease-in-out both;
}

.ai-message.thinking span:nth-child(1) { animation-delay: -0.32s; }
.ai-message.thinking span:nth-child(2) { animation-delay: -0.16s; }

/* Copy button for quotes */
.btn-copy {
  background-color: transparent;
  border: 1px solid var(--border-color);
  color: var(--muted);
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  margin-top: 10px;
  transition: background 0.2s, color 0.2s;
}
.btn-copy:hover { background-color: var(--border-color); color: var(--accent); }
.btn-copy:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Back to Top Button */
.back-to-top-btn {
  display: none;
  position: fixed;
  bottom: 20px;
  right: 30px;
  z-index: 99;
  border: none;
  outline: none;
  background-color: var(--accent);
  color: white;
  cursor: pointer;
  padding: 10px 15px;
  border-radius: 50%;
  font-size: 18px;
}
.back-to-top-btn:hover { background-color: #2563eb; }

/* End Confession Button */
.end-confession-wrapper {
  margin-top: 24px;
  text-align: center;
}
.btn-end { background-color: #166534; color: white; font-size: 16px; width: 100%; border-color: #166534; }
.btn-end:disabled { background: #a5b4fc; border-color: #a5b4fc; color: white; cursor: default; }
.btn-end:hover:not(:disabled) { background-color: #15803d; }
.btn-end:focus-visible { outline: 3px solid color-mix(in srgb, #166534 30%, transparent); outline-offset: 2px; }

/* Burn Letter Animation */
.burn-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(5px);
}

.letter {
  background: #fffcf2;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  padding: 30px 40px;
  border: 1px solid #e2e2e2;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  font-family: 'Times New Roman', serif;
  overflow-y: auto;
  position: relative;
  transition: all 4s ease-in-out;
}
.letter h3 { text-align: center; color: #333; }
.letter p, .letter blockquote { color: #444; line-height: 1.6; }
.letter-quote { font-style: italic; border-left: 2px solid #ccc; padding-left: 10px; margin-left: 20px; }

@keyframes burn {
  0% {
    opacity: 1;
    transform: scale(1);
    filter: brightness(100%);
  }
  50% {
    opacity: 0.8;
    filter: brightness(150%) contrast(120%);
  }
  100% {
    opacity: 0;
    transform: scale(1.2) translateY(-50px);
    filter: brightness(300%) contrast(200%) blur(10px);
  }
}

.letter.burning {
  animation: burn 4s forwards;
}

/* Full-width button link */
.btn-full-width {
  display: block;
  width: 100%;
  text-align: center;
  background-color: var(--card);
  color: var(--accent);
  border: 1px solid var(--border-color);
  padding: 12px 14px;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 700;
  transition: background 0.2s, color 0.2s;
}
.btn-full-width:hover { background-color: var(--accent); color: white; }
.btn-full-width:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 30%, transparent); outline-offset: 2px; }

/* Bible Reader Page */
.bible-reader-controls { margin-bottom: 16px; display: flex; align-items: center; gap: 12px; }
#scripture-text {
    font-size: 1.2em;
    min-height: 100px;
}
.bible-reader-notes { margin-top: 24px; }

/* Theme Toggle Button */
.theme-toggle-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    padding: 0;
    margin-right: 16px;
}
