/* ─────────────────────────────────────────────────────────────────────────────
   Repair Manager Pro – Frontend Styles
   ───────────────────────────────────────────────────────────────────────────── */

:root {
  --rmp-accent:  #e74c3c;
  --rmp-cols:    3;
  --rmp-radius:  12px;
  --rmp-card-bg: #ffffff;
  --rmp-text:    #1a1a1a;
  --rmp-sel-color: var(--rmp-accent);
}

.rmp-root, .rmp-root *, .rmp-root *::before, .rmp-root *::after {
  box-sizing: border-box;
}
.rmp-root {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--rmp-text);
  max-width: 100%;
  overflow-x: clip; /* clip, not hidden, so sticky still works */
  width: 100%;
  position: relative;
}

/* ── Loading ─────────────────────────────────────────────────────────────── */
.rmp-loading {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 60px 20px; gap: 14px; color: #999;
}
.rmp-ring {
  width: 36px; height: 36px; border: 3px solid #e5e5e5;
  border-top-color: var(--rmp-accent); border-radius: 50%;
  animation: rmp-spin 0.7s linear infinite; display: block;
}
@keyframes rmp-spin { to { transform: rotate(360deg); } }

/* ── Search ──────────────────────────────────────────────────────────────── */
.rmp-search { margin-bottom: 14px; }
.rmp-search-inner {
  display: flex; align-items: center; gap: 10px;
  background: #fff; border: 1.5px solid #e0e0e0; border-radius: 50px;
  padding: 10px 16px; transition: border-color .15s, box-shadow .15s;
}
.rmp-search-inner:focus-within {
  border-color: var(--rmp-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--rmp-accent) 12%, transparent);
}
.rmp-search-inner svg { width: 18px; height: 18px; color: #aaa; flex-shrink: 0; }
.rmp-search-inner input {
  flex: 1; border: none; outline: none; font-size: 15px;
  background: transparent; color: var(--rmp-text); min-width: 0;
}
.rmp-search-clear {
  background: none; border: none; color: #bbb; cursor: pointer;
  font-size: 13px; padding: 2px 4px; display: flex; align-items: center;
  border-radius: 50%; transition: background .15s, color .15s;
}
.rmp-search-clear:hover { background: #f0f0f0; color: #666; }

/* ── Selector ────────────────────────────────────────────────────────────── */
.rmp-selector { margin-bottom: 16px; display: flex; flex-direction: column; gap: 10px; overflow: hidden; }

/* Brand pills */
.rmp-brand-pills {
  display: flex; flex-wrap: wrap; gap: 7px;
}
.rmp-brand-pill {
  padding: 6px 16px; border: 1.5px solid #ddd; border-radius: 50px;
  background: #fff; font-size: 13px; font-weight: 500; cursor: pointer;
  transition: all .15s; color: #555; white-space: nowrap;
}
.rmp-brand-pill:hover { border-color: #aaa; color: #111; }
.rmp-brand-pill.active { color: #fff; font-weight: 600; }

/* Device dropdown */
.rmp-dropdown-wrap { position: relative; }
.rmp-device-select {
  width: 100%; padding: 11px 40px 11px 14px; font-size: 15px;
  border: 1.5px solid #e0e0e0; border-radius: var(--rmp-radius);
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23999' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 14px center;
  appearance: none; -webkit-appearance: none; cursor: pointer;
  color: var(--rmp-text); transition: border-color .15s, box-shadow .15s;
}
.rmp-device-select:focus {
  outline: none; border-color: var(--rmp-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--rmp-accent) 12%, transparent);
}

/* ── Grid ────────────────────────────────────────────────────────────────── */
.rmp-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr); /* overridden by JS-injected style per instance */
  gap: 14px;
  margin-top: 4px;
}

/* ── Card ────────────────────────────────────────────────────────────────── */
.rmp-card {
  background: var(--rmp-card-bg);
  border: 1.5px solid #e8e8e8;
  border-radius: var(--rmp-radius);
  overflow: hidden;
  transition: transform .15s, box-shadow .15s, border-color .15s;
  animation: rmp-in .25s ease both;
}
.rmp-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,.08);
}
.rmp-card.rmp-selected {
  border-color: var(--rmp-sel-color) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--rmp-sel-color) 18%, transparent) !important;
}
@keyframes rmp-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.rmp-card-body {
  padding: 16px 18px;
  display: flex; flex-direction: column; height: 100%; box-sizing: border-box;
}
.rmp-card-body h3 {
  font-size: 15px; font-weight: 600; margin: 0 0 5px;
  color: var(--rmp-text); line-height: 1.35;
}
.rmp-info {
  font-size: 13px; color: #777; margin: 0 0 10px; line-height: 1.4;
  flex: 1;
}
.rmp-foot {
  display: flex; align-items: center; gap: 8px;
  margin-top: auto; padding-top: 12px; flex-wrap: wrap;
}

