/* ================================================
   MOBILE OPTIMIZATIONS FOR KITASEHAT
   Additional mobile-specific improvements
   ================================================ */

/* Extra Small Devices (< 400px) */
@media (max-width: 400px) {
  /* Hero Section */
  .hero-title {
    font-size: 1.5rem !important;
    margin-bottom: 1rem !important;
  }

  .hero-content .mb-3 h5,
  .hero-content .mb-4 h5 {
    font-size: 0.9rem !important;
    letter-spacing: 0.5px !important;
  }

  .hero-content .mb-3 .hero-subtitle,
  .hero-content .mb-4 .hero-subtitle {
    font-size: 0.8rem !important;
    margin-bottom: 0.75rem !important;
  }

  /* Logo Box Mobile Optimization */
  .hero-section .text-center[style*="background"] {
    padding: 1rem 0.75rem !important;
    margin-bottom: 1rem !important;
  }

  .hero-section .text-center[style*="background"] img {
    max-width: 110px !important;
  }

  /* Stats Section */
  .stat-card {
    padding: 1rem 0.5rem !important;
  }

  .stat-number i {
    font-size: 1.8rem !important;
  }

  .stat-label {
    font-size: 0.7rem !important;
    line-height: 1.3;
  }

  /* Feature Cards */
  .feature-icon {
    width: 50px !important;
    height: 50px !important;
    font-size: 1.4rem !important;
  }

  .feature-title {
    font-size: 1.05rem !important;
  }

  .feature-text {
    font-size: 0.875rem !important;
  }

  /* Buttons */
  .hero-btn {
    padding: 10px 20px !important;
    font-size: 0.875rem !important;
  }

  .cta-section .hero-btn {
    min-width: 150px !important;
    margin: 0.4rem 0.2rem !important;
  }
}

/* Small Devices Enhancements (400px - 576px) */
@media (min-width: 400px) and (max-width: 576px) {
  /* Logo Box */
  .hero-section .text-center[style*="background"] {
    padding: 1.25rem 1rem !important;
  }

  .hero-section .text-center[style*="background"] img {
    max-width: 130px !important;
  }

  /* Hero Typography */
  .hero-content .mb-3 h5,
  .hero-content .mb-4 h5 {
    font-size: 0.95rem !important;
  }

  .hero-content .mb-3 .hero-subtitle,
  .hero-content .mb-4 .hero-subtitle {
    font-size: 0.85rem !important;
  }
}

