/* SparkleTour Map - Responsive Styles */

/* Tablet and Below (768px) - Base tablet styles */
@media (max-width: 768px) {
  /* Logo Overlay */
  .overlay-logo {
    max-width: 140px;
    padding: 0.5rem 0.75rem;
    top: 0.75rem;
    left: 0.75rem;
  }
  
  /* Top Controls - Keep horizontal on tablet */
  .overlay-top-controls {
    top: 0.75rem;
    right: 0.75rem;
    flex-direction: row;
    gap: 0.75rem;
    align-items: center;
  }
  
  /* Help button wrapper */
  .help-button-wrapper {
    flex-shrink: 0;
  }
}

/* Tablet Medium Range (600px - 770px) - Prevent logo/controls overlap */
/* This must come AFTER the 768px query to override it */
@media (min-width: 600px) and (max-width: 770px) {
  /* Logo Overlay - Keep at top like other sizes */
  .overlay-logo {
    max-width: 110px !important;
    top: 0.75rem !important;
    left: 0.75rem !important;
  }
  
  /* Top Controls - Position BELOW the logo with clear separation */
  /* Logo is ~27px tall + 0.8rem padding + 0.75rem top = need ~3.5rem for controls */
  .overlay-top-controls {
    top: 3.5rem !important;
    right: 0.75rem !important;
  }
}

/* Continue with other tablet styles */
@media (max-width: 768px) {
  
  /* Social Links */
  .social-links-compact a {
    width: 36px;
    height: 36px;
  }
  
  .social-links-compact a img {
    width: 20px;
    height: 20px;
  }
  
  /* FAB - Positioning */
  .fab-container {
    right: 1.5rem;
  }
  
  /* Modal Adjustments */
  .modal-dialog {
    margin: 0.5rem;
    max-width: calc(100% - 1rem);
  }
  
  .modal-title {
    font-size: 1.125rem;
  }
  
  .modal-body {
    padding: 1rem;
  }
  
  /* Form Controls */
  .form-control {
    font-size: 0.9rem;
    padding: 0.625rem;
  }
  
  .btn-success {
    padding: 0.625rem 1.5rem;
    font-size: 0.95rem;
  }
  
  /* Leaflet Controls */
  .leaflet-top.leaflet-left {
    top: 4rem;
    left: 0.75rem;
  }
  
  .leaflet-top.leaflet-right {
    top: 4rem;
    right: 0.75rem;
  }
  
  /* Keep attribution at the bottom of the screen on tablet */
  .leaflet-bottom.leaflet-right {
    bottom: 0.5rem;
    right: 0.5rem;
  }
}

/* Mobile (576px and below) */
@media (max-width: 576px) {
  /* Logo Overlay */
  .overlay-logo {
    max-width: 120px;
    padding: 0.4rem 0.6rem;
    top: 0.5rem;
    left: 0.5rem;
  }
  
  /* Top Controls - Stack horizontally with proper alignment */
  .overlay-top-controls {
    top: 0.5rem;
    right: 0.5rem;
    gap: 0.5rem;
    flex-direction: row;
    align-items: center;
  }
  
  /* Help button wrapper - ensure it stays inline */
  .help-button-wrapper {
    flex-shrink: 0;
  }
  
  .help-button-wrapper .btn-link i {
    font-size: 1.75rem !important;
  }
  
  /* Social Links - Smaller */
  .social-links-compact {
    padding: 0.4rem;
    gap: 0.4rem;
  }
  
  .social-links-compact a {
    width: 32px;
    height: 32px;
  }
  
  .social-links-compact a img {
    width: 18px;
    height: 18px;
  }
  
  /* FAB - Positioning */
  .fab-container {
    right: 1rem;
  }
  
  /* Modal - Full screen on small devices */
  .modal-dialog {
    margin: 0;
    max-width: 100%;
    height: 100%;
  }
  
  .modal-content {
    border-radius: 0;
  }
  
  .modal-header {
    border-radius: 0;
  }
  
  .modal-footer {
    border-radius: 0;
  }
  
  .modal-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .modal-title {
    font-size: 1rem;
  }
  
  /* Form Adjustments */
  .form-label {
    font-size: 0.875rem;
    margin-bottom: 0.35rem;
  }
  
  .form-control {
    font-size: 0.875rem;
    padding: 0.5rem;
  }
  
  textarea.form-control {
    min-height: 80px;
  }
  
  .btn-success {
    padding: 0.5rem 1.25rem;
    font-size: 0.875rem;
  }
  
  /* Feature Checkboxes - Smaller */
  .feature-checkboxes label {
    font-size: 0.8rem;
  }
  
  /* Photo Preview - Smaller */
  #photo-preview img {
    max-height: 150px;
  }
  
  /* Leaflet Controls - Adjusted for small screens */
  .leaflet-top.leaflet-left {
    top: 3.5rem;
    left: 0.5rem;
  }
  
  .leaflet-top.leaflet-right {
    top: 3.5rem;
    right: 0.5rem;
  }
  
  .leaflet-bottom.leaflet-left {
    bottom: 0.5rem;
    left: 0.5rem;
  }
  
  /* Keep attribution at the very bottom of the screen on mobile */
  .leaflet-bottom.leaflet-right {
    bottom: 0.25rem;
    right: 0.5rem;
  }
  
  /* Leaflet Popup - Larger on mobile since controls are hidden */
  .leaflet-popup-content {
    margin: 1rem;
    font-size: 0.95rem;
  }
  
  .leaflet-popup-content-wrapper {
    max-width: 90vw !important;
    min-width: 320px !important;
  }
}

