/* ═══════════════════════════════════════════════════════
   RapidCare Processing Widget  v2.0  —  widget.css
   Fully responsive: 360px → 1400px+
   States: pending | inprog | done  (steps & QC & deliver)
═══════════════════════════════════════════════════════ */

/* ── CSS Custom Properties ───────────────────────────── */
.rc-outer {
  --rc-green:        #1a7a5e;
  --rc-green-light:  #d0f0e4;
  --rc-teal:         #2ec9a0;
  --rc-amber:        #c07800;
  --rc-amber-light:  #fef3d0;
  --rc-border:       #d8ede6;
  --rc-bg-soft:      #f5fbf8;
  --rc-text:         #1a1a1a;
  --rc-muted:        #888;
  --rc-pale:         #bbb;
  --rc-outer-bg-start: #e8f5f0;
  --rc-outer-bg-end:   #daeee9;
}

/* ── Reset ───────────────────────────────────────────── */
.rc-outer *, .rc-outer *::before, .rc-outer *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Outer wrapper ───────────────────────────────────── */
.rc-outer {
  background: linear-gradient(135deg, var(--rc-outer-bg-start) 0%, var(--rc-outer-bg-end) 100%);
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

/* ── Card ────────────────────────────────────────────── */
.rc-card {
  background: #fff;
  border-radius: 20px;
  padding: clamp(16px, 4vw, 22px) clamp(14px, 4vw, 20px);
  width: 100%;
  max-width: 480px;
  box-shadow: 0 6px 32px rgba(0,0,0,0.08);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--rc-text);
}

/* ── Title bar ───────────────────────────────────────── */
.rc-titlebar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  flex-wrap: nowrap;
  min-width: 0;
}
.rc-dot {
  width: 11px; height: 11px;
  border-radius: 50%;
  flex-shrink: 0;
}
.rc-r { background: #FF5F57; }
.rc-y { background: #FEBC2E; }
.rc-g { background: #28C840; }

.rc-brand {
  font-size: clamp(12px, 3vw, 13.5px);
  font-weight: 600;
  color: var(--rc-text);
  margin-left: 4px;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rc-live-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: clamp(10.5px, 2.5vw, 11.5px);
  color: #555;
  border: 1px solid var(--rc-border);
  border-radius: 20px;
  padding: 3px 10px;
  background: #f5fdf9;
  flex-shrink: 0;
  white-space: nowrap;
  margin-left: auto;
}
.rc-live-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--rc-teal);
  flex-shrink: 0;
  animation: rc-pulse 1.5s ease-in-out infinite;
}
@keyframes rc-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.2; }
}

/* ── Case card ───────────────────────────────────────── */
.rc-case-card {
  background: var(--rc-bg-soft);
  border: 1px solid var(--rc-border);
  border-radius: 12px;
  padding: 7px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.rc-file-ico {
  width: 34px; height: 34px; min-width: 34px;
  border-radius: 8px;
  background: #e8f5f0;
  border: 1px solid #c8e4da;
  display: flex;
  align-items: center;
  justify-content: center;
}
.rc-case-title {
  font-size: clamp(13px, 3vw, 14px);
  font-weight: 600;
  color: var(--rc-text);
  line-height: 1.3;
}
.rc-case-sub {
  font-size: clamp(11px, 2.5vw, 12px);
  color: var(--rc-muted);
  margin-top: 2px;
}

/* ── Progress ────────────────────────────────────────── */
.rc-prog-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 7px;
}
.rc-prog-label { font-size: 11px; color: var(--rc-muted); }
.rc-prog-pct   { font-size: 11px; font-weight: 700; color: #333; }

.rc-prog-track {
  height: 6px;
  background: #e2ede9;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: clamp(12px, 3vw, 16px);
}
.rc-prog-fill {
  height: 100%;
  width: 0%;
  background: var(--rc-green);
  border-radius: 999px;
  transition: none;
}
.rc-prog-fill.completed {
  background: linear-gradient(90deg, var(--rc-green) 0%, var(--rc-teal) 100%);
}
.rc-prog-label.completed {
  color: var(--rc-green);
  font-weight: 700;
}

/* ── Steps ───────────────────────────────────────────── */
.rc-step {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-radius: 10px;
  padding: 3px 10px;
  margin-bottom: 8px;
  /* ── PENDING state (default) ── */
  background: #f7f7f7;
  border: 1px solid #e4e4e4;
  transition: background 0.45s ease, border-color 0.45s ease;
}
/* ── IN-PROGRESS state ── */
.rc-step.inprog {
  background: #fffdf4;
  border-color: #f0dfa0;
}
/* ── DONE state ── */
.rc-step.done {
  background: #f0faf5;
  border-color: #d4ede5;
}

.rc-step-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

/* Circle indicator */
.rc-circle {
  width: 22px; height: 22px; min-width: 22px;
  border-radius: 50%;
  background: #e4e4e4;          /* pending */
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
  transition: background 0.45s ease;
}
.rc-step.inprog .rc-circle { background: var(--rc-amber-light); }
.rc-step.done   .rc-circle { background: var(--rc-green-light); }

.rc-num {
  font-size: 11px;
  font-weight: 700;
  color: #bbb;                  /* pending */
  position: absolute;
  transition: opacity 0.3s ease, color 0.3s ease;
}
.rc-step.inprog .rc-num { color: var(--rc-amber); animation: rc-blink 1s ease-in-out infinite; }
.rc-step.done   .rc-num { opacity: 0; }

@keyframes rc-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.2; }
}

