/* Quote Modal
   Colours come from custom properties injected by qm_enqueue() so this file
   stays static and cacheable across every site the plugin runs on.
   Everything is namespaced .qm- to avoid collisions with Avada / Fusion. */

/* Own our box model rather than inheriting the theme's. Avada happens to set
   border-box globally, but a plugin that only lays out correctly on one theme
   is a plugin that breaks on the next site. Without this the panel computes
   as 100% + 68px padding and overflows the viewport on phones. */
.qm-root,
.qm-root *,
.qm-root *::before,
.qm-root *::after { box-sizing: border-box; }

.qm-root {
  --qm-primary: #17b5d3;
  --qm-dark: #0e7c93;
  --qm-accent: #e8a33d;
  --qm-panel-from: #24404c;
  --qm-panel-to: #1c2b33;
  --qm-text: #ffffff;
  --qm-muted: rgba(255, 255, 255, 0.62);
  --qm-line: rgba(255, 255, 255, 0.14);
  --qm-field: rgba(255, 255, 255, 0.06);

  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.qm-root[hidden] { display: none; }

.qm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 16, 20, 0.82);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  opacity: 0;
  transition: opacity 0.28s ease;
}
.qm-root.is-open .qm-backdrop { opacity: 1; }

.qm-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 540px;
  max-height: 92vh;
  overflow-y: auto;
  padding: 40px 34px 30px;
  border-radius: 22px;
  border: 1px solid var(--qm-line);
  background: linear-gradient(155deg, var(--qm-panel-from) 0%, var(--qm-panel-to) 100%);
  box-shadow: 0 32px 100px rgba(0, 0, 0, 0.62);
  color: var(--qm-text);
  font-family: inherit;
  opacity: 0;
  transform: scale(0.92) translateY(18px);
  transition: transform 0.32s cubic-bezier(0.34, 1.4, 0.64, 1), opacity 0.26s ease;
}
.qm-root.is-open .qm-panel { opacity: 1; transform: scale(1) translateY(0); }

.qm-close {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.72);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.qm-close:hover { background: rgba(255, 255, 255, 0.18); color: #fff; }

/* Header */
.qm-head { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.qm-icon {
  flex-shrink: 0;
  width: 50px;
  height: 50px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: linear-gradient(145deg, var(--qm-primary), var(--qm-dark));
  box-shadow: 0 6px 20px rgba(23, 181, 211, 0.35);
}
.qm-head h2 {
  margin: 0;
  font-size: 25px;
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.01em;
  color: var(--qm-text);
}
.qm-head p { margin: 4px 0 0; font-size: 12.5px; color: var(--qm-muted); }

/* Trust pills */
.qm-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 22px;
  padding: 0;
  list-style: none;
}
.qm-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid;
}
.qm-pill--0 { color: #4ade80; background: rgba(74, 222, 128, 0.11); border-color: rgba(74, 222, 128, 0.28); }
.qm-pill--1 { color: var(--qm-primary); background: rgba(23, 181, 211, 0.11); border-color: rgba(23, 181, 211, 0.3); }
.qm-pill--2 { color: var(--qm-accent); background: rgba(232, 163, 61, 0.11); border-color: rgba(232, 163, 61, 0.3); }

/* Form */
.qm-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.qm-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.qm-field { margin-bottom: 13px; display: flex; flex-direction: column; }
.qm-field label {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--qm-muted);
  margin-bottom: 6px;
}
.qm-opt { text-transform: none; letter-spacing: 0; font-weight: 500; opacity: 0.7; }

.qm-field input,
.qm-field select,
.qm-field textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px;
  border-radius: 11px;
  border: 1px solid var(--qm-line);
  background: var(--qm-field);
  color: var(--qm-text);
  /* 16px keeps iOS Safari from zooming the viewport on focus. */
  font-size: 16px;
  font-family: inherit;
  line-height: 1.35;
  transition: border-color 0.18s, background 0.18s, box-shadow 0.18s;
  -webkit-appearance: none;
  appearance: none;
}
.qm-field textarea { resize: vertical; min-height: 74px; }
.qm-field input::placeholder,
.qm-field textarea::placeholder { color: rgba(255, 255, 255, 0.34); }
.qm-field select { color: var(--qm-text); }
.qm-field select option { background: var(--qm-panel-to); color: var(--qm-text); }

