/**
 * =================================================================
 * NOBAMO - Mobile Navigation CSS
 * =================================================================
 * 
 * Štýly pre mobilnú navigáciu:
 * - Drawer menu (rôzne štýly)
 * - Bottom bar
 * - Animácie a transitions
 * - Touch optimalizácie
 * 
 * FÁZA E: Nový súbor
 * 
 * @version 1.0.0
 * @date    2025-12-29
 */

/* ==================== CSS Variables ==================== */
:root {
  --mobile-nav-bg: #ffffff;
  --mobile-nav-border: #e5e7eb;
  --mobile-nav-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  --mobile-nav-transition: 300ms;
  --mobile-nav-easing: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==================== Mobile Drawer Base ==================== */
#mobile-drawer {
  will-change: transform, opacity;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

/* Drawer style (default - from left) */
#mobile-drawer[data-mobile-style="drawer"] {
  transition: transform var(--mobile-nav-transition) var(--mobile-nav-easing);
}

/* Fullscreen style */
#mobile-drawer[data-mobile-style="fullscreen"] {
  transition: transform var(--mobile-nav-transition) var(--mobile-nav-easing),
              opacity var(--mobile-nav-transition) var(--mobile-nav-easing);
}

/* Bottom sheet style */
#mobile-drawer[data-mobile-style="bottom-sheet"] {
  transition: transform var(--mobile-nav-transition) var(--mobile-nav-easing);
  border-top-left-radius: 1.5rem;
  border-top-right-radius: 1.5rem;
}

#mobile-drawer[data-mobile-style="bottom-sheet"]::before {
  content: '';
  position: absolute;
  top: 0.75rem;
  left: 50%;
  transform: translateX(-50%);
  width: 3rem;
  height: 0.25rem;
  background-color: #d1d5db;
  border-radius: 9999px;
}

/* ==================== Overlay ==================== */
#mobile-menu-overlay {
  transition: opacity var(--mobile-nav-transition) var(--mobile-nav-easing);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* ==================== Mobile Nav Items ==================== */
.mobile-nav-item {
  transition: all 0.2s ease;
}

.mobile-nav-item:active {
  transform: scale(0.98);
}

.mobile-nav-icon {
  transition: transform 0.2s ease;
}

.mobile-nav-item:hover .mobile-nav-icon {
  transform: scale(1.1);
}

/* ==================== Submenu Animations ==================== */
.mobile-nav-submenu {
  transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
}

.mobile-nav-submenu.hidden {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
}

/* Staggered animation for items */
.mobile-nav-list > li {
  animation: slideInLeft 0.3s ease forwards;
  opacity: 0;
}

.mobile-nav-list > li:nth-child(1) { animation-delay: 0.05s; }
.mobile-nav-list > li:nth-child(2) { animation-delay: 0.1s; }
.mobile-nav-list > li:nth-child(3) { animation-delay: 0.15s; }
.mobile-nav-list > li:nth-child(4) { animation-delay: 0.2s; }
.mobile-nav-list > li:nth-child(5) { animation-delay: 0.25s; }
.mobile-nav-list > li:nth-child(6) { animation-delay: 0.3s; }
.mobile-nav-list > li:nth-child(7) { animation-delay: 0.35s; }
.mobile-nav-list > li:nth-child(8) { animation-delay: 0.4s; }
.mobile-nav-list > li:nth-child(n+9) { animation-delay: 0.45s; }

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ==================== Toggle Button Rotation ==================== */
.mobile-nav-toggle svg {
  transition: transform 0.3s ease;
}

.mobile-nav-toggle[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

/* ==================== Scrollbar Styling ==================== */
#mobile-drawer-content::-webkit-scrollbar {
  width: 4px;
}

#mobile-drawer-content::-webkit-scrollbar-track {
  background: transparent;
}

#mobile-drawer-content::-webkit-scrollbar-thumb {
  background-color: #d1d5db;
  border-radius: 2px;
}

#mobile-drawer-content::-webkit-scrollbar-thumb:hover {
  background-color: #9ca3af;
}

