/* 
 * Veteran Property Network - Mobile & Responsive Optimization
 * Comprehensive mobile-first responsive design
 */

/* ============================================================================
   BASE RESPONSIVE UTILITIES
   ============================================================================ */

/* Prevent horizontal scroll on mobile */
html, body {
  max-width: 100%;
  overflow-x: hidden;
}

/* Smooth scrolling for mobile */
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

/* Touch optimization */
* {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

/* ============================================================================
   MOBILE TYPOGRAPHY
   ============================================================================ */

/* Base font size adjustments for mobile readability */
@media (max-width: 640px) {
  body {
    font-size: 16px; /* Prevents iOS zoom on input focus */
  }
  
  h1 {
    font-size: 2rem !important; /* 32px */
    line-height: 2.25rem !important;
  }
  
  h2 {
    font-size: 1.75rem !important; /* 28px */
    line-height: 2rem !important;
  }
  
  h3 {
    font-size: 1.5rem !important; /* 24px */
    line-height: 1.75rem !important;
  }
  
  h4 {
    font-size: 1.25rem !important; /* 20px */
    line-height: 1.5rem !important;
  }
  
  p, li {
    font-size: 1rem !important; /* 16px */
    line-height: 1.5rem !important;
  }
  
  small, .text-sm {
    font-size: 0.875rem !important; /* 14px */
  }
}

/* ============================================================================
   MOBILE NAVIGATION
   ============================================================================ */

@media (max-width: 768px) {
  /* Navigation bar adjustments */
  nav {
    padding: 0.75rem 1rem !important;
  }
  
  .nav-logo {
    font-size: 1.25rem !important;
  }
  
  /* Hamburger menu - ensure visibility */
  .mobile-menu-button {
    display: block !important;
    z-index: 50;
  }
  
  /* Hide desktop nav items on mobile */
  .desktop-nav {
    display: none !important;
  }
  
  /* Mobile menu overlay */
  .mobile-menu {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 40;
  }
  
  .mobile-menu-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 80%;
    max-width: 320px;
    height: 100vh;
    background: white;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
    overflow-y: auto;
    z-index: 50;
  }
}

/* ============================================================================
   MOBILE CONTAINERS & SPACING
   ============================================================================ */

@media (max-width: 640px) {
  /* Container padding adjustments */
  .container, 
  [class*="max-w-"] {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }
  
  /* Section spacing - reduce for mobile */
  section {
    padding-top: 3rem !important;
    padding-bottom: 3rem !important;
  }
  
  /* Card spacing */
  .card, 
  .liquid-card,
  [class*="bg-white"] {
    margin-bottom: 1rem !important;
  }
  
  /* Grid adjustments */
  .grid {
    gap: 1rem !important;
  }
}

/* ============================================================================
   MOBILE BUTTONS & FORMS
   ============================================================================ */

@media (max-width: 640px) {
  /* Touch-friendly button sizes */
  button,
  .btn,
  a[class*="btn"],
  input[type="submit"] {
    min-height: 44px !important; /* iOS touch target recommendation */
    padding: 0.75rem 1.25rem !important;
    font-size: 1rem !important;
  }
  
  /* Full-width buttons on mobile */
  .mobile-full-width {
    width: 100% !important;
  }
  
  /* Form inputs */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="tel"],
  input[type="number"],
  input[type="search"],
  select,
  textarea {
    font-size: 16px !important; /* Prevents iOS zoom */
    min-height: 44px !important;
    padding: 0.75rem 1rem !important;
  }
  
  /* Search bars */
  .search-input {
    width: 100% !important;
  }
}

/* ============================================================================
   MOBILE CARDS & LISTINGS
   ============================================================================ */

@media (max-width: 640px) {
  /* Property cards */
  .property-card,
  .listing-card {
    width: 100% !important;
    margin-bottom: 1rem !important;
  }
  
  /* Card images */
  .card-image img {
    width: 100% !important;
    height: auto !important;
    max-height: 240px !important;
    object-fit: cover !important;
  }
  
  /* Card content padding */
  .card-body,
  .card-content {
    padding: 1rem !important;
  }
  
  /* Badge sizing */
  .badge,
  [class*="badge"] {
    font-size: 0.75rem !important;
    padding: 0.25rem 0.5rem !important;
  }
}

