/**
 * Stablecoin Payment System - Merchant UI
 * Styles rewritten to match .sc-* class naming convention
 */

/* ========== Reset & Variables ========== */
:root {
  --primary: #2775CA;
  --primary-dark: #1e5fa1;
  --success: #10B981;
  --danger: #EF4444;
  --warning: #F59E0B;
  
  --gray-50: #F9FAFB;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-400: #9CA3AF;
  --gray-500: #6B7280;
  --gray-600: #4B5563;
  --gray-700: #374151;
  --gray-800: #1F2937;
  --gray-900: #111827;

  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", Monaco, "Cascadia Code", Consolas, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font-sans);
  color: var(--gray-900);
  background: radial-gradient(1200px 500px at 20% 0%, rgba(39,117,202,.18), transparent 60%),
              radial-gradient(900px 500px at 90% 20%, rgba(118,75,162,.20), transparent 60%),
              linear-gradient(180deg, #F5F7FF 0%, #EEF2FF 100%);
  min-height: 100vh;
  padding: 1rem;
  overflow-x: hidden;
}

/* ========== Layout ========== */
.sc-shell {
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding-bottom: 2rem;
}

/* ========== Cards ========== */
.sc-card {
  background: #fff;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.5);
}

.sc-subcard {
  background: var(--gray-50);
  border-radius: var(--radius-lg);
  padding: 1rem;
  margin-bottom: 1rem;
  border: 1px dashed var(--gray-200);
}

.sc-subcard__title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--gray-500);
  margin-bottom: 0.75rem;
}

/* ========== Header (Hero) ========== */
.sc-hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  padding: 1.25rem;
}

.sc-hero__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.sc-hero__brand {
  display: flex;
  gap: 0.75rem;
}

.sc-hero__icon {
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,0.2);
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.sc-hero__text {
  display: flex;
  flex-direction: column;
}

.sc-hero__titleRow {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sc-hero__title {
  font-size: 1.1rem;
  font-weight: 800;
  line-height: 1.2;
}

.sc-pill {
  background: rgba(255,255,255,0.2);
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.sc-hero__subtitle {
  font-size: 0.85rem;
  opacity: 0.9;
}

.sc-hero__chips {
  display: flex;
  gap: 0.5rem;
}

.sc-chip {
  font-size: 0.75rem;
  background: rgba(255,255,255,0.15);
  padding: 4px 8px;
  border-radius: 6px;
  font-weight: 600;
}

/* Icon Button (Menu) */
.sc-iconBtn {
  background: transparent;
  border: none;
  width: 36px;
  height: 36px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.2s;
}
.sc-iconBtn:hover { background: rgba(255,255,255,0.1); }
.sc-iconBtn span {
  display: block;
  width: 20px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
}

/* ========== Stepper ========== */
.sc-stepper {
  display: flex;
  justify-content: space-between;
  padding: 1rem;
  position: relative;
}

.sc-stepper::before {
  content: '';
  position: absolute;
  top: 1.7rem; /* adjust based on dot size */
  left: 1rem;
  right: 1rem;
  height: 2px;
  background: var(--gray-200);
  z-index: 0;
}

.sc-step {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  flex: 1;
}

.sc-step__dot {
  width: 1.5rem;
  height: 1.5rem;
  background: var(--gray-200);
  color: var(--gray-500);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  border: 2px solid #fff;
  transition: all 0.3s;
}

.sc-step__label {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--gray-400);
  transition: color 0.3s;
}

/* Active/Done states */
.sc-step.is-active .sc-step__dot,
.sc-step.is-done .sc-step__dot {
  background: var(--primary);
  color: #fff;
  transform: scale(1.1);
}
.sc-step.is-active .sc-step__label { color: var(--primary); }
.sc-step.is-done .sc-step__label { color: var(--gray-700); }

/* ========== Order Summary ========== */
.sc-order[open] { padding-bottom: 0.5rem; }
.sc-order__summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  cursor: pointer;
  list-style: none;
}
.sc-order__summary::-webkit-details-marker { display: none; }

