/* Custom CSS for Baraka Community Centre */

:root {
  --primary-color: #007a33;
  --primary-dark: #005a26;
  --primary-light: #00a344;
  --brown-accent: #8b4513;
  --brown-light: #d2b48c;
  --white: #ffffff;
  --light-gray: #f8f9fa;
  --dark-gray: #6c757d;
  --text-dark: #212529;
}

/* Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Poppins", sans-serif;
  line-height: 1.6;
  color: var(--text-dark);
  padding-top: 0px; /* Account for fixed top bar (40px) and navbar */
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 1rem;
}

.display-4,
.display-5 {
  font-weight: 700;
}

p {
  margin-bottom: 1rem;
  line-height: 1.6;
}

.lead {
  font-size: 1.1rem;
  font-weight: 400;
}

/* Custom Colors */
.text-primary {
  color: var(--primary-color) !important;
}

.bg-primary {
  background-color: var(--primary-color) !important;
}

.btn-primary {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  font-weight: 500;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  transition: all 0.3s ease;
}

.btn-primary:hover {
  background-color: var(--primary-dark);
  border-color: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 122, 51, 0.3);
}

.btn-outline-primary {
  color: var(--primary-color);
  border-color: var(--primary-color);
  font-weight: 500;
}

.btn-outline-primary:hover {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}

/* Navigation */
.navbar {
  padding: 1rem 0;
  transition: all 0.3s ease;
}

.navbar.fixed-top {
  top: 40px; /* Position below top bar */
}

/* Added scrolled navbar styles */
.navbar.scrolled {
  background-color: rgba(255, 255, 255, 0.95) !important;
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
}

.navbar-brand {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color) !important;
}

.navbar-nav .nav-link {
  font-weight: 500;
  color: var(--text-dark) !important;
  margin: 0 0.5rem;
  padding: 0.5rem 1rem !important;
  border-radius: 0.375rem;
  transition: all 0.3s ease;
}

.navbar-nav .nav-link:hover,
.navbar-nav .nav-link.active {
  color: var(--primary-color) !important;
  background-color: rgba(0, 122, 51, 0.1);
}

.dropdown-menu {
  border: none;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
  border-radius: 0.5rem;
}

.dropdown-item {
  padding: 0.75rem 1.5rem;
  font-weight: 500;
  transition: all 0.3s ease;
}

.dropdown-item:hover {
  background-color: rgba(0, 122, 51, 0.1);
  color: var(--primary-color);
}

/* Top Bar */
.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 40px;
  background: linear-gradient(90deg, var(--primary-color), var(--primary-dark));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1030; /* Above navbar */
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.scrolling-text {
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scrolling-text span {
  position: absolute;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  animation: fade-in-out 12s infinite ease-in-out;
  text-align: center;
}

.scrolling-text span:nth-child(1) { animation-delay: 0s; }
.scrolling-text span:nth-child(2) { animation-delay: 3s; }
.scrolling-text span:nth-child(3) { animation-delay: 6s; }
.scrolling-text span:nth-child(4) { animation-delay: 9s; }

@keyframes fade-in-out {
  0% { 
    opacity: 0; 
    transform: translateY(10px); 
  }
  8% { 
    opacity: 1; 
    transform: translateY(0); 
  }
  25% { 
    opacity: 1; 
    transform: translateY(0); 
  }
  33% { 
    opacity: 0; 
    transform: translateY(-10px); 
  }
  100% { 
    opacity: 0; 
    transform: translateY(-10px); 
  }
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .top-bar {
    height: 35px;
  }
  .scrolling-text span {
    font-size: 12px;
  }
  .navbar.fixed-top {
    top: 35px;
  }
  body {
    padding-top: 111px; /* 76 + 35 */
  }
}

/* Promotional Section */
.bg-white {
  background: #ffffff !important;
  position: relative;
}

.bg-white::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="subtle-pattern" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="50" cy="50" r="0.5" fill="rgba(0,122,51,0.03)"/><circle cx="20" cy="20" r="0.3" fill="rgba(0,122,51,0.02)"/><circle cx="80" cy="80" r="0.3" fill="rgba(0,122,51,0.02)"/></pattern></defs><rect width="100" height="100" fill="url(%23subtle-pattern)"/></svg>');
  opacity: 0.5;
  pointer-events: none;
}

.promo-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border: none;
  border-radius: 20px;
  padding: 2rem 1.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  opacity: 0;
  transform: translateY(50px);
  animation: slideUp 0.8s ease-out forwards;
}

