/**
 * Responsive Fixes
 * This stylesheet improves the mobile experience
 */

/* Fix font sizes on smaller screens */
@media (max-width: 576px) {
  html {
    font-size: 15px;
  }
  
  h1 {
    font-size: 2.2rem;
  }
  
  h2 {
    font-size: 1.8rem;
  }
  
  h3 {
    font-size: 1.3rem;
  }
  
  p {
    font-size: 0.95rem;
  }
}

/* Improve container padding on mobile */
@media (max-width: 768px) {
  .container {
    width: 95%;
    padding: 0 10px;
  }
  
  section {
    padding: 3rem 0;
  }
}

/* Fix header spacing on mobile */
@media (max-width: 991px) {
  #header {
    height: 70px;
  }
  
  .logo a {
    font-size: 1.5rem;
  }
  
  .logo i {
    font-size: 1.5rem;
  }
  
  /* Fix for mobile menu navigation */
  .nav-links {
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    max-width: 350px;
    height: 100vh;
    background: white;
    z-index: 1000;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
    padding: 80px 20px 30px;
    box-shadow: -5px 0 25px rgba(0,0,0,0.15);
    overflow-y: auto;
  }
  
  .nav-links.active {
    right: 0;
  }
  
  .header-actions {
    display: none;
  }
}

/* CRITICAL FIX: Mobile menu and overflow issues */
/* Prevent horizontal overflow in all views */
html, body {
  overflow-x: hidden;
  width: 100%;
  max-width: 100%;
}

/* Ensure all content fits within viewport */
section, .container, .row, [class*="col-"] {
  max-width: 100%;
  box-sizing: border-box;
}

/* Fix desktop nav bar with duplicate CTA buttons */
@media (min-width: 992px) {
  /* Hide hamburger menu on desktop */
  .hamburger {
    display: none !important;
  }
  
  /* Ensure nav links display correctly for desktop */
  .nav-links {
    display: flex;
    flex-direction: row;
    position: static;
    width: auto;
    background: transparent;
    box-shadow: none;
    padding: 0;
    height: auto;
  }
  
  /* Ensure header actions (CTA button) are visible on desktop */
  .header-actions {
    display: flex;
  }
  
  /* Hide mobile CTA */
  .mobile-cta {
    display: none !important;
  }
}

/* Mobile-specific styles */
@media (max-width: 991px) {
  /* Override any problematic CSS that might be hiding the menu */
  .nav-links {
    position: fixed !important;
    top: 0 !important;
    height: 100vh !important;
    right: -100% !important; /* Start offscreen */
    width: 80% !important;
    max-width: 400px !important;
    background-color: white !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    padding-top: 80px !important;
    transition: right 0.3s ease !important;
    transform: none !important; /* Don't use transform */
    z-index: 1000 !important;
    overflow-y: auto !important;
  }
  
  .nav-links.active {
    right: 0 !important; /* Slide in from right */
    transform: none !important;
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.15) !important;
  }
  
  /* Ensure hamburger is visible and clickable */
  .hamburger {
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    width: 30px !important;
    height: 25px !important;
    cursor: pointer !important;
    z-index: 1001 !important;
    margin-left: auto !important;
  }
  
  .hamburger div {
    width: 100% !important;
    height: 3px !important;
    background-color: var(--text-dark) !important;
    border-radius: 2px !important;
    transition: all 0.3s ease !important;
  }
  
  /* Improve hamburger animation */
  .hamburger.active .line1 {
    transform: translateY(8px) rotate(45deg) !important;
  }
  
  .hamburger.active .line2 {
    opacity: 0 !important;
  }
  
  .hamburger.active .line3 {
    transform: translateY(-8px) rotate(-45deg) !important;
  }
  
  /* Mobile menu items */
  .nav-links li {
    width: 100% !important;
    margin: 8px 0 !important;
    text-align: center !important;
  }
  
  .nav-links a {
    display: block !important;
    padding: 12px 15px !important;
    font-size: 1.1rem !important;
  }
  
  /* Fix overlay */
  .nav-overlay {
    display: block !important;
    opacity: 0 !important;
    visibility: hidden !important;
  }
  
  .nav-overlay.active {
    opacity: 1 !important;
    visibility: visible !important;
  }
  
  /* Hide desktop actions and show mobile */
  .header-actions {
    display: none !important;
  }
  
  .mobile-cta {
    display: block !important;
  }
}

