/* ===============================================
   RESPONSIVE DESIGN SYSTEM
   Mobile First Approach
   Breakpoints:
   - Mobile: 320px - 767px
   - Tablet: 768px - 1023px
   - Desktop: 1024px+
=============================================== */

/* ===============================================
   0. MOBILE MENU SCROLL LOCK
   Prevents body scroll when mobile menu is open
   Works on iOS Safari and all mobile browsers
=============================================== */

html.mobile-menu-open,
body.mobile-menu-open {
  overflow: hidden !important;
}

/* Prevent touch scrolling on the backdrop */
.mobile-menu-backdrop.active {
  touch-action: none !important;
  -webkit-overflow-scrolling: none !important;
}

/* ===============================================
   1. MOBILE NAVIGATION & HAMBURGER MENU
=============================================== */

/* Hamburger Button */
/* COMMENTED OUT - Conflicts with page-specific hamburger implementation */
/* Each page now handles its own hamburger styling for better control */
/*
.hamburger {
  display: none;
  width: 40px;
  height: 40px;
  background: white;
  border: 2px solid #3b82f6;
  border-radius: 10px;
  cursor: pointer;
  padding: 0;
  z-index: 1001;
  position: relative;
  margin-right: 12px;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
  transition: all 0.3s ease;
}

.hamburger:hover {
  background: #3b82f6;
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.hamburger:active {
  transform: scale(0.95);
}

.hamburger span {
  display: block;
  position: absolute;
  width: 22px;
  height: 2.5px;
  background: #3b82f6;
  border-radius: 2px;
  transition: all 0.3s ease;
  left: 50%;
  transform: translateX(-50%);
}

.hamburger:hover span {
  background: white;
}
*/

/* Position each line with proper spacing */
/* COMMENTED OUT - Using page-specific positioning */
/*
.hamburger span:nth-child(1) {
  top: 10px;
}

.hamburger span:nth-child(2) {
  top: 50%;
  transform: translate(-50%, -50%);
}

.hamburger span:nth-child(3) {
  bottom: 10px;
}
*/

/* Hover effect - lines expand */
/* COMMENTED OUT - Using page-specific hover effects */
/*
.hamburger:hover span {
  width: 26px;
}

.hamburger:hover span:nth-child(1) {
  top: 9px;
}

.hamburger:hover span:nth-child(3) {
  bottom: 9px;
}
*/

/* Mobile Navigation Overlay */
.mobile-nav-overlay {
  position: fixed;
  top: 0;
  left: -320px;
  width: 320px;
  height: 100vh;
  background: white;
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.1);
  transition: left 0.3s ease;
  z-index: 10001;
  overflow-y: auto;
}

.mobile-nav-overlay.active {
  left: 0;
}

/* Dark overlay behind menu */
.nav-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 9999;  /* Below menu and hamburger */
}

.nav-backdrop.active {
  opacity: 1;
  visibility: visible;
}

/* Mobile Menu Styles */
.mobile-nav {
  padding: 160px 20px 20px;
  position: relative;
  z-index: 1;
}

/* Close button for mobile menu */
.mobile-nav-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  background: white;
  border: 2px solid #3b82f6;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
  z-index: 2;
}