/* ============================================================================
   MOBILE TABLES
   ============================================================================ */

@media (max-width: 768px) {
  /* Responsive table wrapper */
  .table-responsive {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }
  
  table {
    min-width: 600px !important;
    font-size: 0.875rem !important;
  }
  
  th, td {
    padding: 0.5rem !important;
  }
}

/* ============================================================================
   MOBILE MODALS & OVERLAYS
   ============================================================================ */

@media (max-width: 640px) {
  /* Modal sizing */
  .modal,
  [role="dialog"] {
    width: 95% !important;
    max-width: 95% !important;
    max-height: 90vh !important;
    margin: 1rem !important;
  }
  
  .modal-body {
    padding: 1rem !important;
  }
  
  /* Full-screen modals on small screens */
  .modal-fullscreen-sm {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    margin: 0 !important;
    border-radius: 0 !important;
  }
}

/* ============================================================================
   MOBILE MAP VIEW
   ============================================================================ */

@media (max-width: 768px) {
  /* Map container */
  .map-container {
    height: 300px !important;
    width: 100% !important;
  }
  
  /* Map controls */
  .map-controls {
    position: fixed !important;
    bottom: 1rem !important;
    left: 1rem !important;
    right: 1rem !important;
    z-index: 20 !important;
  }
  
  /* Listings panel - collapsible on mobile */
  .listings-panel {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    max-height: 50vh !important;
    overflow-y: auto !important;
    background: white !important;
    border-radius: 1rem 1rem 0 0 !important;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15) !important;
  }
}

/* ============================================================================
   MOBILE FILTERS
   ============================================================================ */

@media (max-width: 640px) {
  /* Filter panel */
  .filter-panel,
  #contextual-filters-container {
    padding: 1rem !important;
    border-radius: 1rem !important;
  }
  
  /* Filter buttons */
  .filter-btn,
  .context-filter-btn {
    font-size: 0.875rem !important;
    padding: 0.625rem 1rem !important;
  }
  
  /* Property type toggle */
  .property-type-toggle {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 0.5rem !important;
  }
  
  .property-type-toggle button {
    font-size: 0.875rem !important;
    padding: 0.75rem !important;
  }
  
  /* Filter dropdowns */
  select.filter-select {
    width: 100% !important;
    font-size: 1rem !important;
  }
}

/* ============================================================================
   MOBILE MESSAGES & CHAT
   ============================================================================ */

@media (max-width: 768px) {
  /* Messages split view - stack on mobile */
  .messages-container {
    flex-direction: column !important;
  }
  
  .messages-list {
    width: 100% !important;
    max-height: 40vh !important;
  }
  
  .message-thread {
    width: 100% !important;
    height: 60vh !important;
  }
  
  /* Message input */
  .message-input {
    padding: 0.75rem !important;
  }
  
  .message-input textarea {
    min-height: 44px !important;
  }
}

/* ============================================================================
   MOBILE APPLICATIONS
   ============================================================================ */

@media (max-width: 768px) {
  /* Application cards */
  .application-card {
    width: 100% !important;
    padding: 1rem !important;
  }
  
  /* Application sections */
  .application-section {
    margin-bottom: 1.5rem !important;
  }
  
  /* Split view - stack on mobile */
  .application-split-view {
    flex-direction: column !important;
  }
  
  .application-list,
  .application-detail {
    width: 100% !important;
  }
}

/* ============================================================================
   MOBILE FOOTER
   ============================================================================ */

@media (max-width: 768px) {
  /* Footer layout */
  footer {
    padding: 2rem 1rem !important;
  }
  
  .footer-grid {
    grid-template-columns: 1fr !important;
    gap: 2rem !important;
  }
  
  /* Footer links */
  .footer-links {
    flex-direction: column !important;
    gap: 1rem !important;
  }
  
  /* Social icons */
  .social-icons {
    justify-content: center !important;
  }
}

/* ============================================================================
   MOBILE HERO SECTIONS
   ============================================================================ */

