/* RMA Form — Stage 1 custom web page.
   Design ported verbatim from RMA_NEW/rma-form.html (design source of
   truth), with additions for the Stage 1 seven-field product row, the
   serial-number "i" icon, and the verify / Samsung popups. */

/* ---------- Design tokens ---------- */
:root {
  --navy:        #1B2A5B;
  --navy-hover:  #141F44;
  --navy-tint:   #E7EAF3;
  --cyan:        #27BDD6;
  --crimson:     #E8285A;

  --paper-0:     #FFFFFF;
  --paper-50:    #FAF8F4;
  --slate-50:    #F5F7FA;
  --slate-100:   #ECEFF4;
  --slate-200:   #E3E7EE;
  --slate-300:   #CCD3DD;
  --slate-400:   #97A1B2;
  --slate-500:   #64708A;
  --slate-700:   #2F3849;
  --slate-900:   #0E1729;

  --radius-card: 12px;
  --radius-panel: 8px;
  --radius-input: 6px;
  --ease: cubic-bezier(.2, .8, .2, 1);

  --font-sans: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

/* Frappe's templates/web.html wraps content in a centered Bootstrap
   .container with its own margins, and the outer <body> /
   .page-content-wrapper keep their default (white) background — so a
   background set only on .rma-page shows as a narrow band, not the full
   screen. Pushing the cream background up to <body> + the wrapper makes
   it span the whole viewport. We also zero the wrapper's container
   padding so .rma-page can center across the full width.
   (full_width=1 in the controller removes the .container my-4 box.) */
body {
  background: var(--paper-50);
}
.page-content-wrapper,
.page-content-wrapper > .container,
.page-content-wrapper > main {
  background: var(--paper-50);
}

/* Scope to the page wrapper. .rma-page now centers the card across the
   full viewport width; its own cream bg matches <body> seamlessly. */
.rma-page {
  font-family: var(--font-sans);
  color: var(--slate-900);
  background: var(--paper-50);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  padding: 48px 24px;
  display: flex;
  justify-content: center;
}
.rma-card {
  width: 100%;
  max-width: 980px;
  background: var(--paper-0);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-card);
  box-shadow: 0 8px 24px -8px rgba(27,42,91,.18), 0 2px 6px rgba(27,42,91,.06);
  overflow: hidden;
}

/* ---------- Header ---------- */
.rma-header {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 32px;
  background: var(--navy);
}
.rma-header::after {
  content: "";
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 5px;
  background: linear-gradient(var(--cyan), var(--crimson));
}
.rma-brand { display: flex; align-items: center; gap: 16px; }
.rma-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px; height: 46px;
  background: #fff;
  border-radius: 10px;
  padding: 5px;
}
/* 2026-06-22: Newcom "N" logo fits inside the white header badge
   without distortion. */
.rma-logo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.rma-title    { font-size: 22px; font-weight: 800; letter-spacing: -.01em; color: #fff; line-height: 1.1; }
.rma-subtitle {
  margin-top: 5px;
  font-size: 11px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase;
  color: rgba(255,255,255,.62);
}
.rma-header-meta { display: flex; align-items: center; gap: 14px; }
.rma-id { font-family: var(--font-mono); font-size: 12px; font-weight: 500; color: rgba(255,255,255,.7); }

.rma-status {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 13px 6px 11px;
  border-radius: 999px;
  background: rgba(255,255,255,.92);
  font-size: 11px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--crimson);
}
.rma-status .dot { width: 7px; height: 7px; border-radius: 999px; background: var(--crimson); }
.rma-status.is-saved { background: rgba(46,139,87,.16); border: 1px solid rgba(46,139,87,.35); color: #1F8A5B; }
.rma-status.is-saved .dot { background: #2E8B57; }

/* ---------- Body & sections ---------- */
.rma-body { padding: 32px; }
.rma-section {
  display: flex; align-items: center; gap: 12px;
  margin: 0 0 20px;
}
.rma-section + .rma-grid { margin-top: 0; }
.rma-section-label {
  font-size: 11px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--slate-500);
}
.rma-section .rule { flex: 1; height: 1px; background: var(--slate-200); }
.rma-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 999px;
  background: var(--navy-tint); color: var(--navy);
  font-size: 11px; font-weight: 700;
}
.rma-section--products { margin: 36px 0 16px; }

