/* ============================================
   MODAL ANIMATIONS
   Единый файл для всех модальных анимаций
   ============================================ */

/* Fade in animation */
@keyframes modalFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Slide up animation (mobile bottom sheet) */
@keyframes modalSlideUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Scale in animation (desktop modal) */
@keyframes modalScaleIn {
  from {
    transform: scale(0.95);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* Fade out animation */
@keyframes modalFadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

/* Slide down animation */
@keyframes modalSlideDown {
  from {
    transform: translateY(0);
    opacity: 1;
  }
  to {
    transform: translateY(100%);
    opacity: 0;
  }
}

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

.animate-modal-fade-in {
  animation: modalFadeIn 0.3s ease-out;
}

.animate-modal-slide-up {
  animation: modalSlideUp 0.35s cubic-bezier(0.32, 0.72, 0, 1);
}

.animate-modal-scale-in {
  animation: modalScaleIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.animate-modal-fade-out {
  animation: modalFadeOut 0.2s ease-in forwards;
}

.animate-modal-slide-down {
  animation: modalSlideDown 0.3s cubic-bezier(0.32, 0.72, 0, 1) forwards;
}

/* ============================================
   HARDWARE ACCELERATION
   ============================================ */

.modal-backdrop,
.modal-content {
  will-change: transform, opacity;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  transform: translateZ(0);
}

/* ============================================
   BACKDROP STYLES
   ============================================ */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
}

/* ============================================
   MODAL CONTAINER STYLES
   ============================================ */

.modal-container {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

/* Desktop: centered modal */
@media (min-width: 640px) {
  .modal-container {
    align-items: center;
    padding: 1rem;
  }
}

/* ============================================
   MODAL CONTENT STYLES
   ============================================ */

.modal-content {
  width: 100%;
  max-width: 32rem; /* 32rem / 512px */
  max-height: 100vh;
  background: rgba(10, 10, 15, 0.98);
  backdrop-filter: blur(60px) saturate(180%);
  -webkit-backdrop-filter: blur(60px) saturate(180%);
  border-radius: 0;
  box-shadow: 
    0 -20px 60px rgba(0, 0, 0, 0.8),
    0 4px 40px rgba(0, 0, 0, 0.6);
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

/* Desktop: rounded corners on all sides */
@media (min-width: 640px) {
  .modal-content {
    max-height: 90vh;
    border-radius: 1.75rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
  }
}

/* ============================================
   POINTER EVENTS
   ============================================ */

.modal-container {
  pointer-events: none;
}

.modal-content {
  pointer-events: auto;
}

/* ============================================
   SCROLL LOCK
   ============================================ */

body.modal-scroll-locked {
  overflow: hidden !important;
  position: fixed;
  width: 100%;
  height: 100%;
}

/* ============================================
   DRAG HANDLE (Mobile Only)
   ============================================ */

.modal-drag-handle {
  display: flex;
  justify-content: center;
  padding: 0.375rem 0 0.25rem 0;
}

.modal-drag-handle::after {
  content: '';
  width: 2.5rem;
  height: 0.375rem;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 9999px;
}

/* Hide drag handle on desktop */
@media (min-width: 640px) {
  .modal-drag-handle {
    display: none;
  }
}

/* ============================================
   CUSTOM SCROLLBAR
   ============================================ */

.modal-content::-webkit-scrollbar {
  width: 6px;
}

.modal-content::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

.modal-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}