@media (max-width: 640px) {
  /* Hero section */
  .hero {
    padding: 3rem 1rem !important;
    min-height: auto !important;
  }
  
  .hero h1 {
    font-size: 2rem !important;
    line-height: 2.25rem !important;
  }
  
  .hero p {
    font-size: 1rem !important;
  }
  
  /* Hero CTA buttons */
  .hero-cta {
    flex-direction: column !important;
    width: 100% !important;
  }
  
  .hero-cta button,
  .hero-cta a {
    width: 100% !important;
    margin-bottom: 0.75rem !important;
  }
}

/* ============================================================================
   MOBILE STATISTICS & METRICS
   ============================================================================ */

@media (max-width: 640px) {
  /* Stats grid */
  .stats-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }
  
  .stat-card {
    padding: 1rem !important;
  }
  
  .stat-value {
    font-size: 2rem !important;
  }
}

/* ============================================================================
   MOBILE IMAGE OPTIMIZATION
   ============================================================================ */

@media (max-width: 640px) {
  /* Responsive images */
  img {
    max-width: 100% !important;
    height: auto !important;
  }
  
  /* Logo sizing */
  .logo img {
    max-height: 40px !important;
  }
  
  /* Avatar sizing */
  .avatar {
    width: 40px !important;
    height: 40px !important;
  }
}

/* ============================================================================
   MOBILE ANIMATIONS & TRANSITIONS
   ============================================================================ */

@media (max-width: 640px) {
  /* Reduce motion for performance */
  @media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
    }
  }
  
  /* Simplified transitions on mobile */
  * {
    transition-duration: 200ms !important;
  }
}

/* ============================================================================
   MOBILE UTILITY CLASSES
   ============================================================================ */

/* Show/hide utilities */
@media (max-width: 640px) {
  .hide-mobile {
    display: none !important;
  }
  
  .show-mobile {
    display: block !important;
  }
}

@media (min-width: 641px) {
  .hide-desktop {
    display: none !important;
  }
  
  .show-desktop {
    display: block !important;
  }
}

/* Mobile-specific spacing */
@media (max-width: 640px) {
  .mobile-p-4 {
    padding: 1rem !important;
  }
  
  .mobile-px-4 {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }
  
  .mobile-py-4 {
    padding-top: 1rem !important;
    padding-bottom: 1rem !important;
  }
  
  .mobile-m-4 {
    margin: 1rem !important;
  }
  
  .mobile-mt-4 {
    margin-top: 1rem !important;
  }
  
  .mobile-mb-4 {
    margin-bottom: 1rem !important;
  }
}

/* ============================================================================
   TABLET SPECIFIC (768px - 1024px)
   ============================================================================ */