/* Price */
.rmp-price {
  font-size: 22px; font-weight: 700; color: var(--rmp-accent);
  letter-spacing: -0.5px; white-space: nowrap;
}
.rmp-price-ab { font-size: 13px; font-weight: 400; opacity: .7; }
.rmp-sku { font-size: 11px; color: #bbb; margin-left: auto; }

/* CTA button */
.rmp-btn {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--rmp-accent); color: #fff !important;
  padding: 8px 16px; border-radius: calc(var(--rmp-radius) - 4px);
  font-size: 13px; font-weight: 600; text-decoration: none !important;
  margin-left: auto; transition: filter .15s, transform .1s; white-space: nowrap;
  border: none; cursor: pointer;
}
.rmp-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.rmp-btn:active { transform: translateY(0); }

/* Select button (inquiry mode) */
.rmp-select-btn {
  display: inline-flex; align-items: center; gap: 5px;
  border: 2px solid var(--rmp-accent); color: var(--rmp-accent);
  background: transparent; padding: 7px 14px;
  border-radius: calc(var(--rmp-radius) - 4px);
  font-size: 13px; font-weight: 600; cursor: pointer;
  margin-left: auto; transition: all .15s; white-space: nowrap;
}
.rmp-select-btn:hover { background: color-mix(in srgb, var(--rmp-accent) 8%, transparent); }
.rmp-select-btn.rmp-selected-btn { color: #fff; }
.rmp-select-btn svg { flex-shrink: 0; }

/* Badge (search results) */
.rmp-badge {
  display: inline-block; background: color-mix(in srgb, var(--rmp-accent) 10%, transparent);
  color: var(--rmp-accent); font-size: 11px; font-weight: 600;
  padding: 2px 8px; border-radius: 4px; margin-bottom: 6px;
}

/* ── Skeleton ────────────────────────────────────────────────────────────── */
.rmp-skeleton { pointer-events: none; }
.rmp-skel-line {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: rmp-shimmer 1.4s infinite; border-radius: 4px; margin-bottom: 8px;
}
@keyframes rmp-shimmer { to { background-position: -200% 0; } }
.rmp-skel-title { height: 16px; width: 70%; }
.rmp-skel-info  { height: 12px; width: 90%; }
.rmp-skel-price { height: 28px; width: 45%; }

/* ── Unavailable notice ──────────────────────────────────────────────────── */
.rmp-unavail-notice {
  background: #fff9e6; border: 1px solid #f59e0b; border-radius: var(--rmp-radius);
  padding: 12px 16px; margin-bottom: 14px; font-size: 14px; color: #92400e;
}

/* ── Count / empty ───────────────────────────────────────────────────────── */
.rmp-count { font-size: 13px; color: #888; margin: 0 0 10px; }
.rmp-empty { color: #999; font-size: 14px; padding: 20px 0; text-align: center; }

/* ── Inquiry bar ─────────────────────────────────────────────────────────── */
.rmp-inquiry-bar {
  position: sticky; bottom: 16px; z-index: 200;
  background: #1a1a1a; color: #fff;
  border-radius: var(--rmp-radius); padding: 14px 18px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  box-shadow: 0 8px 32px rgba(0,0,0,.3);
  margin-top: 18px;
  animation: rmp-bar-in .2s ease;
}
@keyframes rmp-bar-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.rmp-inquiry-left { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }

.rmp-inquiry-count {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 600; flex-wrap: wrap;
}
.rmp-inquiry-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; background: var(--rmp-accent);
  border-radius: 50%; font-size: 13px; font-weight: 700; flex-shrink: 0;
}
.rmp-inquiry-total {
  background: rgba(255,255,255,.12); border-radius: 20px;
  padding: 2px 10px; font-size: 13px; font-weight: 700;
  color: #fff; white-space: nowrap;
}

.rmp-inquiry-chips {
  display: flex; flex-wrap: wrap; gap: 5px;
}
.rmp-inquiry-chip {
  background: rgba(255,255,255,.1); border-radius: 20px;
  padding: 3px 10px; font-size: 12px; white-space: nowrap;
}
.rmp-inquiry-chip strong { font-weight: 600; }

.rmp-inquiry-actions {
  display: flex; gap: 8px; align-items: center; flex-shrink: 0;
}
.rmp-inquiry-clear {
  background: none; border: 1.5px solid rgba(255,255,255,.25);
  color: rgba(255,255,255,.7); padding: 8px 14px; border-radius: 8px;
  cursor: pointer; font-size: 13px; font-weight: 500;
  transition: all .15s; white-space: nowrap;
}
.rmp-inquiry-clear:hover { border-color: #fff; color: #fff; }
.rmp-inquiry-submit { background: var(--rmp-accent) !important; font-size: 14px !important; padding: 9px 18px !important; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
/* Note: column counts per breakpoint are injected as per-instance <style> tags by JS */
@media (max-width: 580px) {
  /* fallback only – overridden by JS-injected styles */
  .rmp-root { --rmp-cols: 1; }
  .rmp-brand-pills { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
  .rmp-price { font-size: 20px; }
  .rmp-inquiry-bar { flex-direction: column; align-items: stretch; bottom: 0; border-radius: var(--rmp-radius) var(--rmp-radius) 0 0; position: fixed; left: 0; right: 0; margin: 0; }
  .rmp-inquiry-actions { justify-content: space-between; }
  .rmp-inquiry-submit { text-align: center; flex: 1; }
}
@media (max-width: 360px) {
  .rmp-card-body { padding: 12px 14px; }
  .rmp-price { font-size: 18px; }
}


/* ── Inquiry bar (multi-select) ──────────────────────────────────────────── */
.rmp-inquiry-bar {
  position: sticky;
  bottom: 16px;
  z-index: 100;
  background: #1a1a1a;
  color: #fff;
  border-radius: 14px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,.35);
  margin-top: 24px;
  animation: rmp-in .2s ease;
}
.rmp-inquiry-left {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.rmp-inquiry-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.rmp-inquiry-count {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}
.rmp-inquiry-total {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.2);
  padding: 3px 12px;
  border-radius: 20px;
  font-size: 13px;
  white-space: nowrap;
}
.rmp-inquiry-total strong {
  color: #fff;
  font-size: 15px;
}
.rmp-inquiry-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.rmp-inquiry-chip {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.15);
  padding: 4px 11px;
  border-radius: 20px;
  font-size: 12px;
  white-space: nowrap;
  color: rgba(255,255,255,.85);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rmp-inquiry-chip strong {
  color: #fff;
}
.rmp-inquiry-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-shrink: 0;
}
.rmp-inquiry-clear {
  background: none;
  border: 1px solid rgba(255,255,255,.25);
  color: rgba(255,255,255,.65);
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  transition: all .15s;
  white-space: nowrap;
}
.rmp-inquiry-clear:hover { border-color: #fff; color: #fff; }
.rmp-inquiry-submit {
  background: var(--rmp-accent) !important;
  padding: 9px 20px !important;
  font-size: 14px !important;
  white-space: nowrap;
}

/* Selected card state – uses accent color */
.rmp-selected {
  border-color: var(--rmp-sel-color, var(--rmp-accent)) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--rmp-sel-color, var(--rmp-accent)) 20%, transparent) !important;
}
.rmp-select-btn {
  border: 2px solid var(--rmp-accent);
  background: none;
  color: var(--rmp-accent);
  padding: 7px 14px;
  border-radius: calc(var(--rmp-radius) - 4px);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin-left: auto;
  transition: all .15s;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 5px;
}
.rmp-select-btn:hover { opacity: .85; }

/* Unavailable notice */
.rmp-unavail-notice {
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: var(--rmp-radius);
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 14px;
  color: #856404;
}

/* Brand pill color support */
.rmp-brand-pill { --pill-color: var(--rmp-accent); }
.rmp-brand-pill:hover { border-color: var(--pill-color) !important; color: var(--pill-color) !important; }

/* Mobile */
@media (max-width: 600px) {
  .rmp-inquiry-bar {
    flex-direction: column;
    align-items: stretch;
    bottom: 0;
    border-radius: 14px 14px 0 0;
    padding: 14px 16px 20px;
  }
  .rmp-inquiry-actions {
    justify-content: space-between;
  }
  .rmp-inquiry-submit { text-align: center; justify-content: center; }
}
/* ── Design settings via CSS vars ──────────────────────────────────────────── */
.rmp-card {
  box-shadow: var(--rmp-card-shadow, 0 2px 8px rgba(0,0,0,.07));
  border: var(--rmp-card-border, 1.5px solid #e8e8e8);
}
.rmp-card:hover {
  transform: translateY(calc(-1 * var(--rmp-hover-lift, 4px)));
}
/* Section background */
.rmp-root { background: var(--rmp-section-bg, transparent); }

/* ── Variant preview list on card ──────────────────────────────────────────── */
.rmp-vp-list {
  list-style: none;
  margin: 6px 0 10px;
  padding: 0;
  border-top: 1px solid rgba(0,0,0,.06);
  padding-top: 8px;
}
.rmp-vp-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #555;
  padding: 3px 0;
  position: relative;
  cursor: default;
}
.rmp-vp-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--rmp-accent);
  flex-shrink: 0;
}
.rmp-vp-name { flex: 1; }
.rmp-vp-price {
  font-weight: 600;
  color: var(--rmp-accent);
  white-space: nowrap;
  font-size: 12px;
}
.rmp-vp-more {
  list-style: none;
  font-size: 11px;
  color: #999;
  padding: 2px 0 0 11px;
}
/* Hover tooltip on variant preview items */
.rmp-vp-tooltip {
  display: none;
  position: absolute;
  left: 0; bottom: calc(100% + 6px);
  background: #1a202c;
  color: #fff;
  font-size: 11px;
  padding: 5px 9px;
  border-radius: 6px;
  white-space: nowrap;
  max-width: 220px;
  white-space: normal;
  z-index: 99;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0,0,0,.25);
}
.rmp-vp-tooltip::after {
  content: '';
  position: absolute;
  top: 100%; left: 12px;
  border: 5px solid transparent;
  border-top-color: #1a202c;
}
.rmp-vp-has-tip:hover .rmp-vp-tooltip { display: block; }
.rmp-vp-has-tip { cursor: help; }

