/* Enhanced styles for offline mode */

/* Font Face Declaration */
@font-face {
  font-family: "Bebas Neue";
  src: url("../fonts/BebasNeue-Regular.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
}

/* CSS Variables (fallback) */
:root {
  --header-height: 88.5938px;
}

/* Calendar fallback styles */
.calendar-fallback {
  max-width: 100%;
  margin: 20px 0;
}

.calendar-fallback .card-header {
  background-color: #007bff;
  color: white;
  border-bottom: 1px solid #007bff;
}

.calendar-fallback .card-body {
  padding: 20px;
}

.calendar-fallback .card.bg-light {
  border: 1px solid #dee2e6;
  transition: transform 0.2s;
}

.calendar-fallback .card.bg-light:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.calendar-fallback .btn-sm {
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
}

/* General improvements */
.hero {
  background: linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7)),
    url("https://kmcfinal.codedvisiondesign.co.uk/assets/images/hero.jpg")
      center/cover no-repeat;
  height: 100vh; /* Full viewport height */
  width: 100vw; /* Full viewport width */
  display: flex;
  align-items: center;
  justify-content: center;
  color: white !important;
  margin: 0 !important; /* Remove all margins */
  padding-top: var(
    --header-height
  ) !important; /* Push content below fixed header */
  padding-bottom: 0 !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  position: relative;
  left: 50%; /* Center the hero section */
  right: 50%;
  margin-left: -50vw; /* Pull it to full width */
  margin-right: -50vw;
  z-index: 1;
  background-attachment: scroll; /* Better mobile compatibility */
  transform: none !important; /* Prevent any transform effects */
  overflow: hidden; /* Prevent any content overflow */
  box-sizing: border-box; /* Include padding in height calculation */
}

.hero h1 {
  font-size: 4rem;
  margin-bottom: 1rem;
  line-height: 1.1;
  font-family: "Bebas Neue", sans-serif;
  letter-spacing: 1px;
  color: white !important;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.hero p {
  font-size: 1.2rem;
  margin-bottom: 2rem;
  color: white !important;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.hero .container {
  position: relative;
  z-index: 3;
}

/* Ensure sections after hero don't overlap */
.section {
  position: relative;
  z-index: 2;
  background-color: white;
  margin-top: 0;
  clear: both;
}

/* ALTERNATING SECTION BACKGROUNDS */
/* White sections (odd sections: about, classes, timetable, contact) */
.section:nth-child(odd),
#about,
#classes,
#timetable,
#contact {
  background-color: white !important;
  color: #1a1a1a;
}

.section:nth-child(odd) h1,
.section:nth-child(odd) h2,
.section:nth-child(odd) h3,
.section:nth-child(odd) h4,
.section:nth-child(odd) h5,
.section:nth-child(odd) h6,
#about h1,
#about h2,
#about h3,
#about h4,
#about h5,
#about h6,
#classes h1,
#classes h2,
#classes h3,
#classes h4,
#classes h5,
#classes h6,
#timetable h1,
#timetable h2,
#timetable h3,
#timetable h4,
#timetable h5,
#timetable h6,
#contact h1,
#contact h2,
#contact h3,
#contact h4,
#contact h5,
#contact h6 {
  color: #1a1a1a !important;
}

/* Dark sections (even sections: instructors, memberships, testimonials, faq) */
.section:nth-child(even),
#instructors,
#memberships,
#testimonials,
.faq-section {
  background-color: #333333 !important;
  color: white;
}

.section:nth-child(even) h1,
.section:nth-child(even) h2,
.section:nth-child(even) h3,
.section:nth-child(even) h4,
.section:nth-child(even) h5,
.section:nth-child(even) h6,
#instructors h1,
#instructors h2,
#instructors h3,
#instructors h4,
#instructors h5,
#instructors h6,
#memberships h1,
#memberships h2,
#memberships h3,
#memberships h4,
#memberships h5,
#memberships h6,
#testimonials h1,
#testimonials h2,
#testimonials h3,
#testimonials h4,
#testimonials h5,
#testimonials h6,
.faq-section h1,
.faq-section h2,
.faq-section h3,
.faq-section h4,
.faq-section h5,
.faq-section h6 {
  color: white !important;
}

/* Specific section overrides to ensure proper alternation */
.instructors-section,
.membership-section,
.testimonials-section,
.faq-section {
  background-color: #333333 !important;
  color: white;
}

.instructors-section h1,
.instructors-section h2,
.instructors-section h3,
.instructors-section h4,
.instructors-section h5,
.instructors-section h6,
.membership-section h1,
.membership-section h2,
.membership-section h3,
.membership-section h4,
.membership-section h5,
.membership-section h6,
.testimonials-section h1,
.testimonials-section h2,
.testimonials-section h3,
.testimonials-section h4,
.testimonials-section h5,
.testimonials-section h6,
.faq-section h1,
.faq-section h2,
.faq-section h3,
.faq-section h4,
.faq-section h5,
.faq-section h6 {
  color: white !important;
}