@media (min-width: 768px) and (max-width: 1024px) {
  /* Container adjustments for tablet */
  .container {
    padding-left: 2rem !important;
    padding-right: 2rem !important;
  }
  
  /* Grid adjustments */
  .grid-cols-3 {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  
  /* Font size adjustments */
  h1 {
    font-size: 2.5rem !important;
  }
  
  h2 {
    font-size: 2rem !important;
  }
}

/* ============================================================================
   LANDSCAPE MOBILE (667px height or less)
   ============================================================================ */

@media (max-height: 667px) and (orientation: landscape) {
  /* Reduce vertical spacing */
  section {
    padding-top: 2rem !important;
    padding-bottom: 2rem !important;
  }
  
  /* Compact navigation */
  nav {
    padding: 0.5rem 1rem !important;
  }
  
  /* Adjust modal heights */
  .modal {
    max-height: 85vh !important;
  }
}

/* ============================================================================
   HIGH DPI SCREENS (Retina)
   ============================================================================ */

@media (-webkit-min-device-pixel-ratio: 2), 
       (min-resolution: 192dpi) {
  /* Enhance borders and shadows for crisp rendering */
  .liquid-card,
  .card {
    border-width: 0.5px !important;
  }
}

/* ============================================================================
   SAFE AREAS (iPhone X+, Notch Devices)
   ============================================================================ */

@supports (padding: env(safe-area-inset-top)) {
  body {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }
  
  /* Fixed navigation */
  nav.fixed {
    padding-top: calc(env(safe-area-inset-top) + 0.5rem) !important;
  }
  
  /* Fixed footer */
  footer.fixed {
    padding-bottom: calc(env(safe-area-inset-bottom) + 1rem) !important;
  }
}

/* ============================================================================
   PRINT STYLES
   ============================================================================ */

@media print {
  /* Hide non-essential elements */
  nav,
  footer,
  .no-print,
  button {
    display: none !important;
  }
  
  /* Optimize for printing */
  body {
    background: white !important;
    color: black !important;
  }
  
  .container {
    max-width: 100% !important;
  }
}

/* ============================================================================
   MOBILE SEARCH PAGE - COMPLETE OPTIMIZATION
   Premium mobile experience for property search
   ============================================================================ */

/* Mobile View Container - Stack Layout */
@media (max-width: 1024px) {
  .map-view-container {
    display: flex !important;
    flex-direction: column !important;
    height: calc(100vh - 64px) !important;
    position: relative !important;
    overflow: hidden !important;
    margin-top: 0 !important;
  }
  
  /* Map takes full screen on mobile by default */
  .map-container {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 1 !important;
  }
  
  #map {
    width: 100% !important;
    height: 100% !important;
  }
  
  /* Listings Panel as Bottom Sheet */
  .map-listings-panel {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 100% !important;
    height: auto !important;
    max-height: 70vh !important;
    border-radius: 24px 24px 0 0 !important;
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.15) !important;
    z-index: 100 !important;
    transform: translateY(calc(100% - 120px)) !important;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
    border-right: none !important;
    overflow: hidden !important;
  }
  
  .map-listings-panel.expanded {
    transform: translateY(0) !important;
    max-height: 85vh !important;
  }
  
  .map-listings-panel.collapsed {
    transform: translateY(calc(100% - 60px)) !important;
  }
  
  /* Full screen list view mode */
  .map-listings-panel.full-list-view {
    transform: translateY(0) !important;
    max-height: 100vh !important;
    height: 100vh !important;
    border-radius: 0 !important;
    z-index: 200 !important;
  }
}

/* Mobile Search Header Optimization */
@media (max-width: 768px) {
  .search-header-premium {
    position: relative !important;
  }
  
  .search-header-premium .relative.p-5 {
    padding: 16px !important;
  }
  
  /* Mobile Location Search Input */
  .location-search-container {
    margin-bottom: 0 !important;
  }
  
  .location-search-container .relative.group {
    margin: 0 !important;
  }
  
  .location-search-container .relative.flex.items-center {
    border-radius: 16px !important;
  }
  
  .location-search-container .w-14.h-14 {
    width: 48px !important;
    height: 48px !important;
    min-width: 48px !important;
  }
  
  .location-search-container input {
    font-size: 16px !important; /* Prevents iOS zoom */
    padding: 14px 12px !important;
  }
  
  .location-search-container .mr-3.w-10.h-10 {
    display: none !important; /* Hide mic button on mobile */
  }
  
  /* Quick Location Tags - Horizontal Scroll */
  .search-header-premium .flex.flex-wrap.gap-2.mt-4 {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
    padding-bottom: 8px !important;
    margin-top: 12px !important;
    gap: 8px !important;
  }
  
  .search-header-premium .flex.flex-wrap.gap-2.mt-4::-webkit-scrollbar {
    display: none !important;
  }
  
  .search-header-premium .flex.flex-wrap.gap-2.mt-4 button {
    flex-shrink: 0 !important;
    padding: 10px 14px !important;
    font-size: 13px !important;
    white-space: nowrap !important;
  }
}

/* Mobile Property Type Toggle */
@media (max-width: 768px) {
  .property-type-toggle-premium {
    gap: 8px !important;
    padding: 4px !important;
    border-radius: 16px !important;
  }
  
  .property-type-toggle-premium button {
    padding: 12px 14px !important;
    border-radius: 12px !important;
    gap: 10px !important;
  }
  
  .property-type-toggle-premium button .toggle-icon {
    width: 38px !important;
    height: 38px !important;
    border-radius: 10px !important;
    font-size: 16px !important;
  }
  
  .property-type-toggle-premium button .toggle-label {
    font-size: 14px !important;
  }
  
  .property-type-toggle-premium button .toggle-sublabel {
    font-size: 10px !important;
  }
  
  /* Type selector container padding */
  .p-5.bg-gradient-to-b {
    padding: 12px 16px !important;
  }
}

