/* ==========================================================================
   استوديو بطاقة الترقب — قسم «صمّم بطاقتك»
   ========================================================================== */

.card-studio {
  position: relative;
  overflow: hidden;
}
.card-studio::before {
  content: '';
  position: absolute;
  inset: -20% -10% auto auto;
  width: 520px;
  height: 520px;
  background: radial-gradient(circle, rgba(243, 198, 74, 0.18), transparent 68%);
  pointer-events: none;
}

.studio {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: clamp(1rem, 2.4vw, 1.8rem);
  align-items: start;
  position: relative;
}

/* ---------- منصة المعاينة ---------- */
.studio-stage {
  background: rgba(2, 27, 17, 0.55);
  border: 1px solid rgba(243, 198, 74, 0.28);
  border-radius: var(--radius-lg);
  padding: clamp(0.7rem, 2vw, 1.1rem);
  box-shadow: var(--shadow);
  position: sticky;
  top: 96px;
}
.stage-frame {
  border-radius: calc(var(--radius-lg) - 10px);
  overflow: hidden;
  background: #062d1d;
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.36);
  display: flex;
  justify-content: center;
}
#cardCanvas {
  display: block;
  width: 100%;
  height: auto;
  max-height: 74vh;
  object-fit: contain;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}
.stage-frame.has-photo #cardCanvas {
  cursor: grab;
  touch-action: none;
}
#cardCanvas.dragging { cursor: grabbing; }

.stage-hint {
  margin: 0.65rem 0 0;
  text-align: center;
  font-size: 0.8rem;
  color: rgba(253, 249, 239, 0.62);
}

.card-counter {
  margin: 0.55rem auto 0;
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
  padding: 0.35rem 0.95rem;
  border-radius: 999px;
  background: rgba(243, 198, 74, 0.13);
  border: 1px solid rgba(243, 198, 74, 0.32);
  color: var(--gold-soft);
  font-size: 0.82rem;
  width: fit-content;
  flex-wrap: wrap;
  justify-content: center;
}
.card-counter strong {
  font-size: 1.15rem;
  color: var(--gold);
  font-family: var(--font-display);
}
.counter-sep {
  color: rgba(243, 198, 74, 0.55);
  font-size: 0.7rem;
}

/* ---------- لوحة التحكم ---------- */
.studio-panel {
  background: rgba(253, 249, 239, 0.98);
  color: var(--ink);
  border-radius: var(--radius-lg);
  padding: clamp(1.05rem, 2.6vw, 1.6rem);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
}
.studio-panel .field { margin-bottom: 0; }
.studio-panel h3 { font-size: 1.1rem; color: var(--green-700); margin: 0; }

.photo-pick {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.photo-pick .btn-outline {
  border-color: rgba(4, 106, 56, 0.4);
}

.zoom-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.6rem;
  background: rgba(4, 106, 56, 0.05);
  border: 1px dashed rgba(4, 106, 56, 0.25);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.7rem;
}
.zoom-row label { font-size: 0.8rem; font-weight: 700; }
.zoom-row input[type='range'] {
  width: 100%;
  accent-color: var(--green-600);
}
.zoom-row .btn-link { padding: 0.2rem 0.3rem; font-size: 0.78rem; }

.role-field,
.fmt-field {
  border: none;
  padding: 0;
  margin: 0;
  min-width: 0;
}
.role-field legend,
.fmt-field legend {
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 0.45rem;
  padding: 0;
}

.role-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.45rem;
}
.role-grid label,
.fmt-grid label {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.6rem;
  border: 1.5px solid rgba(4, 106, 56, 0.18);
  border-radius: 12px;
  background: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}
.role-grid label:hover,
.fmt-grid label:hover { border-color: rgba(4, 106, 56, 0.4); }
.role-grid input,
.fmt-grid input {
  accent-color: var(--green-700);
  margin: 0;
  flex: 0 0 auto;
}
.role-grid label:has(input:checked),
.fmt-grid label:has(input:checked) {
  border-color: var(--gold-deep);
  background: rgba(243, 198, 74, 0.18);
  box-shadow: 0 0 0 3px rgba(243, 198, 74, 0.18);
}

.fmt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.45rem;
}
.fmt-grid label { flex-direction: column; align-items: flex-start; gap: 0.15rem; line-height: 1.5; }
.fmt-grid em {
  font-style: normal;
  font-weight: 400;
  font-size: 0.72rem;
  color: var(--muted);
  direction: ltr;
  display: inline-block;
}

.studio-actions {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.share-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
}
.btn-share {
  background: #fff;
  border: 1.5px solid rgba(4, 106, 56, 0.2);
  color: var(--ink);
  font-size: 0.85rem;
  padding: 0.6rem 0.4rem;
  font-weight: 700;
}
.btn-share:hover { transform: translateY(-1px); }
.btn-share.wa { border-color: rgba(37, 211, 102, 0.5); color: #128c46; background: rgba(37, 211, 102, 0.08); }
.btn-share.fb { border-color: rgba(24, 119, 242, 0.45); color: #1656c8; background: rgba(24, 119, 242, 0.07); }
.btn-share.ig { border-color: rgba(200, 16, 46, 0.35); color: #b3203a; background: rgba(200, 16, 46, 0.05); }

.privacy-note {
  margin: 0;
  font-size: 0.76rem;
  color: var(--muted);
  background: rgba(4, 106, 56, 0.06);
  border-radius: 10px;
  padding: 0.5rem 0.65rem;
  line-height: 1.6;
}
.studio-panel .form-msg { margin: 0; }

@media (max-width: 900px) {
  .studio { grid-template-columns: minmax(0, 1fr); }
  .studio-stage { position: static; }
  #cardCanvas { max-height: none; }
  .studio-stage,
  .studio-panel { border-radius: var(--radius); }
}