.mobile-nav-close:hover {
  background: #3b82f6;
  transform: rotate(90deg);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.mobile-nav-close svg {
  width: 22px;
  height: 22px;
  color: #3b82f6;
  transition: color 0.3s ease;
}

.mobile-nav-close:hover svg {
  color: white;
}

/* Menu header with logo and title */
.mobile-nav-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 20px;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.mobile-nav-logo {
  width: 45px;
  height: 45px;
  border-radius: 8px;
  background: white;
  padding: 2px;
  margin-bottom: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.mobile-nav-header h2 {
  color: white;
  font-size: 1.2rem;
  font-weight: 600;
  margin: 0;
  font-family: 'Cormorant Garamond', serif;
  text-align: center;
}

.mobile-nav-header .subtitle {
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.9rem;
  text-align: center;
  margin-top: 5px;
}

/* Menu items styling */
.mobile-nav a {
  display: block;
  padding: 16px 24px;
  color: #4a5568;
  text-decoration: none;
  font-size: 17px;
  font-weight: 500;
  border-radius: 8px;
  margin: 8px 0;
  transition: all 0.3s ease;
  position: relative;
  background: white;
  border: 1px solid #e5e7eb;
}

.mobile-nav a::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 0;
  background: #3b82f6;
  border-radius: 0 4px 4px 0;
  transition: height 0.3s ease;
}

.mobile-nav a:hover,
.mobile-nav a.active {
  background: #eff6ff;
  color: #3b82f6;
  transform: translateX(5px);
  border-color: #3b82f6;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15);
}

.mobile-nav a:hover::before,
.mobile-nav a.active::before {
  height: 100%;
}

.mobile-nav .lang-toggle {
  display: block;
  padding: 12px 20px;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  border-radius: 25px;
  margin: 30px 20px 20px;
  text-align: center;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.mobile-nav .lang-toggle:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

/* ===============================================
   2. RESPONSIVE TYPOGRAPHY
=============================================== */

/* Fluid Typography using clamp() */
h1 {
  font-size: clamp(1.25rem, 4vw, 1.5rem);
}

h2 {
  font-size: clamp(1.5rem, 5vw, 3rem);
}

h3 {
  font-size: clamp(1.1rem, 3vw, 1.25rem);
}

p {
  font-size: clamp(0.9rem, 2.5vw, 1.125rem);
}

/* ===============================================
   3. HERO SECTION - PROFILE CARDS
=============================================== */

/* Mobile adjustments for profile cards */
@media (max-width: 767px) {
  .profile-card {
    min-width: 140px !important;
    max-width: 180px !important;
  }
  
  .profile-card img {
    max-height: 200px !important;
  }
  
  .profile-name-highlight {
    font-size: 20px !important;
    padding: 0.1em 0.4em !important;
  }
  
  /* Adjust lotus graphics for mobile */
  .lotus-side {
    display: none !important;
  }
}

/* ===============================================
   4. RESPONSIVE QUOTE SECTION
=============================================== */

@media (max-width: 767px) {
  #quote-container {
    padding: 0 20px;
  }
  
  .quote-nav {
    width: 35px;
    height: 35px;
  }
  
  #prev-quote {
    left: 5px;
  }
  
  #next-quote {
    right: 5px;
  }
  
  #quote-text {
    font-size: 1rem !important;
    min-height: 80px !important;
  }
}

/* ===============================================
   5. RESPONSIVE GRID LAYOUTS
=============================================== */

/* Info sections grid */
@media (max-width: 767px) {
  .grid.md\\:grid-cols-3 {
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
  }
}

@media (min-width: 768px) and (max-width: 1399px) {
  .grid.md\\:grid-cols-3 {
    grid-template-columns: 1fr !important;
    gap: 2rem !important;
  }
}

/* ===============================================
   6. DARSHAN SECTION
=============================================== */

@media (max-width: 767px) {
  #darshanList {
    max-width: 100%;
    padding: 0 15px;
  }
  
  #darshanList button {
    font-size: 0.9rem;
    height: 2.5rem;
    padding: 0.4rem 0.8rem;
  }
  
  #countdown {
    font-size: 1rem !important;
  }
}

/* ===============================================
   7. MOBILE & TABLET BREAKPOINTS
=============================================== */

/* Mobile Styles (320px - 767px) */
@media (max-width: 767px) {
  /* Show hamburger, hide desktop nav */
  .hamburger {
    display: block !important;
  }

  /* Ensure mobile navigation elements are visible */
  .mobile-nav-overlay,
  .nav-backdrop {
    display: block !important;
  }

  header nav {
    display: none;
  }
  
  /* Header adjustments - Remove excessive padding */
  header .max-w-6xl {
    padding: 12px 8px !important;
    margin: 0 auto !important;
    max-width: none !important;
    width: 100% !important;
  }

  /* Reduce gap between logo and title */
  header .flex.items-center.gap-3 {
    gap: 8px !important;
  }
  
  /* Main header title styling for mobile */
  #site-title {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    line-height: 1.1 !important;
    gap: 0 !important;
    flex-shrink: 0 !important;
    min-width: 0 !important;
  }

  #site-title .main-title {
    font-size: 1.3rem !important;
    font-weight: 600 !important;
    display: block !important;
    line-height: 1 !important;
    margin: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    max-width: 100% !important;
  }

  #site-title .main-subtitle {
    font-size: 0.85rem !important;
    font-weight: 400 !important;
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    opacity: 0.9;
    line-height: 1 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    max-width: 100% !important;
  }
  
  .logo-icon-link img {
    height: 35px !important;
    width: 35px !important;
  }
  
  /* Hero section */
  section.py-8 {
    padding: 20px 10px !important;
    min-height: auto !important;
  }
  
  .flex.flex-col.md\\:flex-row {
    flex-direction: row !important;
    gap: 15px !important;
    padding: 0 10px;
  }
  
  /* Content sections */
  section.py-16 {
    padding: 40px 15px !important;
  }
  
  section.py-10 {
    padding: 30px 15px !important;
  }
  
  section.py-12 {
    padding: 35px 15px !important;
  }
  
  /* Quote card */
  article.quote {
    padding: 1.5rem 1rem !important;
    margin: 20px 10px !important;
  }
  
  article.quote blockquote {
    font-size: 1.1rem !important;
  }
  
  article.quote blockquote::before {
    font-size: 3rem !important;
  }
}