/* ---------- Field grid ---------- */
.rma-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px 28px;
}
.rma-field { display: flex; flex-direction: column; gap: 7px; position: relative; }
.rma-field label { font-size: 13px; font-weight: 600; line-height: 1.2; color: var(--slate-700); }
.req { color: var(--crimson); }

.rma-input, .rma-select, .rma-textarea {
  width: 100%;
  padding: 0 14px;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-input);
  background: var(--paper-50);
  font: 500 14px var(--font-sans);
  color: var(--slate-900);
  transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease), background 150ms var(--ease);
}
.rma-input, .rma-select { height: 42px; }
.rma-textarea { min-height: 88px; padding: 11px 14px; line-height: 1.5; resize: vertical; }
.rma-input::placeholder, .rma-textarea::placeholder { color: var(--slate-400); }

.rma-input:hover:not(:focus), .rma-select:hover:not(:focus), .rma-textarea:hover:not(:focus) {
  border-color: var(--slate-300);
}
.rma-input:focus, .rma-select:focus, .rma-textarea:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(39,189,214,.22);
  background: var(--paper-0);
}

.rma-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364708A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

/* ---------- Defective-products card (Stage 1 seven-field row) ---------- */
.rma-products { display: flex; flex-direction: column; gap: 16px; }
.rma-product {
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-panel);
  background: var(--paper-0);
  padding: 18px;
  position: relative;
}
.rma-product-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.rma-product-title { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--slate-500); }
.rma-product-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px 18px;
}
.rma-product-grid .rma-field.full { grid-column: 1 / -1; }

.rma-remove {
  display: inline-flex; align-items: center; gap: 6px;
  border: none; background: transparent;
  color: var(--slate-400);
  cursor: pointer; font: 600 12px var(--font-sans);
  transition: color 150ms;
}
.rma-remove:hover { color: var(--crimson); }

.rma-add {
  display: inline-flex; align-items: center; gap: 8px;
  align-self: flex-start;
  /* 2026-06-22: breathing room above the "Add product" button so it is
     not cramped against the product card(s) above it. */
  margin-top: 16px;
  padding: 10px 16px;
  border: 1px dashed var(--slate-300);
  border-radius: var(--radius-input);
  background: var(--paper-0);
  color: var(--navy);
  font: 600 13px var(--font-sans);
  cursor: pointer;
  transition: background 150ms, border-color 150ms;
}
.rma-add:hover { background: var(--slate-50); border-color: var(--navy); }

