/* Modal Styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 1;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(4px);
}

.modal.hidden {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.modal-content {
  background: var(--card-bg);
  width: 95%;
  max-width: 500px;
  /* Default for smaller modals */
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
  transform: scale(1);
  transition: transform 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
  max-height: 90vh;
  overflow-y: auto;
}

#add-modal .modal-content {
  max-width: 900px;
  /* Wide for product grid layout */
}

.modal.hidden .modal-content {
  transform: scale(0.9);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid rgba(var(--shadow-color), 0.1);
  padding-bottom: 0.75rem;
}

.modal-header h2 {
  color: var(--text-main);
  font-size: 1.5rem;
  font-weight: 700;
}

.btn-close {
  background: rgba(var(--shadow-color), 0.05);
  border: none;
  font-size: 1.25rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
}

.btn-close:hover {
  background: #fef2f2;
  color: #ef4444;
  transform: rotate(90deg);
}

body.dark-mode .btn-close {
  background: rgba(255, 255, 255, 0.05);
}

/* Professional Confirm Modal */
.confirm-modal-content {
  text-align: center;
  max-width: 400px;
  padding: 2.5rem;
}

.confirm-icon {
  font-size: 4rem;
  color: #facc15;
  margin-bottom: 1.5rem;
  animation: heartBeat 1.5s ease-in-out infinite;
}

@keyframes heartBeat {
  0% {
    transform: scale(1);
  }

  14% {
    transform: scale(1.1);
  }

  28% {
    transform: scale(1);
  }

  42% {
    transform: scale(1.1);
  }

  70% {
    transform: scale(1);
  }
}

.confirm-modal-content h2 {
  font-size: 1.75rem;
  margin-bottom: 0.75rem;
  color: var(--text-main);
}

.confirm-modal-content p {
  color: var(--text-muted);
  margin-bottom: 2rem;
  line-height: 1.6;
}

.confirm-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.btn-secondary {
  background: rgba(var(--shadow-color), 0.08);
  color: var(--text-main);
  border: 1px solid rgba(var(--shadow-color), 0.1);
  padding: 0.8rem 1.8rem;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: inherit;
}

.btn-secondary:hover {
  background: rgba(var(--shadow-color), 0.15);
  transform: translateY(-1px);
}

body.dark-mode .btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

.btn-danger {
  background: #ef4444;
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-lg);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  box-shadow: 0 4px 6px -1px rgba(239, 68, 68, 0.4);
}

.btn-danger:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 8px -1px rgba(239, 68, 68, 0.5);
}

/* Lightbox Modal */
.lightbox-modal {
  background-color: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(8px);
  z-index: 10000;
}

.lightbox-content {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  padding: 1rem;
}

.lightbox-content img {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
  animation: zoomIn 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

@keyframes zoomIn {
  from {
    transform: scale(0.9);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

.btn-close-lightbox {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  font-size: 1.5rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s;
  z-index: 10001;
}

.btn-close-lightbox:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: rotate(90deg);
}

[dir="rtl"] .btn-close-lightbox {
  right: auto;
  left: 20px;
}
