/* ═══════════════════════════════════════════════════════════════
   WooCommerce Product Customizer — RM Clique (rmclique.com.br)
   v2.1.0
   ═══════════════════════════════════════════════════════════════ */

:root {
  --wcp-primary:      #1a1a2e;
  --wcp-accent:       #e94560;
  --wcp-accent-light: #ff6b81;
  --wcp-surface:      #16213e;
  --wcp-surface2:     #0f3460;
  --wcp-text:         #eaeaea;
  --wcp-text-muted:   #8a8fa8;
  --wcp-radius:       14px;
  --wcp-shadow:       0 24px 80px rgba(0,0,0,.7);
  --wcp-transition:   .22s cubic-bezier(.4,0,.2,1);
}

/* ══════════════════════════════════════════════════════════════
   BOTÃO NA PÁGINA DO PRODUTO
   ══════════════════════════════════════════════════════════════ */

#wcp-open-customizer {
  display:        inline-flex;          /* compacto — não estica */
  align-items:    center;
  gap:            8px;
  padding:        10px 22px;            /* menor que antes */
  margin-bottom:  0;
  background:     linear-gradient(135deg, var(--wcp-surface2) 0%, var(--wcp-primary) 100%);
  color:          var(--wcp-text);
  border:         2px solid var(--wcp-accent);
  border-radius:  var(--wcp-radius);
  font-size:      0.875rem;
  font-weight:    700;
  letter-spacing: .04em;
  cursor:         pointer;
  transition:     var(--wcp-transition);
  position:       relative;
  overflow:       hidden;
  white-space:    nowrap;
}

/* Camada de hover (fundo) */
#wcp-open-customizer::before {
  content:    '';
  position:   absolute;
  inset:      0;
  background: linear-gradient(135deg, var(--wcp-accent) 0%, var(--wcp-accent-light) 100%);
  opacity:    0;
  transition: var(--wcp-transition);
}

/* Ícone e texto ficam acima do ::before */
#wcp-open-customizer .wcp-icon,
#wcp-open-customizer span {
  position: relative;
  z-index:  1;
}

/* Hover — fundo aparece E cor da fonte é forçada */
#wcp-open-customizer:hover::before { opacity: 1; }
#wcp-open-customizer:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(233,69,96,.4);
  color: #ffffff;          /* garante que a fonte NÃO some no hover */
}
#wcp-open-customizer:hover .wcp-icon,
#wcp-open-customizer:hover span {
  color: inherit;          /* herda a cor forçada acima */
}
#wcp-open-customizer:active { transform: translateY(0); }

/* Ícone girando */
.wcp-icon { font-size: 1rem; animation: wcp-spin 6s linear infinite; }
@keyframes wcp-spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════════════════════════
   OVERLAY / BACKDROP
   ══════════════════════════════════════════════════════════════ */

#wcp-overlay {
  position:        fixed;
  inset:           0;
  background:      rgba(0,0,0,.75);
  z-index:         99998;
  display:         flex;
  align-items:     center;
  justify-content: center;
  opacity:         0;
  visibility:      hidden;
  transition:      var(--wcp-transition);
  padding:         16px;
  backdrop-filter: blur(4px);
}

#wcp-overlay.wcp-active {
  opacity:    1;
  visibility: visible;
}

/* ══════════════════════════════════════════════════════════════
   MODAL
   ══════════════════════════════════════════════════════════════ */

#wcp-modal {
  background:     var(--wcp-primary);
  border:         1px solid rgba(233,69,96,.3);
  border-radius:  20px;
  box-shadow:     var(--wcp-shadow);
  width:          min(960px, 100%);
  max-height:     90dvh;
  overflow-y:     auto;
  display:        flex;
  flex-direction: column;
  transform:      translateY(32px) scale(.97);
  transition:     var(--wcp-transition);
  scrollbar-width: thin;
  scrollbar-color: var(--wcp-accent) transparent;
}

#wcp-overlay.wcp-active #wcp-modal {
  transform: translateY(0) scale(1);
}

/* ══════════════════════════════════════════════════════════════
   HEADER — com ícones de título
   ══════════════════════════════════════════════════════════════ */

.wcp-header {
  display:         flex;
  align-items:     flex-start;
  justify-content: space-between;
  padding:         16px 28px 14px;
  border-bottom:   1px solid rgba(255,255,255,.08);
  flex-shrink:     0;
  gap:             12px;
}

/* Coluna esquerda: título + linha de ícones */
.wcp-header-left {
  display:        flex;
  flex-direction: column;
  gap:            8px;
  flex:           1;
  min-width:      0;
}