/* ==================== Bottom Bar ==================== */
#mobile-bottom-bar {
  will-change: transform;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  transition: transform var(--mobile-nav-transition) var(--mobile-nav-easing);
}

#mobile-bottom-bar.hidden-bar {
  transform: translateY(100%);
}

.bottom-bar-item {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: color 0.2s ease;
}

.bottom-bar-icon {
  transition: transform 0.2s ease;
}

.bottom-bar-item:active .bottom-bar-icon {
  transform: scale(0.9);
}

.bottom-bar-item[aria-current="page"] .bottom-bar-icon {
  transform: scale(1.1);
}

/* Bottom bar ripple effect */
.bottom-bar-item {
  position: relative;
  overflow: hidden;
}

.bottom-bar-item::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(22, 163, 74, 0.2) 0%, transparent 70%);
  transform: scale(0);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.bottom-bar-item:active::after {
  transform: scale(2);
  opacity: 1;
}

/* ==================== Safe Area Support ==================== */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  #mobile-bottom-bar {
    padding-bottom: env(safe-area-inset-bottom);
  }
  
  #mobile-bottom-bar-spacer {
    height: calc(4rem + env(safe-area-inset-bottom));
  }
  
  #mobile-drawer {
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* ==================== Touch Optimizations ==================== */
#mobile-drawer a,
#mobile-drawer button,
.bottom-bar-item {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

/* Minimum touch target size */
#mobile-drawer a,
#mobile-drawer button {
  min-height: 44px;
}

/* ==================== Reduced Motion ==================== */
@media (prefers-reduced-motion: reduce) {
  #mobile-drawer,
  #mobile-menu-overlay,
  #mobile-bottom-bar,
  .mobile-nav-item,
  .mobile-nav-submenu,
  .mobile-nav-list > li,
  .bottom-bar-item,
  .bottom-bar-icon {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* ==================== Dark Mode (Optional) ==================== */
@media (prefers-color-scheme: dark) {
  /* Uncomment to enable dark mode support
  :root {
    --mobile-nav-bg: #1f2937;
    --mobile-nav-border: #374151;
  }
  
  #mobile-drawer {
    background-color: var(--mobile-nav-bg);
  }
  
  #mobile-bottom-bar {
    background-color: var(--mobile-nav-bg);
    border-color: var(--mobile-nav-border);
  }
  */
}

/* ==================== Print ==================== */
@media print {
  #mobile-drawer,
  #mobile-menu-overlay,
  #mobile-bottom-bar,
  #mobile-bottom-bar-spacer {
    display: none !important;
  }
}

/* ==================== Landscape Mode Adjustments ==================== */
@media screen and (max-height: 500px) and (orientation: landscape) {
  #mobile-drawer {
    max-height: 100vh;
    max-height: 100dvh;
  }
  
  #mobile-drawer-content {
    max-height: calc(100vh - 60px);
    max-height: calc(100dvh - 60px);
  }
  
  #mobile-bottom-bar {
    height: 3rem;
  }
  
  .bottom-bar-item {
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
  }
  
  .bottom-bar-icon {
    margin-bottom: 0;
  }
  
  .bottom-bar-item span:last-child {
    display: none;
  }
}

/* ==================== iOS Specific Fixes ==================== */
@supports (-webkit-touch-callout: none) {
  #mobile-drawer {
    /* Fix for iOS momentum scrolling */
    -webkit-overflow-scrolling: touch;
  }
  
  #mobile-drawer-content {
    -webkit-overflow-scrolling: touch;
  }
}

/* ==================== Accessibility ==================== */
#mobile-drawer:focus-visible,
#mobile-bottom-bar a:focus-visible,
#mobile-bottom-bar button:focus-visible {
  outline: 2px solid #16a34a;
  outline-offset: 2px;
}

/* Skip link for keyboard navigation */
.mobile-nav-skip-link {
  position: absolute;
  top: -100%;
  left: 0;
  background: #16a34a;
  color: white;
  padding: 0.5rem 1rem;
  z-index: 100;
  transition: top 0.3s;
}

.mobile-nav-skip-link:focus {
  top: 0;
}