.rc-check {
  position: absolute;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.rc-step.done .rc-check { opacity: 1; }
.rc-check polyline { stroke: var(--rc-green); }

/* Step label text */
.rc-step-label {
  font-size: clamp(12px, 2.8vw, 13px);
  color: #bbb;                  /* pending: muted */
  line-height: 1.35;
  transition: color 0.45s ease;
  min-width: 0;
}
.rc-step.inprog .rc-step-label,
.rc-step.done   .rc-step-label { color: var(--rc-text); }

/* Step right-side status pill */
.rc-step-st {
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  color: #ccc;                  /* pending: invisible-ish */
  transition: color 0.45s ease;
  padding: 2px 0;
}
.rc-step.inprog .rc-step-st { color: var(--rc-amber); }     /* Processing */
.rc-step.done   .rc-step-st { color: var(--rc-green); }     /* Done */

/* ── Divider ─────────────────────────────────────────── */
.rc-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px;
}
.rc-div-line {
  flex: 1;
  height: 1px;
  background: #ddeee8;
  display: block;
}
.rc-div-lbl {
  font-size: clamp(9px, 2vw, 10.5px);
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #7ab5a4;
  text-transform: uppercase;
  white-space: nowrap;
}

/* ── QC Card ─────────────────────────────────────────── */
.rc-qc-card {
  border: 1.5px solid var(--rc-border);
  border-radius: 14px;
  padding: 10px;
  margin-bottom: 10px;
  background: #fff;
  transition: border-color 0.45s ease;
  display: flex;
  gap: 20px;
  justify-content: space-between;
}

.rc-qc-card.active { border-color: var(--rc-teal); }

.rc-qc-top {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin-bottom: 8px;
}
.rc-avatars { display: flex; }
.rc-av {
  width: 24px; height: 24px; min-width: 24px;
  border-radius: 50%;
  font-size: 8.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  margin-right: -6px;
}

.rc-qc-title { font-size: clamp(13px, 3vw, 14px); font-weight: 700; color: var(--rc-text); }
.rc-qc-sub   { font-size: clamp(11px, 2.5vw, 12px); color: var(--rc-muted); margin-top: 2px; line-height: 1.4; }