/* Tablet Styles (768px - 1399px) */
@media (min-width: 768px) and (max-width: 1399px) {
  /* Show hamburger on tablets too for consistency */
  .hamburger {
    display: block !important;
  }

  /* Ensure mobile navigation elements are visible */
  .mobile-nav-overlay,
  .nav-backdrop {
    display: block !important;
  }

  header nav {
    display: none;
  }

  /* Header adjustments - Better spacing for tablets */
  header .max-w-6xl {
    padding: 16px 12px !important;
    margin: 0 auto !important;
    max-width: none !important;
    width: 100% !important;
  }

  /* Reduce gap between logo and title */
  header .flex.items-center.gap-3 {
    gap: 10px !important;
  }

  /* Header adjustments */
  #site-title {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    line-height: 1.1 !important;
    gap: 0 !important;
    flex-shrink: 0 !important;
    min-width: 0 !important;
  }

  #site-title .main-title {
    font-size: 1.4rem !important;
    font-weight: 600 !important;
    display: block !important;
    line-height: 1 !important;
    margin: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    max-width: 100% !important;
  }

  #site-title .main-subtitle {
    font-size: 1rem !important;
    font-weight: 400 !important;
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    opacity: 0.9;
    line-height: 1 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    max-width: 100% !important;
  }
  
  /* Hero section */
  .profile-card {
    min-width: 200px !important;
    max-width: 300px !important;
  }
  
  /* Lotus graphics - show but smaller */
  .lotus-side {
    height: 400px !important;
    max-width: 30vw !important;
  }
  
  /* Content padding */
  section {
    padding-left: 30px !important;
    padding-right: 30px !important;
  }
}

/* Desktop Styles (1400px+) */
@media (min-width: 1400px) {
  /* Ensure desktop nav is visible */
  header nav {
    display: flex !important;
  }

  /* Decrease spacing between navigation buttons */
  header nav.space-x-4 {
    gap: 8px !important;
  }

  /* Also handle the space-x-4 class specifically */
  header nav > * + * {
    margin-left: 8px !important;
  }

  .hamburger,
  .mobile-nav-overlay,
  .nav-backdrop {
    display: none !important;
  }

  /* Desktop header spacing - More space on both sides */
  header .max-w-6xl {
    padding: 20px 60px !important;
    margin: 0 auto !important;
    max-width: 1400px !important;
    width: 100% !important;
  }

  /* Proper gap for desktop */
  header .flex.items-center.gap-3 {
    gap: 16px !important;
  }
  
  /* Keep title on one line for desktop */
  #site-title {
    display: inline-flex !important;
    flex-direction: row !important;
    align-items: baseline !important;
    gap: 0 !important;
    flex-wrap: nowrap !important;
    flex-shrink: 1 !important;
    min-width: 0 !important;
  }

  #site-title .main-title {
    display: inline !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: inherit !important;
    white-space: nowrap !important;
    overflow: visible !important;
    text-overflow: unset !important;
  }

  #site-title .main-subtitle {
    display: inline !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: inherit !important;
    white-space: nowrap !important;
    overflow: visible !important;
    text-overflow: unset !important;
  }

  #site-title .main-subtitle::before {
    content: ", ";
    margin: 0 0.25rem !important;
  }
}

/* ===============================================
   8. UTILITY CLASSES
=============================================== */

/* Responsive padding */
.px-responsive {
  padding-left: 15px;
  padding-right: 15px;
}

@media (min-width: 768px) {
  .px-responsive {
    padding-left: 30px;
    padding-right: 30px;
  }
}

@media (min-width: 1024px) {
  .px-responsive {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

/* Responsive margins */
.my-responsive {
  margin-top: 1rem;
  margin-bottom: 1rem;
}

@media (min-width: 768px) {
  .my-responsive {
    margin-top: 2rem;
    margin-bottom: 2rem;
  }
}

@media (min-width: 1024px) {
  .my-responsive {
    margin-top: 3rem;
    margin-bottom: 3rem;
  }
}

/* ===============================================
   9. POPUP MODAL RESPONSIVE
=============================================== */

@media (max-width: 767px) {
  .popup-overlay iframe {
    width: 100% !important;
    height: 100vh !important;
    border-radius: 0 !important;
  }
}

@media (min-width: 768px) and (max-width: 1399px) {
  .popup-overlay iframe {
    width: 90% !important;
    height: 90vh !important;
  }
}

/* ===============================================
   10. SMOOTH SCROLLING & PERFORMANCE
=============================================== */

/* Smooth scrolling for all devices */
html {
  scroll-behavior: smooth;
}

/* Prevent horizontal scroll */
body {
  overflow-x: hidden;
}

/* Optimize for touch devices */
@media (hover: none) and (pointer: coarse) {
  /* Increase touch target sizes */
  button, a {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* Remove hover effects on touch devices */
  .quote-nav {
    opacity: 1 !important;
  }
}