.promo-card:hover {
  transform: translateY(-10px) scale(1.05);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.promo-card:hover .card-glow {
  opacity: 1;
  transform: scale(1.1);
}

.icon-wrapper {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  font-size: 2rem;
  color: white;
  box-shadow: 0 8px 25px rgba(0, 122, 51, 0.3);
  transition: all 0.3s ease;
}

.promo-card:hover .icon-wrapper {
  transform: scale(1.1) rotate(5deg);
  box-shadow: 0 12px 35px rgba(0, 122, 51, 0.4);
}

.card-title {
  color: var(--primary-color);
  font-weight: 700;
  margin-bottom: 1rem;
  font-size: 1.25rem;
}

.card-text {
  color: var(--text-dark);
  line-height: 1.6;
  font-size: 0.95rem;
}

.card-glow {
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(0, 122, 51, 0.04) 0%, transparent 70%);
  opacity: 0;
  transition: all 0.4s ease;
  pointer-events: none;
}

.promo-card-scroll:hover .card-glow {
  opacity: 1;
  transform: scale(1.1);
}

/* Horizontal Scrolling Container */
.promo-scroll-container {
  position: relative;
  width: 100%;
  overflow: hidden;
  padding: 2rem 0;
}

.promo-scroll-wrapper {
  display: flex;
  width: calc(58vw * 8); /* Adjusted for narrower cards with gaps */
  animation: scroll-right-to-left 80s linear infinite; /* Slower for better readability */
}

.promo-card-scroll {
  flex: 0 0 55vw; /* Narrower width like col-md-7 */
  margin-right: 3vw; /* Gap between cards */
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(15px);
  border: 2px solid rgba(0, 122, 51, 0.1);
  border-radius: 0; /* Remove border radius for full-width cards */
  padding: 1.5rem 2rem;
  position: relative;
  overflow: hidden;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.08), 0 5px 15px rgba(0, 122, 51, 0.06);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  min-height: 180px; /* Further reduced height */
}

.promo-card-scroll:hover {
  transform: translateY(-5px);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.12), 0 10px 25px rgba(0, 122, 51, 0.1);
  border-color: rgba(0, 122, 51, 0.2);
}

.promo-card-scroll .icon-wrapper {
  width: 90px;
  height: 90px;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  color: white;
  box-shadow: 0 8px 25px rgba(0, 122, 51, 0.3);
  transition: all 0.3s ease;
  flex-shrink: 0; /* Prevent shrinking */
}

.promo-card-scroll:hover .icon-wrapper {
  transform: scale(1.1) rotate(5deg);
  box-shadow: 0 12px 35px rgba(0, 122, 51, 0.4);
}

.promo-card-scroll .card-title {
  color: var(--primary-color);
  font-weight: 700;
  margin-bottom: 1rem;
  font-size: 1.4rem;
}

.promo-card-scroll .card-text {
  color: var(--text-dark);
  line-height: 1.6;
  font-size: 1rem;
  margin-bottom: 0;
}

@keyframes scroll-right-to-left {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(calc(-58vw * 4)); /* Move by 4 full card widths including gaps */
  }
}

/* Pause animation on hover for better readability */
.promo-scroll-container:hover .promo-scroll-wrapper {
  animation-play-state: paused;
}

.animate-fade-in {
  animation: fadeIn 1s ease-out;
}

.animate-fade-in-delay {
  animation: fadeIn 1s ease-out 0.3s both;
}

/* Floating Shapes */
.floating-shapes {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  pointer-events: none;
}

.shape {
  position: absolute;
  border-radius: 50%;
  background: rgba(0, 122, 51, 0.03);
  animation: float 8s ease-in-out infinite;
}

.shape-1 {
  width: 80px;
  height: 80px;
  top: 15%;
  left: 8%;
  animation-delay: 0s;
}

.shape-2 {
  width: 60px;
  height: 60px;
  top: 70%;
  right: 12%;
  animation-delay: 3s;
}

.shape-3 {
  width: 100px;
  height: 100px;
  bottom: 25%;
  left: 15%;
  animation-delay: 6s;
}

@keyframes float {
  0%, 100% {
    transform: translateY(0px) rotate(0deg);
  }
  50% {
    transform: translateY(-20px) rotate(180deg);
  }
}

/* Responsive adjustments for promo section */
@media (max-width: 768px) {
  .promo-scroll-container {
    padding: 1rem 0;
  }

  .promo-scroll-wrapper {
    width: calc(58vw * 8); /* Adjusted for mobile */
    animation-duration: 45s; /* Slightly faster on mobile */
  }

  .promo-card-scroll {
    flex: 0 0 55vw;
    margin-right: 3vw;
    padding: 1.5rem 1.5rem;
    border: 1px solid rgba(0, 122, 51, 0.08);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06), 0 3px 10px rgba(0, 122, 51, 0.04);
    min-height: 150px; /* Reduced height */
    display: flex;
    flex-direction: column; /* Stack on mobile */
    justify-content: center;
    align-items: center;
    text-align: center;
  }

  .promo-card-scroll:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.08), 0 5px 15px rgba(0, 122, 51, 0.06);
  }

  .promo-card-scroll .icon-wrapper {
    width: 70px;
    height: 70px;
    font-size: 1.8rem;
    margin: 0 auto 1.5rem; /* Center and space below */
  }

  .promo-card-scroll .card-title {
    font-size: 1.2rem;
  }

  .promo-card-scroll .card-text {
    font-size: 0.9rem;
  }

  @keyframes scroll-right-to-left {
    0% {
      transform: translateX(0);
    }
    100% {
      transform: translateX(calc(-58vw * 4)); /* Adjusted for mobile narrower cards */
    }
  }
}

