/* =====================================================================
   studio.css — Urântia Studio: gerador de artes para redes sociais
   ===================================================================== */

/* ---- Botão "Compartilhar" nos parágrafos ---- */
/* Empilha verticalmente abaixo do cite-btn (que fica em top:.2rem right:-2.4rem) */
.share-btn {
  position: absolute;
  top: 2rem;            /* abaixo do cite-btn */
  right: -2.4rem;       /* mesma coluna do cite-btn */
  opacity: 0;
  padding: 0.28rem 0.42rem;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 6px;
  color: var(--muted);
  transition: opacity .15s, color .15s, background .15s;
  line-height: 1;
}
.para:hover .share-btn        { opacity: 1; }
.share-btn:hover               { color: var(--accent); background: var(--accent-soft, #e8f0ff); }

@media (max-width: 820px) {
  /* share-btn fica à esquerda do cite-btn, ambos no rodapé do parágrafo */
  .share-btn {
    top: auto;
    bottom: .2rem;
    right: 40px;   /* imediatamente à esquerda do cite-btn */
    width: 38px;
    height: 38px;
    opacity: .45;
  }
  .para:hover .share-btn { opacity: .75; }
}

/* =====================================================================
   Modal overlay
   ===================================================================== */
.studio-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(0, 0, 0, .88);
  display: flex;
  align-items: stretch;
  overflow: hidden;
}
.studio-overlay[hidden] { display: none; }
body.studio-open { overflow: hidden; }

.studio-inner {
  display: flex;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* ---- Área de preview ---- */
.studio-preview-area {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0e0e18;
  padding: 1.5rem;
  overflow: hidden;
}

#studioCanvas {
  max-width:  100%;
  max-height: calc(100vh - 3rem);
  width: auto;
  height: auto;
  display: block;
  border-radius: 4px;
  box-shadow: 0 16px 64px rgba(0, 0, 0, .75);
}

/* ---- Painel de controles ---- */
.studio-panel {
  width: 330px;
  flex: 0 0 330px;
  background: #1a1a2e;
  color: #dde0f0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-left: 1px solid rgba(255, 255, 255, .07);
}

.studio-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .85rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, .09);
  flex-shrink: 0;
}

.studio-title {
  font-size: .95rem;
  font-weight: 800;
  color: #d4a017;
  letter-spacing: .04em;
}

.studio-close-btn {
  background: none;
  border: none;
  color: #666;
  font-size: 1.55rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 .2rem;
  border-radius: 6px;
  transition: color .12s, background .12s;
}
.studio-close-btn:hover { color: #fff; background: rgba(255,255,255,.08); }

/* ---- Scrollable body ---- */
.studio-panel-body {
  flex: 1 1 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.12) transparent;
}

/* ---- Accordion (details/summary) ---- */
.studio-section {
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.studio-section > summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .72rem 1rem;
  cursor: pointer;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: #8890b8;
  user-select: none;
  transition: color .12s;
}
.studio-section > summary::-webkit-details-marker { display: none; }
.studio-section > summary::after {
  content: '›';
  font-size: 1.1rem;
  display: inline-block;
  transform: rotate(90deg);
  transition: transform .18s;
}
.studio-section[open] > summary::after { transform: rotate(-90deg); }
.studio-section > summary:hover { color: #c8cce8; }

.section-body {
  padding: .4rem 1rem .9rem;
  display: flex;
  flex-direction: column;
  gap: .65rem;
}

/* Textarea de citação */
#studioQuote {
  width: 100%;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.11);
  border-radius: 8px;
  color: #dde0f0;
  padding: .6rem .75rem;
  font-size: .88rem;
  font-family: Georgia, serif;
  resize: vertical;
  line-height: 1.55;
}
#studioQuote:focus { outline: none; border-color: #d4a017; }

/* ---- Formato ---- */
.format-group {
  display: flex;
  gap: .45rem;
}

