/**
 * Confirm & Input Modals - JamWatHQ Brand Styling
 * Design by: Nobara (Creative Strategy & UX)
 * Implementation by: Yuuji (Implementation Specialist)
 * Date: 2026-03-21
 *
 * Replaces native confirm() and prompt() calls with branded modals
 * Follows JamWatHQ black/gold aesthetic matching toast-notifications.css
 */

/* ========================================
   OVERLAY
   ======================================== */

.jwh-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 10004;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.jwh-modal-overlay--show {
  opacity: 1;
  pointer-events: auto;
}

/* ========================================
   MODAL BASE
   ======================================== */

.jwh-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  z-index: 10005;
  width: 90%;
  max-width: 480px;
  background: #1a1a1a;
  border-radius: 12px;
  padding: 32px;
  text-align: center;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.jwh-modal--show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  pointer-events: auto;
}

/* ========================================
   TYPE VARIANTS
   ======================================== */

.jwh-modal--standard {
  border: 2px solid #ffee00;
  box-shadow: 0 20px 60px rgba(255, 238, 0, 0.15);
}

.jwh-modal--destructive {
  border: 2px solid #ef4444;
  box-shadow: 0 20px 60px rgba(239, 68, 68, 0.15);
}

.jwh-modal--input {
  border: 2px solid #3b82f6;
  box-shadow: 0 20px 60px rgba(59, 130, 246, 0.15);
}

/* ========================================
   ICON
   ======================================== */

.jwh-modal__icon {
  font-size: 2.5rem;
  margin-bottom: 16px;
  line-height: 1;
}

.jwh-modal--standard .jwh-modal__icon {
  color: #ffee00;
}

.jwh-modal--destructive .jwh-modal__icon {
  color: #ef4444;
}

.jwh-modal--input .jwh-modal__icon {
  color: #3b82f6;
}

/* ========================================
   TITLE
   ======================================== */

.jwh-modal__title {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 8px 0;
  line-height: 1.3;
}

.jwh-modal--standard .jwh-modal__title {
  color: #ffee00;
}

.jwh-modal--destructive .jwh-modal__title {
  color: #ef4444;
}

.jwh-modal--input .jwh-modal__title {
  color: #3b82f6;
}

/* ========================================
   MESSAGE
   ======================================== */

.jwh-modal__message {
  color: #cccccc;
  font-size: 0.95rem;
  line-height: 1.5;
  margin: 0 0 24px 0;
  word-wrap: break-word;
}

/* ========================================
   INPUT AREA
   ======================================== */

.jwh-modal__input-wrapper {
  margin-bottom: 24px;
  text-align: left;
}

.jwh-modal__textarea,
.jwh-modal__input {
  width: 100%;
  background: #0d0d0d;
  border: 2px solid #333333;
  border-radius: 8px;
  color: #ffffff;
  font-family: inherit;
  font-size: 0.95rem;
  padding: 12px 14px;
  resize: vertical;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  box-sizing: border-box;
}

.jwh-modal__input {
  height: 44px;
  resize: none;
}

.jwh-modal__textarea:focus,
.jwh-modal__input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

.jwh-modal__textarea::placeholder,
.jwh-modal__input::placeholder {
  color: #666666;
}

.jwh-modal__char-count {
  display: block;
  text-align: right;
  font-size: 0.8rem;
  color: #666666;
  margin-top: 6px;
}

.jwh-modal__char-count--warn {
  color: #ef4444;
  font-weight: 600;
}

.jwh-modal__error {
  color: #ef4444;
  font-size: 0.85rem;
  margin: 8px 0 0 0;
  min-height: 1.2em;
}

/* ========================================
   ACTION BUTTONS
   ======================================== */

.jwh-modal__actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.jwh-modal__btn {
  flex: 1;
  max-width: 180px;
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
  font-family: inherit;
}

.jwh-modal__btn:active {
  transform: scale(0.97);
}

/* Cancel button */
.jwh-modal__btn--cancel {
  background: #333333;
  color: #cccccc;
}

.jwh-modal__btn--cancel:hover {
  background: #444444;
  color: #ffffff;
}

.jwh-modal__btn--cancel:focus {
  outline: 2px solid #ffee00;
  outline-offset: 2px;
}

/* Standard confirm button (green) */
.jwh-modal__btn--confirm {
  background: #22c55e;
  color: #000000;
}

.jwh-modal__btn--confirm:hover {
  background: #16a34a;
  box-shadow: 0 4px 16px rgba(34, 197, 94, 0.4);
}

.jwh-modal__btn--confirm:focus {
  outline: 2px solid #ffee00;
  outline-offset: 2px;
}

/* Destructive confirm button (red) */
.jwh-modal__btn--destructive {
  background: #ef4444;
  color: #ffffff;
}

.jwh-modal__btn--destructive:hover {
  background: #dc2626;
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.4);
}

.jwh-modal__btn--destructive:focus {
  outline: 2px solid #ffee00;
  outline-offset: 2px;
}

/* ========================================
   REDUCED MOTION SUPPORT
   ======================================== */

@media (prefers-reduced-motion: reduce) {
  .jwh-modal-overlay {
    transition: opacity 0.05s ease;
  }

  .jwh-modal {
    transition: opacity 0.05s ease;
    transform: translate(-50%, -50%);
  }

  .jwh-modal--show {
    transform: translate(-50%, -50%);
  }

  .jwh-modal__btn {
    transition: none;
  }
}

/* ========================================
   MOBILE RESPONSIVE
   ======================================== */

@media (max-width: 480px) {
  .jwh-modal {
    width: 94%;
    padding: 24px 20px;
    max-width: none;
  }

  .jwh-modal__icon {
    font-size: 2rem;
    margin-bottom: 12px;
  }

  .jwh-modal__title {
    font-size: 1.1rem;
  }

  .jwh-modal__message {
    font-size: 0.9rem;
  }

  .jwh-modal__actions {
    flex-direction: column;
    gap: 8px;
  }

  .jwh-modal__btn {
    max-width: none;
    width: 100%;
  }

  .jwh-modal__textarea {
    font-size: 1rem; /* Prevent iOS zoom */
  }

  .jwh-modal__input {
    font-size: 1rem; /* Prevent iOS zoom */
  }
}

/* ========================================
   HIGH CONTRAST MODE
   ======================================== */

@media (prefers-contrast: high) {
  .jwh-modal {
    border-width: 3px;
  }

  .jwh-modal__textarea,
  .jwh-modal__input {
    border-width: 3px;
  }

  .jwh-modal__btn {
    border: 2px solid currentColor;
  }
}
