/* ========================================
   MODAL SYSTEM
   ======================================== */

/* ────────── Backdrop ────────── */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal-backdrop.show {
  opacity: 1;
}

/* ────────── Container ────────── */
.modal-container {
  background: #FFFFFF;
  border-radius: 16px;
  max-width: 400px;
  position: relative; /* Ensure absolute-positioned controls inside modal (close button) are positioned relative to the modal container rather than to the page. */
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  transform: scale(0.9) translateY(20px);
  padding: 44px 28px 24px; /* add extra top padding so the close button doesn't overlap content */
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-backdrop.show .modal-container {
  /* Center the modal container within the backdrop and finish entrance animation */
    transform: scale(1) translateY(0);
    animation: modalFadeIn 0.32s forwards;
    position: relative;
  }

/* ────────── Content ────────── */
.modal-content {
  padding: 32px 28px 24px;
  text-align: center;
}

/* ────────── Icon ────────── */
.modal-icon {
  z-index: 6;
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-icon svg {
  margin-top: 8px; /* Add margin-top to primary buttons for spacing */
  width: 48px;
  height: 48px;
}

/* ────────── Title ────────── */
.modal-title {
  font-family: 'Outfit', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: #000000;
  margin: 0 0 12px 0;
  line-height: 1.3;
}

/* ────────── Message ────────── */
.modal-message {
  font-family: 'Montserrat', sans-serif;
  font-size: 15px;
  font-weight: 400;
  color: #666666;
  line-height: 1.6;
  margin: 0 0 24px 0;
}

/* ────────── Actions ────────── */
.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* ────────── Buttons ────────── */
.modal-btn {
  font-family: 'Montserrat', sans-serif;
  font-size: 15px;
  font-weight: 600;
  padding: 12px 28px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 100px;
  text-transform: none;
}

.modal-btn:focus {
  outline: 2px solid #43BDAB;
  outline-offset: 2px;
}

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

/* Primary Button */
.modal-btn-primary {
  background: #43BDAB;
  color: #FFFFFF;
}

.modal-btn-primary:hover {
  background: #3AAA9A;
  box-shadow: 0 4px 12px rgba(67, 189, 171, 0.3);
}

/* Secondary Button */
.modal-btn-secondary {
  background: #F5F5F5;
  color: #333333;
}

.modal-btn-secondary:hover {
  background: #E8E8E8;
}

/* Delete variant (red primary) */
.modal-container[data-type="delete"] .modal-btn-primary {
  background: #ff4444;
}

.modal-container[data-type="delete"] .modal-btn-primary:hover {
  background: #ee3333;
  box-shadow: 0 4px 12px rgba(255, 68, 68, 0.3);
}

/* ────────── Mobile ────────── */
@media (max-width: 480px) {
  .modal-container {
    max-width: 100%;
    margin: 0 16px;
  }
  
  .modal-content {
    padding: 28px 20px 20px;
  }
  
  .modal-title {
    font-size: 20px;
  }
  
  .modal-message {
    font-size: 14px;
  }
  
  .modal-actions {
    flex-direction: column-reverse;
  }
  
  .modal-btn {
    width: 100%;
    min-width: auto;
  }
}

/* ────────── Animations ────────── */
@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes backdropFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ────────── Accessibility ────────── */
.modal-backdrop:focus-within .modal-container {
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3),
              0 0 0 3px rgba(67, 189, 171, 0.5);
}

/* ────────── Auth Form (inside modal) ────────── */
.auth-tabs {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 16px;
}
.tab {
  padding: 8px 14px;
  border-radius: 999px;
  background: transparent;
  color: #666666;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
}
.tab-active {
  background: #43BDAB;
  color: #fff;
  border-color: rgba(67,189,171,0.15);
}
.auth-form {
  display: block;
  text-align: left;
  margin: 0 auto 8px;
}
.auth-form label {
  display: block;
  font-size: 13px;
  color: #333333;
  margin-bottom: 6px;
}
.auth-form input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #E6E6E6;
  margin-bottom: 12px;
  font-size: 14px;
  font-family: inherit;
}
.auth-form input:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(67,189,171,0.12);
  border-color: #43BDAB;
}
.auth-form .modal-btn-primary {
  display: block;
  width: 100%;
  padding: 12px 16px;
  border-radius: 10px;
}
.auth-form .text-red-500 {
  margin-top: 6px;
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  .modal-backdrop,
  .modal-container {
    transition: none;
  }
}

/* ────────── Close button & small utility helpers used by auth modal ────────── */
.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: transparent;
  border: none;
  padding: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #9CA3AF; /* gray-400 */
  cursor: pointer;
  border-radius: 8px;
}
.modal-close:hover {
  color: #4B5563; /* gray-600 */
  background: rgba(0,0,0,0.03);
}
.modal-close:focus {
  outline: 3px solid rgba(67,189,171,0.18);
  outline-offset: 2px;
}

/* small utility classes used in markup to mimic Tailwind-like names */
.absolute { position: absolute !important; }
.top-4 { top: 16px !important; }
.right-4 { right: 16px !important; }
.w-6 { width: 24px !important; }
.h-6 { height: 24px !important; }
.hover\:text-gray-600:hover { color: #4B5563 !important; }