/* Very small screens - still generous sizing */
@media (max-width: 400px) {
  .leaflet-popup-content-wrapper {
    max-width: 90vw !important;
    min-width: 280px !important;
  }
  
  .leaflet-popup-content {
    margin: 0.875rem;
    font-size: 0.9rem;
  }
}

/* Landscape Mode on Mobile */
@media (max-width: 768px) and (orientation: landscape) {
  /* Reduce vertical spacing in landscape */
  .overlay-logo {
    top: 0.5rem;
    left: 0.5rem;
    max-width: 100px;
    padding: 0.35rem 0.5rem;
  }
  
  .overlay-top-controls {
    top: 0.5rem;
    right: 0.5rem;
  }
  
  .fab-container {
    right: 0.75rem;
  }
  
  /* Modal adjustments for landscape */
  .modal-dialog {
    margin: 0.5rem auto;
    max-height: 90vh;
  }
  
  .modal-content {
    display: flex;
    flex-direction: column;
  }
  
  .modal-body {
    flex: 1;
    overflow-y: auto;
    max-height: calc(90vh - 120px);
    padding: 0.75rem 1rem;
  }
  
  .modal-header,
  .modal-footer {
    flex-shrink: 0;
    padding: 0.75rem 1rem;
  }
  
  .modal-title {
    font-size: 1.125rem;
  }
  
  /* Action sheets should use more horizontal space */
  .map-action-sheet {
    max-height: 75vh;
    border-radius: 16px 16px 0 0;
  }
  
  .action-sheet-content {
    padding: 12px 16px;
  }
  
  .action-sheet-header {
    padding: 12px 16px;
  }
  
  .action-sheet-title {
    font-size: 1.125rem;
  }
  
  .action-sheet-footer {
    padding: 12px 16px;
  }
  
  /* Form controls in landscape */
  .form-control {
    padding: 0.5rem;
    font-size: 0.875rem;
  }
  
  .form-label {
    font-size: 0.875rem;
    margin-bottom: 0.35rem;
  }
  
  textarea.form-control {
    min-height: 60px;
  }
  
  /* Buttons in landscape */
  .btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
  }
  
  .btn-success,
  .btn-primary {
    padding: 0.625rem 1.25rem;
  }
}

/* Large Screens (1200px and above) - Logo size removed to keep consistent 160px max */
@media (min-width: 1200px) {
  /* Logo size now stays at base 160px for consistency */
  
  
  .modal-dialog {
    max-width: 800px;
  }
}

/* Print Styles */
@media print {
  .map-overlays,
  .fab-container,
  .overlay-top-controls,
  .leaflet-control-container {
    display: none !important;
  }
  
  .overlay-logo {
    position: static;
    max-width: 150px;
    margin-bottom: 1rem;
  }
  
  #map {
    height: 600px !important;
  }
}

/* Accessibility - Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .fab:hover,
  .overlay-logo:hover,
  .social-links-compact a:hover {
    transform: none;
  }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  .overlay-logo,
  .social-links-compact {
    border: 2px solid currentColor;
  }
  
  .fab {
    border: 3px solid white;
  }
}