/* =====================================================================
   LAKÁSŐR - Mobile Navigation Enhancements
   Bottom tab bar ONLY in standalone PWA mode (Add to Home Screen)
   ===================================================================== */

/* =====================================================================
   DEFAULT STATE: Browser mode (no tab bar)
   ===================================================================== */

/* Hide tab bar by default in all browsers */
.tab-bar {
  display: none !important;
}

/* No bottom padding needed in browser mode */
.app-view {
  padding-bottom: 0;
}

/* Footer visible normally */
.footer {
  padding-bottom: var(--space-8);
}

/* =====================================================================
   STANDALONE PWA MODE: Show tab bar on mobile only
   ===================================================================== */

/* Mobile standalone: show tab bar, hide navbar */
@media (max-width: 768px) {
  .pwa-standalone .tab-bar {
    display: flex !important;
  }
  
  .pwa-standalone .navbar {
    display: none !important;
  }
  
  .pwa-standalone .app-view {
    padding-bottom: var(--tab-bar-height, 83px);
  }
  
  /* Safe area for iOS notch at top when navbar hidden */
  .pwa-standalone main,
  .pwa-standalone .page-content {
    padding-top: max(var(--space-4), env(safe-area-inset-top, 0px));
  }
  
  .pwa-standalone .hero {
    padding-top: max(var(--space-8), calc(env(safe-area-inset-top, 0px) + var(--space-4)));
  }
  
  /* Footer needs extra padding to not be hidden behind tab bar */
  .pwa-standalone .footer {
    padding-bottom: calc(var(--tab-bar-height, 83px) + var(--space-8) + env(safe-area-inset-bottom, 0px));
  }
}

/* Desktop: always show navbar, never show tab bar (even in standalone) */
@media (min-width: 769px) {
  .pwa-standalone .tab-bar {
    display: none !important;
  }
  
  .pwa-standalone .navbar {
    display: block !important;
  }
  
  .pwa-standalone .app-view {
    padding-bottom: 0;
  }
  
  .pwa-standalone .footer {
    padding-bottom: var(--space-8);
  }
}

/* =====================================================================
   ENHANCED MOBILE CARD STYLES
   ===================================================================== */

@media (max-width: 768px) {
  /* Glass card enhancements */
  .glass-card,
  .card,
  .feature-card {
    border-radius: 16px;
    margin: 12px;
    transition: transform 0.2s cubic-bezier(0.23, 1, 0.32, 1);
  }
  
  .glass-card:active,
  .card:active,
  .feature-card:active {
    transform: scale(0.98);
  }
  
  /* Container adjustments */
  .container {
    padding-left: 16px;
    padding-right: 16px;
  }
  
  /* Section spacing */
  section {
    padding-top: 24px;
    padding-bottom: 24px;
  }
  
  /* Buttons - larger touch targets */
  .btn,
  .btn-primary,
  .btn-secondary {
    min-height: 50px;
    font-size: 17px;
    border-radius: 12px;
    transition: transform 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  }
  
  .btn:active,
  .btn-primary:active,
  .btn-secondary:active {
    transform: scale(0.97);
  }
  
  /* Form inputs - native feel (exclude checkboxes and radios) */
  input:not([type="checkbox"]):not([type="radio"]),
  select,
  textarea {
    min-height: 50px;
    font-size: 17px;
    border-radius: 12px;
    border-width: 1.5px;
    padding: 0 16px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
  }
  
  input:not([type="checkbox"]):not([type="radio"]):focus,
  select:focus,
  textarea:focus {
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
    border-color: var(--color-primary);
  }
  
  textarea {
    padding: 12px 16px;
  }
  
  /* Labels - don't override display for inline checkbox labels */
  label:not(.inline-label) {
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 8px;
  }
  
  /* Results sections */
  .results-grid,
  .result-card {
    border-radius: 16px;
  }
}

/* =====================================================================
   SMOOTH SCROLL BEHAVIOR
   ===================================================================== */

html {
  scroll-behavior: smooth;
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* =====================================================================
   TOUCH FEEDBACK ENHANCEMENTS
   ===================================================================== */

/* Disable text selection on interactive elements */
.btn,
.tab-bar-item,
.navbar-link,
.card,
.feature-card,
button {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

/* Active state feedback */
.btn:active,
.tab-bar-item:active,
.navbar-link:active,
a.card:active,
a.feature-card:active {
  opacity: 0.85;
}

/* =====================================================================
   LOADING STATES FOR INTERACTIVITY
   ===================================================================== */

.btn.loading {
  pointer-events: none;
  opacity: 0.7;
  position: relative;
}

.btn.loading::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  top: 50%;
  left: 50%;
  margin-top: -10px;
  margin-left: -10px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: buttonSpinner 0.6s linear infinite;
}

@keyframes buttonSpinner {
  to {
    transform: rotate(360deg);
  }
}

/* =====================================================================
   SCROLL SNAP FOR HORIZONTAL CAROUSELS
   ===================================================================== */

.scroll-snap-x {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
  margin: 0 -16px;
}

.scroll-snap-x::-webkit-scrollbar {
  display: none;
}

.scroll-snap-x > * {
  scroll-snap-align: start;
  flex-shrink: 0;
}

/* =====================================================================
   IMPROVED FOCUS STATES FOR ACCESSIBILITY
   ===================================================================== */

:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Remove focus ring for mouse users */
:focus:not(:focus-visible) {
  outline: none;
}

/* =====================================================================
   STANDALONE MODE (INSTALLED PWA) - Additional fixes
   ===================================================================== */

@media (display-mode: standalone) {
  /* Hide install prompts when already installed */
  .pwa-install-prompt,
  .install-button {
    display: none !important;
  }
}

/* iOS-specific fixes */
@supports (-webkit-touch-callout: none) {
  /* Fix 100vh on iOS Safari */
  .app-view {
    min-height: -webkit-fill-available;
  }
  
  body {
    min-height: -webkit-fill-available;
  }
  
  /* Ensure tab bar respects iOS safe area */
  .pwa-standalone .tab-bar {
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
}
