/* ==========================================================================
   Support editor modals — stile iOS squircle
   Usato da Add gift, Create tier, Edit gift, Edit tier, Edit profile.
   ========================================================================== */

/* ---- overlay + modal shell ---- */
.se-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  z-index: 10000; padding: 20px;
  opacity: 1; visibility: visible;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.se-overlay.hidden { opacity: 0; visibility: hidden; pointer-events: none; }

/* ---- iframe-hosted editors (DeepSeek sheets live in app/editors/*.html) ----
   The iframe is anchored at the origin button's position and grows with its
   stage; the scrim is only here for the blur backdrop + outside-click dismiss. */
.se-overlay.se-iframe-overlay {
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 0;
  display: block;
  align-items: initial;
  justify-content: initial;
  transition: opacity 160ms ease;
}
.se-editor-frame {
  border: 0;
  background: transparent;
  display: block;
  will-change: width, height, transform, opacity;
}

.se-modal {
  width: 100%; max-width: 420px; max-height: 92vh;
  background: #ffffff; border-radius: 44px;
  box-shadow: 0 40px 80px rgba(0,0,0,0.35), 0 10px 30px rgba(0,0,0,0.15);
  overflow: hidden; display: flex; flex-direction: column;
  border: 1px solid rgba(255,255,255,0.15);
  transform: scale(1);
}
@media (max-width: 480px) {
  .se-modal { max-height: 96vh; border-radius: 32px; }
  .se-body  { padding: 16px 18px 0 18px !important; }
  .se-footer { padding: 0 18px 18px 18px !important; }
}