/* Mobile Filters - Collapsible Accordion Style */
@media (max-width: 768px) {
  #contextual-filters {
    max-height: 50vh !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }
  
  #rooms-filters,
  #homes-filters {
    padding: 12px !important;
  }
  
  #rooms-filters .space-y-4,
  #homes-filters .space-y-4 {
    gap: 12px !important;
  }
  
  /* Filter Cards - More Compact */
  .filter-card {
    padding: 12px !important;
    border-radius: 12px !important;
    margin-bottom: 10px !important;
  }
  
  .filter-card.military-card {
    margin-bottom: 10px !important;
  }
  
  .filter-label {
    font-size: 13px !important;
    margin-bottom: 8px !important;
  }
  
  /* Filter Chips - Touch Friendly */
  .filter-chip,
  .filter-chip-sm {
    min-height: 44px !important;
    padding: 10px 14px !important;
    font-size: 13px !important;
    border-radius: 10px !important;
  }
  
  /* Budget Chips - Horizontal Scroll */
  .flex.gap-1\.5.mt-2,
  .flex.gap-1\.5.mt-2.flex-wrap {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    padding-bottom: 4px !important;
  }
  
  .flex.gap-1\.5.mt-2::-webkit-scrollbar {
    display: none !important;
  }
  
  .budget-chip {
    flex-shrink: 0 !important;
    min-height: 38px !important;
    padding: 8px 14px !important;
    font-size: 12px !important;
    white-space: nowrap !important;
  }
  
  /* Toggle Rows - Touch Friendly */
  .premium-toggle-row {
    padding: 12px !important;
    min-height: 52px !important;
    border-radius: 10px !important;
  }
  
  .toggle-icon-sm {
    width: 36px !important;
    height: 36px !important;
  }
  
  .toggle-text {
    font-size: 13px !important;
  }
  
  /* Toggle Switch - Larger for Touch */
  .premium-toggle {
    min-width: 52px !important;
    min-height: 32px !important;
  }
  
  .premium-toggle .toggle-slider {
    width: 52px !important;
    height: 32px !important;
  }
  
  .premium-toggle .toggle-slider::before {
    width: 26px !important;
    height: 26px !important;
  }
  
  /* Bed/Bath Selector - Touch Friendly */
  .bed-bath-selector {
    gap: 6px !important;
  }
  
  .bb-btn {
    min-height: 40px !important;
    min-width: 40px !important;
    padding: 8px 10px !important;
    font-size: 12px !important;
    border-radius: 8px !important;
  }
  
  /* Filter Select - Touch Friendly */
  .filter-select {
    min-height: 48px !important;
    font-size: 16px !important;
    padding: 12px 14px !important;
    border-radius: 10px !important;
  }
  
  /* Filter Input - Touch Friendly */
  .filter-input {
    min-height: 48px !important;
    font-size: 16px !important;
    padding: 12px 14px !important;
    border-radius: 10px !important;
  }
  
  /* Military Card - Compact */
  .filter-card.military-card .w-10.h-10 {
    width: 36px !important;
    height: 36px !important;
  }
  
  .filter-card.military-card .font-bold.text-gray-900.text-sm {
    font-size: 13px !important;
  }
  
  /* Listing Type Cards */
  .listing-type-card {
    padding: 12px !important;
    border-radius: 12px !important;
  }
  
  .ltc-icon {
    width: 36px !important;
    height: 36px !important;
  }
  
  .ltc-label {
    font-size: 13px !important;
  }
  
  .ltc-sublabel {
    font-size: 10px !important;
  }
  
  /* Loan Type Cards */
  .loan-type-card {
    padding: 12px !important;
    font-size: 12px !important;
    border-radius: 10px !important;
    min-height: 44px !important;
  }
  
  /* Assumable Banner - Compact */
  .assumable-banner {
    padding: 14px !important;
    border-radius: 12px !important;
    margin-bottom: 10px !important;
  }
  
  .assumable-banner .w-12.h-12 {
    width: 40px !important;
    height: 40px !important;
  }
}