.format-opt { flex: 1; cursor: pointer; }
.format-opt input[type="radio"] { position: absolute; opacity: 0; width: 0; height: 0; }

.format-opt > span {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .18rem;
  padding: .55rem .25rem;
  border: 1.5px solid rgba(255,255,255,.13);
  border-radius: 9px;
  font-size: .72rem;
  font-weight: 700;
  color: #8890b8;
  text-align: center;
  cursor: pointer;
  transition: border-color .14s, color .14s, background .14s;
}
.format-opt > span .fmt-icon {
  display: block;
  width: 20px;
  background: currentColor;
  border-radius: 2px;
  opacity: .5;
}
.format-opt > span small {
  display: block;
  font-size: .62rem;
  font-weight: 400;
  color: #565870;
}
.format-opt input:checked + span {
  border-color: #d4a017;
  color: #d4a017;
  background: rgba(212,160,23,.1);
}
.format-opt input:checked + span small { color: #b08010; }

/* ---- Galeria de fundos ---- */
.bg-strip {
  display: flex;
  gap: .45rem;
  overflow-x: auto;
  padding-bottom: .25rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.12) transparent;
}

.bg-item {
  width: 54px;
  height: 54px;
  flex-shrink: 0;
  border-radius: 8px;
  border: 2px solid rgba(255,255,255,.1);
  cursor: pointer;
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color .13s, box-shadow .13s;
  overflow: hidden;
  padding: 0;
}
.bg-item:hover  { border-color: rgba(255,255,255,.35); }
.bg-item.active { border-color: #d4a017; box-shadow: 0 0 0 2px rgba(212,160,23,.3); }

.bg-none { background: #0d3b66; color: rgba(255,255,255,.45); }

.btn-upload-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .42rem .8rem;
  background: rgba(255,255,255,.05);
  border: 1px dashed rgba(255,255,255,.18);
  border-radius: 8px;
  color: #8890b8;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .13s, border-color .13s;
}
.btn-upload-label:hover { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.28); color: #c8cce8; }

#studioBgFile { display: none; }

.slider-group {
  display: flex;
  flex-direction: column;
  gap: .28rem;
}
.slider-group > label {
  display: flex;
  justify-content: space-between;
  font-size: .78rem;
  color: #7880a0;
  margin: 0;
}
.slider-group > label span { color: #d4a017; }

/* ---- Temas ---- */
.theme-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .45rem;
}
.theme-btn {
  padding: .58rem .4rem;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 9px;
  color: #b8bcd8;
  font-size: .78rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  transition: background .13s, border-color .13s, color .13s;
  line-height: 1.3;
}
.theme-btn:hover {
  background: rgba(212,160,23,.14);
  border-color: rgba(212,160,23,.45);
  color: #d4a017;
}

/* ---- Tipografia ---- */
.ctrl-row {
  display: flex;
  align-items: center;
  gap: .55rem;
  min-height: 32px;
}
.ctrl-row > label {
  font-size: .78rem;
  color: #7880a0;
  flex-shrink: 0;
  min-width: 68px;
  margin: 0;
  display: flex;
  align-items: center;
  gap: .3rem;
}
.ctrl-row > label span { color: #d4a017; font-size: .72rem; }

.ctrl-row select {
  flex: 1;
  background: #252540;          /* sólido: evita fundo branco no dropdown */
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 8px;
  color: #dde0f0;
  padding: .42rem .6rem;
  font-size: .83rem;
  font-family: inherit;
}
.ctrl-row select option {       /* garante texto legível quando o dropdown abre */
  background: #252540;
  color: #dde0f0;
}
.ctrl-row select:focus { outline: none; border-color: #d4a017; }

.ctrl-row input[type="range"] {
  flex: 1;
  accent-color: #d4a017;
  cursor: pointer;
}

.align-group { display: flex; gap: .3rem; }
.align-btn {
  padding: .38rem .5rem;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 7px;
  color: #8890b8;
  cursor: pointer;
  line-height: 1;
  transition: background .12s, border-color .12s, color .12s;
}
.align-btn:hover, .align-btn.active {
  background: rgba(212,160,23,.14);
  border-color: #d4a017;
  color: #d4a017;
}

.style-group { display: flex; gap: .35rem; }
.style-toggle {
  display: flex;
  align-items: center;
  padding: .35rem .65rem;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 7px;
  cursor: pointer;
  font-size: 1rem;
  color: #8890b8;
  margin: 0;
  font-weight: 400;
  transition: background .12s, border-color .12s, color .12s;
  user-select: none;
}
.style-toggle input { display: none; }
.style-toggle:has(input:checked) {
  background: rgba(212,160,23,.14);
  border-color: #d4a017;
  color: #d4a017;
}

/* ---- Cor ---- */
.color-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
}
.swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.12);
  background: var(--c, #fff);
  cursor: pointer;
  transition: transform .12s, border-color .12s, box-shadow .12s;
  padding: 0;
}
.swatch:hover  { transform: scale(1.15); border-color: rgba(255,255,255,.3); }
.swatch.active { border-color: #d4a017; box-shadow: 0 0 0 2px rgba(212,160,23,.35); transform: scale(1.1); }

.hex-row {
  display: flex;
  align-items: center;
  gap: .38rem;
}
.hex-prefix {
  color: #5a6080;
  font-size: .9rem;
  font-family: "SFMono-Regular", Consolas, monospace;
}
#studioHex {
  width: 88px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.11);
  border-radius: 8px;
  color: #dde0f0;
  padding: .38rem .55rem;
  font-size: .85rem;
  font-family: "SFMono-Regular", Consolas, monospace;
  letter-spacing: .04em;
}
#studioHex:focus { outline: none; border-color: #d4a017; }