.qm-field input:focus,
.qm-field select:focus,
.qm-field textarea:focus {
  outline: none;
  border-color: var(--qm-primary);
  background: rgba(255, 255, 255, 0.09);
  box-shadow: 0 0 0 3px rgba(23, 181, 211, 0.18);
}
.qm-field input:user-invalid { border-color: rgba(248, 113, 113, 0.65); }

/* Chevron for the select */
.qm-field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-opacity='0.55' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
}

.qm-error {
  margin: 2px 0 10px;
  padding: 10px 13px;
  border-radius: 10px;
  font-size: 13px;
  color: #fecaca;
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.3);
}

.qm-submit {
  position: relative;
  width: 100%;
  margin-top: 6px;
  padding: 15px 20px;
  border: 0;
  border-radius: 12px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, var(--qm-primary), var(--qm-dark));
  box-shadow: 0 8px 24px rgba(23, 181, 211, 0.28);
  transition: transform 0.16s, box-shadow 0.2s, opacity 0.2s;
}
.qm-submit:hover { transform: translateY(-1px); box-shadow: 0 12px 30px rgba(23, 181, 211, 0.38); }
.qm-submit:active { transform: translateY(0); }
.qm-submit[disabled] { opacity: 0.62; cursor: default; transform: none; }

.qm-spinner {
  display: none;
  position: absolute;
  top: 50%;
  right: 18px;
  width: 16px;
  height: 16px;
  margin-top: -8px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: qm-spin 0.7s linear infinite;
}
.qm-submit.is-busy .qm-spinner { display: block; }
@keyframes qm-spin { to { transform: rotate(360deg); } }

.qm-privacy {
  margin: 13px 0 0;
  text-align: center;
  font-size: 11.5px;
  color: var(--qm-muted);
}

/* Success state */
.qm-success { text-align: center; padding: 12px 0 4px; }
.qm-success__tick {
  width: 66px;
  height: 66px;
  margin: 0 auto 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #4ade80;
  background: rgba(74, 222, 128, 0.13);
  border: 1px solid rgba(74, 222, 128, 0.3);
}
.qm-success h3 { margin: 0 0 8px; font-size: 21px; font-weight: 800; color: var(--qm-text); }
.qm-success p { margin: 0 0 6px; font-size: 14px; color: var(--qm-muted); line-height: 1.5; }
.qm-success__call { margin-bottom: 20px !important; }
.qm-success__call a { color: var(--qm-primary); font-weight: 700; text-decoration: none; }

/* Shortcode trigger button */
.qm-trigger {
  display: inline-block;
  padding: 14px 28px;
  border: 0;
  border-radius: 10px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, var(--qm-primary, #17b5d3), var(--qm-dark, #0e7c93));
  box-shadow: 0 6px 18px rgba(23, 181, 211, 0.26);
  transition: transform 0.16s, box-shadow 0.2s;
}
.qm-trigger:hover { transform: translateY(-1px); box-shadow: 0 10px 26px rgba(23, 181, 211, 0.36); }

@media (max-width: 560px) {
  .qm-panel { padding: 32px 20px 24px; border-radius: 18px; max-height: 94vh; }
  .qm-row { grid-template-columns: 1fr; gap: 0; }
  .qm-head h2 { font-size: 21px; }
  .qm-icon { width: 42px; height: 42px; border-radius: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  .qm-backdrop, .qm-panel, .qm-submit, .qm-trigger { transition: none; }
  .qm-panel { transform: none; }
  .qm-spinner { animation-duration: 2s; }
}
