/*
Theme Name: Moldura Regina Nunes - Apoio
Theme URI: https://borabueno.com.br
Author: Rafael
Description: Página de apoio com ferramenta de moldura de foto de perfil para a campanha da Deputada Estadual Regina Nunes (15115, MDB), estrutura baseada na página de apoio do Baleia Rossi.
Version: 1.0
Requires at least: 5.8
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: moldura-regina-apoio
*/

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body.moldura-regina-body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: linear-gradient(180deg, #163B7A 0%, #0B2242 100%);
  min-height: 100vh;
  padding: 40px 20px 56px;
}

.moldura-wrap {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
}

/* ---------- Hero ---------- */

.moldura-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 20px;
  margin-bottom: 36px;
}

.moldura-hero-img {
  width: 100%;
  max-width: 260px;
  border-radius: 20px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
}

.moldura-hero-text {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.moldura-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  color: #0B2242;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 8px 16px;
  border-radius: 999px;
  margin-bottom: 16px;
}

.moldura-badge span.moldura-badge-accent {
  color: #00B0E6;
}

.moldura-h1 {
  font-size: 30px;
  font-weight: 800;
  color: #FFB200;
  line-height: 1.25;
  margin: 0 0 14px;
  max-width: 480px;
}

.moldura-hero-subtitle {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.6;
  margin: 0;
  max-width: 440px;
}

@media (min-width: 700px) {
  .moldura-hero {
    flex-direction: row;
    text-align: left;
    align-items: center;
    gap: 40px;
  }
  .moldura-hero-text {
    align-items: flex-start;
  }
  .moldura-hero-img {
    max-width: 280px;
    flex-shrink: 0;
  }
}

/* ---------- Section ---------- */

.moldura-section {
  padding: 0;
}

.moldura-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  margin: 0 0 6px;
}

.moldura-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #FFB200;
  color: #0B2242;
  font-size: 14px;
  font-weight: 800;
  flex-shrink: 0;
}

.moldura-section-desc {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
  margin: 0 0 18px;
  line-height: 1.5;
}

/* ---------- Frame picker ---------- */

.moldura-frame-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, 130px);
  gap: 14px;
  max-width: 100%;
}

.moldura-frame-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 130px;
  max-width: 130px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.1s ease;
}

.moldura-frame-thumb {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  overflow: hidden;
  background-color: #b9c2d0;
  background-image:
    linear-gradient(45deg, #a9b3c4 25%, transparent 25%),
    linear-gradient(-45deg, #a9b3c4 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #a9b3c4 75%),
    linear-gradient(-45deg, transparent 75%, #a9b3c4 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
}

.moldura-frame-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.moldura-frame-check {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #FFB200;
  color: #0B2242;
  font-size: 12px;
  font-weight: 800;
  display: none;
  align-items: center;
  justify-content: center;
}

.moldura-frame-label {
  font-size: 12px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.85);
  text-align: center;
  line-height: 1.3;
}

.moldura-frame-option:hover {
  transform: translateY(-2px);
}

.moldura-frame-option.is-selected {
  border-color: #FFB200;
}

.moldura-frame-option.is-selected .moldura-frame-check {
  display: flex;
}

.moldura-frame-option.is-selected .moldura-frame-label {
  color: #FFB200;
}

/* ---------- Tool grid (upload | preview) ---------- */

.moldura-tool-grid {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  padding: 20px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 760px) {
  .moldura-tool-grid {
    grid-template-columns: 1fr 1fr;
    align-items: start;
    padding: 28px;
  }
}

.moldura-card {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.moldura-upload-card {
  cursor: pointer;
  height: 100%;
}

.moldura-dropzone {
  width: 100%;
  height: 100%;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  padding: 28px 20px;
  border: 2px dashed rgba(255, 255, 255, 0.35);
  border-radius: 18px;
  color: #fff;
}

.moldura-dropzone .moldura-cam-icon {
  font-size: 30px;
  margin-bottom: 4px;
}

.moldura-dropzone strong {
  font-size: 15px;
  color: #FFB200;
}

.moldura-dropzone-sub {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.85);
}

.moldura-dropzone small {
  color: rgba(255, 255, 255, 0.6);
  font-size: 11px;
  line-height: 1.5;
  max-width: 240px;
  margin-top: 6px;
}

.moldura-preview-card {
  width: 100%;
}

.moldura-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 16px;
  overflow: hidden;
  background: #EDF1F8;
  user-select: none;
  touch-action: none;
}

.moldura-stage.dragging {
  cursor: grabbing;
}

.moldura-stage.has-photo {
  cursor: grab;
}

.moldura-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 30px;
  color: #8A97AC;
  font-size: 13px;
  line-height: 1.5;
}

.moldura-photo {
  position: absolute;
  left: 50%;
  top: 50%;
  max-width: none;
  transform-origin: center center;
  pointer-events: none;
}

.moldura-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.moldura-controls {
  width: 100%;
  margin-top: 14px;
  display: none;
}

.moldura-controls.active {
  display: block;
}

.moldura-zoom-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.moldura-zoom-row .moldura-zoom-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.moldura-zoom-row input[type="range"] {
  width: 100%;
  accent-color: #FFB200;
}

.moldura-hint {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.75);
  text-align: center;
  margin: 10px 0 0;
}

.moldura-buttons-row {
  width: 100%;
  margin-top: 14px;
  display: flex;
  gap: 10px;
}

.moldura-btn-secondary {
  flex: 0 0 auto;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 0 18px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.moldura-download {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #FFB200;
  color: #0B2242;
  font-size: 15px;
  font-weight: 800;
  border: none;
  border-radius: 12px;
  padding: 14px 10px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(255, 178, 0, 0.35);
  transition: background 0.15s ease, transform 0.1s ease;
}

.moldura-download:hover:not(:disabled) {
  background: #F0A800;
}

.moldura-download:active:not(:disabled) {
  transform: scale(0.98);
}

.moldura-download:disabled {
  background: rgba(255, 178, 0, 0.3);
  color: rgba(11, 34, 66, 0.5);
  cursor: not-allowed;
  box-shadow: none;
}

.moldura-download-caption {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
  text-align: center;
  margin: 10px 0 0;
}

#moldura-file-input {
  display: none;
}

/* ---------- Footer ---------- */

.moldura-footer {
  text-align: center;
  margin-top: 32px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.75);
  line-height: 1.8;
}

.moldura-footer-badge {
  display: inline-block;
  background: rgba(255, 178, 0, 0.15);
  border: 1px solid rgba(255, 178, 0, 0.4);
  color: #FFB200;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 14px;
  border-radius: 999px;
  margin-top: 6px;
}

.moldura-legal {
  text-align: center;
  margin: 18px auto 0;
  max-width: 620px;
  font-size: 10px;
  color: #ffffff;
  line-height: 1.6;
}

/* ---------- Result overlay (fallback for iOS Safari only) ---------- */

.moldura-result-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(10, 10, 15, 0.94);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.moldura-result-overlay.active {
  display: flex;
}

.moldura-result-img {
  max-width: 100%;
  width: 100%;
  max-width: 420px;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.moldura-result-hint {
  color: #fff;
  font-size: 14px;
  text-align: center;
  max-width: 340px;
  line-height: 1.5;
  margin-top: 18px;
}

.moldura-result-hint strong {
  color: #ffd23f;
}

.moldura-result-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
