/* ============================================
   SKLAD-BUMAGA — Modal
   Frosted glass backdrop + refined animations
   ============================================ */

/* ── Overlay ───────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(6px) saturate(1.2);
  -webkit-backdrop-filter: blur(6px) saturate(1.2);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
  animation: modal-overlay-in var(--duration) var(--ease-out);
}

@keyframes modal-overlay-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Modal card ────────────────────────────── */
.modal {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: modal-card-in var(--duration-slow) var(--ease-out);
  border: 1px solid var(--border);
}

.modal-lg {
  max-width: 800px;
}

.modal-xl {
  max-width: 1200px;
}

@keyframes modal-card-in {
  0%   { opacity: 0; transform: translateY(-16px) scale(0.97); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Modal header ──────────────────────────── */
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.75rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  font-family: var(--font-display);
  font-size: var(--font-size-lg);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}

/* Close button */
.modal-close {
  background: none;
  border: none;
  font-size: 1.375rem;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0.25rem;
  line-height: 1;
  border-radius: var(--radius);
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
}

.modal-close:hover {
  background: var(--slate-100);
  color: var(--text);
}

.modal-close:active {
  background: var(--slate-200);
}

/* ── Modal body ────────────────────────────── */
.modal-body {
  padding: 1.75rem;
  overflow-y: auto;
  flex: 1;
}

/* Custom scrollbar inside modal */
.modal-body::-webkit-scrollbar {
  width: 5px;
}

.modal-body::-webkit-scrollbar-track {
  background: transparent;
}

.modal-body::-webkit-scrollbar-thumb {
  background: var(--slate-200);
  border-radius: var(--radius-full);
}

/* ── Modal footer ──────────────────────────── */
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.75rem;
  border-top: 1px solid var(--border);
  background: var(--slate-25);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

/* ── Responsive modal ──────────────────────── */
@media (max-width: 768px) {
  .modal-overlay {
    padding: 0;
    align-items: flex-end;
  }

  .modal {
    max-width: 100%;
    max-height: 92vh;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    animation: modal-slide-up var(--duration-slow) var(--ease-out);
  }

  .modal-lg,
  .modal-xl {
    max-width: 100%;
  }

  @keyframes modal-slide-up {
    0%   { opacity: 0; transform: translateY(100%); }
    100% { opacity: 1; transform: translateY(0); }
  }

  .modal-body {
    padding: 1.25rem;
  }

  .modal-header {
    padding: 1rem 1.25rem;
  }

  .modal-footer {
    padding: 0.875rem 1.25rem;
    border-radius: 0;
  }
}
