/* ============================================================
   Sway Cart Redeem Points Widget
   Scoped under .sway-crp-* to avoid theme conflicts
   ============================================================ */

/* ---- Container ---- */
#sway-cart-redeem-root {
  font-family: inherit;
  box-sizing: border-box;
}

.sway-crp-widget {
  margin: 12px 0;
  font-family: inherit;
  box-sizing: border-box;
}

/* ---- Logged-out bar ---- */
.sway-crp-logged-out {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 16px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  color: #374151;
  flex-wrap: wrap;
}

.sway-crp-logged-out__text {
  flex: 1;
  min-width: 0;
}

.sway-crp-logged-out__login {
  background: none;
  border: none;
  padding: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--sway-crp-primary, #111827);
  cursor: pointer;
  text-decoration: underline;
  white-space: nowrap;
}

.sway-crp-logged-out__login:hover {
  opacity: 0.75;
}

/* ---- Logged-in inline bar ---- */
.sway-crp-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 16px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  color: #374151;
  flex-wrap: wrap;
}

.sway-crp-bar__balance {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.sway-crp-bar__icon {
  width: 28px;
  height: 28px;
  background: var(--sway-crp-primary, #111827);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sway-crp-bar__icon svg {
  width: 16px;
  height: 16px;
  fill: #fff;
}

.sway-crp-bar__redeem-btn {
  background: var(--sway-crp-primary, #111827);
  color: var(--sway-crp-primary-text, #fff);
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s;
}

.sway-crp-bar__redeem-btn:hover {
  opacity: 0.85;
}

/* ---- Modal backdrop ---- */
.sway-crp-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2147483640;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: sway-crp-fade-in 0.2s ease;
}

@media (min-width: 640px) {
  .sway-crp-backdrop {
    align-items: center;
  }
}

@keyframes sway-crp-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ---- Modal panel ---- */
.sway-crp-modal {
  background: #fff;
  border-radius: 16px 16px 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-sizing: border-box;
  animation: sway-crp-slide-up 0.25s ease;
  font-family: inherit;
  font-size: 14px;
  color: #111827;
}

@media (min-width: 640px) {
  .sway-crp-modal {
    border-radius: 16px;
    max-height: 85vh;
  }
}

@keyframes sway-crp-slide-up {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ---- Modal header ---- */
.sway-crp-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 12px;
  border-bottom: 1px solid #f3f4f6;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}

.sway-crp-modal__title {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
  color: #111827;
}

.sway-crp-modal__close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: #6b7280;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.sway-crp-modal__close:hover {
  background: #f3f4f6;
}

.sway-crp-modal__close svg {
  width: 18px;
  height: 18px;
}

/* ---- Modal body ---- */
.sway-crp-modal__body {
  padding: 16px 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ---- Balance row ---- */
.sway-crp-balance-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: #f9fafb;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
}

.sway-crp-balance-row__icon {
  width: 36px;
  height: 36px;
  background: var(--sway-crp-primary, #111827);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sway-crp-balance-row__icon svg {
  width: 20px;
  height: 20px;
  fill: #fff;
}

.sway-crp-balance-row__text {
  font-size: 15px;
  font-weight: 600;
  color: #111827;
}

/* ---- Store credit balance row ---- */
.sway-crp-sc-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: #f0fdf4;
  border-radius: 10px;
  border: 1px solid #bbf7d0;
}

.sway-crp-sc-row__label {
  font-size: 14px;
  font-weight: 600;
  color: #166534;
}

.sway-crp-sc-row__value {
  font-size: 14px;
  color: #166534;
}

/* ---- Section headings ---- */
.sway-crp-section-heading {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6b7280;
  margin: 0 0 8px;
}

/* ---- Reward cards ---- */
.sway-crp-reward-card {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #fff;
  transition: border-color 0.15s;
}

.sway-crp-reward-card:hover {
  border-color: var(--sway-crp-primary, #111827);
}

.sway-crp-reward-card--existing {
  background: #fafafa;
}

.sway-crp-reward-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.sway-crp-reward-card__title {
  font-size: 15px;
  font-weight: 600;
  color: #111827;
}

.sway-crp-reward-card__desc {
  font-size: 13px;
  color: #6b7280;
}

.sway-crp-reward-card__code {
  font-size: 13px;
  color: #374151;
  font-family: monospace;
  background: #f3f4f6;
  border-radius: 4px;
  padding: 2px 6px;
}

.sway-crp-reward-card__points {
  font-size: 13px;
  color: #6b7280;
  white-space: nowrap;
}

.sway-crp-reward-card__min-order {
  font-size: 12px;
  color: #9ca3af;
}

.sway-crp-reward-card__vip {
  font-size: 12px;
  color: #7c3aed;
  background: #ede9fe;
  border-radius: 4px;
  padding: 2px 6px;
  display: inline-block;
}

.sway-crp-reward-card__insufficient {
  font-size: 12px;
  color: #ef4444;
}

/* ---- Slider input ---- */
.sway-crp-slider-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sway-crp-input-label {
  font-size: 13px;
  color: #6b7280;
  margin: 0;
}

.sway-crp-number-input {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 14px;
  color: #111827;
  box-sizing: border-box;
  background: #fff;
}

.sway-crp-number-input:focus {
  outline: none;
  border-color: var(--sway-crp-primary, #111827);
  box-shadow: 0 0 0 2px rgba(0,0,0,0.08);
}

.sway-crp-preview-box {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 13px;
  color: #1e40af;
}

.sway-crp-error-box {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 13px;
  color: #dc2626;
}

/* ---- Redeem button ---- */
.sway-crp-btn {
  display: block;
  width: 100%;
  padding: 12px 20px;
  background: var(--sway-crp-primary, #111827);
  color: var(--sway-crp-primary-text, #fff);
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: opacity 0.15s;
  box-sizing: border-box;
}

.sway-crp-btn:hover:not(:disabled) {
  opacity: 0.85;
}

.sway-crp-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.sway-crp-btn--secondary {
  background: transparent;
  color: var(--sway-crp-primary, #111827);
  border: 1px solid var(--sway-crp-primary, #111827);
}

/* ---- Success state ---- */
.sway-crp-success {
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sway-crp-success__title {
  font-size: 15px;
  font-weight: 700;
  color: #166534;
}

.sway-crp-success__desc {
  font-size: 13px;
  color: #166534;
}

.sway-crp-success__code-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid #86efac;
  border-radius: 6px;
  padding: 8px 12px;
}

.sway-crp-success__code {
  font-family: monospace;
  font-size: 14px;
  font-weight: 700;
  color: #111827;
  flex: 1;
  word-break: break-all;
}

.sway-crp-copy-btn {
  background: none;
  border: 1px solid #d1d5db;
  border-radius: 5px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: #374151;
  white-space: nowrap;
  transition: background 0.15s;
}

.sway-crp-copy-btn:hover {
  background: #f3f4f6;
}

.sway-crp-copy-btn--copied {
  background: #dcfce7;
  border-color: #86efac;
  color: #166534;
}

/* ---- Message banners ---- */
.sway-crp-msg {
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 13px;
}

.sway-crp-msg--error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
}

.sway-crp-msg--info {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
}

/* ---- Empty state ---- */
.sway-crp-empty {
  text-align: center;
  color: #9ca3af;
  font-size: 14px;
  padding: 16px 0;
}

/* ---- Divider ---- */
.sway-crp-divider {
  border: none;
  border-top: 1px solid #f3f4f6;
  margin: 4px 0;
}

/* ---- Spinner ---- */
.sway-crp-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: sway-crp-spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

@keyframes sway-crp-spin {
  to { transform: rotate(360deg); }
}
