/* call-modal.css — new-call customer modal for 2mv.io
 * Loaded by index.html. Activated by script.call-modal.js when a
 * waitercall widget with textparam.call_type_ids is clicked.
 * Mobile-first. No external dependencies. Reuses Montserrat from style.css.
 */

.call-modal[hidden] { display: none !important; }

.call-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  font-family: Montserrat, system-ui, -apple-system, sans-serif;
}

.call-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  animation: cm-fade-in 180ms ease-out;
}

.call-modal__sheet {
  position: relative;
  width: 100%;
  max-width: 480px;
  background: #ffffff;
  border-radius: 16px 16px 0 0;
  padding: 20px 20px 28px;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.18);
  max-height: 92vh;
  overflow-y: auto;
  animation: cm-slide-up 220ms ease-out;
}

@media (min-width: 560px) {
  .call-modal { align-items: center; }
  .call-modal__sheet {
    border-radius: 16px;
    max-height: 84vh;
  }
}

@keyframes cm-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes cm-slide-up {
  from { transform: translateY(24px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

.call-modal__close {
  position: absolute;
  top: 8px;
  right: 12px;
  background: none;
  border: none;
  font-size: 28px;
  line-height: 1;
  color: #6b7280;
  cursor: pointer;
  padding: 6px 10px;
}
.call-modal__close:hover { color: #111827; }

.call-modal__title {
  margin: 0 0 14px;
  font-size: 18px;
  font-weight: 600;
  color: #111827;
  text-align: center;
}

.call-modal__subtitle {
  margin: 0 0 16px;
  font-size: 14px;
  color: #6b7280;
  text-align: center;
}

.call-modal__call-types {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.call-modal__type {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  background: #f9fafb;
  border: 1.5px solid #e5e7eb;
  border-radius: 12px;
  padding: 14px 16px;
  text-align: left;
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  color: #111827;
  cursor: pointer;
  transition: background 120ms, border-color 120ms, transform 80ms;
}
.call-modal__type:hover:not(:disabled) {
  background: #f3f4f6;
  border-color: #d1d5db;
}
.call-modal__type:active:not(:disabled) {
  transform: scale(0.98);
}
.call-modal__type:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.call-modal__type-color {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #9ca3af;
}

.call-modal__type-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.call-modal__type-name {
  font-size: 15px;
  font-weight: 600;
  color: #111827;
}

.call-modal__type-meta {
  font-size: 12px;
  color: #6b7280;
}

.call-modal__type-window {
  font-size: 11px;
  color: #b91c1c;
  margin-top: 2px;
}

/* Centered states (waiting / feedback / thanks / error) */
.call-modal__view[data-view="waiting"],
.call-modal__view[data-view="feedback"],
.call-modal__view[data-view="thanks"],
.call-modal__view[data-view="error"] {
  text-align: center;
  padding: 24px 8px 8px;
}

.call-modal__spinner {
  width: 44px;
  height: 44px;
  border: 4px solid #e5e7eb;
  border-top-color: #2563eb;
  border-radius: 50%;
  margin: 0 auto 16px;
  animation: cm-spin 900ms linear infinite;
}
@keyframes cm-spin {
  to { transform: rotate(360deg); }
}

.call-modal__status {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 600;
  color: #111827;
}

.call-modal__staff {
  margin: 4px 0 0;
  font-size: 14px;
  color: #6b7280;
}

.call-modal__wait-min {
  margin: 8px 0 0;
  font-size: 13px;
  color: #2563eb;
  font-weight: 500;
}

.call-modal__stars {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 12px 0 18px;
}

.call-modal__star {
  background: none;
  border: none;
  font-size: 36px;
  line-height: 1;
  color: #d1d5db;
  cursor: pointer;
  padding: 4px;
  transition: color 120ms, transform 80ms;
}
.call-modal__star:hover,
.call-modal__star.is-active {
  color: #f59e0b;
}
.call-modal__star:active {
  transform: scale(0.92);
}

.call-modal__comment {
  width: 100%;
  box-sizing: border-box;
  min-height: 72px;
  resize: vertical;
  padding: 10px 12px;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  color: #111827;
  background: #f9fafb;
  margin-bottom: 14px;
}
.call-modal__comment:focus {
  outline: none;
  border-color: #2563eb;
  background: #ffffff;
}

.call-modal__submit-feedback,
.call-modal__retry {
  width: 100%;
  background: #2563eb;
  color: #ffffff;
  border: none;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 120ms;
}
.call-modal__submit-feedback:hover,
.call-modal__retry:hover {
  background: #1d4ed8;
}
.call-modal__submit-feedback:disabled {
  background: #93c5fd;
  cursor: not-allowed;
}

.call-modal__error-msg {
  margin: 0 0 16px;
  color: #b91c1c;
  font-size: 14px;
}

.call-modal__loading {
  text-align: center;
  padding: 24px 0;
  color: #6b7280;
  font-size: 14px;
}

/* ─────────────────────────────────────────────────────────────────────
 * Plan 4 follow-up — accessibility + animation polish
 * ───────────────────────────────────────────────────────────────────── */

/* Visible focus ring on every focusable element. Uses :focus-visible so
 * mouse clicks don't show it but keyboard tab navigation does. */
.call-modal :focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
  border-radius: 4px;
}

/* Cancel button — added by Plan 4 follow-up. Lives in the waiting view. */
.call-modal__cancel {
  display: block;
  margin: 24px auto 0;
  padding: 10px 24px;
  background: transparent;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  color: #6b7280;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 80ms ease;
}
.call-modal__cancel:hover {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #b91c1c;
}
.call-modal__cancel:active {
  transform: scale(0.97);
}
.call-modal__cancel:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: transparent;
  border-color: #e5e7eb;
  color: #9ca3af;
}

/* View-to-view fade transition. The .call-modal__view default opacity is 1
 * and we transition opacity when [hidden] toggles. Sadly transitioning to/from
 * [hidden] is fragile (display: none kills the transition), so we use a brief
 * keyframe on the freshly-revealed view instead. */
.call-modal__view:not([hidden]) {
  animation: cm-view-in 200ms ease-out;
}
@keyframes cm-view-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Star micro-interaction — smooth color transition + active scale. The base
 * .call-modal__star already has color transitions from Plan 4; we add an
 * active scale for tactile feedback. */
.call-modal__star {
  transition: color 150ms ease, transform 80ms ease;
}
.call-modal__star:active {
  transform: scale(0.92);
}

/* Submit-feedback button — slightly stronger active state. */
.call-modal__submit-feedback {
  transition: background-color 150ms ease, transform 80ms ease;
}
.call-modal__submit-feedback:active {
  transform: scale(0.98);
}

/* Reduced motion — strip every transition + animation per accessibility
 * guidance. This is a global override scoped to the modal subtree. */
@media (prefers-reduced-motion: reduce) {
  .call-modal,
  .call-modal *,
  .call-modal *::before,
  .call-modal *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
