﻿/*
Theme Name: Emerson RMA Form
Theme URI: https://emerson.co.il/
Author: Avraham Avniloff
Description: RMA (Return Material Authorization) 
Version: 1.2
Text Domain: emerson-rma-form
*/

:root {
  --rma-bg-1: #f4f7fb;
  --rma-bg-2: #e9eff6;
  --rma-surface: #ffffff;
  --rma-text: #10263f;
  --rma-muted: #4f6279;
  --rma-border: #c9d5e4;
  --rma-accent: #004685;
  --rma-accent-dark: #003563;
  --rma-accent-soft: #eaf2f9;
  --rma-success: #2f9e44;
  --rma-error: #d94841;
  --rma-warning: #b06d00;
  --rma-shadow: 0 10px 26px rgba(0, 38, 82, 0.08);
  --rma-radius-lg: 12px;
  --rma-radius-md: 10px;
  --rma-radius-sm: 8px;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  color: var(--rma-text);
  overflow-x: hidden;
  background:
    linear-gradient(180deg, rgba(0, 70, 133, 0.05), rgba(0, 70, 133, 0)),
    linear-gradient(155deg, var(--rma-bg-1), var(--rma-bg-2));
}

.site-main {
  padding: clamp(14px, 1.8vw, 28px);
}

.rma-page {
  direction: ltr !important;
  text-align: left;
}

.rma-page * {
  direction: ltr !important;
  unicode-bidi: isolate;
}

.rma-form input,
.rma-form textarea,
.rma-form select {
  -webkit-user-select: text;
  user-select: text;
}

.rma-shell {
  width: min(1240px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 14px;
}

.rma-logo-card {
  display: flex;
  justify-content: center;
  align-items: center;
  background: #fff;
  border: 1px solid var(--rma-border);
  border-radius: var(--rma-radius-lg);
  padding: clamp(14px, 1.8vw, 20px);
  box-shadow: var(--rma-shadow);
  position: relative;
  overflow: hidden;
}

.rma-logo-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  height: 3px;
  background: var(--rma-accent);
}

.rma-logo-card::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: var(--rma-accent);
}

.rma-logo-card__image {
  width: min(360px, 100%);
  height: auto;
  display: block;
  -webkit-user-drag: none;
  -webkit-user-select: none;
  user-select: none;
}

.rma-logo-card__fallback {
  font-size: clamp(29px, 4vw, 51px);
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--rma-accent);
}

.rma-hero {
  background: #fff;
  border: 1px solid var(--rma-border);
  border-radius: var(--rma-radius-lg);
  padding: clamp(14px, 1.8vw, 20px);
  box-shadow: var(--rma-shadow);
  position: relative;
  overflow: hidden;
}

.rma-hero::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  height: 3px;
  background: var(--rma-accent);
}

.rma-hero__content {
  max-width: 72ch;
}

@media (min-width: 841px) {
  .rma-hero__content {
    max-width: 100%;
  }
}

.rma-eyebrow {
  margin: 0 0 6px;
  color: var(--rma-accent);
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
}

.rma-title {
  margin: 0;
  font-size: clamp(27px, 4vw, 38px);
  line-height: 1.2;
  letter-spacing: 0.01em;
}

.rma-subtitle {
  margin: 8px 0 0;
  color: var(--rma-muted);
  max-width: 70ch;
}

.rma-form {
  display: grid;
  gap: 12px;
}

.rma-card {
  background: var(--rma-surface);
  border: 1px solid var(--rma-border);
  border-radius: var(--rma-radius-lg);
  padding: clamp(14px, 1.8vw, 20px);
  box-shadow: var(--rma-shadow);
  position: relative;
  overflow: hidden;
  animation: rma-fade-up 0.45s ease both;
}

.rma-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--rma-accent);
}

.rma-card:nth-of-type(2) {
  animation-delay: 0.05s;
}

.rma-card:nth-of-type(3) {
  animation-delay: 0.1s;
}

.rma-card:nth-of-type(4) {
  animation-delay: 0.15s;
}

.rma-card:nth-of-type(5) {
  animation-delay: 0.2s;
}

.rma-card__head {
  margin-bottom: 12px;
}

.rma-card__head h2 {
  margin: 0;
  font-size: clamp(19px, 2vw, 25px);
  line-height: 1.2;
}

.rma-card__head p {
  margin: 4px 0 0;
  color: var(--rma-muted);
}

.rma-grid {
  display: grid;
  gap: 10px;
}

.rma-grid > * {
  min-width: 0;
}

.rma-grid + .rma-grid {
  margin-top: 12px;
}

.rma-grid--4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.rma-grid--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.rma-grid.rma-grid--3 {
  margin-top: 15px;
}