/* Ensure cards and content in dark sections have proper styling */
.section:nth-child(even) .card,
#instructors .card,
#memberships .card,
#testimonials .card,
.faq-section .card {
  background-color: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
}

.section:nth-child(even) .text-muted,
#instructors .text-muted,
#memberships .text-muted,
#testimonials .text-muted,
.faq-section .text-muted {
  color: #cccccc !important;
}

/* Specific about section styling to prevent overlap */
#about {
  margin-top: 0 !important;
  padding-top: 5rem;
  position: relative;
  z-index: 2;
  /* Force the about section to start after hero */
  clear: both;
  top: 0;
  transform: translateY(0) !important;
  /* Additional safeguards to prevent title overlap */
  overflow: hidden;
}

/* Ensure About Us title doesn't slide over hero */
#about .section-title {
  position: relative;
  z-index: 3;
  padding-top: 1rem;
  margin-bottom: 3rem;
  /* Prevent any upward animation from breaking container */
  overflow: visible;
}

#about .section-title h2 {
  position: relative;
  z-index: 4;
  padding: 1rem 0;
  margin: 0;
  /* Ensure title stays within bounds */
  transform: translateY(0) !important;
}

/* Additional overlap prevention */
.section:not(.hero) {
  position: relative;
  z-index: 2;
  /* Ensure sections create proper stacking context */
  transform: translateZ(0);
  /* Prevent any negative positioning */
  top: 0 !important;
  margin-top: 0 !important;
}

/* Ensure hero maintains proper height and doesn't interfere */
.hero {
  /* Prevent hero from affecting subsequent elements */
  isolation: isolate;
}

/* Make sure dark sections don't interfere with normal flow */
.instructors-section,
.membership-section,
.testimonials-section {
  position: relative;
  z-index: 2;
  /* Override any transforms that might cause issues */
  transform: translateZ(0);
  /* Ensure they don't pull up other sections */
  margin-top: 0;
  margin-bottom: 0;
}

/* Ensure hero doesn't interfere with subsequent sections */
.hero + .section,
.hero + section {
  margin-top: 0 !important;
  position: relative;
  z-index: 2;
  /* Add a small buffer to ensure separation */
  padding-top: 4rem;
}

/* Container for sections after hero */
main.container {
  position: relative;
  z-index: 2;
}

/* Dark sections should maintain proper z-index */
.instructors-section,
.membership-section,
.testimonials-section {
  position: relative;
  z-index: 2;
  /* Override any transforms that might cause issues */
  transform: translateZ(0);
}

/* Fix for any AOS elements that might cause positioning issues */
[data-aos] {
  /* Ensure AOS elements don't break out of normal document flow */
  position: relative !important;
}

/* Ensure CTA button is visible on hero */
.hero .cta-button {
  color: white !important;
  background-color: #d12727;
  border: 2px solid #d12727;
}

.hero .cta-button:hover {
  background-color: #b31e1e;
  border-color: #b31e1e;
}

.card {
  border-radius: 8px;
}

.btn-primary {
  border-radius: 6px;
}

/* Mobile Menu Styles - From Reference Design */
.mobile-menu-trigger {
  display: none;
  background: none;
  border: none;
  padding: 10px;
  cursor: pointer;
  z-index: 1000;
}

.hamburger {
  display: block;
  position: relative;
  width: 24px;
  height: 20px;
}