.sc-order__kicker {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sc-order__merchant {
  font-weight: 800;
  font-size: 0.95rem;
}

.sc-order__summaryRight {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.sc-order__amount {
  font-weight: 800;
  color: var(--primary);
  font-size: 1rem;
}

.sc-order__caret {
  font-size: 0.8rem;
  color: var(--gray-400);
  transition: transform 0.2s;
}
.sc-order[open] .sc-order__caret { transform: rotate(180deg); }

.sc-order__body {
  padding: 0 1rem 1rem;
  border-top: 1px solid var(--gray-100);
  margin-top: -0.5rem;
  padding-top: 1rem;
}

/* Compact KV Grid (Requested by user) */
.sc-kvGrid {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.sc-kv {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px dashed var(--gray-200);
  font-size: 0.9rem;
}

.sc-kv:last-child { border-bottom: none; }

.sc-kv__k {
  color: var(--gray-500);
  font-weight: 600;
  margin-right: 12px;
  flex-shrink: 0;
}

.sc-kv__v {
  color: var(--gray-900);
  font-weight: 700;
  text-align: right;
  word-break: break-all;
}

.sc-strong { color: var(--primary); font-weight: 800; }
.sc-mono { font-family: var(--font-mono); font-size: 0.8rem; }

/* ========== Main Card ========== */
.sc-main { padding-bottom: 1.5rem; }

.sc-card__head {
  padding: 1.5rem 1.5rem 0.5rem;
  text-align: center;
}

.sc-card__title {
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.sc-card__desc {
  font-size: 0.9rem;
  color: var(--gray-500);
  line-height: 1.4;
}

.sc-stage {
  padding: 1.5rem;
  animation: fadeIn 0.3s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* ========== Toggle ========== */
.sc-toggle {
  display: flex;
  background: #fff;
  border: 1px solid var(--gray-300);
  padding: 4px;
  border-radius: var(--radius-md);
  gap: 4px;
}

.sc-toggle__btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  border: none;
  background: transparent;
  border-radius: 4px;
  font-weight: 700;
  color: var(--gray-500);
  cursor: pointer;
  transition: all 0.2s;
}

.sc-toggle__btn.is-active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 1px 3px rgba(39, 117, 202, 0.4);
}

.sc-coin {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background-size: cover;
}
.sc-coin--usdc { background-image: url('assets/usdc_logo.png'); }
.sc-coin--jpyc { background-image: url('assets/jpyc_logo.png'); }

/* ========== Inputs ========== */
.sc-inputRow {
  display: flex;
  align-items: center;
  background: #fff;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  padding: 0 12px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.sc-inputRow:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(39, 117, 202, 0.15);
}

.sc-inputPrefix {
  font-weight: 700;
  color: var(--gray-500);
  margin-right: 8px;
}

.sc-input {
  flex: 1;
  border: none;
  padding: 12px 0;
  font-size: 1.1rem;
  font-weight: 700;
  outline: none;
  width: 100%;
}

.sc-help {
  font-size: 0.75rem;
  color: var(--gray-400);
  margin-top: 6px;
  text-align: right;
}

/* ========== Buttons ========== */
.sc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  border: none;
  border-radius: var(--radius-md);
  transition: all 0.2s;
}
.sc-btn:active { transform: scale(0.98); }
.sc-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.sc-btn--primary {
  background: var(--primary);
  color: #fff;
  padding: 14px 20px;
  font-size: 1rem;
  box-shadow: 0 2px 4px rgba(39, 117, 202, 0.3);
}
.sc-btn--primary:hover { background: var(--primary-dark); }

.sc-btn--full { width: 100%; }

.sc-btn--tiny {
  padding: 4px 8px;
  font-size: 0.75rem;
  background: var(--gray-200);
  color: var(--gray-700);
}

.sc-btn--ghost {
  background: transparent;
  color: var(--primary);
}
.sc-btn--ghost:hover { background: var(--gray-50); }

.sc-linkBtn {
  background: none;
  border: none;
  color: var(--primary);
  text-decoration: underline;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 8px;
}

/* ========== QR & Progress ========== */
.sc-qrBlock {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.sc-qr {
  background: #fff;
  padding: 10px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  border: 1px solid var(--gray-100);
  text-align: center;
}

.sc-qr__frame {
  width: 200px;
  height: 200px;
  background: #f0f0f0;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}
/* Ensure canvas fits */
.sc-qr__frame canvas, .sc-qr__frame img, .sc-qr__div {
  max-width: 100%;
  max-height: 100%;
}

.sc-qr__caption {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--gray-400);
  letter-spacing: 1px;
}

.sc-note {
  font-size: 0.9rem;
  color: var(--gray-600);
  text-align: center;
}

.sc-statusBlock {
  text-align: center;
  padding: 2rem 0;
  animation: fadeIn 0.5s;
}

.sc-statusIcon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.sc-statusText { margin-bottom: 2rem; }

.sc-statusTitle {
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.sc-statusMessage {
  color: var(--gray-500);
  font-size: 0.95rem;
}

/* ========== Menu Drawer ========== */
.sc-menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(2px);
  z-index: 100;
  display: flex;
  justify-content: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.sc-menu-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.sc-menu-drawer {
  width: 320px;
  max-width: 85vw;
  height: 100%;
  background: #fff;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

.sc-menu-overlay.is-open .sc-menu-drawer {
  transform: translateX(0);
}

.sc-menu-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--gray-50);
}

.sc-menu-title {
  font-size: 1.1rem;
  font-weight: 950;
  color: var(--gray-800);
}

.sc-menu-close {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--gray-500);
  cursor: pointer;
  padding: 4px;
  border-radius: 8px;
  transition: background 0.2s;
}
.sc-menu-close:hover {
  background: var(--gray-200);
  color: var(--gray-800);
}

.sc-menu-content {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.sc-links {
  margin-top: 0;
  border: none;
  background: transparent;
}
.sc-links__summary {
  padding: 0 0 10px 0;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}
.sc-links__body {
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sc-miniRow {
  display: flex;
  gap: 8px;
}
.sc-miniInput {
  flex: 1;
  padding: 4px 8px;
  border: 1px solid var(--gray-300);
  border-radius: 4px;
  font-size: 0.8rem;
  background: var(--gray-50);
}
.sc-miniActions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ========== Footer ========== */
.card-footer {
  margin-top: 24px;
  text-align: center;
  padding: 0 10px 20px;
  display: flex;
  justify-content: center;
}

.card-footer label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--gray-500);
  font-weight: 700;
  line-height: 1.4;
}

@media (min-width: 480px) {
  .card-footer label {
    flex-direction: row;
    text-align: left;
  }
}

.card-footer img {
  height: 24px;
  object-fit: contain;
}

/* ========== Toast ========== */
.sc-toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--gray-800);
  color: #fff;
  padding: 12px 24px;
  border-radius: 50px;
  font-size: 0.9rem;
  font-weight: 600;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
  z-index: 200;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
  white-space: nowrap;
}
.sc-toast.is-show {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}