/* ---- Botões de ação ---- */
.studio-actions {
  padding: .85rem 1rem;
  border-top: 1px solid rgba(255,255,255,.09);
  display: flex;
  align-items: center;
  gap: .55rem;
  flex-shrink: 0;
  background: #121220;
}

.dl-btns { display: flex; gap: .4rem; }

.btn-dl {
  padding: .55rem .8rem;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 9px;
  color: #b8bcd8;
  font-size: .8rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .13s;
}
.btn-dl:hover { background: rgba(255,255,255,.12); color: #fff; }

.btn-share {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  padding: .6rem 1rem;
  background: #d4a017;
  border: none;
  border-radius: 10px;
  color: #1a1000;
  font-size: .86rem;
  font-weight: 800;
  cursor: pointer;
  transition: filter .13s;
}
.btn-share:hover { filter: brightness(1.1); }

/* =====================================================================
   Emojis
   ===================================================================== */
.emoji-grid {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
}
.emoji-pick-btn {
  font-size: 1.45rem;
  padding: .28rem .32rem;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 7px;
  cursor: pointer;
  line-height: 1;
  transition: background .12s, transform .12s;
  user-select: none;
}
.emoji-pick-btn:hover {
  background: rgba(255,255,255,.14);
  transform: scale(1.18);
}
.section-hint {
  font-size: .72rem;
  color: #4e5570;
  line-height: 1.45;
  margin: 0;
}
.btn-emoji-del {
  width: 100%;
  margin-top: .35rem;
  padding: .48rem;
  background: rgba(204,34,34,.12);
  border: 1px solid rgba(204,34,34,.28);
  border-radius: 8px;
  color: #ff7070;
  font-size: .8rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .12s;
}
.btn-emoji-del:hover { background: rgba(204,34,34,.24); }

/* =====================================================================
   Responsivo
   ===================================================================== */
@media (max-width: 680px) {
  .studio-inner    { flex-direction: column; }
  .studio-preview-area { flex: 0 0 220px; padding: .75rem; }
  #studioCanvas    { max-height: 210px; }
  .studio-panel    { width: 100%; flex: 1 1 0; border-left: none; border-top: 1px solid rgba(255,255,255,.07); }
}
