/* ─────────────────── Trigger button ─────────────────── */

.cwmatch-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1.5rem;
  border: 0;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  background: linear-gradient(135deg, #EA5B0C 0%, #D14D0C 100%);
  color: #fff;
  box-shadow: 0 6px 20px rgba(234, 91, 12, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  font-family: inherit;
}
.cwmatch-trigger:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(234, 91, 12, 0.45);
}
.cwmatch-trigger:focus-visible {
  outline: 3px solid #fbbf24;
  outline-offset: 2px;
}
.cwmatch-trigger-icon { font-size: 1.1rem; }

.cwmatch-btn-hero {
  padding: 1.15rem 2.25rem;
  font-size: 1.15rem;
}

.cwmatch-floating {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  z-index: 9998;
}

/* ─────────────────── Modal ─────────────────── */

.cwmatch-modal-backdrop[hidden] { display: none; }
.cwmatch-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 9999;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 4vh 1rem;
  overflow-y: auto;
  animation: cwmatch-fade 0.2s ease;
}
@keyframes cwmatch-fade { from { opacity: 0; } to { opacity: 1; } }

.cwmatch-modal {
  position: relative;
  width: 100%;
  max-width: 640px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
  padding: 1.75rem 1.75rem 2rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #1f2937;
}
.cwmatch-modal h2 {
  margin: 0 0 0.5rem;
  font-size: 1.5rem;
  color: #0f172a;
}
.cwmatch-subtitle {
  margin: 0 0 1.25rem;
  color: #475569;
  font-size: 0.95rem;
  line-height: 1.5;
}
.cwmatch-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: #64748b;
}
.cwmatch-close:hover { background: #f1f5f9; color: #0f172a; }

/* ─────────────────── Form ─────────────────── */

.cwmatch-form { display: flex; flex-direction: column; gap: 1rem; }

.cwmatch-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  cursor: pointer;
  background: #f8fafc;
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.cwmatch-dropzone:hover, .cwmatch-dropzone.cwmatch-drag-over {
  border-color: #EA5B0C;
  background: #fef3eb;
}
.cwmatch-dropzone input[type=file] {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}
.cwmatch-dropzone-text {
  color: #475569;
  font-size: 0.95rem;
}
.cwmatch-filename {
  display: block;
  margin-top: 0.5rem;
  font-weight: 600;
  color: #1e40af;
}

.cwmatch-email-field { display: flex; flex-direction: column; gap: 0.35rem; }
.cwmatch-email-field span { font-size: 0.85rem; color: #475569; }
.cwmatch-email-field input {
  padding: 0.65rem 0.85rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
}
.cwmatch-email-field input:focus {
  outline: 0;
  border-color: #EA5B0C;
  box-shadow: 0 0 0 3px rgba(234, 91, 12, 0.15);
}

.cwmatch-submit {
  padding: 0.85rem 1.5rem;
  border: 0;
  border-radius: 10px;
  background: #EA5B0C;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s ease;
}
.cwmatch-submit:hover { background: #D14D0C; }
.cwmatch-submit:disabled { background: #94a3b8; cursor: wait; }

/* ─────────────────── Loading ─────────────────── */

.cwmatch-loading {
  text-align: center;
  padding: 1.5rem 0;
  color: #475569;
}
.cwmatch-spinner {
  width: 44px; height: 44px;
  margin: 0 auto 1rem;
  border: 4px solid #e2e8f0;
  border-top-color: #EA5B0C;
  border-radius: 50%;
  animation: cwmatch-spin 0.8s linear infinite;
}
@keyframes cwmatch-spin { to { transform: rotate(360deg); } }

/* ─────────────────── Results ─────────────────── */

.cwmatch-results { margin-top: 1rem; }
.cwmatch-results h3 {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
  color: #0f172a;
}
.cwmatch-result-list { display: flex; flex-direction: column; gap: 0.75rem; }
.cwmatch-result {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.15rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.cwmatch-result:hover {
  border-color: #EA5B0C;
  transform: translateY(-1px);
}
.cwmatch-result-info { flex: 1; min-width: 0; }
.cwmatch-result-title {
  display: block;
  font-weight: 600;
  color: #0f172a;
  margin-bottom: 0.15rem;
}
.cwmatch-result-meta {
  font-size: 0.85rem;
  color: #64748b;
}
.cwmatch-result-score {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.4rem 0.75rem;
  background: #d1fae5;
  color: #065f46;
  border-radius: 8px;
  font-weight: 700;
}
.cwmatch-score-label {
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #047857;
}
.cwmatch-no-matches {
  text-align: center;
  padding: 1rem;
  color: #475569;
}
.cwmatch-no-matches a { color: #EA5B0C; }

.cwmatch-suggestions-heading {
  margin-top: 1.5rem;
  font-size: 1rem;
  color: #475569;
}
.cwmatch-suggestions-intro {
  font-size: 0.9rem;
  color: #64748b;
  margin: 0 0 0.5rem;
}
.cwmatch-result-suggestion { border-style: dashed; }
.cwmatch-suggestion-badge {
  flex-shrink: 0;
  padding: 0.4rem 0.85rem;
  background: #f1f5f9;
  color: #475569;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
}
.cwmatch-result-suggestion:hover .cwmatch-suggestion-badge {
  background: #EA5B0C;
  color: #fff;
}

/* ─────────────────── Errors ─────────────────── */

.cwmatch-error {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  color: #991b1b;
  font-size: 0.92rem;
}

/* ─────────────────── Mobile ─────────────────── */

@media (max-width: 480px) {
  .cwmatch-modal { padding: 1.25rem 1.25rem 1.5rem; border-radius: 10px; }
  .cwmatch-floating { right: 1rem; bottom: 1rem; }
  .cwmatch-trigger { padding: 0.75rem 1.15rem; font-size: 0.95rem; }
}
