/* =================================================================== */
/*                      [NEW] PRELOADER STYLES                         */
/* =================================================================== */
#preloader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  background-color: #fff; /* Match your site's background */
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease, visibility 0.5s ease;
  visibility: visible;
  opacity: 1;
}
#preloader.loaded {
  /* This class will be added by JS to hide the preloader */
  opacity: 0;
  visibility: hidden;
}
.spinner {
  width: 50px;
  height: 50px;
  border: 5px solid #f3f3f3; /* Light grey circle */
  border-top: 5px solid var(--accent-color); /* The moving part's color */
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}


:root {
  --primary-color: #2c3e50;
  --secondary-color: #34495e;
  --accent-color: #c0392b;
  --accent-color-light: rgba(192, 57, 43, 0.2);
  --giving-color: #27ae60;
  --giving-color-light: rgba(39, 174, 96, 0.15);
  --white: #ffffff;
  --light-gray: #f9f9f9;
  --text-color: #333;
}

/* Reset & Base */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 100%; scroll-behavior: smooth; }
body { font-family: 'Segoe UI', 'Roboto', sans-serif; line-height: 1.6; color: var(--text-color); background: var(--white); }
.container { width: min(95%, 1200px); margin: 0 auto; }
img { max-width: 100%; display: block; }
a { color: var(--accent-color); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4, h5, h6 { color: var(--primary-color); font-weight: 600; }
h2 { font-size: clamp(1.8rem, 4vw, 2.5rem); margin-bottom: 1rem; }
.bg-light { background: var(--light-gray); }
main { overflow-x: hidden; }

/* Top Bar */
.top-bar {
  background: var(--accent-color);
  color: var(--white);
  font-size: 0.9rem;
  padding: 0.5rem 0;
  /* [THE FIX] Add padding to the top to account for mobile device notches. */
  padding-top: calc(0.5rem + env(safe-area-inset-top));
}
.top-bar-inner { display: flex; justify-content: space-between; align-items: center; }
.top-bar a { color: var(--white); text-decoration: none; }
.contact-info a { margin-left: 1.5rem; } /* Keep margin for email only */
.top-bar a:hover { color: #ddd; }
.top-bar i { margin-right: 0.5rem; }

/* [MODIFIED] Use flexbox for alignment and gap for spacing */
.social-links {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}
.social-links a {
  font-size: 1.1rem;
  line-height: 1.2; /* Ensures icons are aligned */
}

/* [MODIFIED] Style for the "Watch Live" button in the top bar */
.top-bar .btn-live {
  padding: 0.3rem 1rem; /* Adjusted padding for correct height */
  border: 1px solid rgba(255,255,255,0.8);
  border-radius: 50px;
  color: var(--white);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem; /* Match top bar font size */
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}
.top-bar .btn-live:hover {
  background: var(--white);
  color: var(--accent-color);
  text-decoration: none;
}

/* Navbar */
.navbar { background: var(--white); box-shadow: 0 2px 5px rgba(0,0,0,0.05); padding: 0.5rem 0; transition: all 0.3s ease-in-out; }
.navbar.sticky { position: fixed; top: 0; left: 0; width: 100%; z-index: 1000; box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.nav-inner { display: flex; justify-content: space-between; align-items: center; }
.logo img { height: 50px; transition: height 0.3s ease-in-out; }
.navbar.sticky .logo img { height: 40px; }
.nav-menu { list-style: none; display: flex; flex-wrap: wrap; gap: 1rem 2rem; align-items: center; justify-content: center; }

/* Styles for REGULAR navigation links */
.nav-menu li:not(.nav-item-cta):not(.nav-item-give) a {
  text-decoration: none;
  color: #333;
  font-weight: 500;
  padding: 0.5rem;
  position: relative;
}
.nav-menu li:not(.nav-item-cta):not(.nav-item-give) a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent-color);
  transition: width 0.3s ease;
}
.nav-menu li:not(.nav-item-cta):not(.nav-item-give) a:hover::after {
  width: 100%;
}

/* Style for the Online Giving link */
.nav-item-give a {
  background-color: var(--giving-color-light);
  color: var(--giving-color);
  border-radius: 50px;
  padding: 0.5rem 1rem;
  font-weight: 600;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.giving-logo-icon {
  height: 30px;
  width: auto;
}
.nav-item-give a:hover {
  background-color: var(--giving-color);
  color: var(--white);
  text-decoration: none;
}

/* Style for the "I'm New Here" button's list item on DESKTOP */
.nav-item-cta {
  margin-left: 0rem;
}
.nav-item-cta a:hover {
  text-decoration: none;
}

/* Buttons */
.btn { display: inline-block; padding: 0.75rem 1.75rem; border: 2px solid transparent; border-radius: 50px; cursor: pointer; text-decoration: none; font-weight: 600; transition: all 0.3s ease; }
.btn-primary   { background: var(--accent-color); color: var(--white); border-color: var(--accent-color); }
.btn-primary:hover { background: #a93226; border-color: #a93226; color: var(--white); text-decoration: none; }
.btn-secondary { background: transparent; color: var(--white); border-color: var(--white); }
.btn-secondary:hover { background: var(--white); color: var(--primary-color); text-decoration: none; }

/* Footer */
.site-footer { background: var(--secondary-color); color: var(--white); padding: 3rem 0; }
.footer-grid { display: grid; gap: 2rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.footer-logo { max-height: 60px; margin-bottom: 1rem; }
.site-footer h4 { color: var(--white); margin-bottom: 1rem; border-bottom: 1px solid var(--accent-color); padding-bottom: 0.5rem; }
.site-footer p { font-size: 0.9rem; color: #ccc; }
.site-footer a { color: #ccc; }
.site-footer a:hover { color: var(--white); text-decoration: none; }
.footer-links ul { list-style: none; }
.footer-links li { margin-bottom: 0.5rem; }


/* =================================================================== */
/*                     RESPONSIVE STYLES (FINAL)                       */
/* =================================================================== */

.nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--primary-color);
  cursor: pointer;
}

@media (max-width: 850px) {
  /* -- Top Bar -- */
  .top-bar {
    font-size: 0.8rem;
    padding: 0.75rem 1rem;
    text-align: center;
    /* [THE FIX] Apply the safe-area fix for the mobile padding value. */
    padding-top: calc(0.75rem + env(safe-area-inset-top));
  }
  .top-bar-inner { flex-direction: column; gap: 0.75rem; }
  .contact-info { display: flex; flex-direction: column; gap: 0.3rem; align-items: center; }
  .contact-info a { margin-left: 0; }
  .social-links { gap: 0rem; justify-content: center; }
  .social-links a { margin: 0 0.75rem; }
  /* [THE FIX] Style the "Watch Live" button for mobile to prevent wrapping */
  .top-bar .btn-live {
    white-space: nowrap; /* Prevents the text from breaking into two lines */
    font-size: 0.8rem;   /* Match the rest of the top bar's mobile font size */
    padding: 0.4rem 0.8rem; /* Adjust padding for the smaller font */
  }
  
  /* -- Main Navbar -- */
  .nav-inner { height: 65px; align-items: center; }
  .logo img { height: 45px; }
  .navbar.sticky .logo img { height: 40px; }
  
  /* -- Hamburger Button -- */
  .nav-toggle {
    display: block;
    position: relative;
    z-index: 1100;
  }
  
  /* -- Body State when Menu is Open -- */
  body.nav-open {
    overflow: hidden;
  }
  body.nav-open .nav-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
  }

  /* -- Slide-out Menu Container -- */
  .nav-menu {
    display: none; /* Hide by default */
    position: fixed;
    top: 0;
    right: -100%;
    width: min(80%, 320px);
    height: 100vh;
    background: var(--white);
    padding: 6rem 2rem 2rem 2rem;
    box-shadow: -5px 0 15px rgba(0,0,0,0.1);
    transition: right 0.4s ease-in-out;
    z-index: 1050;
    overflow-y: auto;
    gap: 0; /* Reset desktop gap */
  }
  
  /* [THE FIX] - When active, display as a block element. */
  .nav-menu.active {
    display: block;
    right: 0;
  }
  
  /* [THE FIX] - Force all list items to be block-level and stack vertically. */
  .nav-menu li {
    display: block;
    width: 100%;
    margin-bottom: 1.5rem; /* Add vertical spacing */
  }

  /* Style all links inside the mobile menu */
  .nav-menu li a {
    font-size: 1.2rem;
    padding: 0.25rem 0; /* Add a little vertical padding */
    width: 100%;
    display: block;
    text-decoration: none;
  }
  
  /* Remove hover underline */
  .nav-menu li a::after {
    display: none !important;
  }

  /* -- "Online Giving" Button in Mobile Menu -- */
  .nav-item-give { margin-left: 0; }
  .nav-menu .nav-item-give a {
    display: flex;
    justify-content: center;
    padding: 0.75rem 1rem;
  }

  /* -- "I'm New Here" Button in Mobile Menu -- */
  .nav-item-cta { 
    margin-top: 1rem; 
    margin-left: 0;
    margin-bottom: 0;
  }
  .nav-menu .nav-item-cta a.btn {
    width: 100%;
    text-align: center;
    padding: 0.85rem 1rem;
    font-size: 1.1rem;
    color: var(--white);
  }
}

/* =================================================================== */
/*                  [MOVED & CORRECTED] VIDEO MODAL STYLES             */
/* =================================================================== */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.modal.active {
  pointer-events: auto;
  opacity: 1;
}
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  cursor: pointer;
}
.modal-content {
  position: relative;
  z-index: 2001;
  background: #000;
  border-radius: 0.5rem;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  width: min(90%, 900px);
  transform: scale(0.9);
  transition: transform 0.3s ease;
}
.modal.active .modal-content {
  transform: scale(1);
}
.modal-close {
  position: absolute;
  top: -40px;
  right: 0;
  background: transparent;
  border: none;
  color: var(--white);
  font-size: 2.5rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.2s;
}
.modal-close:hover {
  opacity: 1;
}
.video-wrapper {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  height: 0;
  overflow: hidden;
  border-radius: 0.5rem; /* Match the content container */
}
.video-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* =================================================================== */
/*                      FLASH MESSAGE STYLES                           */
/* =================================================================== */

.flash-messages-container {
  /* This container sits in the normal document flow below the nav */
  padding: 1rem 0;
  width: min(95%, 1200px); /* Match the main .container width */
  margin: 0 auto;
}

.flash-message {
  margin-bottom: 1rem;
  padding: 1rem 2.5rem 1rem 1.5rem; /* Extra right padding for the close button */
  border-left: 5px solid #333;
  border-radius: 0.5rem;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  color: var(--white);
  font-weight: 500;
}

.flash-messages-container .flash-message:last-child {
  margin-bottom: 0;
}

/* Success (e.g., Form submitted) */
.flash-success {
  background-color: #27ae60; /* Using giving-color from your theme */
  border-color: #229954;
}

/* Error (e.g., Form validation failed) */
.flash-error {
  background-color: var(--accent-color);
  border-color: #a93226; 
}

/* Info / Default */
.flash-info {
  background-color: #3498db;
  border-color: #2980b9;
}

.flash-message .close-flash {
  position: absolute;
  top: 50%;
  right: 1rem;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  font-size: 1.5rem;
  font-weight: bold;
  line-height: 1;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  padding: 0;
  text-shadow: none;
  transition: color 0.2s ease;
}

.flash-message .close-flash:hover {
  color: var(--white);
}

/* -- Dynamic-Island / notch background ---------------------------------- */
html   { background-color: var(--accent-color); }  /* red behind the notch */
body   { background-color: var(--white); }         /* keeps the page white */