/* HAMBURGER MENU VISIBILITY FIX */
@media (max-width: 991px) {
  /* Ensure hamburger menu is visible */
  .hamburger {
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    width: 30px !important;
    height: 25px !important;
    cursor: pointer !important;
    z-index: 1001 !important;
    margin-left: auto !important;
    position: relative !important;
    opacity: 1 !important;
    visibility: visible !important;
  }
  
  /* Make the hamburger lines clearly visible */
  .hamburger div {
    width: 100% !important;
    height: 3px !important;
    background-color: #333 !important; /* Darker color for better visibility */
    border-radius: 2px !important;
    transition: all 0.3s ease !important;
    opacity: 1 !important;
    display: block !important;
    margin: 4px 0 !important;
  }
  
  /* Specific line styles to ensure visibility */
  .hamburger .line1 {
    top: 0;
    transform-origin: center;
  }
  
  .hamburger .line2 {
    top: 50%;
    transform: translateY(-50%);
  }
  
  .hamburger .line3 {
    bottom: 0;
    transform-origin: center;
  }
  
  /* Fixed header styles that work with the hamburger */
  nav {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
  }
  
  /* Force the hamburger to show regardless of other styles */
  #hamburger-menu {
    display: flex !important; 
    opacity: 1 !important;
    visibility: visible !important;
  }
}

/* Hero section improvements for mobile */
@media (max-width: 768px) {
  .hero {
    min-height: auto;
    padding: 6rem 0 3rem;
  }
  
  .hero .container {
    flex-direction: column;
  }
  
  .hero-content {
    text-align: center;
    max-width: 100%;
  }
  
  .hero-content h1 {
    margin-bottom: 1rem;
  }
  
  .hero-content p {
    margin: 0 auto 1.5rem;
  }
  
  .cta-group {
    justify-content: center;
  }
  
  .hero-image {
    margin-top: 2rem;
    max-width: 80%;
    margin-left: auto;
    margin-right: auto;
  }
}

/* Fix steps/cards layout on mobile */
@media (max-width: 576px) {
  .step {
    padding: 1.5rem;
  }
  
  .step-icon {
    width: 65px;
    height: 65px;
    margin-bottom: 1.25rem;
  }
  
  .step-icon i {
    font-size: 1.5rem;
  }
  
  .benefits-list {
    grid-template-columns: 1fr;
  }
}

/* Responsive fixes for About section */
@media (max-width: 991px) {
  .about .container {
    flex-direction: column-reverse;
    gap: 3rem;
  }
  
  .about-image {
    max-width: 70%;
    margin: 0 auto;
  }
  
  .about-content {
    text-align: center;
  }
  
  .about-content h2::after {
    left: 50%;
    transform: translateX(-50%);
  }
  
  .about-stats {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    justify-content: center;
  }
}

/* Stack features on mobile */
@media (max-width: 576px) {
  .features {
    grid-template-columns: 1fr;
  }
  
  .feature {
    text-align: center;
  }
  
  .feature-link {
    justify-content: center;
  }
}

/* Testimonial fixes */
@media (max-width: 768px) {
  .testimonial-content {
    padding: 25px 20px;
  }
  
  .testimonial-author {
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-left: 0;
  }
  
  .testimonial-author img {
    margin-right: 0;
    margin-bottom: 10px;
  }
}