/* Medium Mobile Devices (577px - 768px) */
@media (min-width: 577px) and (max-width: 768px) {
  /* Logo Box */
  .hero-section .text-center[style*="background"] {
    padding: 1.5rem 1.25rem !important;
  }

  .hero-section .text-center[style*="background"] img {
    max-width: 150px !important;
  }

  /* Stat Cards - Better spacing */
  .stat-card {
    padding: 1.5rem 1rem !important;
  }

  /* Feature Cards Grid */
  .features-section .col-md-6 {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

/* Tablet Optimization (769px - 991px) */
@media (min-width: 769px) and (max-width: 991px) {
  /* Logo Box for tablet */
  .hero-section .text-center[style*="background"] {
    padding: 1.5rem 1rem !important;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
  }

  .hero-section .text-center[style*="background"] img {
    max-width: 140px !important;
  }

  /* Hero Content Spacing */
  .hero-content .mb-3,
  .hero-content .mb-4 {
    margin-bottom: 1.5rem !important;
  }
}

/* Landscape Mobile Orientation */
@media (max-width: 768px) and (orientation: landscape) {
  /* Compact Hero Section */
  .hero-section {
    min-height: auto !important;
    padding: 80px 0 40px !important;
  }

  .hero-title {
    font-size: 1.5rem !important;
    margin-bottom: 0.75rem !important;
  }

  .hero-content .mb-3,
  .hero-content .mb-4 {
    margin-bottom: 0.75rem !important;
  }

  .hero-content .mb-3 h5,
  .hero-content .mb-4 h5 {
    margin-bottom: 0.25rem !important;
  }

  .hero-content .mb-3 .hero-subtitle,
  .hero-content .mb-4 .hero-subtitle {
    font-size: 0.8rem !important;
    margin-bottom: 0.5rem !important;
  }

  /* Hide logo in landscape to save space */
  .hero-section .text-center[style*="background"] {
    padding: 1rem !important;
    margin-bottom: 1rem !important;
  }

  .hero-section .text-center[style*="background"] img {
    max-width: 100px !important;
  }

  .hero-image-mobile {
    display: none !important;
  }

  /* Compact sections */
  .features-section,
  .stats-section,
  .about-section,
  .cta-section {
    padding: 40px 0 !important;
  }
}

/* Touch Interaction Improvements */
@media (hover: none) and (pointer: coarse) {
  /* Larger touch targets */
  .nav-link {
    min-height: 48px;
    display: flex;
    align-items: center;
  }

  .hero-btn {
    min-height: 48px;
    min-width: 140px;
  }

  .gallery-item {
    cursor: pointer;
  }

  /* Disable hover effects on touch devices */
  .feature-card:hover,
  .gallery-item:hover {
    transform: none;
  }

  /* Add active state feedback */
  .hero-btn:active {
    transform: scale(0.97);
    opacity: 0.9;
  }

  .feature-card:active {
    transform: translateY(-3px);
  }

  .nav-link:active {
    opacity: 0.7;
  }
}

/* Improve Typography Readability */
@media (max-width: 768px) {
  /* Better line heights for mobile reading */
  .hero-subtitle,
  .section-subtitle,
  .feature-text {
    line-height: 1.7 !important;
  }

  /* Improve paragraph spacing */
  .about-section p {
    line-height: 1.8 !important;
    margin-bottom: 1.25rem !important;
  }

  /* CTA text readability */
  .cta-section p {
    line-height: 1.6 !important;
    padding: 0 1rem;
  }
}

/* Spacing & Padding Improvements */
@media (max-width: 576px) {
  /* Section padding optimization */
  .features-section,
  .about-section,
  .stats-section,
  .cta-section {
    padding: 45px 0 !important;
  }

  /* Card margins */
  .feature-card {
    margin-bottom: 1.25rem !important;
  }

  /* Footer spacing */
  .footer h5 {
    margin-top: 1.5rem !important;
    margin-bottom: 1rem !important;
  }

  .footer h5:first-child {
    margin-top: 0 !important;
  }
}

/* Performance Optimizations */
@media (max-width: 768px) {
  /* Reduce animation complexity on mobile */
  .gallery-track {
    animation-duration: 35s !important;
  }

  /* Simplify transitions */
  .feature-card,
  .stat-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease !important;
  }
}

/* Prevent Horizontal Scroll Issues */
@media (max-width: 768px) {
  body,
  html {
    overflow-x: hidden !important;
    width: 100% !important;
    position: relative !important;
  }

  .container {
    padding-left: 20px !important;
    padding-right: 20px !important;
  }

  .row {
    margin-left: -15px !important;
    margin-right: -15px !important;
  }
}

/* Loading Performance */
@media (max-width: 768px) {
  /* Lazy load optimization hint */
  img[loading="lazy"] {
    min-height: 200px;
    background: #f0f0f0;
  }
}

/* Accessibility Improvements */
@media (max-width: 768px) {
  /* Better focus states for keyboard navigation */
  a:focus,
  button:focus,
  .btn:focus {
    outline: 3px solid rgba(45, 122, 79, 0.5) !important;
    outline-offset: 2px !important;
  }

  /* Skip to content link */
  .skip-to-content {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary-green);
    color: white;
    padding: 8px;
    text-decoration: none;
    z-index: 100;
  }

  .skip-to-content:focus {
    top: 0;
  }
}

/* iOS Safari Specific Fixes */
@supports (-webkit-touch-callout: none) {
  @media (max-width: 768px) {
    /* Fix for iOS bottom bar */
    .hero-section {
      min-height: -webkit-fill-available;
    }

    /* Prevent zoom on input focus */
    input,
    select,
    textarea {
      font-size: 16px !important;
    }
  }
}

/* Dark Mode Support (Optional) */
@media (prefers-color-scheme: dark) and (max-width: 768px) {
  /* Optional: Adjust for dark mode if needed in future */
  .lightbox-modal {
    background: rgba(0, 0, 0, 0.98) !important;
  }
}
