/* Mobile Navigation Fix */

/* Hamburger Menu Button */
.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 24px;
  cursor: pointer;
  padding: 8px;
  z-index: 1001;
}

/* Mobile Navigation Styles */
@media (max-width: 768px) {
  /* Show hamburger button on mobile */
  .mobile-menu-toggle {
    display: block;
  }
  
  /* Hide desktop nav links by default */
  nav > div > div:last-child {
    position: fixed;
    top: 0;
    right: -100%;
    width: 280px;
    height: 100vh;
    background: var(--bg-secondary);
    backdrop-filter: blur(20px);
    flex-direction: column;
    align-items: flex-start;
    padding: 80px 30px 30px;
    gap: 20px !important;
    transition: right 0.3s ease;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    overflow-y: auto;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
    z-index: 1000;
  }
  
  .light nav > div > div:last-child {
    background: rgba(255, 255, 255, 0.98);
    border-left: 1px solid rgba(0, 0, 0, 0.1);
  }
  
  /* Show menu when active */
  nav > div > div:last-child.mobile-menu-open {
    right: 0;
  }
  
  /* Style mobile nav links */
  nav > div > div:last-child a {
    width: 100%;
    padding: 12px 0;
    font-size: 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    position: relative;
    z-index: 1001;
    pointer-events: auto;
    display: block;
  }
  
  .light nav > div > div:last-child a {
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  }
  
  /* Theme toggle button in mobile menu */
  nav > div > div:last-child button {
    width: 100%;
    justify-content: flex-start;
    margin-top: 20px;
    position: relative;
    z-index: 1001;
    pointer-events: auto;
  }
  
  /* Overlay for mobile menu */
  .mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    pointer-events: auto;
  }
  
  .mobile-menu-overlay.active {
    display: block;
    pointer-events: auto;
  }
}

/* Improved Text Contrast — desktop nav links default color */
nav a {
  opacity: 0.9;
}

nav a:hover,
nav a.active {
  color: var(--accent) !important;
  opacity: 1;
}

@media (max-width: 768px) {
  nav a {
    color: var(--text-primary) !important;
  }

  .light nav a {
    color: var(--text-primary) !important;
  }
}

/* Chatbot Text Visibility Fix */
.chatbot-header {
  background: var(--gradient-accent);
  color: #000 !important;
  font-weight: 700;
  font-size: 16px;
}

.chatbot-header * {
  color: #000 !important;
}

.chatbot-close {
  color: #000 !important;
  opacity: 0.8;
}

.chatbot-close:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.1);
}

.chatbot-message {
  color: var(--text-primary);
  line-height: 1.6;
}

.chatbot-message.bot {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.chatbot-message.user {
  background: var(--gradient-accent);
  color: #000;
}

.chatbot-option {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.chatbot-option:hover {
  color: #000;
  background: var(--accent-primary);
}

.light .chatbot-message.bot {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-primary);
}

.light .chatbot-option {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-primary);
}

/* Ensure all text is readable */
body {
  color: var(--text-primary);
}

p, li, span {
  color: var(--text-secondary);
}

h1, h2, h3, h4, h5, h6 {
  color: var(--text-primary);
}

/* ============================================================
   MOBILE RESPONSIVE FIXES
   1. About Stock Pathshala hero card
   2. Send a Message form (phone/email grid)
   3. Mobile bottom navigation bar
   ============================================================ */

/* ── 1. About Stock Pathshala hero card ── */
@media (max-width: 768px) {
  /* The hero card inside #about-sp uses grid-template-columns:auto 1fr inline.
     We override it to single column via a utility class added below. */
  #about-sp > div:first-of-type {
    grid-template-columns: 1fr !important;
    padding: 24px !important;
    gap: 20px !important;
    text-align: center;
  }
  #about-sp > div:first-of-type > div:first-child {
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  #about-sp > div:first-of-type h3 {
    font-size: 18px !important;
  }
  #about-sp > div:first-of-type p {
    font-size: 14px !important;
  }
  #about-sp > div:first-of-type > div:last-child > div:last-child {
    justify-content: center;
  }
}

