/* ============================================================
   BOSE ENTERPRISES - SMOOTH MODAL ANIMATION SYSTEM
   Premium, smooth modal open/close animations
   ============================================================ */

/* PREVENT BODY SCROLL WHEN MODAL OPEN */
body.modal-open {
  overflow: hidden;
  padding-right: var(--scrollbar-width, 0);
}

/* MODAL OVERLAY */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0);
  opacity: 0;
  visibility: hidden;
  z-index: 1040;
  transition: opacity 0.35s cubic-bezier(0.22, 1, 0.36, 1),
              visibility 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}

.modal-overlay.active {
  background: rgba(0, 0, 0, 0.55);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* MODAL CONTAINER */
.modal-container {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95) translateY(20px);
  opacity: 0;
  visibility: hidden;
  z-index: 1050;
  max-width: 90vw;
  max-height: 90vh;
  width: auto;
  background: #ffffff;
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  transition: opacity 0.35s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
              visibility 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform: translateZ(0);
}

.modal-container.open {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1) translateY(0);
  pointer-events: auto;
}

/* MODAL CLOSE ANIMATION STATE */
.modal-container.closing {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.95) translateY(10px);
  pointer-events: none;
}

/* MODAL HEADER */
.modal-header {
  padding: 1.5rem 1.75rem;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.modal-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: #0f172a;
  font-family: 'Rajdhani', 'Arial', 'Helvetica', system-ui, -apple-system, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

/* MODAL CLOSE BUTTON */
.modal-close-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: rgba(15, 23, 42, 0.06);
  border-radius: 12px;
  color: #0f172a;
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1),
              background 0.25s cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  flex-shrink: 0;
}

.modal-close-btn:hover {
  transform: translateY(-2px) scale(1.05);
  background: rgba(15, 23, 42, 0.12);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.modal-close-btn:active {
  transform: translateY(-1px) scale(0.98);
}

/* MODAL BODY */
.modal-body {
  padding: 1.75rem;
  overflow-y: auto;
  max-height: calc(90vh - 120px);
}

/* MODAL FOOTER */
.modal-footer {
  padding: 1.5rem 1.75rem;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
}

/* MODAL SCROLLBAR STYLING */
.modal-body::-webkit-scrollbar {
  width: 8px;
}

.modal-body::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.04);
  border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb {
  background: rgba(15, 23, 42, 0.2);
  border-radius: 4px;
  transition: background 0.3s ease;
}

.modal-body::-webkit-scrollbar-thumb:hover {
  background: rgba(15, 23, 42, 0.3);
}

/* IMAGE MODAL / LIGHTBOX */
.image-modal {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  padding: 0;
}

.image-modal .modal-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0) 100%);
  border: none;
  padding: 1rem 1.5rem;
  z-index: 10;
}

.image-modal .modal-title {
  color: #ffffff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.image-modal .modal-close-btn {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  backdrop-filter: blur(8px);
}

.image-modal .modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

.image-modal .modal-body {
  padding: 0;
  max-height: 90vh;
  overflow: hidden;
}

.image-modal img {
  width: 100%;
  height: auto;
  max-height: 90vh;
  object-fit: contain;
  display: block;
}

/* VIDEO MODAL */
.video-modal {
  background: #000000;
}

.video-modal .modal-header {
  background: rgba(0, 0, 0, 0.5);
}

.video-modal .modal-title {
  color: #ffffff;
}

.video-modal .modal-close-btn {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

.video-modal .modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

.video-modal .modal-body {
  padding: 0;
  max-height: 90vh;
  overflow: hidden;
}

.video-modal video,
.video-modal iframe {
  width: 100%;
  height: auto;
  max-height: 90vh;
  display: block;
}

/* FORM MODAL */
.form-modal {
  max-width: 600px;
}

.form-modal .modal-body {
  max-height: calc(90vh - 180px);
}

/* CONFIRMATION MODAL */
.confirmation-modal {
  max-width: 500px;
}

.confirmation-modal .modal-body {
  padding: 2rem 1.75rem;
  text-align: center;
}

.confirmation-modal .modal-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  color: #0d6efd;
}

.confirmation-modal .modal-message {
  margin: 0 0 1.5rem;
  color: #555;
  line-height: 1.6;
}

/* MODAL BUTTONS */
.modal-btn {
  padding: 0.75rem 1.5rem;
  border-radius: 50px;
  border: none;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 0.25s cubic-bezier(0.22, 1, 0.36, 1),
              background-color 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

.modal-btn-primary {
  background: linear-gradient(135deg, #0d6efd 0%, #0b5ed7 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(13, 110, 253, 0.25);
}

.modal-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(13, 110, 253, 0.35);
}

.modal-btn-secondary {
  background: rgba(15, 23, 42, 0.06);
  color: #0f172a;
  border: 1px solid rgba(15, 23, 42, 0.12);
}

.modal-btn-secondary:hover {
  transform: translateY(-2px);
  background: rgba(15, 23, 42, 0.12);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.modal-btn:active {
  transform: translateY(-1px) scale(0.98);
}

/* RESPONSIVE DESIGN */
@media (max-width: 768px) {
  .modal-container {
    max-width: 95vw;
    max-height: 95vh;
    border-radius: 16px;
  }

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

  .modal-title {
    font-size: 1.25rem;
  }

  .modal-body {
    padding: 1.5rem;
    max-height: calc(95vh - 110px);
  }

  .modal-footer {
    padding: 1.25rem 1.5rem;
    flex-wrap: wrap;
  }

  .image-modal img {
    max-height: 95vh;
  }

  .video-modal video,
  .video-modal iframe {
    max-height: 95vh;
  }
}

@media (max-width: 576px) {
  .modal-container {
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 12px;
    top: 50%;
    left: 50%;
  }

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

  .modal-title {
    font-size: 1.1rem;
  }

  .modal-close-btn {
    width: 36px;
    height: 36px;
    font-size: 1.1rem;
  }

  .modal-body {
    padding: 1.25rem;
    max-height: calc(100vh - 100px);
  }

  .modal-footer {
    padding: 1rem 1.25rem;
    gap: 0.75rem;
  }

  .modal-btn {
    padding: 0.65rem 1.25rem;
    font-size: 0.9rem;
  }

  .image-modal img {
    max-height: 100vh;
  }

  .video-modal video,
  .video-modal iframe {
    max-height: 100vh;
  }

  .confirmation-modal .modal-icon {
    font-size: 2.5rem;
  }
}

/* ACCESSIBILITY */
.modal-container:focus-visible {
  outline: 3px solid rgba(13, 110, 253, 0.35);
  outline-offset: 2px;
}

.modal-close-btn:focus-visible {
  outline: 3px solid rgba(13, 110, 253, 0.35);
  outline-offset: 2px;
}

.modal-btn:focus-visible {
  outline: 3px solid rgba(13, 110, 253, 0.35);
  outline-offset: 2px;
}

/* RESPECT MOTION PREFERENCES */
@media (prefers-reduced-motion: reduce) {
  .modal-overlay,
  .modal-container,
  .modal-close-btn,
  .modal-btn {
    transition: none !important;
    animation: none !important;
  }
}

/* PREVENT LAYOUT SHIFT */
html.modal-open {
  overflow-y: scroll;
}

/* SMOOTH SCROLLING */
.modal-body {
  scroll-behavior: smooth;
}

/* PREVENT DOUBLE SCROLLBAR */
.modal-overlay.active {
  overflow: hidden;
}