@media (max-width: 576px) {
  .promo-scroll-wrapper {
    width: calc(100vw * 8);
    animation-duration: 60s; /* Keep it readable on very small screens */
  }

  .promo-card-scroll {
    flex: 0 0 55vw;
    margin-right: 3vw;
    padding: 1rem 1rem;
    min-height: 120px; /* Reduced height */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
  }

  .promo-card-scroll .icon-wrapper {
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
    margin: 0 auto 1.5rem;
  }

  .promo-card-scroll .card-title {
    font-size: 1.1rem;
  }

  .promo-card-scroll .card-text {
    font-size: 0.85rem;
  }

  @keyframes scroll-right-to-left {
    0% {
      transform: translateX(0);
    }
    100% {
      transform: translateX(calc(-58vw * 4));
    }
  }
}

/* Hero Section */
.hero-section {
  position: relative;
  overflow: hidden;
}

.hero-slide {
  height: 70vh;
  min-height: 500px;
  background-attachment: fixed;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

.carousel-item {
  transition: transform 1s ease-in-out;
}

.carousel-indicators button {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin: 0 4px;
}

.carousel-control-prev,
.carousel-control-next {
  width: 5%;
}

.carousel-control-prev-icon,
.carousel-control-next-icon {
  width: 2rem;
  height: 2rem;
}

/* Cards */
.card {
  border-radius: 1rem;
  transition: all 0.3s ease;
  overflow: hidden;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 1rem 2rem rgba(0, 0, 0, 0.15) !important;
}

.card-img-top {
  height: 250px;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.card:hover .card-img-top {
  transform: scale(1.05);
}

.card-body {
  padding: 1.5rem;
}

.card-title {
  font-weight: 600;
  margin-bottom: 1rem;
}

/* Sections */
section {
  position: relative;
}

.bg-light {
  background-color: var(--light-gray) !important;
}

/* Testimonials */
.bg-primary .bi-quote {
  opacity: 0.3;
}

/* Forms */
.form-control {
  border-radius: 0.5rem;
  border: 2px solid #e9ecef;
  padding: 0.75rem 1rem;
  font-weight: 500;
  transition: all 0.3s ease;
}

.form-control:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.2rem rgba(0, 122, 51, 0.25);
}

/* Added enhanced form validation styles */
.form-control.is-invalid {
  border-color: #dc3545;
  box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

.form-control.is-valid {
  border-color: #198754;
  box-shadow: 0 0 0 0.2rem rgba(25, 135, 84, 0.25);
}

.invalid-feedback {
  display: block;
  width: 100%;
  margin-top: 0.25rem;
  font-size: 0.875rem;
  color: #dc3545;
}

.was-validated .form-control:valid {
  border-color: #198754;
}

.was-validated .form-control:invalid {
  border-color: #dc3545;
}

/* Added donation amount button styles */
.amount-btn {
  border: 2px solid var(--primary-color);
  color: var(--primary-color);
  background-color: transparent;
  transition: all 0.3s ease;
  font-weight: 600;
}

.amount-btn:hover,
.amount-btn.active {
  background-color: var(--primary-color);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 122, 51, 0.3);
}

/* Added event filter button styles */
.event-filter-btn {
  border: 2px solid var(--primary-color);
  color: var(--primary-color);
  background-color: transparent;
  margin: 0.25rem;
  transition: all 0.3s ease;
}

.event-filter-btn:hover,
.event-filter-btn.active {
  background-color: var(--primary-color);
  color: white;
}

/* Added modal enhancements */
.modal-content {
  border-radius: 1rem;
  border: none;
  box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.175);
}

.modal-header {
  border-bottom: 1px solid rgba(0, 0, 0, 0.125);
  border-radius: 1rem 1rem 0 0;
}

.modal-footer {
  border-top: 1px solid rgba(0, 0, 0, 0.125);
  border-radius: 0 0 1rem 1rem;
}