/* Mobile Results Header */
@media (max-width: 768px) {
  .results-header-premium {
    padding: 12px 16px !important;
  }
  
  .results-count-premium .count-number {
    font-size: 20px !important;
  }
  
  .results-count-premium .count-label {
    font-size: 12px !important;
  }
  
  .sort-select-premium {
    font-size: 14px !important;
    padding: 8px 28px 8px 10px !important;
    min-height: 40px !important;
  }
  
  /* Active Filters Tags - Horizontal Scroll */
  .active-filters-container {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 8px 0 !important;
    gap: 8px !important;
  }
  
  .active-filters-container::-webkit-scrollbar {
    display: none !important;
  }
}

/* Mobile Account Promo Banner */
@media (max-width: 768px) {
  .promo-banner-premium {
    margin: 12px !important;
    padding: 14px !important;
    border-radius: 14px !important;
  }
  
  .promo-banner-premium .flex.items-start.gap-4 {
    gap: 12px !important;
  }
  
  .promo-icon {
    width: 44px !important;
    height: 44px !important;
    font-size: 16px !important;
  }
  
  .promo-banner-premium h3 {
    font-size: 14px !important;
  }
  
  .promo-banner-premium p {
    font-size: 12px !important;
    margin-bottom: 10px !important;
  }
  
  .promo-btn-primary,
  .promo-btn-secondary {
    padding: 10px 14px !important;
    font-size: 12px !important;
    border-radius: 8px !important;
  }
}

/* Mobile Listing Cards */
@media (max-width: 768px) {
  #map-listings-container {
    padding: 8px !important;
  }
  
  .map-listing-card {
    margin: 8px !important;
    border-radius: 14px !important;
  }
  
  .map-listing-image {
    height: 160px !important;
  }
  
  .map-listing-price {
    padding: 6px 12px !important;
    font-size: 1rem !important;
    border-radius: 8px !important;
  }
  
  .map-listing-military,
  .map-listing-assumable {
    padding: 5px 10px !important;
    font-size: 0.7rem !important;
    border-radius: 6px !important;
  }
  
  .map-listing-assumable {
    top: 40px !important;
  }
  
  .map-listing-content {
    padding: 12px !important;
  }
  
  .map-listing-title {
    font-size: 0.9rem !important;
    margin-bottom: 6px !important;
  }
  
  .map-listing-address {
    font-size: 0.8rem !important;
    margin-bottom: 10px !important;
  }
  
  .map-listing-details {
    gap: 12px !important;
    padding-top: 10px !important;
    font-size: 0.8rem !important;
  }
  
  /* Empty State */
  .empty-state-premium {
    padding: 30px 20px !important;
  }
  
  .empty-icon {
    width: 60px !important;
    height: 60px !important;
    font-size: 24px !important;
  }
  
  .empty-title {
    font-size: 18px !important;
  }
  
  .empty-subtitle {
    font-size: 14px !important;
  }
  
  .empty-suggestion-btn {
    padding: 8px 14px !important;
    font-size: 12px !important;
  }
}

/* Mobile Map Controls */
@media (max-width: 768px) {
  .map-controls {
    top: 12px !important;
    left: 12px !important;
    right: auto !important;
    gap: 8px !important;
    flex-direction: column !important;
  }
  
  .map-control-btn {
    padding: 10px 14px !important;
    font-size: 13px !important;
    border-radius: 12px !important;
    min-height: 44px !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12) !important;
  }
  
  .map-control-btn span {
    display: none !important;
  }
  
  .map-control-btn i {
    margin-right: 0 !important;
    font-size: 16px !important;
  }
  
  .map-toggle-list {
    top: 12px !important;
    right: 12px !important;
  }
  
  /* Mobile Map Loading */
  .map-loading {
    padding: 16px 24px !important;
    border-radius: 14px !important;
  }
  
  .map-loading-text {
    font-size: 0.875rem !important;
  }
}

/* Mobile Bottom Sheet Handle */
@media (max-width: 1024px) {
  .map-listings-panel::before {
    content: '' !important;
    display: block !important;
    width: 40px !important;
    height: 5px !important;
    background: rgba(0, 0, 0, 0.2) !important;
    border-radius: 3px !important;
    margin: 12px auto !important;
  }
}

