/* ===================================
   RESPONSIVE MOBILE DESIGN IMPROVEMENTS
   Task 8.1: Fix mobile navigation and layout issues
   ===================================
   
   This file contains mobile-specific responsive design improvements
   for navigation, forms, and content layout optimization.
   ================================= */

/* ===================================
   MOBILE NAVIGATION IMPROVEMENTS
   ================================= */

/* Enhanced mobile navigation with better touch targets */
@media (max-width: 991px) {
  /* Improved mobile navigation overlay */
  .navbar-collapse {
    position: fixed;
    top: 4.5rem;
    left: 0;
    right: 0;
    width: 100vw;
    height: calc(100vh - 4.5rem);
    background: rgba(0, 0, 0, 0.98);
    backdrop-filter: blur(15px);
    z-index: 9999;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .navbar-nav {
    height: 100%;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem 1rem;
    gap: 1.5rem;
  }

  /* Enhanced touch targets for mobile navigation */
  .navbar .nav-item {
    margin-right: 0;
    width: 100%;
    max-width: 280px;
  }

  .navbar .nav-link {
    text-align: center;
    font-size: 1.25rem;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    transition: all 0.3s ease;
    min-height: 48px; /* Minimum touch target size */
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
  }

  .navbar .nav-link:hover,
  .navbar .nav-link:focus {
    background: rgba(193, 0, 0, 0.2);
    border-color: var(--accent);
    transform: translateY(-2px);
  }

  .navbar .nav-link.active {
    background: rgba(193, 0, 0, 0.3);
    border-color: var(--accent);
  }

  /* Enhanced mobile CTA button */
  .navbar-cta {
    margin: 2rem auto 0;
    justify-content: center;
    width: 100%;
    max-width: 280px;
  }

  .navbar-cta .join-btn {
    width: 100%;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    min-height: 48px;
  }

  /* Improved hamburger menu animation */
  .navbar-toggler {
    padding: 0.75rem;
    border-radius: 8px;
    min-width: 48px;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .navbar-toggler:focus {
    box-shadow: 0 0 0 3px rgba(193, 0, 0, 0.3);
  }

  /* Smooth slide-in animation for mobile menu */
  .navbar-collapse {
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
    display: block !important;
  }

  .navbar-collapse.collapsing {
    transform: translateX(50%);
  }

  .navbar-collapse.show {
    transform: translateX(0);
  }
}

/* ===================================
   MOBILE FORM IMPROVEMENTS
   ================================= */

@media (max-width: 768px) {
  /* Enhanced form layouts for mobile */
  .contact-form,
  .enhanced-form,
  #joinus-form {
    padding: 1.5rem;
    margin: 0 1rem;
  }

  /* Touch-friendly form inputs */
  .form-control,
  .form-group input,
  .form-group textarea,
  .form-group select {
    font-size: 16px; /* Prevents zoom on iOS */
    padding: 1rem;
    min-height: 48px;
    border-radius: 8px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
    transition: all 0.3s ease;
  }

  .form-control:focus,
  .form-group input:focus,
  .form-group textarea:focus,
  .form-group select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(193, 0, 0, 0.2);
    background: rgba(255, 255, 255, 0.12);
  }

  /* Enhanced form labels for mobile */
  .form-label,
  .form-group label {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
  }

  /* Touch-friendly form buttons */
  .form-group button,
  .contact-form button,
  .btn {
    min-height: 48px;
    padding: 1rem 2rem;
    font-size: 1rem;
    border-radius: 8px;
    width: 100%;
    margin-top: 1rem;
  }

  /* Form feedback improvements */
  .form-feedback {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.95rem;
    line-height: 1.5;
  }

  .form-error {
    font-size: 0.9rem;
    margin-top: 0.5rem;
    padding: 0.5rem;
    border-radius: 4px;
    background: rgba(239, 68, 68, 0.1);
    border-left: 3px solid #ef4444;
  }

  .form-text {
    font-size: 0.85rem;
    margin-top: 0.25rem;
    color: var(--text-secondary);
  }
}

/* ===================================
   MOBILE CONTENT LAYOUT IMPROVEMENTS
   ================================= */

@media (max-width: 768px) {
  /* Improved section spacing for mobile */
  section {
    padding: 3rem 1rem;
  }

  /* Enhanced heading hierarchy for mobile */
  .section-heading {
    margin-bottom: 2rem;
    padding: 0 0.5rem;
  }

  .section-heading h1 {
    font-size: clamp(2rem, 5vw, 2.5rem);
    line-height: 1.2;
    margin-bottom: 1rem;
  }

  .section-heading p {
    font-size: 1rem;
    line-height: 1.6;
  }

  /* Mobile-optimized grid layouts */
  .about-metrics,
  .events-grid,
  .updates-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .contact-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  /* Enhanced card layouts for mobile */
  .metric-card,
  .event-card,
  .update-card {
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 1rem;
  }

  .metric-card h3 {
    font-size: clamp(2rem, 6vw, 2.5rem);
    margin-bottom: 1rem;
  }

  .metric-card p,
  .event-card p,
  .update-card p {
    font-size: 0.95rem;
    line-height: 1.6;
  }

  /* Mobile-optimized button groups */
  .about-actions,
  .button-group {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }

  .primary-link,
  .secondary-link {
    padding: 0.75rem 1.5rem;
    text-align: center;
    justify-content: center;
    min-height: 48px;
    border-radius: 8px;
  }
}