/* serial "i" icon */
.rma-serial-label { display: inline-flex; align-items: center; gap: 6px; }
.rma-info-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 999px;
  background: var(--navy-tint); color: var(--navy);
  font-size: 11px; font-weight: 700; cursor: pointer;
  border: none;
}
.rma-info-icon:hover { background: var(--cyan); color: #fff; }

.rma-cell-readonly { background: var(--slate-50) !important; color: var(--slate-500); cursor: not-allowed; }

/* autocomplete dropdown for part number */
/* 2026-06-22: the part-number autocomplete used to be appended in
   normal flow, so it pushed/covered the Description field. It is now
   absolutely positioned directly under its input (the input's
   .rma-field is position:relative) and floats above the rest of the
   grid via a high z-index, so it never covers a neighbouring field. */
.rma-ac {
  position: absolute; z-index: 60;
  top: calc(100% + 4px); left: 0;
  background: #fff; border: 1px solid var(--slate-200);
  border-radius: var(--radius-input);
  box-shadow: 0 8px 20px -6px rgba(27,42,91,.18);
  max-height: 240px; overflow-y: auto;
  font-size: 13px;
}
.rma-ac-item { padding: 9px 12px; cursor: pointer; line-height: 1.35; }
.rma-ac-item:hover, .rma-ac-item.active { background: var(--slate-50); }
.rma-ac-empty { padding: 9px 12px; color: var(--slate-500); font-style: italic; }

/* ---------- Notes / disclaimer ---------- */
.rma-notes { display: flex; flex-direction: column; gap: 7px; margin-top: 24px; }
.rma-notes label { font-size: 13px; font-weight: 600; line-height: 1.2; color: var(--slate-700); }

.rma-disclaimer {
  margin-top: 24px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  background: var(--slate-50, #f8fafc);
  border: 1px solid var(--slate-200, #e2e8f0);
  border-radius: var(--radius-input, 10px);
  transition: border-color 150ms, background 150ms;
}
.rma-disclaimer:hover { border-color: var(--slate-300, #cbd5e1); background: #f1f5f9; }

/* 2026-06-22: custom-styled disclaimer checkbox. The base form styles
   were shrinking the native box (var(--checkbox-size) + a grey border),
   leaving it tiny and misaligned. We override those with an explicit
   20px square, branded accent on check, and a white tick. !important is
   needed to beat the higher-specificity base input rules. */
.rma-disclaimer input[type="checkbox"] {
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
  width: 20px !important;
  height: 20px !important;
  min-width: 20px !important;
  margin: 1px 0 0 0 !important;
  padding: 0 !important;
  flex-shrink: 0;
  border: 2px solid var(--slate-300, #cbd5e1) !important;
  border-radius: 5px !important;
  background: #fff !important;
  cursor: pointer;
  position: relative;
  transition: background 150ms, border-color 150ms;
}
.rma-disclaimer input[type="checkbox"]:hover { border-color: var(--navy, #2563eb) !important; }
.rma-disclaimer input[type="checkbox"]:checked {
  background: var(--navy, #2563eb) !important;
  border-color: var(--navy, #2563eb) !important;
}
.rma-disclaimer input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 5px; top: 1px;
  width: 6px; height: 11px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.rma-disclaimer input[type="checkbox"]:focus {
  outline: none !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .18) !important;
}
.rma-disclaimer label {
  font-size: 13px;
  color: var(--slate-700);
  line-height: 1.5;
  margin: 0;
  cursor: pointer;
}
.rma-disclaimer label b { color: var(--slate-900, #0f172a); font-weight: 600; }

/* 2026-07-09: full Terms & Conditions list (carried over from the old
   /rma/new form) shown right below the accept checkbox. */
.rma-terms-list {
  margin: 10px 0 0;
  padding: 0 4px 0 22px;
  font-size: 12px;
  color: var(--slate-600, #475569);
  line-height: 1.6;
}
.rma-terms-list li { margin-bottom: 2px; }
.rma-terms-list b { color: var(--slate-900, #0f172a); font-weight: 600; }

/* 2026-07-09: "required fields missing" popup — every unfilled
   mandatory field listed together in red. */
.rma-required-list {
  margin: 10px 0 0;
  padding-left: 20px;
  max-height: 45vh;
  overflow-y: auto;
}
.rma-required-list li {
  color: #dc2626;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.7;
  cursor: pointer;
}
.rma-required-list li:hover { text-decoration: underline; }

/* Brief red flash on the field the user jumped to from the popup. */
.rma-field-flash {
  outline: 2px solid #dc2626 !important;
  outline-offset: 2px;
  border-radius: 6px;
}

.rma-attach { margin-top: 20px; display: flex; flex-direction: column; gap: 7px; }
.rma-attach label { font-size: 13px; font-weight: 600; color: var(--slate-700); }

/* ---------- Multi-file attachment widget ---------- */
.rma-drop {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 18px; cursor: pointer;
  border: 1.5px dashed var(--slate-300);
  border-radius: var(--radius-input);
  background: var(--slate-50);
  color: var(--slate-500);
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.rma-drop:hover, .rma-drop:focus-visible, .rma-drop.is-over {
  border-color: var(--navy); background: #fff; color: var(--navy);
  outline: none;
}
.rma-drop.is-invalid { border-color: #d92d20; }
.rma-drop svg { flex: 0 0 auto; }
.rma-drop-text { font-size: 13px; line-height: 1.45; color: var(--slate-700); }
.rma-drop-text b { font-weight: 650; }
.rma-drop-text span { display: block; font-size: 11px; color: var(--slate-500); margin-top: 2px; }

.rma-files { list-style: none; margin: 10px 0 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.rma-file {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px 8px 12px;
  border: 1px solid var(--slate-300); border-radius: var(--radius-input);
  background: #fff; font-size: 12.5px; color: var(--slate-700);
}
.rma-file .nm { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rma-file .sz { flex: 0 0 auto; font-size: 11px; color: var(--slate-500); font-variant-numeric: tabular-nums; }
.rma-file .rm {
  flex: 0 0 auto; border: 0; background: transparent; cursor: pointer;
  color: var(--slate-500); line-height: 0; padding: 4px; border-radius: 4px;
}
.rma-file .rm:hover { color: #d92d20; background: #fef3f2; }

/* ---------- Footer ---------- */
.rma-footer {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 18px 32px;
  border-top: 1px solid var(--slate-200);
  background: var(--paper-50);
}
.rma-footer-note { font-size: 12px; font-weight: 500; color: var(--slate-500); }
.rma-actions { display: flex; align-items: center; gap: 10px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border-radius: var(--radius-input);
  font: 600 14px var(--font-sans);
  cursor: pointer;
  transition: background 150ms, border-color 150ms;
}
.btn-secondary {
  padding: 10px 18px;
  border: 1px solid var(--slate-300);
  background: var(--paper-0);
  color: var(--slate-900);
}
.btn-secondary:hover { background: var(--paper-50); border-color: var(--slate-400); }
.btn-primary {
  padding: 10px 22px;
  border: none;
  background: var(--navy);
  color: #fff;
}
.btn-primary:hover { background: var(--navy-hover); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ---------- Modal (verify / serial-help / samsung) ---------- */
.rma-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(14,23,41,.5);
  display: none; align-items: center; justify-content: center;
  z-index: 1000; padding: 24px;
}
.rma-modal-overlay.open { display: flex; }
.rma-modal {
  background: #fff; border-radius: var(--radius-card);
  max-width: 560px; width: 100%;
  box-shadow: 0 20px 50px -12px rgba(14,23,41,.4);
  overflow: hidden;
}
.rma-modal-head { padding: 18px 24px; border-bottom: 1px solid var(--slate-200); font-size: 16px; font-weight: 700; color: var(--navy); }
.rma-modal-body { padding: 20px 24px; font-size: 13px; color: var(--slate-700); max-height: 60vh; overflow-y: auto; }
.rma-modal-body table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 8px; }
.rma-modal-body th, .rma-modal-body td { border: 1px solid var(--slate-200); padding: 6px 8px; text-align: left; }
.rma-modal-body th { background: var(--slate-50); }
.rma-modal-foot { padding: 14px 24px; border-top: 1px solid var(--slate-200); display: flex; justify-content: flex-end; gap: 10px; background: var(--paper-50); }
.rma-modal-img { max-width: 100%; border: 1px solid var(--slate-200); border-radius: 6px; margin-top: 10px; }

.rma-alert { padding: 10px 14px; border-radius: var(--radius-input); font-size: 13px; margin-bottom: 14px; }
.rma-alert-error { background: rgba(232,40,90,.1); color: var(--crimson); border: 1px solid rgba(232,40,90,.3); }
.rma-alert-success { background: rgba(46,139,87,.12); color: #1F8A5B; border: 1px solid rgba(46,139,87,.3); }

/* ---------- Success card (shown after a successful submit) ---------- */
.rma-success-card {
  background: var(--paper-0);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-card);
  box-shadow: 0 24px 60px -20px rgba(27,42,91,.28);
  width: 100%;
  max-width: 560px;
  /* The card sits inside .rma-page, which already provides top padding
     and centers horizontally. Pin the card to the top (no large top
     margin) so there is no big empty gap above it; align-self:flex-start
     keeps it from being vertically centered in the tall flex container. */
  margin: 0 auto;
  align-self: flex-start;
  overflow: hidden;
  font-family: var(--font-sans);
  animation: rma-success-in .5s var(--ease) both;
}
.rma-success-card[hidden] { display: none; }

@keyframes rma-success-in {
  from { opacity: 0; transform: translateY(16px) scale(.98); }
  to   { opacity: 1; transform: none; }
}

/* Top banner — navy gradient header matching the form card */
.rma-success-top {
  background: linear-gradient(135deg, var(--navy) 0%, #243a78 100%);
  padding: 40px 36px 32px;
  text-align: center;
  position: relative;
}
.rma-success-top::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: 0; height: 4px;
  background: linear-gradient(90deg, var(--cyan), var(--crimson));
}
.rma-success-icon {
  width: 76px; height: 76px;
  margin: 0 auto 18px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: #fff;
  color: #1F8A5B;
  box-shadow: 0 0 0 8px rgba(255,255,255,.14);
  animation: rma-tick-pop .45s var(--ease) .15s both;
}
.rma-success-icon svg { width: 38px; height: 38px; }
@keyframes rma-tick-pop {
  from { transform: scale(0); }
  60%  { transform: scale(1.12); }
  to   { transform: scale(1); }
}
.rma-success-title {
  font-size: 23px; font-weight: 800;
  color: #fff;
  letter-spacing: -.01em;
  margin-bottom: 8px;
}
.rma-success-subtitle {
  font-size: 14px; line-height: 1.55;
  color: rgba(255,255,255,.82);
  max-width: 400px; margin: 0 auto;
}

/* Body */
.rma-success-body { padding: 30px 36px 34px; }

/* Ticket reference chip */
.rma-ticket-chip {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: var(--navy-tint);
  border: 1px dashed var(--slate-300);
  border-radius: var(--radius-panel);
  padding: 18px 20px;
  margin-bottom: 26px;
}
.rma-ticket-chip-label {
  font-size: 11px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--slate-500);
}
.rma-ticket-chip-value {
  font-family: var(--font-mono);
  font-size: 20px; font-weight: 600;
  color: var(--navy);
  letter-spacing: .01em;
}

/* Next-steps list */
.rma-next-title {
  font-size: 12px; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: var(--slate-500);
  margin-bottom: 14px;
}
.rma-next-list { list-style: none; margin: 0; padding: 0; }
.rma-next-list li {
  display: flex; align-items: flex-start; gap: 12px;
  font-size: 14px; line-height: 1.55; color: var(--slate-700);
  padding: 10px 0;
  border-bottom: 1px solid var(--slate-100);
}
.rma-next-list li:last-child { border-bottom: none; }
.rma-next-ico {
  flex: 0 0 auto;
  width: 30px; height: 30px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: var(--slate-50);
  color: var(--cyan);
}
.rma-next-ico svg { width: 16px; height: 16px; }
.rma-next-list a { color: var(--navy); font-weight: 600; text-decoration: none; }
.rma-next-list a:hover { text-decoration: underline; }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .rma-grid { grid-template-columns: 1fr; }
  .rma-product-grid { grid-template-columns: 1fr; }
  .rma-success-card { margin: 0 auto; }
  .rma-success-top { padding: 32px 22px 26px; }
  .rma-success-body { padding: 24px 22px 28px; }
}