/* Linha do título */
.wcp-title-row {
  display:     flex;
  align-items: center;
}

.wcp-title-row h2,
#wcp-title-text {
  margin:      0;
  font-size:   1.15rem;
  font-weight: 800;
  color:       var(--wcp-text);
  line-height: 1.3;
}

/* Linha de ícones decorativos abaixo do título */
.wcp-title-icons-row {
  display:     flex;
  align-items: center;
  flex-wrap:   wrap;
  gap:         4px;
}

.wcp-title-icons-label {
  font-size:      .65rem;
  font-weight:    700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color:          var(--wcp-text-muted);
  margin-right:   4px;
  white-space:    nowrap;
}

/* Botões de ícone no título */
.wcp-title-icon-btn {
  background:    rgba(255,255,255,.05);
  border:        1px solid rgba(255,255,255,.1);
  border-radius: 7px;
  font-size:     1.1rem;
  line-height:   1;
  cursor:        pointer;
  padding:       4px 6px;
  transition:    var(--wcp-transition);
  color:         var(--wcp-text);
}

.wcp-title-icon-btn:hover {
  background:   rgba(233,69,96,.2);
  border-color: var(--wcp-accent);
  transform:    scale(1.15);
}

.wcp-title-icon-btn.wcp-title-icon-active {
  background:   rgba(233,69,96,.25);
  border-color: var(--wcp-accent);
  box-shadow:   0 0 0 2px rgba(233,69,96,.3);
}

/* Botão de limpar ícone */
.wcp-title-icon-clear {
  font-size:   .75rem !important;
  padding:     4px 8px !important;
  color:       var(--wcp-text-muted) !important;
}

.wcp-title-icon-clear:hover {
  color: var(--wcp-accent) !important;
}

/* Branding no header */
.wcp-header-brand {
  font-size:   .7rem;
  color:       var(--wcp-text-muted);
  text-align:  right;
  line-height: 1.5;
  white-space: nowrap;
  flex-shrink: 0;
}

.wcp-header-brand a {
  color:           var(--wcp-accent);
  text-decoration: none;
  font-weight:     600;
}

.wcp-header-brand a:hover { text-decoration: underline; }

/* Botão fechar */
#wcp-close {
  background:    none;
  border:        none;
  color:         var(--wcp-text-muted);
  font-size:     1.6rem;
  cursor:        pointer;
  line-height:   1;
  padding:       4px;
  border-radius: 50%;
  transition:    var(--wcp-transition);
  display:       flex;
  flex-shrink:   0;
}

#wcp-close:hover { color: var(--wcp-accent); background: rgba(233,69,96,.12); }

/* ══════════════════════════════════════════════════════════════
   BODY
   ══════════════════════════════════════════════════════════════ */

.wcp-body {
  display:  flex;
  gap:      24px;
  padding:  20px 28px;
  flex:     1;
}

/* ══════════════════════════════════════════════════════════════
   PAINEL ESQUERDO (controles)
   ══════════════════════════════════════════════════════════════ */

.wcp-controls {
  width:          250px;
  flex-shrink:    0;
  display:        flex;
  flex-direction: column;
  gap:            14px;
  overflow-y:     auto;
  max-height:     calc(90dvh - 140px);
  padding-right:  4px;
  scrollbar-width: thin;
  scrollbar-color: var(--wcp-accent) transparent;
}

.wcp-section-label {
  font-size:      .67rem;
  font-weight:    700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color:          var(--wcp-accent);
  margin-bottom:  4px;
}

/* ── Galeria de imagens do produto ──────────────────────────── */
.wcp-gallery {
  display:               grid;
  grid-template-columns: repeat(4, 1fr);
  gap:                   6px;
}

.wcp-gallery-thumb {
  border:        2px solid transparent;
  border-radius: 8px;
  overflow:      hidden;
  cursor:        pointer;
  transition:    var(--wcp-transition);
  aspect-ratio:  1;
  background:    rgba(255,255,255,.04);
}

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

.wcp-gallery-thumb:hover              { border-color: rgba(233,69,96,.5); }
.wcp-gallery-thumb.wcp-gallery-active { border-color: var(--wcp-accent); }

/* ── Upload area ────────────────────────────────────────────── */
.wcp-upload-zone {
  border:      2px dashed rgba(233,69,96,.4);
  border-radius: var(--wcp-radius);
  padding:     16px 12px;
  text-align:  center;
  cursor:      pointer;
  transition:  var(--wcp-transition);
  background:  rgba(255,255,255,.02);
  position:    relative;
}

.wcp-upload-zone:hover,
.wcp-upload-zone.wcp-drag-over {
  border-color: var(--wcp-accent);
  background:   rgba(233,69,96,.06);
}