/* Mobile View Toggle Button */
@media (max-width: 1024px) {
  .mobile-view-toggle {
    position: fixed !important;
    bottom: 130px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    z-index: 150 !important;
    display: flex !important;
    gap: 8px !important;
    background: white !important;
    padding: 6px !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15) !important;
  }
  
  .mobile-view-toggle.panel-expanded {
    bottom: 20px !important;
  }
  
  .view-toggle-btn {
    padding: 10px 16px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    border-radius: 8px !important;
    border: none !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
  }
  
  .view-toggle-btn.active {
    background: linear-gradient(135deg, var(--vpn-blue-600, #006AFF) 0%, var(--vpn-blue-700, #0052CC) 100%) !important;
    color: white !important;
    box-shadow: 0 4px 12px rgba(0, 106, 255, 0.3) !important;
  }
  
  .view-toggle-btn:not(.active) {
    background: transparent !important;
    color: var(--gray-600, #757575) !important;
  }
  
  .view-toggle-btn:not(.active):hover {
    background: var(--gray-100, #F5F5F5) !important;
  }
}

/* Desktop: Hide mobile-specific elements */
@media (min-width: 1025px) {
  .mobile-view-toggle {
    display: none !important;
  }
  
  .map-listings-panel::before {
    display: none !important;
  }
}

/* Advanced Filters Modal - Mobile Optimization */
@media (max-width: 768px) {
  #filters-modal {
    padding: 0 !important;
    align-items: flex-end !important;
  }
  
  #filters-modal > div {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 90vh !important;
    border-radius: 24px 24px 0 0 !important;
    margin: 0 !important;
  }
  
  #filters-modal .sticky.top-0 {
    padding: 16px 20px !important;
    border-radius: 24px 24px 0 0 !important;
  }
  
  #filters-modal .sticky.top-0 h2 {
    font-size: 18px !important;
  }
  
  #filters-modal .p-6.space-y-6 {
    padding: 16px 20px !important;
    gap: 16px !important;
  }
  
  #filters-modal .grid.grid-cols-2 {
    gap: 12px !important;
  }
  
  #filters-modal select,
  #filters-modal input {
    min-height: 48px !important;
    font-size: 16px !important;
  }
  
  #filters-modal .space-y-3 label {
    min-height: 44px !important;
  }
  
  #filters-modal .space-y-3 input[type="checkbox"] {
    width: 24px !important;
    height: 24px !important;
  }
  
  #filters-modal .sticky.bottom-0 {
    padding: 16px 20px !important;
  }
  
  #filters-modal .sticky.bottom-0 button {
    min-height: 48px !important;
    font-size: 14px !important;
  }
}

/* Smooth scroll behavior for mobile */
@media (max-width: 1024px) {
  .map-listings-panel,
  #contextual-filters,
  #map-listings-container {
    scroll-behavior: smooth !important;
    overscroll-behavior: contain !important;
  }
}

/* Touch targets - ensure minimum 44px */
@media (max-width: 768px) {
  .filter-card button,
  .filter-card input,
  .filter-card select,
  .filter-card label,
  .map-listing-card {
    touch-action: manipulation !important;
  }
}

/* Landscape Mobile Optimization */
@media (max-width: 1024px) and (orientation: landscape) {
  .map-listings-panel {
    max-height: 60vh !important;
    transform: translateY(calc(100% - 80px)) !important;
  }
  
  .map-listings-panel.expanded {
    max-height: 75vh !important;
  }
  
  #contextual-filters {
    max-height: 35vh !important;
  }
}

/* Small Mobile Screens (SE, etc) */
@media (max-width: 375px) {
  .search-header-premium .relative.p-5 {
    padding: 12px !important;
  }
  
  .location-search-container .w-14.h-14 {
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
  }
  
  .property-type-toggle-premium button .toggle-icon {
    width: 32px !important;
    height: 32px !important;
  }
  
  .property-type-toggle-premium button {
    padding: 10px 12px !important;
    gap: 8px !important;
  }
  
  .filter-card {
    padding: 10px !important;
  }
  
  .mobile-view-toggle {
    bottom: 110px !important;
  }
  
  .view-toggle-btn {
    padding: 8px 14px !important;
    font-size: 12px !important;
  }
}
