/**
 * Mobile Responsiveness Improvements
 * Enhanced mobile-first design and touch-friendly interfaces
 */

/* Base mobile optimizations */
@media (max-width: 768px) {
  /* Base readable sizing */
  html { font-size: 17px; }
  body { line-height: 1.8; }

  /* Typography adjustments for mobile */
  h1, .h1 { font-size: 1.75rem; }
  h2, .h2 { font-size: 1.5rem; }
  h3, .h3 { font-size: 1.25rem; }
  h4, .h4 { font-size: 1.1rem; }
  h1, h2, h3, h4, h5, h6 { line-height: 1.25; }
  p, li { text-wrap: pretty; hyphens: auto; }
  .card-text { font-size: 1rem; line-height: 1.8; }
  
  /* Improved spacing */
  .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  
  /* Touch-friendly buttons */
  .btn {
    min-height: 48px;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
  }
  
  /* Mobile navigation improvements */
  .navbar-collapse {
    max-height: 70vh;
    overflow-y: auto;
    padding: 1rem 0;
  }
  
  .nav-link {
    padding: 0.75rem 1rem;
    font-size: 1.1rem;
  }
  
  /* Card improvements */
  .card {
    margin-bottom: 1rem;
  }
  
  .card-body {
    padding: 1rem;
  }
  
  /* Form improvements */
  .form-control,
  .form-select {
    min-height: 48px;
    font-size: 16px; /* Prevents zoom on iOS */
    padding: 0.75rem;
  }
  
  .form-label {
    font-size: 1rem;
    margin-bottom: 0.5rem;
  }
  
  /* Table responsiveness */
  .table-responsive {
    border: 0;
  }
  
  /* Modal improvements */
  .modal-dialog {
    margin: 0.5rem;
  }
  
  .modal-content {
    border-radius: 0.5rem;
  }
  
  /* Hero section adjustments */
  .home-hero {
    min-height: 60vh;
    padding: 2rem 0;
  }
  
  .display-4 {
    font-size: 2rem;
  }
  
  .lead {
    font-size: 1.125rem;
    line-height: 1.8;
  }
  
  /* Footer improvements */
  footer .col-lg-4,
  footer .col-lg-3,
  footer .col-md-6 {
    margin-bottom: 2rem;
  }
  
  /* Image optimizations */
  img {
    max-width: 100%;
    height: auto;
  }
  
  /* Grid improvements */
  .row.g-4 {
    --bs-gutter-y: 1.5rem;
  }
  /* Section rhythm */
  .section, .py-5 {
    padding-top: 2rem !important;
    padding-bottom: 2rem !important;
  }
  
  /* Badge and tag sizing */
  .badge {
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
  }
  
  /* Search and filter forms */
  .filter-form .col-md-3,
  .filter-form .col-md-4,
  .filter-form .col-md-6 {
    width: 100%;
    margin-bottom: 0.75rem;
  }
}

/* Extra small devices (portrait phones) */
@media (max-width: 576px) {
  /* Slightly reduce base size for very small screens */
  html { font-size: 16.5px; }
    /* Compact display heading */
    .display-4 { font-size: 1.9rem; }
  /* Reduced padding for very small screens */
  .py-5 {
    padding-top: 2rem !important;
    padding-bottom: 2rem !important;
  }
  
  .mb-5 {
    margin-bottom: 2rem !important;
  }
  
  /* Single column layouts */
  .row > [class*="col-"] {
    width: 100%;
  }
  
  /* Compact buttons */
  .btn-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .btn-group .btn {
    width: 100%;
  }
  
  /* Simplified navigation */
  .navbar-brand img {
    max-height: 48px;
  }
  
  /* Full-width CTAs */
  .cta-custom-tour {
    width: 100%;
    text-align: center;
  }
  
  /* Accordion improvements */
  .accordion-button {
    font-size: 1rem;
    padding: 1rem;
  }
  
  /* Breadcrumb improvements */
  .breadcrumb {
    font-size: 0.875rem;
    padding: 0.5rem 0;
  }
}

/* Landscape phone optimization */
@media (max-width: 768px) and (orientation: landscape) {
  .home-hero {
    min-height: 100vh;
  }
  
  .navbar-collapse {
    max-height: 50vh;
  }
}

/* Tablet optimizations */
@media (min-width: 768px) and (max-width: 992px) {
  .container {
    max-width: 720px;
  }
  
  /* Improved grid for tablets */
  .col-md-6 {
    flex: 0 0 50%;
    max-width: 50%;
  }
  
  .col-md-4 {
    flex: 0 0 50%;
    max-width: 50%;
  }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
  /* Larger touch targets */
  a, button, .btn, .nav-link, .card {
    -webkit-tap-highlight-color: rgba(255, 107, 53, 0.2);
  }
  
  /* Remove hover effects that don't work on touch */
  .card:hover {
    transform: none;
  }
  
  /* Improve dropdown menus for touch */
  .dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 200px;
  }
  
  /* Better spacing for touch */
  .list-group-item {
    padding: 1rem;
  }
}

/* High DPI displays (Retina) */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  /* Use higher quality images when available */
  .navbar-brand img {
    image-rendering: -webkit-optimize-contrast;
  }
}

/* Dark mode auto-detection disabled: site remains light by default.
   Manual dark mode is now available via adding class="theme-dark" on <body>. */
@media (prefers-color-scheme: dark) {
  :root {
    --bs-body-bg: #f5f7fa; /* keep light background even if system prefers dark */
    --bs-body-color: #2C3E50;
  }
}

/* Print styles */
@media print {
  /* Hide navigation and footers */
  .navbar, footer, .whatsapp-float, .btn {
    display: none !important;
  }
  
  /* Expand all content */
  .accordion-collapse {
    display: block !important;
    height: auto !important;
  }
  
  /* Optimize for printing */
  body {
    font-size: 12pt;
  }
  
  h1 { font-size: 18pt; }
  h2 { font-size: 16pt; }
  h3 { font-size: 14pt; }
  
  /* Prevent page breaks inside elements */
  .card, .section {
    page-break-inside: avoid;
  }
}

/* Safe area insets for notched devices (iPhone X+) */
@supports (padding: env(safe-area-inset-top)) {
  body {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
  
  .navbar {
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }
  
  .whatsapp-float {
    right: max(20px, env(safe-area-inset-right));
    bottom: max(20px, env(safe-area-inset-bottom));
  }
}