/* ===================================
   MOBILE SWIPER/CAROUSEL IMPROVEMENTS
   ================================= */

@media (max-width: 768px) {
  .swiper-container {
    height: auto;
    min-height: 60vh;
    margin: 0;
  }

  .swiper-slide {
    padding: 1rem;
  }

  .swiper-slide .container {
    padding: 0;
  }

  .swiper-slide .row {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .swiper-slide .col-md-5,
  .swiper-slide .col-md-7 {
    width: 100%;
    max-width: none;
    margin-bottom: 1rem;
  }

  .swiper-slide h4 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
  }

  .swiper-slide p {
    font-size: 0.95rem;
    line-height: 1.6;
    max-width: 100%;
  }

  .swiper-slide img {
    transform: scale(0.8);
    max-width: 100%;
    height: auto;
  }

  /* Enhanced swiper navigation for mobile */
  .swiper-button-next,
  .swiper-button-prev {
    width: 40px;
    height: 40px;
    margin-top: -20px;
  }

  .swiper-button-next::after,
  .swiper-button-prev::after {
    font-size: 16px;
  }

  .swiper-pagination {
    bottom: 10px;
  }

  .swiper-pagination-bullet {
    width: 8px;
    height: 8px;
    margin: 0 4px;
  }
}

/* ===================================
   MOBILE HERO SECTION IMPROVEMENTS
   ================================= */

@media (max-width: 768px) {
  .hero {
    height: calc(100vh - 4.5rem);
    min-height: 600px;
  }

  .img-container {
    height: 25%;
    margin-top: 2rem;
  }

  .img-container img {
    transform: scale(0.35);
  }

  img[src="./assets/aerokleimgs/INThrust_1.png"] {
    top: 20vh;
  }

  /* Optimize parallax layers for mobile */
  .layer1,
  .layer2,
  .trees {
    will-change: auto; /* Remove will-change on mobile for better performance */
  }
}

/* ===================================
   MOBILE GALLERY IMPROVEMENTS
   ================================= */

@media (max-width: 768px) {
  .gallery .section h3 {
    font-size: 1.5rem;
    text-align: center;
    margin-bottom: 2rem;
  }

  .gallery .content {
    margin-bottom: 1rem;
    border-radius: 8px;
    overflow: hidden;
  }

  .gallery .content-image,
  .gallery video {
    width: 100%;
    height: auto;
    object-fit: cover;
  }

  .gallery .content-details {
    padding: 1rem;
  }

  .gallery .content-title {
    font-size: 1rem;
    margin-bottom: 0.5rem;
  }

  .gallery .content-text {
    font-size: 0.85rem;
  }
}

/* ===================================
   MOBILE FOOTER IMPROVEMENTS
   ================================= */

@media (max-width: 768px) {
  .footer {
    padding: 2rem 1rem;
    margin-top: 3rem;
  }

  .footer .row {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 2rem;
  }

  .footer .col-sm-4 {
    width: 100%;
    max-width: 300px;
  }

  .socialicons ul {
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
  }

  .socialicons li a {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
  }

  .location {
    margin: 1rem 0;
    padding: 0 1rem;
  }

  .locdetails {
    font-size: 0.9rem;
    line-height: 1.5;
  }

  .copyright {
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.85rem;
  }
}

/* ===================================
   MOBILE ACCESSIBILITY IMPROVEMENTS
   ================================= */

@media (max-width: 768px) {
  /* Ensure focus indicators are visible on mobile */
  *:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
  }

  /* Improve tap target sizes */
  a, button, input, textarea, select {
    min-height: 44px;
    min-width: 44px;
  }

  /* Ensure text is readable */
  body {
    font-size: 16px;
    line-height: 1.6;
  }

  /* Improve contrast for mobile */
  .text-secondary {
    color: rgba(231, 236, 255, 0.85);
  }
}

/* ===================================
   MOBILE PERFORMANCE OPTIMIZATIONS
   ================================= */

@media (max-width: 768px) {
  /* Reduce animations on mobile for better performance */
  .rellax {
    transform: none !important;
  }

  /* Optimize images for mobile */
  img {
    max-width: 100%;
    height: auto;
  }

  /* Reduce motion for mobile users who prefer it */
  @media (prefers-reduced-motion: reduce) {
    * {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
    }
  }
}

/* ===================================
   MOBILE LANDSCAPE ORIENTATION
   ================================= */

@media (max-width: 768px) and (orientation: landscape) {
  .hero {
    height: 100vh;
  }

  .img-container {
    height: 30%;
    margin-top: 1rem;
  }

  .navbar-collapse {
    height: calc(100vh - 4.5rem);
  }

  .navbar-nav {
    padding: 1rem;
    gap: 1rem;
  }

  .navbar .nav-link {
    font-size: 1.1rem;
    padding: 0.75rem 1rem;
  }
}