.wcp-upload-zone input[type="file"] {
  position: absolute;
  inset:    0;
  opacity:  0;
  cursor:   pointer;
  width:    100%;
  height:   100%;
}

.wcp-upload-icon { font-size: 1.8rem; display: block; margin-bottom: 6px; }

.wcp-upload-zone p {
  margin:    0;
  font-size: .77rem;
  color:     var(--wcp-text-muted);
  line-height: 1.4;
}

.wcp-upload-zone strong {
  color:         var(--wcp-text);
  display:       block;
  margin-bottom: 2px;
}

.wcp-upload-hint {
  font-size:   .69rem !important;
  color:       var(--wcp-accent) !important;
  margin-top:  4px !important;
}

/* ── Lista de logos ─────────────────────────────────────────── */
#wcp-logo-items {
  display:        flex;
  flex-direction: column;
  gap:            6px;
  max-height:     140px;
  overflow-y:     auto;
}

.wcp-logo-item {
  display:       flex;
  align-items:   center;
  gap:           8px;
  padding:       7px 10px;
  border-radius: 8px;
  background:    rgba(255,255,255,.04);
  cursor:        pointer;
  transition:    var(--wcp-transition);
  border:        1px solid transparent;
}

.wcp-logo-item:hover { background: rgba(255,255,255,.08); }

.wcp-logo-item.wcp-logo-item-active {
  border-color: var(--wcp-accent);
  background:   rgba(233,69,96,.08);
}

.wcp-logo-item img {
  width:         32px;
  height:        32px;
  object-fit:    contain;
  border-radius: 4px;
  flex-shrink:   0;
}

.wcp-logo-item span {
  flex:          1;
  font-size:     .75rem;
  color:         var(--wcp-text);
  overflow:      hidden;
  text-overflow: ellipsis;
  white-space:   nowrap;
}

.wcp-logo-item-del {
  background:    none;
  border:        none;
  color:         var(--wcp-text-muted);
  cursor:        pointer;
  font-size:     .8rem;
  padding:       2px 4px;
  border-radius: 4px;
  transition:    var(--wcp-transition);
}

.wcp-logo-item-del:hover { color: var(--wcp-accent); background: rgba(233,69,96,.15); }

/* ── Sliders ────────────────────────────────────────────────── */
.wcp-slider-wrap { display: flex; flex-direction: column; gap: 5px; }

.wcp-slider-row {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
}

.wcp-slider-row span   { font-size: .72rem; color: var(--wcp-text-muted); }
.wcp-slider-row strong { font-size: .78rem; color: var(--wcp-text); min-width: 36px; text-align: right; }

input[type="range"].wcp-slider {
  width:        100%;
  accent-color: var(--wcp-accent);
  cursor:       pointer;
}

/* ── Botões internos do popup ───────────────────────────────── */
.wcp-btn {
  display:         flex;
  align-items:     center;
  justify-content: center;
  gap:             8px;
  padding:         11px 16px;
  border-radius:   10px;
  font-size:       .85rem;
  font-weight:     600;
  cursor:          pointer;
  border:          none;
  transition:      var(--wcp-transition);
  width:           100%;
}

.wcp-btn-primary {
  background: linear-gradient(135deg, var(--wcp-accent), var(--wcp-accent-light));
  color:      #fff;
}

.wcp-btn-primary:hover { filter: brightness(1.1); transform: translateY(-1px); }

.wcp-btn-secondary {
  background: rgba(255,255,255,.06);
  color:      var(--wcp-text);
  border:     1px solid rgba(255,255,255,.1);
}

.wcp-btn-secondary:hover { background: rgba(255,255,255,.1); }

.wcp-btn-icon {
  background: rgba(255,255,255,.05);
  color:      var(--wcp-text);
  border:     1px solid rgba(255,255,255,.1);
  flex:       1;
  font-size:  .78rem;
  padding:    7px 8px;
}

.wcp-btn-icon:hover { background: rgba(233,69,96,.15); border-color: var(--wcp-accent); }

.wcp-btn:disabled { opacity: .4; cursor: not-allowed; transform: none !important; filter: none !important; }

/* ══════════════════════════════════════════════════════════════
   CANVAS ÁREA
   ══════════════════════════════════════════════════════════════ */

.wcp-canvas-wrap {
  flex:           1;
  display:        flex;
  flex-direction: column;
  gap:            12px;
  min-width:      0;
}

.wcp-canvas-instructions {
  font-size:    .78rem;
  color:        var(--wcp-text-muted);
  text-align:   center;
  background:   rgba(255,255,255,.03);
  border-radius: 8px;
  padding:      7px 12px;
}