/* Variants button on card */
.rmp-open-variants-btn {
  border: 2px solid var(--rmp-accent);
  background: none;
  padding: 7px 14px;
  border-radius: calc(var(--rmp-radius) - 4px);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin-left: auto;
  transition: all .15s;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}
.rmp-open-variants-btn:hover { opacity: .85; }
.rmp-has-variants { cursor: default; }

/* ── Variant modal overlay ──────────────────────────────────────────────────── */
.rmp-variant-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity .2s ease;
  backdrop-filter: blur(3px);
}
.rmp-variant-modal-overlay.rmp-modal-visible { opacity: 1; }

.rmp-variant-modal {
  background: #fff;
  border-radius: 16px;
  max-width: 520px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 24px 60px rgba(0,0,0,.22);
  transform: translateY(16px) scale(.97);
  transition: transform .22s cubic-bezier(.34,1.56,.64,1);
}
.rmp-modal-visible .rmp-variant-modal {
  transform: translateY(0) scale(1);
}

.rmp-vm-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 22px 22px 16px;
  border-bottom: 1px solid #f0f0f0;
}
.rmp-vm-titles { flex: 1; }
.rmp-vm-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 4px;
  color: #1a202c;
}
.rmp-vm-sub {
  font-size: 13px;
  color: #718096;
  margin: 0;
}
.rmp-vm-price { white-space: nowrap; padding-top: 2px; }
.rmp-vm-price .rmp-price { font-size: 20px; }
.rmp-vm-close {
  background: none;
  border: none;
  cursor: pointer;
  color: #a0aec0;
  padding: 2px;
  border-radius: 6px;
  transition: color .15s, background .15s;
  flex-shrink: 0;
}
.rmp-vm-close:hover { color: #1a202c; background: #f7fafc; }

.rmp-vm-hint {
  font-size: 12px;
  color: #a0aec0;
  margin: 12px 22px 8px;
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 600;
}

/* Variant items inside modal */
.rmp-vi-list { padding: 0 14px 14px; }
.rmp-vi {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 10px;
  border-radius: 10px;
  margin-bottom: 4px;
  transition: background .12s;
  border: 1.5px solid transparent;
}
.rmp-vi:hover { background: #f7fafc; }
.rmp-vi--sel {
  background: color-mix(in srgb, var(--rmp-accent) 8%, transparent);
  border-color: color-mix(in srgb, var(--rmp-accent) 30%, transparent);
}
.rmp-vi-info { flex: 1; }
.rmp-vi-name {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #1a202c;
}
.rmp-vi-desc {
  display: block;
  font-size: 12px;
  color: #718096;
  margin-top: 2px;
}
.rmp-vi-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.rmp-vi-price {
  font-size: 16px;
  font-weight: 700;
  color: var(--rmp-accent);
  white-space: nowrap;
}
.rmp-btn--sm {
  padding: 5px 12px;
  font-size: 12px;
}

/* Mobile modal */
@media (max-width: 600px) {
  .rmp-variant-modal-overlay { align-items: flex-end; padding: 0; }
  .rmp-variant-modal {
    border-radius: 20px 20px 0 0;
    max-height: 80vh;
    max-width: 100%;
  }
  .rmp-vm-head { padding: 18px 16px 14px; }
  .rmp-vi-list { padding: 0 8px 24px; }
}