/* Added notification styles */
.alert {
  border-radius: 0.75rem;
  border: none;
  font-weight: 500;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.alert-success {
  background-color: #d1e7dd;
  color: #0a3622;
}

.alert-danger {
  background-color: #f8d7da;
  color: #58151c;
}

.alert-info {
  background-color: #cff4fc;
  color: #055160;
}

/* Added counter animation styles */
.counter {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary-color);
  display: block;
}

/* Added stagger animation for cards */
.card.fade-in {
  animation-delay: var(--animation-delay, 0s);
}

.card:nth-child(1) {
  --animation-delay: 0.1s;
}
.card:nth-child(2) {
  --animation-delay: 0.2s;
}
.card:nth-child(3) {
  --animation-delay: 0.3s;
}
.card:nth-child(4) {
  --animation-delay: 0.4s;
}
.card:nth-child(5) {
  --animation-delay: 0.5s;
}
.card:nth-child(6) {
  --animation-delay: 0.6s;
}

/* Added loading button states */
.btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none !important;
}

.btn.loading {
  position: relative;
  color: transparent !important;
}

.btn.loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin-left: -8px;
  margin-top: -8px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Added resource search styles */
.resource-item {
  transition: all 0.3s ease;
}

.resource-item:hover {
  background-color: rgba(0, 122, 51, 0.05);
}

/* Added emergency resources styling */
.card.border-danger {
  border-color: #dc3545 !important;
  border-width: 2px;
}

.card-header.bg-danger {
  background-color: #dc3545 !important;
}

/* Footer */
footer {
  background-color: #1a1a1a !important;
}

footer h5,
footer h6 {
  color: var(--white);
  margin-bottom: 1rem;
}

footer p,
footer small {
  color: #adb5bd;
  line-height: 1.6;
}

footer a {
  transition: all 0.3s ease;
}

footer a:hover {
  color: var(--primary-light) !important;
  transform: translateY(-2px);
}

footer .bi {
  transition: all 0.3s ease;
}

footer .bi:hover {
  transform: scale(1.2);
}

/* Accessibility */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Enhanced focus styles for better accessibility */
.btn:focus,
.form-control:focus,
.nav-link:focus,
.dropdown-item:focus,
.amount-btn:focus,
.event-filter-btn:focus {
  outline: 3px solid var(--primary-color);
  outline-offset: 2px;
}

/* Skip link styles */
.visually-hidden-focusable:focus {
  position: static !important;
  width: auto !important;
  height: auto !important;
  padding: 0.5rem 1rem !important;
  margin: 0 !important;
  overflow: visible !important;
  clip: auto !important;
  white-space: normal !important;
}

/* Responsive Design */
@media (max-width: 768px) {
  .hero-slide {
    height: 60vh;
    min-height: 400px;
  }

  .display-4 {
    font-size: 2rem;
  }

  .display-5 {
    font-size: 1.75rem;
  }

  .navbar-brand {
    font-size: 1.25rem;
  }

  .card-body {
    padding: 1rem;
  }

  .btn-lg {
    padding: 0.75rem 1.25rem;
    font-size: 1rem;
  }

  /* Mobile-specific donation button styles */
  .amount-btn {
    margin-bottom: 0.5rem;
    width: 100%;
  }

  /* Mobile notification positioning */
  .alert.position-fixed {
    left: 10px !important;
    right: 10px !important;
    min-width: auto !important;
  }
}

@media (max-width: 576px) {
  body {
    padding-top: 70px;
  }

  .hero-slide {
    height: 50vh;
    min-height: 350px;
  }

  .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .display-4 {
    font-size: 1.75rem;
  }

  .btn-lg {
    display: block;
    width: 100%;
    margin-bottom: 0.5rem;
  }

  .btn-lg:last-child {
    margin-bottom: 0;
  }

  /* Mobile counter styles */
  .counter {
    font-size: 2rem;
  }
}

/* Animation Classes */
.fade-in {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.6s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Added slide-in animation variants */
.slide-in-left {
  opacity: 0;
  transform: translateX(-50px);
  transition: all 0.6s ease;
}

.slide-in-left.visible {
  opacity: 1;
  transform: translateX(0);
}

.slide-in-right {
  opacity: 0;
  transform: translateX(50px);
  transition: all 0.6s ease;
}

.slide-in-right.visible {
  opacity: 1;
  transform: translateX(0);
}

/* Added scale animation */
.scale-in {
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.6s ease;
}

.scale-in.visible {
  opacity: 1;
  transform: scale(1);
}

/* Print Styles */
@media print {
  .navbar,
  .carousel-control-prev,
  .carousel-control-next,
  .carousel-indicators,
  footer {
    display: none !important;
  }

  body {
    padding-top: 0;
  }

  .hero-slide {
    height: auto;
    min-height: auto;
    background: none !important;
  }

  .card {
    break-inside: avoid;
    box-shadow: none !important;
    border: 1px solid #dee2e6;
  }
}
