/**
 * HQModal — Modal / Toast component (Hotelequip)
 */

/* Overlay */
.hq-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13, 31, 41, 0.55);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 2147483100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity .18s ease;
  font-family: inherit;
}
.hq-modal-overlay.is-open {
  opacity: 1;
}

/* Card */
.hq-modal {
  background: #ffffff;
  color: #131313;
  border-radius: 12px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35), 0 8px 24px rgba(0, 0, 0, 0.18);
  width: 100%;
  max-width: 460px;
  overflow: hidden;
  transform: translateY(12px) scale(.98);
  opacity: 0;
  transition: transform .22s ease, opacity .22s ease;
  font-family: inherit;
}
.hq-modal-overlay.is-open .hq-modal {
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* Header */
.hq-modal-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 22px 22px 8px;
}
.hq-modal-icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e6f1f6;
  color: #004F6B;
}
.hq-modal-icon svg {
  width: 24px;
  height: 24px;
  stroke-width: 2;
}
.hq-modal-title-wrap {
  flex: 1;
  min-width: 0;
  padding-top: 4px;
}
.hq-modal-title {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 700;
  color: #131313;
  line-height: 1.3;
}

/* Body */
.hq-modal-body {
  padding: 4px 22px 18px 80px;
  font-size: 14px;
  color: #4a5560;
  line-height: 1.55;
  white-space: pre-line;
  word-wrap: break-word;
}
.hq-modal-body p { margin: 0 0 8px; }
.hq-modal-body p:last-child { margin-bottom: 0; }

/* Prompt input */
.hq-modal-input {
  width: 100%;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid #d4dbe2;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  color: #131313;
  background: #fff;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
  box-sizing: border-box;
}
.hq-modal-input:focus {
  border-color: #004F6B;
  box-shadow: 0 0 0 3px rgba(0, 79, 107, 0.15);
}

/* Footer */
.hq-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px 20px;
  border-top: 1px solid #eef1f4;
  background: #fafbfc;
}
.hq-modal-btn {
  min-width: 96px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease, transform .05s ease;
  line-height: 1.2;
}
.hq-modal-btn:active { transform: translateY(1px); }
.hq-modal-btn:focus { outline: 2px solid #004F6B; outline-offset: 2px; }

.hq-modal-btn-cancel {
  background: #fff;
  color: #4a5560;
  border-color: #d4dbe2;
}
.hq-modal-btn-cancel:hover { background: #f1f4f6; color: #131313; }

.hq-modal-btn-confirm {
  background: #004F6B;
  color: #fff;
}
.hq-modal-btn-confirm:hover { background: #003a52; }

/* Variants (icon color) */
.hq-modal-overlay.hq-type-info      .hq-modal-icon { background: #e6f1f6; color: #004F6B; }
.hq-modal-overlay.hq-type-success   .hq-modal-icon { background: #e4f7ea; color: #137c3a; }
.hq-modal-overlay.hq-type-warning   .hq-modal-icon { background: #fff4e0; color: #b66a00; }
.hq-modal-overlay.hq-type-danger    .hq-modal-icon { background: #fde8e8; color: #b42318; }
.hq-modal-overlay.hq-type-error     .hq-modal-icon { background: #fde8e8; color: #b42318; }

/* Variants (confirm button color) */
.hq-modal-overlay.hq-type-danger  .hq-modal-btn-confirm,
.hq-modal-overlay.hq-type-error   .hq-modal-btn-confirm {
  background: #b42318;
}
.hq-modal-overlay.hq-type-danger  .hq-modal-btn-confirm:hover,
.hq-modal-overlay.hq-type-error   .hq-modal-btn-confirm:hover {
  background: #8a1a12;
}
.hq-modal-overlay.hq-type-success .hq-modal-btn-confirm { background: #137c3a; }
.hq-modal-overlay.hq-type-success .hq-modal-btn-confirm:hover { background: #0e5c2b; }
.hq-modal-overlay.hq-type-warning .hq-modal-btn-confirm { background: #b66a00; }
.hq-modal-overlay.hq-type-warning .hq-modal-btn-confirm:hover { background: #8a5000; }

/* Responsive */
@media (max-width: 480px) {
  .hq-modal { max-width: 100%; }
  .hq-modal-header { padding: 18px 16px 6px; gap: 12px; }
  .hq-modal-icon { width: 40px; height: 40px; }
  .hq-modal-body { padding: 4px 16px 14px 68px; font-size: 13.5px; }
  .hq-modal-footer { padding: 12px 16px 16px; flex-direction: column-reverse; }
  .hq-modal-btn { width: 100%; min-width: 0; }
}

/* -------- Toast -------- */
.hq-toast-container {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 2147483050;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  width: 360px;
  max-width: calc(100vw - 40px);
  pointer-events: none;
}
.hq-toast-container > .hq-toast { width: 100%; }
.hq-toast {
  pointer-events: auto;
  background: #fff;
  color: #131313;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.08);
  padding: 12px 14px 12px 14px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border-left: 4px solid #004F6B;
  font-size: 14px;
  line-height: 1.45;
  transform: translateX(120%);
  opacity: 0;
  transition: transform .28s ease, opacity .28s ease;
  max-width: 360px;
}
.hq-toast.is-open {
  transform: translateX(0);
  opacity: 1;
}
.hq-toast-icon {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  color: #004F6B;
}
.hq-toast-icon svg { width: 22px; height: 22px; stroke-width: 2; }
.hq-toast-body { flex: 1; word-wrap: break-word; }
.hq-toast-close {
  flex-shrink: 0;
  border: none;
  background: transparent;
  color: #9aa4ae;
  cursor: pointer;
  padding: 2px;
  line-height: 1;
  font-size: 18px;
}
.hq-toast-close:hover { color: #4a5560; }

.hq-toast.hq-type-success { border-left-color: #137c3a; }
.hq-toast.hq-type-success .hq-toast-icon { color: #137c3a; }
.hq-toast.hq-type-error,
.hq-toast.hq-type-danger { border-left-color: #b42318; }
.hq-toast.hq-type-error .hq-toast-icon,
.hq-toast.hq-type-danger .hq-toast-icon { color: #b42318; }
.hq-toast.hq-type-warning { border-left-color: #b66a00; }
.hq-toast.hq-type-warning .hq-toast-icon { color: #b66a00; }

@media (max-width: 480px) {
  .hq-toast-container {
    top: auto;
    bottom: 20px;
    left: 20px;
    right: 20px;
    max-width: none;
  }
  .hq-toast { transform: translateY(120%); }
  .hq-toast.is-open { transform: translateY(0); }
}

/* Lock body scroll when modal open */
body.hq-modal-open {
  overflow: hidden;
}
