/* SV Intake Renderer CSS — Phase 1A
 *
 * Self-contained styles cho sv-intake-renderer.js
 * Cherry-pick từ customer-form/assets/style.css (V22.0.9)
 * Adapt: prefix "sv-iq-" để KHÔNG conflict với admin styles có sẵn
 * Variables hardcode (không phụ thuộc admin theme)
 */

/* ============================================================
   LAYOUT — Question field
   ============================================================ */
.sv-iq {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0;
}

.sv-iq-label {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-size: 14px;
  font-weight: 500;
  color: #1A1918;
  line-height: 1.4;
}

.sv-iq-label .sv-iq-req {
  color: #F8951D;
  font-weight: 400;
  margin-left: 2px;
}

.sv-iq-helper {
  font-size: 12px;
  color: #65625B;
  line-height: 1.55;
  margin-bottom: 2px;
}

/* ============================================================
   TEXT / TEXTAREA / SELECT inputs
   ============================================================ */
.sv-iq input[type="text"],
.sv-iq input[type="email"],
.sv-iq input[type="tel"],
.sv-iq textarea,
.sv-iq select {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  color: #1A1918;
  background: #FFFFFF;
  border: 1px solid #E1DED7;
  border-radius: 6px;
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.sv-iq input::placeholder,
.sv-iq textarea::placeholder {
  color: #94908A;
}

.sv-iq input:hover,
.sv-iq textarea:hover,
.sv-iq select:hover {
  border-color: #C5C2BC;
}

.sv-iq input:focus,
.sv-iq textarea:focus,
.sv-iq select:focus {
  border-color: #F8951D;
  box-shadow: 0 0 0 3px rgba(248, 149, 29, 0.12);
}

.sv-iq textarea {
  min-height: 80px;
  resize: vertical;
}

.sv-iq select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2365625B' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 10px;
  padding-right: 32px;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

/* ============================================================
   CHOICE GRID (radio + checkbox)
   ============================================================ */
.sv-iq-choice-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.sv-iq-choice-grid.is-compact {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.sv-iq-choice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  background: #FFFFFF;
  border: 1px solid #E1DED7;
  border-radius: 6px;
  cursor: pointer;
  transition: all 150ms ease;
  user-select: none;
}

.sv-iq-choice:hover {
  border-color: #C5C2BC;
  background: #F7F6F3;
}

.sv-iq-choice input {
  margin: 2px 0 0;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  accent-color: #F8951D;
  cursor: pointer;
}

.sv-iq-choice span {
  font-size: 14px;
  color: #1A1918;
  line-height: 1.4;
  flex: 1;
}

.sv-iq-choice:has(input:checked) {
  border-color: #F8951D;
  background: #FFF7EC;
}

.sv-iq-choice:has(input:checked) span {
  color: #C9700E;
  font-weight: 500;
}

/* ============================================================
   ERROR STATE
   ============================================================ */
.sv-iq.sv-iq-error {
  padding: 10px 12px;
  background: #FEF2F2;
  border: 1px solid #FCA5A5;
  border-radius: 6px;
}

.sv-iq-err-msg {
  font-size: 12px;
  color: #B91C1C;
  margin-top: 6px;
}

/* ============================================================
   ADMIN OVERRIDE INDICATOR (5% chrome — Phase 2 sẽ dùng)
   ============================================================ */
.sv-iq.is-admin-override {
  position: relative;
}
.sv-iq.is-admin-override::before {
  content: "✏ Admin sửa";
  position: absolute;
  top: -8px;
  right: 8px;
  padding: 1px 8px;
  background: #0EA371;
  color: #FFFFFF;
  font-size: 10px;
  font-weight: 600;
  border-radius: 8px;
}
.sv-iq.is-admin-addition::before {
  content: "➕ Admin thêm";
  background: #5B6CFF;
}
.sv-iq.is-admin-deleted {
  opacity: 0.5;
}
.sv-iq.is-admin-deleted::before {
  content: "🗑 N/A";
  background: #94908A;
}

/* ============================================================
   SAVE INDICATOR (Phase 2)
   ============================================================ */
.sv-iq-save-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  margin-left: 8px;
  font-size: 11px;
  font-weight: 500;
  background: #DCFCE7;
  color: #166534;
  border-radius: 10px;
  opacity: 0;
  transition: opacity 200ms ease;
}
.sv-iq-save-chip.is-visible { opacity: 1; }
.sv-iq-save-chip.is-saving {
  background: #FEF3C7;
  color: #92400E;
}
.sv-iq-save-chip.is-error {
  background: #FEE2E2;
  color: #991B1B;
}