/* ── 2. Send a Message — phone/email 2-col grid collapse ── */
@media (max-width: 640px) {
  /* The inline style uses display:grid;grid-template-columns:1fr 1fr
     We target the parent .contact-form-wrap grid inside */
  .contact-form-wrap {
    padding: 20px !important;
  }
  /* Force the phone/email row to single column */
  .contact-form-wrap form > div[style*="grid-template-columns:1fr 1fr"],
  .contact-form-wrap form > div[style*="grid-template-columns: 1fr 1fr"] {
    display: flex !important;
    flex-direction: column !important;
    gap: 0 !important;
  }
  /* Email/send alternative buttons row */
  .contact-form-wrap form > div[style*="display:flex;gap:8px"] {
    flex-direction: column !important;
    gap: 10px !important;
  }
  .contact-form-wrap form > div[style*="display:flex;gap:8px"] a {
    flex: none !important;
    width: 100% !important;
  }
}

/* ── 3. Mobile Bottom Navigation Bar — Modern Redesign ── */
.mobile-bottom-nav {
  display: none;
}

@media (max-width: 768px) {

  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 998;
    /* Frosted glass base */
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-top: 1px solid rgba(5, 150, 105, 0.12);
    box-shadow:
      0 -1px 0 rgba(255,255,255,0.6) inset,
      0 -8px 32px rgba(0, 0, 0, 0.10);
    padding: 6px 8px max(10px, env(safe-area-inset-bottom));
    justify-content: space-around;
    align-items: flex-end;
    gap: 2px;
  }

  .dark .mobile-bottom-nav {
    background: rgba(8, 16, 32, 0.94);
    border-top: 1px solid rgba(0, 208, 132, 0.12);
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.4);
  }

  /* Regular nav items */
  .mobile-bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 6px 10px 4px;
    text-decoration: none;
    color: #94a3b8;
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 0.3px;
    border-radius: 14px;
    transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
    min-width: 48px;
    text-align: center;
    position: relative;
  }

  .mobile-bottom-nav a i {
    font-size: 19px;
    line-height: 1;
    transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  /* Active dot indicator */
  .mobile-bottom-nav a.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    background: #059669;
    border-radius: 50%;
  }

  /* Active & hover state */
  .mobile-bottom-nav a.active,
  .mobile-bottom-nav a:active {
    color: #059669;
    background: rgba(5, 150, 105, 0.08);
  }

  .mobile-bottom-nav a.active i,
  .mobile-bottom-nav a:active i {
    transform: translateY(-2px);
  }

  /* Hover effect for non-enroll items */
  .mobile-bottom-nav a:not(.nav-enroll):hover {
    color: #059669;
    background: rgba(5, 150, 105, 0.06);
  }

  /* ── Centre Enroll pill button ── */
  .mobile-bottom-nav a.nav-enroll {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: #fff !important;
    padding: 8px 16px 6px;
    border-radius: 22px;
    box-shadow: 0 4px 14px rgba(5, 150, 105, 0.4);
    font-size: 9.5px;
    font-weight: 800;
    letter-spacing: 0.3px;
    position: static;
    bottom: auto;
    width: auto;
    height: auto;
    min-width: auto;
    justify-content: center;
    gap: 3px;
    transform: none;
    transition: all 0.2s ease;
  }

  .mobile-bottom-nav a.nav-enroll i {
    font-size: 18px;
    transition: none;
  }

  .mobile-bottom-nav a.nav-enroll::before {
    display: none;
  }

  .mobile-bottom-nav a.nav-enroll::after {
    display: none;
  }

  .mobile-bottom-nav a.nav-enroll:hover,
  .mobile-bottom-nav a.nav-enroll:active {
    transform: scale(1.04);
    box-shadow: 0 6px 18px rgba(5, 150, 105, 0.5);
  }

  .dark .mobile-bottom-nav a.nav-enroll {
    box-shadow: 0 4px 14px rgba(5, 150, 105, 0.45);
  }

  /* Push page content up */
  body {
    padding-bottom: 76px;
  }

  /* Chatbot FAB above bottom nav */
  #sp-chat-fab {
    bottom: 88px !important;
  }

  #sp-chat-widget {
    bottom: 160px !important;
  }
}