.hamburger-line {
  display: block;
  position: absolute;
  width: 100%;
  height: 2px;
  background-color: white;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.hamburger-line:nth-child(1) {
  top: 0;
}

.hamburger-line:nth-child(2) {
  top: 50%;
  transform: translateY(-50%);
}

.hamburger-line:nth-child(3) {
  bottom: 0;
}

.mobile-menu-trigger.is-active .hamburger-line:nth-child(1) {
  transform: translateY(9px) rotate(45deg);
}

.mobile-menu-trigger.is-active .hamburger-line:nth-child(2) {
  opacity: 0;
}

.mobile-menu-trigger.is-active .hamburger-line:nth-child(3) {
  transform: translateY(-9px) rotate(-45deg);
}

.nav-wrapper {
  transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s ease;
}

/* Responsive improvements */
@media (max-width: 1024px) {
  .mobile-menu-trigger {
    display: block;
  }

  .nav-wrapper {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: 100%;
    height: calc(100vh - var(--header-height));
    background-color: var(--dark, #1a1a1a);
    transform: translateX(100%);
    opacity: 0;
    visibility: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
  }

  .nav-wrapper.is-active {
    transform: translateX(0);
    opacity: 1;
    visibility: visible;
  }

  .nav-links {
    flex-direction: column;
    padding: 0.75rem 1rem;
    height: 100%;
    justify-content: flex-start;
  }

  .nav-links li {
    margin: 0.1rem 0;
    width: 100%;
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
  }

  .nav-wrapper.is-active .nav-links li {
    opacity: 1;
    transform: translateX(0);
  }

  .nav-links a {
    display: block;
    padding: 0.5rem 1rem;
    text-align: center;
    font-size: 0.95rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    text-decoration: none;
    transition: background-color 0.3s ease;
  }

  .nav-links a:hover {
    background-color: rgba(255, 255, 255, 0.1);
  }

  .nav-links li:last-child a {
    border-bottom: none;
  }

  .hero h1 {
    font-size: 3rem !important;
  }
}

@media (max-width: 768px) {
  .calendar-fallback .col-md-4 {
    margin-bottom: 1rem;
  }

  .hero h1 {
    font-size: 2.5rem !important;
  }

  /* Enhanced mobile hero compatibility */
  .hero {
    min-height: 100vh;
    min-height: 100dvh; /* Dynamic viewport height for modern browsers */
    background-position: center center;
    background-size: cover;
    background-repeat: no-repeat;
    /* Ensure smooth scrolling on iOS */
    -webkit-overflow-scrolling: touch;
  }
}

/* Additional mobile and iOS optimizations */
@media (max-width: 480px) {
  .hero h1 {
    font-size: 2rem !important;
    line-height: 1.2;
  }

  .hero p {
    font-size: 1rem !important;
    margin-bottom: 1.5rem;
  }

  .hero .cta-button {
    font-size: 0.9rem;
    padding: 0.75rem 1.5rem;
  }
}

/* High-resolution display support */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .hero {
    background-image: linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7)),
      url("https://kmcfinal.codedvisiondesign.co.uk/assets/images/hero.jpg");
  }
}

/* iOS Safari specific fixes */
@supports (-webkit-appearance: none) {
  .hero {
    /* Fix for iOS viewport height issues */
    min-height: -webkit-fill-available;
  }
}

/* Ensure shop page body doesn't have padding conflicts */
body {
  padding-top: 0 !important;
}

/* Fix for any sections immediately after hero */
.hero + .container,
.hero + .section,
.hero + div {
  margin-top: 0;
  padding-top: 2rem;
  position: relative;
  z-index: 2;
  background-color: white;
}

/* User Welcome Banner Styles */
.user-welcome-banner {
  background: linear-gradient(
    135deg,
    var(--primary, #d12727) 0%,
    var(--primary-hover, #b31e1e) 100%
  );
  color: white;
  padding: 1.5rem 0;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm, 0 2px 4px rgba(0, 0, 0, 0.1));
}

.welcome-content {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.welcome-avatar {
  font-size: 3rem;
  color: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
}

.welcome-text h4 {
  margin: 0;
  font-family: "Bebas Neue", sans-serif;
  font-size: 1.5rem;
  letter-spacing: 1px;
}

.welcome-text p {
  margin: 0;
  opacity: 0.8;
  font-size: 0.9rem;
}

/* Responsive adjustments for welcome banner */
@media (max-width: 768px) {
  .user-welcome-banner {
    padding: 1rem 0;
  }

  .welcome-avatar {
    font-size: 2.5rem;
  }

  .welcome-text h4 {
    font-size: 1.25rem;
  }

  .welcome-text p {
    font-size: 0.85rem;
  }
}

/* Button styles in navigation */
.nav-links .btn {
  display: inline-block;
  padding: 0.4rem 1rem;
  margin: 0.2rem 0;
  border-radius: var(--radius-md, 6px);
  font-weight: 500;
  text-decoration: none;
  transition: all var(--transition-normal, 0.3s ease);
  border: 2px solid transparent;
}

.nav-links .btn-primary {
  background-color: var(--primary, #d12727);
  color: white;
  border-color: var(--primary, #d12727);
}

.nav-links .btn-primary:hover {
  background-color: var(--primary-hover, #b31e1e);
  border-color: var(--primary-hover, #b31e1e);
  color: white;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md, 0 4px 8px rgba(0, 0, 0, 0.1));
}

.nav-links .btn-outline-primary {
  background-color: transparent;
  color: var(--primary, #d12727);
  border-color: var(--primary, #d12727);
}

.nav-links .btn-outline-primary:hover {
  background-color: var(--primary, #d12727);
  color: white;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md, 0 4px 8px rgba(0, 0, 0, 0.1));
}

/* Mobile menu button adjustments */
@media (max-width: 1024px) {
  .nav-links .btn {
    display: block;
    width: 100%;
    text-align: center;
    margin: 0.5rem 0;
  }
}

/* About section - ensure proper separation and no overlap */
#about {
  position: relative;
  z-index: 2;
  background: white;
  margin-top: 0 !important;
  padding-top: 60px;
  clear: both;
}

/* Ensure proper document flow between sections */
.hero + * {
  clear: both;
  position: relative;
}