.se-body {
  flex: 1 1 auto;
  overflow-y: auto; overflow-x: hidden;
  padding: 20px 24px 0 24px;
  display: flex; flex-direction: column;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.se-body::-webkit-scrollbar { display: none; }

.se-footer {
  flex-shrink: 0;
  padding: 0 24px 24px 24px;
  background: transparent; border-top: none;
}

/* ---- header ---- */
.se-header {
  display: flex; align-items: center; gap: 12px;
  padding-top: 4px; margin-bottom: 12px; flex-shrink: 0;
}
.se-close {
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(241,245,249,0.9);
  color: #475569; border: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.15s ease, background 0.15s ease;
  flex-shrink: 0;
}
.se-close:active { transform: scale(0.95); background: #e2e8f0; }
.se-close svg { width: 16px; height: 16px; }

.se-title {
  font: 800 22px/1.1 var(--font-sans);
  letter-spacing: -0.025em; color: var(--fg-1, #0f172a); margin: 0;
}

/* ---- form layout ---- */
.se-form {
  flex: 1 1 auto;
  display: flex; flex-direction: column;
  gap: 14px; justify-content: flex-start;
}
.se-form > * { flex-shrink: 0; }

/* ---- labels ---- */
.se-label {
  display: block;
  font: 700 10px/1 var(--font-sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b; margin-bottom: 4px;
}

/* ---- input field ---- */
.se-input-wrap {
  width: 100%; background: #fff; border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  overflow: hidden; display: flex; align-items: center;
  transition: box-shadow 0.15s ease;
  border: 1.5px solid transparent;
}
.se-input-wrap:focus-within {
  box-shadow: 0 2px 8px rgba(0,0,0,0.08), 0 0 0 2px color-mix(in srgb, var(--pf-accent, #ff1493) 20%, transparent);
}
.se-input-wrap.is-error {
  border-color: #ef4444;
  box-shadow: 0 2px 8px rgba(239,68,68,0.18);
}

/* ---- input shake on validation ---- */
:root {
  --se-shake-distance: 6px;
  --se-shake-overshoot: 4px;
  --se-shake-ease: cubic-bezier(0.22, 1, 0.36, 1);
}
.se-input-wrap {
  will-change: transform;
}
.se-input-wrap.is-shaking {
  animation: se-input-shake 280ms linear;
}
@keyframes se-input-shake {
  0%      { transform: translateX(0); animation-timing-function: var(--se-shake-ease); }
  28.57%  { transform: translateX(var(--se-shake-distance)); animation-timing-function: var(--se-shake-ease); }
  57.14%  { transform: translateX(calc(var(--se-shake-distance) * -1)); animation-timing-function: var(--se-shake-ease); }
  78.57%  { transform: translateX(var(--se-shake-overshoot)); animation-timing-function: var(--se-shake-ease); }
  100%    { transform: translateX(0); }
}

.se-input {
  width: 100%; background: transparent; border: 0;
  border-radius: 16px; padding: 12px 16px;
  font: 400 14px/1.4 var(--font-sans);
  color: #0f172a; outline: none;
}
.se-input::placeholder { color: #94a3b8; }

.se-char-counter {
  font: 500 12px/1 var(--font-sans);
  color: #94a3b8; flex-shrink: 0; margin-right: 12px;
  user-select: none; transition: color 0.2s ease;
}
.se-char-counter.over { color: #ef4444; }

.se-error-msg {
  opacity: 0; visibility: hidden;
  font: 600 10px/1 var(--font-sans);
  color: #ef4444; white-space: nowrap;
  transition: opacity 0.28s ease-out, visibility 0s linear 0.28s;
}
.se-field-group.is-error .se-error-msg {
  opacity: 1; visibility: visible;
  transition: opacity 0.28s ease-out, visibility 0s linear 0s;
}

/* ---- price field ---- */
.se-price-wrap {
  position: relative; display: flex; align-items: center;
  background: #fff; border: 0; border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  overflow: hidden; padding: 0 12px; min-height: 44px;
  transition: box-shadow 0.15s ease;
}
.se-price-wrap:focus-within {
  box-shadow: 0 2px 8px rgba(0,0,0,0.08), 0 0 0 2px color-mix(in srgb, var(--pf-accent, #ff1493) 20%, transparent);
}
.se-price-wrap .se-cur-select {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  background: none; background-image: none !important;
  border: 0; padding: 6px 20px 6px 0;
  font: 700 13px/1 var(--font-sans);
  color: var(--pf-accent, #ff1493); cursor: pointer; outline: none;
}
.se-price-wrap .se-cur-select option { color: var(--pf-accent, #ff1493); }
.se-price-wrap .se-cur-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  pointer-events: none; color: var(--pf-accent, #ff1493);
}
.se-price-wrap .se-cur-sep {
  width: 1px; align-self: stretch; margin: 8px 0;
  background: rgba(226,232,240,0.7);
}
.se-price-wrap .se-price-input {
  flex: 1; background: transparent; border: 0;
  padding: 0 0 0 10px; font: 700 15px/1 var(--font-sans);
  color: #0f172a; outline: none;
}
.se-price-wrap .se-price-input::placeholder { color: #94a3b8; }

/* ---- banner upload ---- */
.se-banner-upload {
  background: var(--surface-1, #f3f3f5) !important;
  border: 1.5px dashed var(--border-strong, #d4d4d8) !important;
}
.se-banner-upload:hover { border-color: var(--pf-accent, var(--pf-accent, #ff1493)) !important; }
.se-banner-upload [data-se-banner-placeholder] svg {
  width: 28px; height: 28px; margin-bottom: 2px; opacity: .7;
}

/* ---- photo upload ---- */
.se-photo {
  width: 116px; height: 116px; border-radius: 28px;
  position: relative; background: #fff; cursor: pointer;
  box-shadow: 6px 6px 14px rgba(200,200,210,0.5), -6px -6px 14px rgba(255,255,255,0.9);
  border: 1px solid rgba(255,255,255,0.4);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  transition: box-shadow 0.2s ease, transform 0.15s ease;
  background-size: cover; background-position: center;
}
@media (min-width: 480px) { .se-photo { width: 128px; height: 128px; } }
.se-photo:hover {
  box-shadow: 4px 4px 10px rgba(200,200,210,0.4), -4px -4px 10px rgba(255,255,255,0.95);
  transform: scale(1.01);
}
.se-photo:active {
  box-shadow: inset 5px 5px 12px rgba(200,200,210,0.4), inset -5px -5px 12px rgba(255,255,255,0.7);
  transform: scale(0.98);
}
.se-photo-icon {
  width: 42px; height: 42px; border-radius: 50%;
  background: color-mix(in srgb, var(--pf-accent, #ff1493) 10%, transparent); color: var(--pf-accent, #ff1493);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 4px;
}
.se-photo-icon svg { width: 21px; height: 21px; }
.se-photo-label { font: 600 12px/1 var(--font-sans); color: var(--pf-accent, #ff1493); }
.se-photo.has-image .se-photo-label { display: none; }
/* When an image is set, keep the camera visible as a floating badge so the user
   can clearly tap to replace. */
.se-photo.has-image .se-photo-icon {
  position: absolute; bottom: 6px; right: 6px;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--pf-accent, #ff1493); color: #fff;
  margin-bottom: 0;
  box-shadow: 0 3px 10px rgba(0,0,0,0.3), 0 0 0 2px #fff;
  pointer-events: none;
}
.se-photo.has-image .se-photo-icon svg { width: 18px; height: 18px; }

/* Banner: when an image is set, overlay a camera badge in the corner too. */
.se-banner-upload.has-image [data-se-banner-placeholder] {
  opacity: 1 !important;
  inset: auto 10px 10px auto !important;
  width: 36px; height: 36px;
  background: var(--pf-accent, #ff1493); color: #fff !important;
  border-radius: 50%;
  box-shadow: 0 3px 10px rgba(0,0,0,0.3), 0 0 0 2px #fff;
  pointer-events: none;
}
.se-banner-upload.has-image [data-se-banner-placeholder] span { display: none; }
.se-banner-upload.has-image [data-se-banner-placeholder] svg {
  width: 18px; height: 18px; margin: 0 !important; opacity: 1 !important;
}

/* ---- toggle card ---- */
.se-toggle-card {
  border-radius: 16px; background: #fff; padding: 12px 14px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.se-toggle-title { font: 700 13px/1.2 var(--font-sans); color: #0f172a; }

.se-toggle-sw {
  position: relative; width: 40px; height: 20px; flex-shrink: 0;
}
.se-toggle-sw input { position: absolute; opacity: 0; width: 0; height: 0; }
.se-toggle-track {
  display: block; width: 100%; height: 100%; background: #cbd5e1; border-radius: 9999px;
  transition: background 0.25s ease; cursor: pointer; position: relative;
}
.se-toggle-sw input:checked + .se-toggle-track { background: var(--pf-accent, #ff1493); }
.se-toggle-track::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; background: #fff; border-radius: 50%;
  transition: transform 0.25s ease;
}
.se-toggle-sw input:checked + .se-toggle-track::after { transform: translateX(20px); }

/* ---- segmented control ---- */
.se-seg {
  display: flex; align-items: center; gap: 2px;
  padding: 3px; border-radius: 9999px;
  background: #eef0f2; border: 1px solid rgba(15,23,42,0.05);
  position: relative; width: 100%;
}
.se-seg > button {
  position: relative; z-index: 1; flex: 1;
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 40px; padding: 0 10px;
  font: 600 12.5px/1 var(--font-sans);
  color: #64748b; border-radius: 9999px;
  background: transparent; border: 0; cursor: pointer;
  transition: color 0.25s cubic-bezier(0.22,1,0.36,1);
  white-space: nowrap;
}
.se-seg > button:not(.active):hover { color: #1c1c1e; }
.se-seg > button.active {
  color: #0a0a0a; z-index: 2;
  text-shadow:
    -1px -1px 1px rgba(255,255,255,0.6),
     1px  1px 1px rgba(0,0,0,0.4),
     2px  2px 2px rgba(0,0,0,0.3),
     4px  4px 4px rgba(0,0,0,0.2),
     8px  8px 12px rgba(0,0,0,0.15);
}
.se-seg > .se-seg-pill {
  position: absolute; top: 3px; left: 0;
  height: calc(100% - 6px); background: #fff;
  border-radius: 9999px;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--pf-accent, #ff1493) 18%, transparent), 0 1px 2px rgba(15,23,42,0.04);
  transition: transform 0.25s cubic-bezier(0.22,1,0.36,1), width 0.25s cubic-bezier(0.22,1,0.36,1);
  z-index: 0; pointer-events: none;
}

/* ---- save button ---- */
.se-save-btn {
  width: 60%; max-width: 210px; height: 50px;
  margin: 0 auto; background: var(--pf-accent, #ff1493); border: none;
  border-radius: 25px;
  display: flex; align-items: center; justify-content: center; gap: 7px;
  color: #fff; font: 700 14px/1 var(--font-sans);
  cursor: pointer;
  box-shadow: 0 8px 20px color-mix(in srgb, var(--pf-accent, #ff1493) 35%, transparent);
  transition: background-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}
.se-save-btn:active { transform: scale(0.97); }
.se-save-btn:not(.is-saved):hover .se-save-icon {
  animation: se-wiggle 0.5s ease-in-out infinite;
}
.se-save-btn .se-save-icon {
  position: relative; width: 1.35em; height: 1.35em; display: flex;
  align-items: center; justify-content: center; flex-shrink: 0;
}
.se-save-btn .se-save-icon svg { overflow: visible; width: 100%; height: 100%; }
/* Labels container — matches reference file structure */
.se-save-labels {
  position: relative; display: flex; align-items: center; will-change: transform;
}
.se-save-label, .se-save-sent {
  display: flex; align-items: center; white-space: nowrap; line-height: 1;
  will-change: transform, opacity, filter;
}
.se-save-sent {
  position: absolute; left: 0; top: 0; opacity: 0; pointer-events: none; color: #fff;
}
/* is-saved is added by GSAP timeline at the morph midpoint */
.se-save-btn.is-saved { pointer-events: none; }

/* ---- delete button ---- */
.se-delete-btn {
  background: none; border: none; cursor: pointer;
  font: 600 13px/1 var(--font-sans); color: #ef4444;
  padding: 8px 16px; border-radius: 12px;
  transition: background 0.15s ease, color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.se-delete-btn:hover { background: rgba(239,68,68,0.08); }
.se-delete-btn:active { background: rgba(239,68,68,0.15); transform: scale(0.97); }

@keyframes se-wiggle {
  0%, 100% { transform: rotate(0deg); }
  25%  { transform: rotate(-9deg); }
  75%  { transform: rotate(9deg); }
}
@media (prefers-reduced-motion: reduce) {
  .se-save-btn:hover .se-save-icon { animation: none !important; }
  .se-save-btn { transition: none; }
  .se-input-wrap { animation: none !important; transform: none !important; }
}

/* ---- textarea ---- */
.se-textarea {
  width: 100%; background: #fff; border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  border: 1.5px solid transparent; padding: 12px 16px;
  font: 400 14px/1.5 var(--font-sans); color: #0f172a;
  outline: none; resize: vertical; min-height: 80px;
  transition: box-shadow 0.15s ease;
}
.se-textarea:focus {
  box-shadow: 0 2px 8px rgba(0,0,0,0.08), 0 0 0 2px color-mix(in srgb, var(--pf-accent, #ff1493) 20%, transparent);
}
.se-textarea::placeholder { color: #94a3b8; }

/* ---- number spin hide ---- */
.se-modal input[type=number]::-webkit-inner-spin-button,
.se-modal input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.se-modal input[type=number] { -moz-appearance: textfield; }