.wcp-canvas-instructions kbd {
  background:    rgba(255,255,255,.1);
  border-radius: 4px;
  padding:       1px 5px;
  font-size:     .72rem;
  color:         var(--wcp-text);
}

#wcp-canvas-container {
  position:        relative;
  background:      repeating-conic-gradient(rgba(255,255,255,.04) 0% 25%, transparent 0% 50%) 0 0 / 20px 20px;
  border-radius:   12px;
  overflow:        hidden;
  border:          1px solid rgba(255,255,255,.07);
  display:         flex;
  align-items:     center;
  justify-content: center;
  min-height:      300px;
}

#wcp-canvas {
  display:       block;
  max-width:     100%;
  border-radius: 8px;
}

/* ── Logo overlay (sobre o canvas) ─────────────────────────── */
.wcp-logo-overlay {
  position:         absolute;
  cursor:           move;
  user-select:      none;
  transform-origin: center center;
}

.wcp-logo-overlay img {
  display:        block;
  width:          100%;
  height:         100%;
  object-fit:     contain;
  pointer-events: none;
}

/* Handle resize (canto inferior direito) */
.wcp-handle-resize {
  position:      absolute;
  width:         12px;
  height:        12px;
  background:    var(--wcp-accent);
  border:        2px solid #fff;
  border-radius: 50%;
  cursor:        se-resize;
  bottom:        -6px;
  right:         -6px;
  z-index:       10;
}

/* Handle rotação (centro superior) */
.wcp-handle-rotate {
  position:        absolute;
  width:           20px;
  height:          20px;
  background:      var(--wcp-surface2);
  border:          2px solid var(--wcp-accent);
  border-radius:   50%;
  cursor:          grab;
  top:             -10px;
  left:            50%;
  transform:       translateX(-50%);
  z-index:         10;
  font-size:       .65rem;
  color:           var(--wcp-accent);
  display:         flex;
  align-items:     center;
  justify-content: center;
  line-height:     1;
  font-weight:     700;
}

.wcp-handle-rotate:active { cursor: grabbing; }

.wcp-delete-btn {
  position:        absolute;
  top:             -10px;
  right:           -10px;
  width:           20px;
  height:          20px;
  background:      var(--wcp-accent);
  border:          none;
  border-radius:   50%;
  color:           #fff;
  font-size:       .7rem;
  cursor:          pointer;
  display:         flex;
  align-items:     center;
  justify-content: center;
  z-index:         10;
  line-height:     1;
}

.wcp-logo-overlay.wcp-selected {
  outline:        2px dashed var(--wcp-accent);
  outline-offset: 3px;
}

/* ══════════════════════════════════════════════════════════════
   FOOTER
   ══════════════════════════════════════════════════════════════ */

.wcp-footer {
  padding:         14px 28px;
  border-top:      1px solid rgba(255,255,255,.06);
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  gap:             12px;
  flex-shrink:     0;
}

.wcp-footer-hint  { font-size: .76rem; color: var(--wcp-text-muted); }

.wcp-footer-brand { font-size: .72rem; color: var(--wcp-text-muted); white-space: nowrap; }

.wcp-footer-brand a {
  color:           var(--wcp-accent);
  text-decoration: none;
  font-weight:     600;
}

.wcp-footer-brand a:hover { text-decoration: underline; }

/* ══════════════════════════════════════════════════════════════
   RESPONSIVO
   ══════════════════════════════════════════════════════════════ */

@media (max-width: 640px) {
  .wcp-body            { flex-direction: column; padding: 14px; }
  .wcp-controls        { width: 100%; max-height: none; }
  .wcp-header          { padding: 14px; flex-wrap: wrap; }
  .wcp-header-brand    { display: none; }
  .wcp-title-icons-row { gap: 3px; }
  .wcp-title-icon-btn  { font-size: .95rem; padding: 3px 5px; }
  .wcp-footer          { padding: 12px 14px; }
}

/* ══════════════════════════════════════════════════════════════
   TOAST
   ══════════════════════════════════════════════════════════════ */

#wcp-toast {
  position:      fixed;
  bottom:        32px;
  right:         32px;
  background:    var(--wcp-surface2);
  color:         var(--wcp-text);
  padding:       12px 20px;
  border-radius: 10px;
  border-left:   3px solid var(--wcp-accent);
  font-size:     .86rem;
  z-index:       99999;
  opacity:       0;
  transform:     translateY(12px);
  transition:    var(--wcp-transition);
  pointer-events: none;
  max-width:     300px;
}

#wcp-toast.wcp-show {
  opacity:   1;
  transform: translateY(0);
}