/* Contact section improvements */
@media (max-width: 991px) {
  .contact-wrapper {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  
  .contact-form-container {
    padding: 25px;
  }
}

/* Developer section fixes */
@media (max-width: 991px) {
  .developer-profile {
    flex-direction: column;
  }
  
  .developer-image {
    width: 100%;
    height: 320px;
  }
  
  .developer-info {
    padding: 30px 20px;
    text-align: center;
  }
  
  .developer-info h3::after {
    left: 50%;
    transform: translateX(-50%);
  }
  
  .developer-skills {
    justify-content: center;
  }
  
  .developer-contact {
    justify-content: center;
  }
}

/* Footer fixes */
@media (max-width: 991px) {
  .footer-content {
    grid-template-columns: 1fr 1fr;
    gap: 30px;
  }
}

@media (max-width: 576px) {
  .footer-content {
    grid-template-columns: 1fr;
  }
  
  .footer-logo {
    flex-direction: column;
    text-align: center;
    align-items: center;
    margin-bottom: 15px;
  }
  
  .footer-logo i {
    margin-right: 0;
    margin-bottom: 10px;
  }
  
  .footer-links h4,
  .footer-contact h4,
  .footer-newsletter h4 {
    text-align: center;
  }
  
  .footer-links h4:after,
  .footer-contact h4:after,
  .footer-newsletter h4:after {
    left: 50%;
    transform: translateX(-50%);
  }
  
  .footer-contact p {
    justify-content: center;
  }
  
  .newsletter-form {
    max-width: 280px;
    margin: 0 auto;
  }
}

/* Additional touch-friendly improvements */
@media (max-width: 576px) {
  /* Increase touch targets */
  .cta-button,
  .primary-button,
  .secondary-button {
    padding: 0.8rem 1.5rem;
    min-height: 44px;
    min-width: 44px;
  }
  
  /* Fix form elements to be more touch-friendly */
  input, 
  select, 
  textarea, 
  button {
    font-size: 16px !important; /* Prevents iOS zoom on focus */
    min-height: 44px;
  }
  
  /* Improve tap target spacing */
  .nav-links a,
  .footer-link {
    padding: 12px 0;
  }
  
  /* Fix buttons to have proper spacing */
  .social-btn {
    padding: 10px 16px;
  }
}

/* Improve mobile forms and inputs */
@media (max-width: 768px) {
  .contact-form .form-group input,
  .contact-form .form-group textarea {
    padding: 12px 15px;
  }
  
  .contact-form .form-group label {
    font-size: 14px;
  }
}

/* Fix iOS-specific issues */
@supports (-webkit-touch-callout: none) {
  /* Fix for iOS 100vh issue */
  .nav-links, 
  .hero {
    height: -webkit-fill-available;
    min-height: -webkit-fill-available;
  }
  
  /* Fix for iOS form zooming */
  input[type="text"],
  input[type="email"],
  input[type="tel"],
  textarea {
    font-size: 16px;
  }
}

/* Fix for scroll animation visibility on mobile */
@media (max-width: 768px) {
  .step, 
  .feature, 
  .developer-profile, 
  .developer-quote, 
  .testimonial-slider {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* Ensure images don't cause overflow */
img {
  max-width: 100%;
  height: auto;
}

/* Fix wave shapes that might cause overflow */
.wave-shape {
  width: 100%;
  overflow: hidden;
}

.wave-shape svg {
  width: 100%;
}

/* Fix sections that might have overflow issues */
#about .container, 
#how-it-works .container,
#contact .container,
#developers .container {
  overflow: hidden;
}

/* Add CTA button to mobile menu */
@media (max-width: 991px) {
  .mobile-cta {
    display: block !important;
    text-align: center;
    margin-top: 20px;
    padding: 0 15px;
    width: 100%;
  }
  
  .mobile-cta .cta-button {
    width: 80%;
    margin: 0 auto;
    display: flex;
    justify-content: center;
  }
}