.rma-grid--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.rma-field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.rma-field span {
  font-size: 13px;
  font-weight: 700;
  color: #2a3f59;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.rma-field--full {
  grid-column: 1 / -1;
}

.erma-control {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 44px;
  border: 1px solid #bfcde0;
  border-radius: var(--rma-radius-sm);
  background: #fff;
  color: var(--rma-text);
  font: inherit;
  font-size: 16px;
  padding: 9px 11px;
  box-sizing: border-box;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

textarea.erma-control {
  min-height: 88px;
  resize: vertical;
}

.erma-reason {
  min-height: 160px;
}

.erma-control::placeholder {
  color: #7488a2;
}

.erma-control[readonly] {
  background: #eff4fa;
  color: #334860;
}

.erma-control:disabled {
  opacity: 0.75;
  cursor: default;
}

.erma-control:focus,
.erma-control:focus-visible {
  outline: none;
  border-color: var(--rma-accent);
  box-shadow: 0 0 0 3px rgba(0, 70, 133, 0.16);
}

.erma-control[aria-invalid="true"] {
  border-color: var(--rma-error);
  box-shadow: 0 0 0 3px rgba(217, 72, 65, 0.14);
}

select.erma-control {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpolyline points='1%201%205%205%209%201' fill='none' stroke='%23435a76' stroke-width='1.35' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: 10px 6px;
  background-position: calc(100% - 12px) 50%;
  padding-right: 32px;
  cursor: pointer;
}

select.erma-control::-ms-expand {
  display: none;
}

.rma-subcard {
  border: 1px solid var(--rma-border);
  border-radius: var(--rma-radius-md);
  padding: 10px;
  background: var(--rma-accent-soft);
}

.rma-subcard h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.rma-address-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1.4fr;
  border: 1px solid #bfcde0;
  border-radius: var(--rma-radius-sm);
  overflow: hidden;
  background: #fff;
}

.rma-address-grid > .erma-control {
  border: 0;
  border-radius: 0;
  min-height: 44px;
}

.rma-address-grid > .erma-control:not(:last-child) {
  border-right: 1px solid #cfd9e8;
}

.rma-address-grid select.erma-control {
  background-position: calc(100% - 10px) 50%;
}

.rma-serial-panel {
  border: 1px solid #c8d6e7;
  border-radius: var(--rma-radius-md);
  background: #f7fbff;
  padding: 10px;
  margin-bottom: 12px;
  display: grid;
  gap: 10px;
}

.rma-serial-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.rma-serial-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.rma-btn--small {
  min-height: 40px;
  padding: 8px 14px;
  font-size: 15px;
}

.rma-serial-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.rma-serial-count {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #304a67;
}

.rma-serial-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.rma-serial-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid #d1dceb;
  border-radius: 8px;
  background: #fff;
  padding: 8px 10px;
}

.rma-serial-item--empty {
  justify-content: flex-start;
  color: #607691;
  font-style: italic;
}

.rma-serial-value {
  font-family: "Consolas", "Courier New", monospace;
  font-size: 15px;
  color: #183453;
  word-break: break-word;
}

.rma-choice {
  margin: 0;
  border: 1px solid var(--rma-border);
  border-radius: var(--rma-radius-md);
  padding: 9px 11px;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  background: var(--rma-accent-soft);
}

.rma-choice legend {
  padding: 0 6px;
  font-weight: 700;
  font-size: 13px;
  color: #2f3e55;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.rma-choice label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #28374d;
  font-size: 16px;
}

input.erma-control[type="radio"] {
  width: 18px;
  min-height: 18px;
  height: 18px;
  margin: 0;
  cursor: pointer;
}

input.erma-control[type="date"] {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

/* iOS Safari/Chrome: native date control may overflow grid cells */
@supports (-webkit-touch-callout: none) {
  input.erma-control[type="date"] {
    width: -webkit-fill-available;
    max-width: 100%;
    min-width: 0;
  }

  input.erma-control[type="date"]::-webkit-date-and-time-value {
    min-width: 0;
    width: 100%;
    text-align: left;
  }
}

.rma-statement {
  margin: 0;
  border: 1px solid #c8d5e5;
  border-radius: var(--rma-radius-md);
  background: #f5f9fd;
  padding: 11px;
  color: #2e3f56;
}

.rma-note {
  margin-top: 10px;
  border-left: 4px solid var(--rma-warning);
  background: #fff6e4;
  border-radius: 0 var(--rma-radius-sm) var(--rma-radius-sm) 0;
  padding: 9px 11px;
  color: #624200;
}

.rma-footer-warning {
  margin: 12px 0 0;
  color: #8b2722;
  font-weight: 600;
}

.rma-actions {
  position: sticky;
  bottom: 12px;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 8px;
  border: 1px solid #c9d5e4;
  border-radius: var(--rma-radius-md);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 6px 16px rgba(0, 35, 76, 0.1);
}

.rma-actions__credit {
  margin: 0;
  margin-right: auto;
  font-size: 13px;
  font-weight: 600;
  color: #5d6f85;
  white-space: nowrap;
}

.rma-btn,
.erma-btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 8px;
  min-height: 44px;
  padding: 9px 16px;
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.rma-btn:active,
.erma-btn:active {
  transform: translateY(1px);
}

.rma-btn:focus-visible,
.erma-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 70, 133, 0.24);
}