.rc-qc-st { font-size: 10px; font-weight: 600; display: inline-block; }
.rc-qc-st.idle      { color: #ccc; }
.rc-qc-st.reviewing { color: var(--rc-teal); }
.rc-qc-st.done      { color: var(--rc-green); }

/* ── Deliver Card ────────────────────────────────────── */
.rc-del-card {
  border: 1px solid var(--rc-border);
  border-radius: 14px;
  padding: 8px;
  margin-bottom: 12px;
  background: #fff;
  transition: border-color 0.4s ease, background 0.4s ease;
}
.rc-del-card.active {
  border: 1.5px solid var(--rc-teal);
  background: #fafffe;
}

.rc-del-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.rc-del-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.rc-del-ico {
  width: 32px; height: 32px; min-width: 32px;
  border-radius: 8px;
  background: #e8f5f0;
  border: 1px solid #c8e4da;
  display: flex;
  align-items: center;
  justify-content: center;
}
.rc-del-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--rc-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rc-del-st {
  font-size: 10px;
  white-space: nowrap;
  flex-shrink: 0;
}
.rc-del-st.queued    { color: #aaa; }
.rc-del-st.preparing { color: var(--rc-amber); font-weight: 600; }
.rc-del-st.done      { color: var(--rc-green); font-weight: 600; }

/* Format tags */
.rc-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.rc-tag {
  font-size: 10px;
  padding: 0px 7px;
  border-radius: 20px;
  border: 1px solid #d0e8e0;
  color: #5a9080;
  background: #fff;
  opacity: 0.35;
  transition: opacity 0.4s ease;
  white-space: nowrap;
}
.rc-tag.show { opacity: 1; }

/* ── Meta Grid ───────────────────────────────────────── */
.rc-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.rc-meta-box {
  background: var(--rc-bg-soft);
  border: 1px solid var(--rc-border);
  border-radius: 12px;
  padding: clamp(9px, 2.5vw, 12px) clamp(10px, 3vw, 14px);
}
.rc-meta-lbl {
  font-size: clamp(9px, 2vw, 10px);
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #7ab5a4;
  margin-bottom: 4px;
}
.rc-meta-val {
  font-size: clamp(12px, 2.8vw, 13.5px);
  font-weight: 600;
  color: var(--rc-text);
  line-height: 1.3;
}
.rc-meta-accent { color: var(--rc-green); }

/* ═══════════════════════════════════════════════════════
   RESPONSIVE BREAKPOINTS
═══════════════════════════════════════════════════════ */

/* ── Wide desktop (≥ 1200px) ─────────────────────────── */
@media (min-width: 1200px) {
  .rc-card  { padding: 26px 24px; }
}

/* ── Tablet landscape (768px–1023px) ────────────────── */
@media (max-width: 1023px) {
  .rc-card { max-width: 100%; }
}

/* ── Tablet portrait (600px–767px) ──────────────────── */
@media (max-width: 767px) {
  .rc-card  { border-radius: 16px; padding: 18px 16px; }

  .rc-step-label {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
  }
}

/* ── Mobile (≤ 599px) ────────────────────────────────── */
@media (max-width: 599px) {
  .rc-card  { border-radius: 14px; padding: 16px 14px; }
  .rc-titlebar { gap: 5px; }
  .rc-dot  { width: 9px; height: 9px; }
  .rc-brand { font-size: 12px; }
  .rc-live-badge { font-size: 10.5px; padding: 2px 8px; }
  .rc-live-dot   { width: 6px; height: 6px; }

  .rc-step { padding: 9px 11px; margin-bottom: 7px; }
  .rc-circle { width: 20px; height: 20px; min-width: 20px; }
  .rc-num  { font-size: 10px; }

  .rc-qc-top { gap: 9px; }
  .rc-av { width: 22px; height: 22px; min-width: 22px; font-size: 8px; }

  .rc-del-top { gap: 6px; }
  .rc-del-ico { width: 28px; height: 28px; min-width: 28px; }

  .rc-tags { gap: 5px; }
  .rc-tag  { font-size: 10px; padding: 3px 8px; }

  .rc-meta-box { padding: 9px 10px; }
}

/* ── Small mobile (≤ 420px) ─────────────────────────── */
@media (max-width: 420px) {
  .rc-card { padding: 14px 12px; }

  .rc-brand { font-size: 11.5px; }

  .rc-del-top { flex-direction: row; flex-wrap: wrap; }

  /* Stack meta boxes vertically on very small screens */
  .rc-meta-grid { grid-template-columns: 1fr 1fr; gap: 6px; }
}

/* ── Extra small (≤ 360px) ───────────────────────────── */
@media (max-width: 360px) {
  .rc-card { padding: 12px 10px; border-radius: 12px; }
  .rc-meta-grid { grid-template-columns: 1fr; }
  .rc-del-top { flex-direction: column; align-items: flex-start; gap: 6px; }
  .rc-div-lbl { font-size: 8.5px; }
  .rc-tags { gap: 4px; }
  .rc-tag  { font-size: 9.5px; padding: 3px 7px; }
}

/* ── Reduced motion preference ───────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .rc-live-dot { animation: none; opacity: 1; }
  .rc-num { animation: none !important; }
  .rc-prog-fill,
  .rc-step,
  .rc-circle,
  .rc-step-label,
  .rc-step-st,
  .rc-num,
  .rc-check,
  .rc-tag { transition: none !important; }
}
