/* ===================================
   S.S. COMPUTECH - Mobile Responsiveness Fixes
   Add this file after style.css in your layout
   =================================== */

/* Mobile Mega Menu Styles */
@media (max-width: 992px) {
  .mega-mobile-menu {
    display: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: #f8f9fa;
    border-radius: 8px;
    margin: 10px 0;
  }

  .mega-mobile-menu.open {
    display: block;
    max-height: 600px;
    padding: 15px;
    overflow-y: auto;
  }

  .mega-mobile-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 10px;
    border-bottom: 1px solid #e9ecef;
    text-decoration: none;
    color: #374151;
    transition: background 0.15s;
  }

  .mega-mobile-item:hover {
    background: #f0f4ff;
    color: #4f46e5;
  }

  .mega-mobile-item:last-child {
    border-bottom: none;
  }

  .mega-mobile-item img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 6px;
    background: #f8f9fa;
    padding: 3px;
  }

  .mega-mobile-item-info {
    display: flex;
    flex-direction: column;
  }

  .mega-mobile-item-name {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
  }

  .mega-mobile-item-dur {
    font-size: 12px;
    color: #9ca3af;
  }

  /* Fix nav-link arrow for mobile */
  .nav-menu .mega-parent > .nav-link::after {
    content: '+' !important;
    position: absolute;
    right: 0;
    font-size: 1.2rem;
    width: auto;
    height: auto;
    background: none;
    transition: transform 0.2s ease;
  }

  .nav-menu .mega-parent.open > .nav-link::after {
    content: '-' !important;
  }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
  .btn,
  .nav-link,
  .slider-btn,
  .mega-item,
  .mega-mobile-item {
    min-height: 44px;
    min-width: 44px;
  }

  .nav-menu .nav-link {
    padding: 15px 0;
  }

  .mega-item {
    padding: 12px 10px;
  }
}

/* Improved mobile typography */
@media (max-width: 768px) {
  body {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
  }

  h1, h2, h3, h4, h5, h6 {
    word-break: break-word;
  }

  /* Better hero scaling */
  .hero-title {
    font-size: clamp(1.75rem, 5vw, 2.5rem);
    line-height: 1.2;
    margin-bottom: 15px;
  }

  .hero-subtitle {
    font-size: 1rem;
    line-height: 1.5;
    margin-bottom: 25px;
  }

  .hero-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }

  .stat-number {
    font-size: 1.75rem;
  }

  .stat-label {
    font-size: 0.8rem;
  }

  /* Course cards */
  .courses-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .course-card {
    padding: 25px;
  }

  .course-icon {
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
  }

  /* Testimonials */
  .testimonial-card {
    min-width: calc(100% - 30px);
    padding: 25px;
  }

  .testimonial-text {
    font-size: 1rem;
    line-height: 1.6;
  }

  /* Footer */
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .footer {
    padding: 50px 0 20px;
  }

  .footer-bottom {
    flex-direction: column;
    text-align: center;
    gap: 10px;
  }

  .footer-bottom-links {
    justify-content: center;
    flex-wrap: wrap;
  }
}

/* Extra small screens */
@media (max-width: 420px) {
  .container,
  .nav-container {
    padding: 0 12px;
  }

  .hero-content {
    padding: 100px 12px 40px;
  }

  .hero-buttons {
    flex-direction: column;
    width: 100%;
  }

  .hero-buttons .btn {
    width: 100%;
    max-width: 280px;
  }

  .hero-stats {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .course-card {
    padding: 20px;
  }

  .btn {
    padding: 11px 20px;
    font-size: 0.95rem;
  }

  .testimonial-card {
    min-width: 100%;
    padding: 20px;
  }
}

/* Page hero mobile fixes */
@media (max-width: 768px) {
  .page-hero {
    min-height: 40vh;
    margin-top: 60px;
    padding-top: 20px;
  }

  .page-hero-content {
    padding: 30px 16px;
  }

  .page-title {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
  }

  .page-subtitle {
    font-size: 0.95rem;
  }
}

/* Blog page mobile fixes */
@media (max-width: 768px) {
  .blog-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .blog-card {
    padding: 20px;
  }

  .blog-card-title {
    font-size: 1.1rem;
  }

  .blog-post-content {
    padding: 20px;
  }

  .blog-post-content img {
    max-width: 100%;
    height: auto;
  }
}

/* Contact form mobile fixes */
@media (max-width: 768px) {
  .contact-form {
    padding: 20px;
  }

  .contact-form input,
  .contact-form textarea,
  .contact-form select {
    font-size: 16px; /* Prevent zoom on iOS */
  }
}

/* Smooth scrolling with offset for fixed header */
html {
  scroll-padding-top: 80px;
}

/* Prevent horizontal scroll on mobile */
html, body {
  overflow-x: hidden;
  max-width: 100vw;
}

/* Mobile menu overlay */
body.mobile-menu-open::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 1;
  transition: opacity 0.3s ease;
}

/* Ensure hamburger stays above overlay */
.hamburger {
  position: relative;
  z-index: 1002;
  /* Real touch devices: without this some mobile browsers add a
     ~300ms tap delay / treat the tap as a double-tap-zoom gesture,
     so the first tap silently does nothing. */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  pointer-events: auto;
}

.hamburger .bar {
  /* Prevent taps landing on a <span> from being swallowed differently
     than taps on the parent .hamburger div. */
  pointer-events: none;
}

/* Ensure nav-menu stays above overlay */
.nav-menu {
  z-index: 1000;
}

/* WhatsApp float button must never sit above the open mobile menu */
.wa-float {
  z-index: 998;
}

/* Image optimization for mobile */
@media (max-width: 768px) {
  img {
    height: auto;
    max-width: 100%;
  }

  .hero-bg::before,
  .page-hero-bg::before {
    background-size: cover;
    background-position: center;
  }
}