.rma-btn--ghost {
  color: #2a405c;
  border-color: #bfcfe0;
  background: #fff;
}

.rma-btn--ghost:hover {
  background: #edf4fb;
}

.rma-btn--primary {
  color: #fff;
  background: var(--rma-accent);
  box-shadow: 0 6px 14px rgba(0, 70, 133, 0.24);
}

.rma-btn--primary:hover {
  background: var(--rma-accent-dark);
}

body.erma-popup-open {
  overflow: hidden;
}

.erma-popup-root {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 9999;
}

.erma-popup-root[hidden] {
  display: none !important;
}

.erma-popup-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(3, 20, 41, 0.48);
  cursor: pointer;
}

.erma-popup {
  position: relative;
  width: min(500px, calc(100% - 24px));
  border-radius: var(--rma-radius-lg);
  border: 1px solid #cad7e8;
  background: #fff;
  box-shadow: 0 18px 36px rgba(8, 35, 69, 0.24);
  overflow: hidden;
}

.erma-popup::before {
  content: "";
  display: block;
  height: 6px;
  background: var(--rma-accent);
}

.erma-popup--success::before {
  background: var(--rma-success);
}

.erma-popup--error::before {
  background: var(--rma-error);
}

.erma-popup--warning::before {
  background: var(--rma-warning);
}

.erma-popup-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  border-bottom: 1px solid #d8e1ec;
}

.erma-popup-title {
  margin: 0;
  font-size: 22px;
}

.erma-popup-close {
  border: 0;
  background: transparent;
  color: #374b65;
  font-size: 31px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

.erma-popup-body {
  padding: 16px 16px 10px;
}

.erma-popup-message {
  margin: 0;
  color: #2f425a;
  font-size: 17px;
}

.erma-popup-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 16px 16px;
}

.rma-popup-btn {
  min-width: 96px;
  border-color: #bfd0e2;
  color: #2b4059;
  background: #fff;
}

.rma-popup-btn:hover {
  background: #edf4fb;
}

@keyframes rma-fade-up {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1120px) {
  .rma-grid--4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .rma-grid--3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 840px) {
  .rma-hero {
    text-align: center;
  }

  .rma-logo-card {
    padding: 14px;
  }

  .rma-logo-card__image {
    width: 100%;
  }

  .rma-hero__content {
    width: 100%;
    text-align: center;
  }

  .rma-subtitle {
    margin-left: auto;
    margin-right: auto;
  }
}

@media (max-width: 720px) {
  .site-main {
    padding: 12px;
  }

  .rma-shell {
    gap: 12px;
  }

  .rma-card {
    padding: 14px;
    border-radius: 12px;
  }

  .rma-grid--4,
  .rma-grid--3,
  .rma-grid--2 {
    grid-template-columns: 1fr;
  }

  .rma-address-grid {
    grid-template-columns: 1fr;
  }

  .rma-address-grid > .erma-control:not(:last-child) {
    border-right: 0;
    border-bottom: 1px solid #d2dcea;
  }

  .rma-serial-entry {
    grid-template-columns: 1fr;
  }

  .rma-serial-actions {
    width: 100%;
  }

  .rma-serial-actions .rma-btn {
    flex: 1;
  }

  .rma-serial-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .rma-serial-item {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }

  .rma-serial-item .rma-serial-value {
    flex: 1 1 auto;
    min-width: 0;
    padding-right: 8px;
  }

  .rma-serial-item .rma-btn {
    flex: 0 0 auto;
  }

  .rma-actions {
    bottom: 14px;
    bottom: calc(14px + env(safe-area-inset-bottom));
    padding: 8px;
    flex-wrap: wrap;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
  }

  .rma-actions__credit {
    width: 100%;
    margin-right: 0;
    font-size: 12px;
    text-align: center;
  }

  .rma-btn,
  .erma-btn {
    flex: 1;
    justify-content: center;
  }
}

@media print {
  body {
    background: #fff;
  }

  .site-main {
    padding: 0;
  }

  .rma-hero,
  .rma-card {
    box-shadow: none;
    border: 1px solid #d3d9e2;
    background: #fff;
  }

  .rma-actions,
  .erma-popup-root {
    display: none !important;
  }
}
