/* ==========================================================================
   LifeCompass.pro — Base Stylesheet
   Path: /styles/style.css
   Notes:
   - Compatible with existing markup you shared
   - Fixes profile dropdown off-screen issue
   - Improves responsive nav + cards + forms
   - Adds focus states & small transitions
   ========================================================================== */

/* -----------------------------
   Design Tokens
----------------------------- */
:root{
  --bg: #f5f5f5;
  --surface: #ffffff;
  --ink: #333333;
  --ink-2: #555555;
  --muted: #666666;
  --brand: #3a8c8c;          /* teal-ish accent for links */
  --brand-2: #2f6f6f;
  --silver: #d3d3d3;         /* existing header/footer color */
  --shadow-sm: 0 2px 10px rgba(0,0,0,.08);
  --shadow-md: 0 6px 18px rgba(0,0,0,.12);
  --radius: 10px;
  --radius-lg: 20px;
  --gap: 20px;
  --focus: 2px solid #2f6f6f;
}

/* -----------------------------
   CSS Reset (minimal)
----------------------------- */
*,
*::before,
*::after{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: "Noto Sans", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img{ max-width:100%; display:block; }
a{ color: inherit; text-decoration: none; }
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible{ outline: var(--focus); outline-offset: 2px; }

/* -----------------------------
   Layout Containers
----------------------------- */
.container{
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
  padding: 10px;
  overflow-x: hidden;
}

/* Wider gutters on desktop */
@media (min-width: 1200px){
  .container{ padding-inline: 40px; }
}

@media (min-width: 1600px){
  .container{ padding-inline: 200px; }
}

/* -----------------------------
   Header & Footer
----------------------------- */
header,
footer{
  background: var(--silver);
  color: var(--ink);
  padding: 20px 10px;
  position: relative;
  z-index: 100;
}

header{
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

footer{
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  text-align: center;
}

header .logo img,
.logo img{
  max-height: 72px;
  width: auto;
}

/* Desktop header padding mirrors container gutters */
@media (min-width: 1200px){
  header, footer{ padding-inline: 40px; }
}

@media (min-width: 1600px){
  header, footer{ padding-inline: 200px; }
}

/* -----------------------------
   Navigation  (SCOPED TO HEADER ONLY)
----------------------------- */
header { position: relative; z-index: 100; }

/* Desktop header nav */
header nav { position: relative; z-index: 1000; }
header nav ul{
  list-style: none;
  margin: 0; padding: 0;
  display: flex; gap: 10px;
}
header nav ul li a{
  display: inline-block;
  padding: 10px 14px;
  border-radius: 8px;
  font-weight: 700;
  transition: background .2s ease, color .2s ease;
}
header nav ul li a:hover{ background: rgba(0,0,0,.06); }

/* Hamburger only for header on mobile */
header .hamburger-icon{
  display: none;
  position: absolute;
  left: 20px;
  top: 22px;
  z-index: 1001;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
}
header .hamburger-icon span{
  width: 26px; height: 3px; background: var(--ink);
  transition: transform .25s ease, opacity .25s ease;
}

/* Mobile menu (scoped to header) */
@media (max-width: 1024px){
  header .hamburger-icon{ display: flex; }
  header nav ul{
    display: none;
    position: fixed;
    top: 80px; left: 10px; right: 10px;
    background: var(--silver);
    padding: 10px;
    border-radius: var(--radius);
    flex-direction: column;
    gap: 0;
    box-shadow: var(--shadow-md);
  }
  header nav ul.active{ display: flex; }
  header nav ul li{
    border-bottom: 1px solid rgba(0,0,0,.08);
  }
  header nav ul li:last-child{ border-bottom: 0; }
  header nav ul li a{
    width: 100%;
    text-align: left;
    border-radius: 8px;
  }
}

.profile-icon-container { position: absolute; top: 60px; right: 20px; }

.profile-icon{
  width: 30px;
  color: var(--ink);
  cursor: pointer;
  transition: opacity .2s ease;
}
.profile-icon:hover{ opacity: .8; }

.dropdown{ position: relative; }
.dropdown-toggle { display: inline-flex; align-items: center; }
/* Keep menu within viewport by anchoring to the right edge */
.dropdown-menu{
  position: absolute;
  top: calc(100% + 8px);
  right: 0;            /* anchor to right edge */
  left: auto;
  min-width: 220px;
  max-width: calc(100vw - 24px); /* never exceed viewport */
  width: max-content;            /* shrink if needed */
  padding: 8px 0;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,.12);
  z-index: 1000;
  display: none;
}
.dropdown-menu.is-open { display: block; }

.dropdown-menu li { padding: 0; }
  .dropdown-menu li a{ white-space: normal; }   /* wrap text if needed */

.dropdown-menu li a:hover {
  background: rgba(0,0,0,.04);
  border-radius: 6px;
}

/* On very narrow screens, prevent overflow by letting it max at screen edge */
@media (max-width: 420px){
  .dropdown-menu{
    right: 10px;
    left: 10px;
    min-width: unset;
  }
}
/* Very small screens: give breathing room and allow wrapping */
@media (max-width: 480px){
  .profile-icon-container { right: 12px; }      /* pull in from the edge */
  .dropdown-menu{
    right: 8px;
    left: auto;
    min-width: 180px;
    max-width: calc(100vw - 16px);
  }
}
@media (max-width: 360px){
  .dropdown-menu { left: auto; right: 0; transform: translateX(0); min-width: 180px; }
}
/* -----------------------------
   Welcome / Hero
----------------------------- */
.dashboard .welcome{
  background: var(--surface);
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.dashboard .welcome h1{
  margin: 0 0 10px;
  font-size: clamp(1.25rem, 1rem + 1.5vw, 2rem);
}
.dashboard .welcome p{ color: var(--ink-2); margin: 0; }

/* -----------------------------
   Cards Grid
----------------------------- */
.card{
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  transition: transform .2s ease, box-shadow .2s ease;
}
.card:hover{ transform: translateY(-2px); box-shadow: var(--shadow-md); }
.card h2{
  margin: 0 0 12px;
  font-size: 1.25rem;
  display: flex; align-items: center; gap: 10px;
}
.card p{ color: var(--ink-2); margin: 0 0 10px; }
.card ul{ list-style: none; margin: 0; padding: 0; }
.card ul li{ margin-bottom: 8px; }

.dashboard-link{
  color: var(--brand);
  font-weight: 700;
  display: inline-block;
  margin-top: 10px;
}
.dashboard-link:hover{ color: var(--brand-2); text-decoration: underline; }

/* -----------------------------
   Conversation Layout
----------------------------- */
.conversation-container{
  display: flex; flex-direction: column; gap: 10px; width: 100%;
  padding: 10px;
}
@media (min-width: 769px){
  .conversation-container{ flex-direction: row; }
}

.conversation-history{
  background: var(--silver);
  border-bottom: 1px solid #ddd;
  padding: 10px;
  max-height: 500px;
  overflow-y: auto;
  width: 100%;
}
@media (min-width: 769px){
  .conversation-history{
    width: 28%;
    border-right: 1px solid #ddd;
    border-bottom: 0;
    border-radius: var(--radius);
  }
}
.conversation-history h3{ margin: 0 0 10px; }
.conversation-history ul{ list-style: none; margin: 0; padding: 0; }
.conversation-history li{
  display: flex; align-items: center; gap: 8px;
  padding: 8px 4px;
  border-radius: 8px;
}
.conversation-history li.active{ background: #e0f7fa; }
.conversation-history a:hover{ text-decoration: underline; color: var(--ink); }

.conversation-box{
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  margin: 10px auto;
  width: 100%;
}
@media (min-width: 769px){
  .conversation-box{ width: 72%; }
}
.conversation-box h2{ margin-top: 0; }
.conversation-box textarea{
  width: 100%; height: 200px; resize: vertical;
  padding: 12px; border: 1px solid #ccc; border-radius: 8px;
}
.conversation-box button{
  width: 100%; padding: 12px 14px;
  background: var(--ink); color: #fff; border: 0; border-radius: 8px;
  font-size: 16px; cursor: pointer; transition: background .2s ease;
}
.conversation-box button:hover{ background: #4d4d4d; }

.bot-response{
  background: #f9f9f9; border-radius: 8px; padding: 10px; margin: 10px 0;
}

/* Utility buttons (delete/edit) */
.delete-button,
.edit-button{
  background: #f5f5f5;
  border: none; border-radius: 50%;
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 18px; cursor: pointer; margin-left: 8px;
  transition: background .2s ease, color .2s ease;
}
.delete-button{ color: #c62828; }
.edit-button{ color: #2e7d32; }
.delete-button:hover,
.edit-button:hover{ background: #4d4d4d; color: #f5f5f5; }

@media (max-width: 768px){
  .delete-button, .edit-button{ width: 32px; height: 32px; font-size: 20px; }
}

/* -----------------------------
   Forms: Login / Register / Settings
----------------------------- */
.login-container,
.register-container,
.settings-container{
  display:flex; align-items:center; justify-content:center;
  min-height: 100vh;
  padding: 20px;
  background: var(--silver);
}

.login-box,
.register-box,
.settings-box{
  width: 100%; max-width: 420px;
  background: #fff; border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 28px;
  text-align: center;
}
.login-box h2,
.register-box h2,
.settings-box h2{ margin: 0 0 18px; }

.login-box label,
.register-box label,
.settings-box label{
  display:block; text-align:left; margin-bottom:6px; font-weight:700;
}

/* Exclude checkboxes from global full-width input styling */
.login-box input:not([type="checkbox"]),
.register-box input:not([type="checkbox"]),
.settings-box select,
.settings-box input:not([type="checkbox"]){
  width: 100%; padding: 10px 12px; margin-bottom: 14px;
  border:1px solid #ccc; border-radius: 8px; color: var(--ink);
}


.login-box button,
.register-box button,
.settings-box button{
  width: 100%; padding: 12px 14px;
  background: var(--ink); color:#fff; border:0; border-radius: 8px;
  font-size:16px; cursor: pointer; transition: background .2s ease;
}
.login-box button:hover,
.register-box button:hover,
.settings-box button:hover{ background: #4d4d4d; }

/* -----------------------------
   Contact Form
----------------------------- */
.contact-container{
  display:flex; align-items:center; justify-content:center;
  padding: 50px 10px; background: var(--bg);
}
.contact-box{
  width: 100%; max-width: 520px;
  background: #fff; border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 28px;
}
.contact-box h2{
  color: var(--ink); text-align:center; margin: 0 0 18px;
  font-size: 1.8em;
}
.contact-form label{ display:block; margin-bottom:6px; font-weight:700; color: var(--ink); }
.contact-form input[type="text"],
.contact-form input[type="email"],
.contact-form input[type="tel"],
.contact-form textarea{
  width: 100%; padding: 10px; margin-bottom: 14px;
  border:1px solid #ccc; border-radius: 8px; font-size: 1em;
}
.contact-form textarea{ min-height: 150px; resize: vertical; }
.captcha-image{ display:block; margin: 10px auto; max-width: 120px; }
.submit-button{
  width: 100%; padding: 12px 14px; background: var(--ink);
  color:#fff; border:0; border-radius:8px; cursor:pointer; transition: background .2s ease;
}
.submit-button:hover{ background: #4d4d4d; }

/* -----------------------------
   Tables (Bible Studies)
----------------------------- */
.styled-table{
  width: 100%; border-collapse: collapse; margin-top: 20px;
  box-shadow: var(--shadow-sm); background: #fff; border-radius: var(--radius); overflow: hidden;
}
.styled-table thead tr{
  background: var(--silver); color: var(--ink);
}
.styled-table th, .styled-table td{
  padding: 12px 15px; border-bottom: 1px solid #eee; text-align:left;
}
.styled-table tbody tr:hover{ background: #f7f7f7; }

/* -----------------------------
   Buttons (utility)
----------------------------- */
.btn-primary{
  background: var(--ink); color:#fff; border:0; border-radius:8px;
  padding: 10px 16px; cursor:pointer; transition: background .2s ease;
}
.btn-primary:hover{ background:#4d4d4d; }

.btn-info, .btn-secondary, .btn-danger{
  background: #4d4d4d; color:#fff; border:0; border-radius:8px;
  padding: 8px 12px; cursor:pointer; transition: background .2s ease;
}
.btn-info:hover, .btn-secondary:hover, .btn-danger:hover{ background: var(--ink); }

/* -----------------------------
   Donation
----------------------------- */
.donation, .donation-methods{ display:flex; flex-direction:column; align-items:center; }
.donation-method{ margin-bottom: 24px; text-align:center; }
.venmo-logo, .venmo-qr-code{ max-width: 120px; margin: 0 auto; }

/* -----------------------------
   Modals (Help / Feedback)
----------------------------- */
.modal,
.help-modal{
  display: none; /* default hidden; show with .active */
  position: fixed; inset: 0; z-index: 1300;
  background: rgba(0,0,0,.5);
  align-items: center; justify-content: center;
}
.modal.active,
.help-modal.active{ display:flex; }

.modal-content,
.help-modal-content{
  background: #fff; color: var(--ink);
  width: min(90%, 520px); border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 20px; max-height: 80vh; overflow: auto; position: relative;
}
.modal-header{
  display:flex; align-items:center; justify-content:space-between;
  border-bottom: 1px solid #eee; margin-bottom: 12px;
}
.modal-close,
.help-modal-close{
  cursor: pointer; font-size: 22px; line-height: 1; color: var(--muted);
  position: absolute; right: 16px; top: 12px;
}
.modal-footer{ display:flex; justify-content:flex-end; gap: 8px; margin-top: 16px; }
.modal-body textarea{
  width: 100%; min-height: 120px; padding: 12px;
  border:1px solid #ccc; border-radius:8px; resize: vertical;
}

/* -----------------------------
   History
----------------------------- */
.history-box{
  background:#fff; border-radius: var(--radius); box-shadow: var(--shadow-sm);
  padding: 20px; margin-top: 20px;
}
.history-item{
  padding-bottom: 15px; margin-bottom: 15px; border-bottom: 1px solid #eee;
}
.history-item:last-child{ border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.history-item strong{ color: var(--brand); }
.history-item em{ color: var(--muted); }

/* -----------------------------
   Wizard
----------------------------- */
.wizard-container{
  position: fixed; inset: 0; z-index: 1400;
  display: grid; place-items: center; padding: 16px;
  background: rgba(0,0,0,.4);
}
.wizard-box{
  width: 100%; max-width: 320px; background: #fff; border: 2px solid var(--silver);
  border-radius: var(--radius); box-shadow: var(--shadow-md);
  padding: 20px; text-align: center;
}
.wizard-controls{ display:flex; justify-content:space-between; gap: 10px; margin-top: 12px; }
.wizard-footer{ margin-top: 8px; }
.wizard-button{
  background: var(--ink); color:#fff; border:0; border-radius:8px; padding: 8px 14px; cursor:pointer;
}
.wizard-button:hover{ background:#4d4d4d; }

/* -----------------------------
   Timestamps & small text
----------------------------- */
.timestamp{ font-size: .85rem; color: var(--muted); margin-left: 8px; }

/* -----------------------------
   Utilities
----------------------------- */
.hidden{ display:none !important; }
.center{ text-align:center !important; }
.mt-1{ margin-top: 4px; } .mt-2{ margin-top: 8px; } .mt-3{ margin-top: 12px; } .mt-4{ margin-top: 16px; }
.mb-1{ margin-bottom: 4px; } .mb-2{ margin-bottom: 8px; } .mb-3{ margin-bottom: 12px; } .mb-4{ margin-bottom: 16px; }

/* -----------------------------
   Spinner
----------------------------- */
.loading-spinner{
  display: none; width: 40px; height: 40px; margin-top: 16px;
  border: 4px solid var(--silver); border-top-color: transparent; border-radius: 50%;
  animation: spin 1s linear infinite;
}
.loading-spinner.active{ display: inline-block; }
@keyframes spin{
  to{ transform: rotate(360deg); }
}

/* -----------------------------
   Quick Access / Links in footer
----------------------------- */
footer a{ color: #4d4d4d; }
footer a:hover{ text-decoration: underline; }
/* =========================================
   /* --- Header nav link states: force site colors & no underline --- */
header a,
header a:link,
header a:visited,
header nav .nav-links li a,
header nav .nav-links li a:link,
header nav .nav-links li a:visited{
  color: var(--ink) !important;
  text-decoration: none !important;
}

header nav .nav-links li a:hover,
header nav .nav-links li a:focus{
  color: var(--ink) !important;
  text-decoration: none !important;
  background: rgba(0,0,0,.06);
}

header nav .nav-links li a:active{
  color: var(--ink) !important;
  text-decoration: none !important;
}


/* -----------------------------
   Category Toggle list (Blog)
----------------------------- */
#category-list{ margin-top: 8px; }
#category-list li + li{ margin-top: 6px; }
#category-toggle{ color: var(--brand); cursor: pointer; }
#category-toggle:hover{ color: var(--brand-2); text-decoration: underline; }
/* ======================================================================
   LifeCompass – Unified Card Layout & Page Styling
   Add at the END of /styles/style.css
   ====================================================================== */

/* ----- Page Containers ----- */
.page-section {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 30px 24px;
  margin: 30px auto;
  max-width: 960px;
}

/* Headings for page sections */
.page-section h1,
.page-section h2 {
  font-weight: 700;
  margin-top: 0;
  margin-bottom: 12px;
  color: var(--ink);
}

/* Optional subtle intro text */
.page-section p.intro {
  font-size: 1.1rem;
  color: var(--ink-2);
  margin-bottom: 24px;
}

/* ----- Form Improvements ----- */
.page-section .input-field,
.page-section select,
.page-section textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 1rem;
  margin-bottom: 16px;
  transition: border-color .2s ease;
}
.page-section .input-field:focus,
.page-section select:focus,
.page-section textarea:focus {
  border-color: var(--brand);
  outline: none;
}

/* Buttons inside these sections */
.page-section .btn-primary {
  width: auto;
  padding: 10px 22px;
  font-size: 1rem;
}

/* ----- Lists of items (studies or conversations) ----- */
.card-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-top: 24px;
}

.card-item {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  transition: box-shadow .2s ease, transform .2s ease;
}
.card-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.card-item h3 {
  margin-top: 0;
  margin-bottom: 8px;
  font-size: 1.1rem;
}
.card-item .meta {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 12px;
}

/* ----- Conversation specific tweaks ----- */
.conversation-container {
  gap: 24px;
}
.conversation-history {
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  padding: 20px;
}
.conversation-box {
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  background: var(--surface);
}

/* Restore 3-column responsive grid for dashboard cards */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  margin-top: 24px;
}
/* --- Dashboard Hero with Overlay --- */
/* Faint background image layer */
/* Make the hero a positioning context so ::before stays inside it */
.dashboard .welcome {
  position: relative;     /* <-- key fix */
  background: none;       /* let the image show through */
  overflow: hidden;       /* clip blurred edges inside the rounded card */
  border-radius: var(--radius);
  /* keep your existing padding/box-shadow if you had them */
}

.dashboard .welcome::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url('/uploads/your-bible.jpg') center/cover no-repeat;
  opacity: 0.15;                  /* << lower = lighter image */
  filter: blur(1px);              /* optional soft blur */
  border-radius: var(--radius);
  z-index: 0;                     /* keep behind text */
}

/* Keep text above the image */
.dashboard .welcome h1,
.dashboard .welcome p {
  position: relative;
  z-index: 1;
}
/* -------------------------------------------------
   Dashboard Grid – force 3 columns on large screens
   ------------------------------------------------- */

/* Default: single column on narrow phones */
.dashboard-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: 1fr;
}

/* Medium screens (tablet / small laptop): 2 columns */
@media (min-width: 768px) {
  .dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Large screens / desktop: full 3-column layout */
@media (min-width: 1200px) {
  .dashboard-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Optional: let the container breathe so 3 columns fit */
@media (min-width: 1200px) {
  .container.dashboard {
    max-width: 1400px;     /* give a bit more room */
    padding-inline: 40px;  /* balanced side gutters */
  }
}
/* =========================================================
   Conversation Screen — Unified (desktop two-pane / mobile stack)
   ========================================================= */

/* Page width on this screen */
.page-conversation { max-width: 1200px; }
@media (min-width: 1024px){ .page-conversation { padding-inline: 40px; } }

/* Layout grid */
.conversation-container{
  display: grid;
  gap: 24px;
}
@media (min-width: 1024px){
  .conversation-container{
    grid-template-columns: minmax(300px, 360px) 1fr; /* sidebar | main */
    align-items: start;
  }
}

/* ----- Sidebar (history) ----- */
.conversation-history{
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 16px;
  max-height: calc(100vh - 200px);
  overflow: auto;
}

.conversation-history h3{
  margin: 0 0 10px;
  font-size: 1.05rem;
}

.new-conversation-link{
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%;
  font-size: 22px; font-weight: 700; color: #fff;
  background: var(--ink); text-decoration: none;
  margin: 8px 0 12px;
  transition: transform .15s ease, background .2s ease;
}
.new-conversation-link:hover{ background:#4d4d4d; transform: translateY(-1px); }

.conversation-history ul{ list-style: none; margin: 0; padding: 0; }
.conversation-history li{
  display: grid;
  grid-template-columns: 1fr auto auto; /* title | edit | delete */
  align-items: center;
  gap: 8px;
  padding: 8px 6px;
  border-radius: 8px;
}
.conversation-history li + li{ margin-top: 4px; }
.conversation-history li:hover{ background: rgba(0,0,0,.04); }
.conversation-history li.active{ background: #eaf6f6; outline: 1px solid rgba(0,0,0,.05); }

.conversation-history li a{
  color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.conversation-history .timestamp{
  grid-column: 1 / -1; margin-left: 0;
  font-size: .8rem; color: var(--muted);
}

/* Hide action buttons until hover (desktop only) */
@media (min-width: 1024px){
  .conversation-history .delete-button,
  .conversation-history .edit-button{ opacity: 0; pointer-events: none; transition: opacity .15s ease; }
  .conversation-history li:hover .delete-button,
  .conversation-history li:hover .edit-button{ opacity: 1; pointer-events: auto; }
}

/* ----- Right pane (conversation) ----- */
.conversation-box{
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 18px;
  min-height: calc(100vh - 220px);
  display: grid;
  grid-template-rows: auto auto 1fr; /* header | form | messages */
  gap: 14px;
}

/* Composer */
#conversationForm textarea{
  width: 100%;
  min-height: 110px;
  max-height: 40vh;
  resize: vertical;
  padding: 12px 14px;
  border: 1px solid #ccc;
  border-radius: 8px;
}
#conversationForm button{
  margin-top: 8px;
  width: 100%;
  padding: 12px 14px;
  background: var(--ink);
  color:#fff; border:0; border-radius:8px;
  font-size:16px; cursor:pointer; transition: background .2s ease, opacity .2s ease;
}
#conversationForm button:hover{ background:#4d4d4d; }
#conversationForm button:disabled{ opacity: .6; cursor:not-allowed; }

/* Messages area */
#response{
  overflow: auto;
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 12px;
  background: #fafafa;
}
#response > div{
  background: #fff;
  border: 1px solid #eee;
  border-radius: 10px;
  padding: 10px 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
}
#response > div + div{ margin-top: 10px; }
#response strong{ color: var(--brand); }

/* Edit modal tidy */
#editModal .modal-content{
  width: min(90%, 520px);
  border-radius: var(--radius);
}

/* ----- Mobile tweaks ----- */
@media (max-width: 1023px){
  .conversation-history{ max-height: none; }
  .conversation-box{ min-height: auto; }
}
/* === Conversation page fix: keep sidebar readable & tame gutters === */

/* 1) Narrow the giant container gutters ONLY on the conversation page */
@media (min-width: 1024px){
  .container.page-conversation {               /* matches <div class="container page-conversation"> */
    padding-inline: 40px !important;           /* override the global 200px */
    max-width: 1200px;                         /* enough room for two panes */
  }
}

/* 2) Solid two-pane grid with responsive, but never tiny, sidebar */
@media (min-width: 1024px){
  .conversation-container{
    display: grid;
    grid-template-columns: clamp(280px, 28vw, 360px) 1fr;  /* sidebar | main */
    gap: 24px;
    align-items: start;
  }
  .conversation-history{
    min-width: 280px;                           /* stop the skinny strip */
    max-height: calc(100vh - 220px);
    overflow-y: auto;
    overflow-x: hidden;
  }
  .conversation-box{
    min-height: calc(100vh - 220px);
  }
}

/* 3) List rows: keep title flexible, actions compact, no accidental shrink */
.conversation-history ul { list-style: none; margin: 0; padding: 0; }
.conversation-history li{
  display: grid;
  grid-template-columns: 1fr auto auto;        /* title | edit | delete */
  align-items: center;
  gap: 8px;
  padding: 8px 6px;
  border-radius: 8px;
  overflow: hidden;                             /* no horiz scrollbars */
}
.conversation-history li a{
  min-width: 0;                                 /* allow ellipsis */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.conversation-history .timestamp{
  grid-column: 1 / -1;
  font-size: .82rem;
  color: var(--muted);
  margin-left: 0;
}

/* Optional: hide action buttons until hover on desktop */
@media (min-width: 1024px){
  .conversation-history .delete-button,
  .conversation-history .edit-button{ opacity: 0; pointer-events: none; transition: opacity .15s ease; }
  .conversation-history li:hover .delete-button,
  .conversation-history li:hover .edit-button{ opacity: 1; pointer-events: auto; }
}
/* === Conversation titles: show full text (no ellipsis) === */
.conversation-history li{
  align-items: start;               /* let row grow as title wraps */
  padding: 10px 12px;
}

.conversation-history li a{
  display: block;                   /* own line */
  font-weight: 600;
  line-height: 1.3;
  white-space: normal !important;   /* wrap instead of single-line */
  overflow: visible !important;     /* don't clip */
  text-overflow: initial !important;
  min-width: auto !important;       /* undo min-width:0 from earlier */
}

.conversation-history .timestamp{
  grid-column: 1 / -1;              /* full width on new line */
  margin-top: 6px;
}

/* Optional: give the active item a subtle card look */
.conversation-history li.active {
  background: #eaf6f6;
  border-radius: 10px;
}
/* ===== Bible Studies – legacy CRUD list to modern cards ===== */

.existing-studies { margin-top: 24px; }

/* Make the list a responsive grid */
.bible-studies-list{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
  margin-top: 12px;
}

/* Each study becomes a card */
.bible-study-item{
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  /* kill any inherited grey strips */
  border: none;
}

/* Title + theme */
.bible-study-info .bible-study-title{
  display: block;
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 6px;
  color: var(--ink);
}
.bible-study-info .bible-study-theme{
  color: var(--muted);
  font-size: .95rem;
}

/* Actions row (View | Change | Delete) */
.bible-study-actions{
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: auto; /* push actions to bottom of card */
}

.bible-study-actions a,
.bible-study-actions button{
  appearance: none;
  border: 1px solid #e5e5e5;
  background: #f7f7f7;
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 12px;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s ease, border-color .15s ease;
}
.bible-study-actions a:hover,
.bible-study-actions button:hover{
  background: #efefef;
  border-color: #ddd;
}

/* Emphasize destructive action */
.bible-study-actions .btn-delete{
  background: #fff5f5;
  color: #b23b3b;
  border-color: #f2c7c7;
}
.bible-study-actions .btn-delete:hover{
  background: #ffecec;
}

/* Keep inline delete form from breaking the row */
.bible-study-actions form{ display: inline; }

/* Tighten heading spacing inside this section */
.existing-studies h2{ margin-bottom: 10px; }
/* ===============================
   Bible Studies – Carded CRUD list
   Targets the markup you shared:
   .studies-grid > .study-card
   =============================== */

.page-section .studies-grid{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 16px;
}

.page-section .study-card{
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 18px;
  display: flex;
  flex-direction: column;
  min-height: 180px;
  transition: transform .15s ease, box-shadow .2s ease;
}
.page-section .study-card:hover{
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.page-section .study-card header{ margin-bottom: 10px; }
.page-section .study-card .title{
  margin: 0 0 6px 0;
  font-size: 1.2rem;
  line-height: 1.25;
  color: var(--ink);
}
.page-section .study-card .meta{
  color: var(--muted);
  font-size: .95rem;
}

/* Action row */
.page-section .study-card .actions{
  margin-top: auto;                 /* pins actions to the bottom */
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

/* Keep the delete form inline with the links */
.page-section .study-card .actions form{
  display: inline;
}

/* Chip-style buttons for View / Change / Delete */
.page-section .btn-chip{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 9999px;
  border: 1px solid #e6e6e6;
  background: #f7f7f7;
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .05s ease;
}
.page-section .btn-chip:hover{
  background: #f0f0f0;
  border-color: #dddddd;
  transform: translateY(-1px);
}

/* Destructive button */
.page-section .btn-chip.danger{
  background: #fff3f3;
  border-color: #f5c2c2;
  color: #a12424;
}
.page-section .btn-chip.danger:hover{
  background: #ffe9e9;
  border-color: #eeaaaa;
}

/* Small screens: single column with comfy touch targets */
@media (max-width: 480px){
  .page-section .studies-grid{
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .page-section .btn-chip{ padding: 10px 14px; }
}
/* --- Bible Studies CRUD list: neutralize global header/footer rules --- */
.page-section .study-card header,
.page-section .study-card footer {
  /* kill the site-wide header/footer styling */
  background: transparent !important;
  padding: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  color: inherit !important;
  display: block !important;       /* ensure normal block flow */
}

/* Title + meta layout & readability */
.page-section .study-card .title {
  margin: 0 0 6px 0;
  font-size: 1.2rem;
  line-height: 1.3;
  white-space: normal;             /* allow normal wrapping */
  word-break: normal;
}

.page-section .study-card .meta {
  color: var(--muted);
  font-size: .95rem;
  margin-bottom: 10px;
}

/* Actions row: inline, tidy */
.page-section .study-card .actions {
  margin-top: auto;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.page-section .study-card .actions form { display: inline; }

/* Ensure the grid behaves (in case earlier rules collided) */
.page-section .studies-grid{
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)) !important;
  gap: 20px !important;
  margin-top: 16px !important;
}
/* ==========================
   Profile page styling
   ========================== */
.profile-container { max-width: 1000px; }

.flash { margin: 10px 0 16px; font-weight: 600; }
.flash.ok { color: #2e7d32; }
.flash.err { color: #c62828; }

/* Card wrapper for each form */
.profile-card{
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  margin: 18px 0;
}

/* Grid form */
.profile-form{
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.profile-form label{ font-weight: 700; }
.profile-form .input-field{
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 1rem;
}
.profile-form .wide{ grid-column: 1 / -1; }

/* Radios */
.gender-selection{
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

/* Make the main button consistent */
.profile-card .btn-primary{ width: 100%; }
@media (min-width: 768px){
  .profile-form{
    grid-template-columns: 1fr 1fr;
    gap: 14px 16px;
  }
  .profile-card .btn-primary.wide{ justify-self: end; width: auto; padding-inline: 22px; }
}

/* Picture block */
.profile-form.media{
  grid-template-columns: 140px 1fr;
  align-items: start;
}
.media-preview{
  display: grid; place-items: center;
}
.profile-picture{
  width: 120px; height: 120px; object-fit: cover;
  border-radius: 50%;
  border: 3px solid rgba(0,0,0,.06);
  box-shadow: var(--shadow-sm);
  background: #fff;
}
.media-controls{ display: grid; gap: 10px; }
@media (max-width: 520px){
  .profile-form.media{ grid-template-columns: 1fr; }
  .profile-picture{ margin: 0 auto 8px; }
}
/* === Auth: Remember me alignment (REPLACE) === */
.remember-row{
  display: flex;               /* force a single horizontal row */
  align-items: center;         /* vertical centering */
  justify-content: flex-start; /* keep the pair left-aligned */
  gap: .5rem;
  margin: .5rem 0 1rem;
  width: 100%;
  text-align: left;            /* neutralize parent text-align:center */
}

/* override any global form rules that center checkboxes */
.remember-row input[type="checkbox"]{
  display: inline-block !important;
  margin: 0 .5rem 0 0 !important;   /* no auto-centering */
  vertical-align: middle;
}

.remember-row label{
  display: inline-flex;
  align-items: center;
  margin: 0;
  white-space: nowrap;
  line-height: 1.2;
}

/* extra safeguard if the parent box is centered */
.login-box .remember-row{ text-align: left; }



/* Small link at bottom */
.profile-footer-link{ margin-top: 8px; }
.profile-footer-link a{ color: var(--brand); font-weight: 700; }
.profile-footer-link a:hover{ color: var(--brand-2); text-decoration: underline; }
/* === Conversation: mobile-first UX (updated for desktop/tablet) === */

/* Phones: composer first, history collapsed, toggle visible */
@media (max-width: 767px){
  .conversation-container{
    display: flex;
    flex-direction: column;
    gap: 16px;
  }
  .conversation-box{ order: 1; }
  .conversation-history{ order: 2; }

  /* Mobile toggle */
  .history-toggle{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid #ddd;
    background: #fff;
    font-weight: 700;
  }
  .history-toggle[aria-expanded="true"]::after{ content: " ▲"; }
  .history-toggle[aria-expanded="false"]::after{ content: " ▼"; }

  /* History hidden by default on phones */
  .conversation-history{ display: none; }
  .conversation-history.is-open{ display: block; }

  /* Sticky action row inside composer */
  .conversation-box .create-study-button-container{
    position: sticky;
    top: 0;
    background: var(--surface);
    padding-top: 6px;
    z-index: 5;
  }

  /* Optional floating new button */
  .fab-new{
    position: fixed;
    right: 16px;
    bottom: 16px;
    width: 54px; height: 54px;
    border-radius: 50%;
    display: grid; place-items: center;
    background: var(--ink);
    color: #fff;
    font-size: 26px;
    box-shadow: var(--shadow-md);
    text-decoration: none;
  }
}

/* Tablet & Desktop (≥768px): hide toggle, force two-pane grid, show history */
@media (min-width: 768px){
  .history-toggle{ display: none !important; }
  .conversation-container{
    display: grid;
    grid-template-columns: clamp(280px, 28vw, 360px) 1fr;  /* sidebar | main */
    gap: 24px;
    align-items: start;
  }
  .conversation-history{
    display: block !important;             /* ensure visible */
    max-height: calc(100vh - 220px);
    overflow-y: auto;
    overflow-x: hidden;
  }
}
/* =========================================
   HEADER NAV – SCOPED STYLES (SAFE OVERRIDE)
   ========================================= */
header { position: relative; z-index: 100; }

/* Ensure header links use site colors, not browser defaults */
header a,
header nav a {
  color: var(--ink);
  text-decoration: none;
}

/* Desktop header navigation (CENTERED) */
header nav{
  position: relative;
  z-index: 1000;
  flex: 1;                     /* allow nav to take center space */
  display: flex;               /* so we can center the UL */
}
header nav .nav-links{
  list-style: none;
  margin: 0 auto;              /* center the UL within the header */
  padding: 0;
  display: flex;
  gap: 20px;
  justify-content: center;     /* center the links */
  align-items: center;
}
header nav .nav-links li a{
  display: inline-block;
  padding: 10px 14px;
  border-radius: 8px;
  font-weight: 600;            /* bolder text */
  transition: background .2s ease, color .2s ease;
}
header nav .nav-links li a:hover{
  background: rgba(0,0,0,.06);
}

/* Hamburger icon only affects header */
header .hamburger-icon{
  display: none;
  position: absolute;
  left: 20px;
  top: 22px;
  z-index: 1001;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
}
header .hamburger-icon span{
  width: 26px;
  height: 3px;
  background: var(--ink);
  transition: transform .25s ease, opacity .25s ease;
}

/* Mobile menu panel (scoped to header nav only) */
@media (max-width: 1024px){
  header .hamburger-icon{ display: flex; }
  header nav{ flex: 0 0 auto; }            /* prevent odd stretching on mobile */
  header nav .nav-links{
    display: none;
    position: fixed;
    top: 80px;
    left: 10px;
    right: 10px;
    background: var(--silver);
    padding: 10px;
    border-radius: var(--radius);
    flex-direction: column;
    gap: 0;
    box-shadow: var(--shadow-md);
    justify-content: flex-start;           /* drawer list aligns left */
    margin: 0;                             /* override the desktop centering */
  }
  header nav .nav-links.active{ display: flex; }
  header nav .nav-links li{
    border-bottom: 1px solid rgba(0,0,0,.08);
  }
  header nav .nav-links li:last-child{ border-bottom: 0; }
  header nav .nav-links li a{
    width: 100%;
    text-align: left;
  }
}


/* 3) If any global .row/.col or flex tries to split columns, force full width */
@media (max-width: 992px){
  .blog-layout .row,
  .blog-layout [class*="col-"]{
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
  }
}

/* 4) Guard rails: ensure cards/images don’t shrink weirdly */
@media (max-width: 992px){
  .post-preview-card,
  .post-full-content{
    width: 100%;
  }
  .post-preview-image,
  .post-featured-image{
    width: 100%;
    height: auto;
    object-fit: cover;
  }
}

/* 5) Optional: slightly tighten gaps so mobile feels intentional */
@media (max-width: 576px){
  .post-preview-content{ padding: 1rem !important; }
  .blog-page-title{ margin: 1rem 0 .5rem; font-size: 1.9rem; }
}
/* ==== BLOG: FORCE SINGLE COLUMN ON SMALL SCREENS ==== */
@media (max-width: 992px){

  /* 1) Make the blog layout a simple vertical stack */
  .blog-layout{
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 1.25rem !important;          /* smaller, sane spacing */
  }

  /* 2) Kill any floats, fixed widths, or flex-basis coming from globals */
  .blog-layout > *{
    float: none !important;
    position: static !important;
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 auto !important;
  }
  .blog-main,
  .blog-sidebar{
    margin: 0 !important;
    padding: 0 !important;
  }

  /* 3) Neutralize framework grid classes inside the blog (Bootstrap/Tailwind/etc.) */
  .blog-layout [class^="col"],
  .blog-layout [class*=" col"],
  .blog-layout .row{
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* 4) Container must not constrain width */
  .blog-container{
    width: 100% !important;
    max-width: none !important;
    margin: 0 auto !important;
    padding: 0 12px !important;
  }

  /* 5) Cards & media shouldn’t shrink oddly */
  .post-preview-card,
  .post-full-content{ width: 100% !important; }
  .post-preview-image,
  .post-featured-image{ width: 100% !important; height: auto !important; object-fit: cover; }
}

/* Optional: tighten tiny-phone spacing */
@media (max-width: 576px){
  .post-preview-content{ padding: 1rem !important; }
  .blog-page-title{ margin: 1rem 0 .5rem; font-size: 1.9rem; }
}
/* ============================================================
   BLOG LAYOUT – FINAL RESPONSIVE OVERRIDES (SAFE, SCOPED)
   Ensures full-width stack on small screens; robust desktop grid.
   ============================================================ */

/* Desktop/tablet: two-column grid with flexible main area */
.blog-layout{
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 320px !important; /* main grows, sidebar fixed */
  gap: 24px !important;
  align-items: start !important;
}

/* Critical: allow grid children to shrink so columns don't crush */
.blog-main,
.blog-sidebar{
  min-width: 0 !important;
}

/* Do not allow sidebar contents to force overflow */
.blog-sidebar,
.blog-sidebar *{
  max-width: 100% !important;
  overflow-wrap: anywhere !important;
}

/* Container comfort */
.blog-container{
  width: 100% !important;
  max-width: 1200px !important;
  padding-left: 12px !important;
  padding-right: 12px !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

/* Phones/tablets: stack — main first, then sidebar */
@media (max-width: 992px){
  .blog-layout{
    grid-template-columns: 1fr !important;
    grid-template-areas:
      "main"
      "sidebar" !important;
    gap: 16px !important;
  }
  .blog-main{ grid-area: main !important; }
  .blog-sidebar{
    grid-area: sidebar !important;
    width: 100% !important;
  }
}

/* Tiny phones: tighter paddings */
@media (max-width: 576px){
  .blog-container{ padding-left: 10px !important; padding-right: 10px !important; }
  .post-preview-content{ padding: 14px !important; }
}
/* ============================================================
   BLOG – MOBILE TOGGLE FOR CATEGORIES & SEARCH
   Shows a top toggle on small screens; sidebar panel collapses.
   ============================================================ */

/* Desktop: hide the toggle; show sidebar normally */
@media (min-width: 993px){
  .cat-toggle{ display: none !important; }
  #blog-sidebar-panel{ display: block !important; }
}

/* Mobile/tablet: show the toggle; collapse the sidebar by default */
@media (max-width: 992px){
  .cat-toggle{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid #ddd;
    background: #fff;
    font-weight: 800;
    letter-spacing: .2px;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
  }
  .cat-toggle:focus-visible{ outline: var(--focus); outline-offset: 2px; }

  /* collapsed by default; open with .is-open (toggled via JS) */
  #blog-sidebar-panel{ display: none; }
  #blog-sidebar-panel.is-open{ display: block; }

  /* panel spacing + containment */
  .blog-sidebar{
    width: 100%;
    background: transparent;
  }
  .blog-sidebar .sidebar-widget{
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
  }
}
/* === BLOG MOBILE ORDER: toggle → sidebar → main (force placement) === */
@media (max-width: 992px){
  .blog-layout{
    grid-template-areas:
      "toggle"
      "sidebar"
      "main" !important;
  }
  .cat-toggle{ grid-area: toggle !important; }
  .blog-sidebar{ grid-area: sidebar !important; }
  .blog-main{ grid-area: main !important; }
}
