/* estilos complementares */
::-webkit-scrollbar{ width:8px; height:8px; }
::-webkit-scrollbar-thumb{ background:#cbd5e1; border-radius:10px; }
.swal2-popup{ background:#ffffff !important; color:#111 !important; border:1px solid #e5e7eb; border-radius:16px; }
.swal2-styled.swal2-confirm{ background:linear-gradient(135deg,#10b981,#3b82f6) !important; }
.swal2-styled.swal2-cancel{ background:#e5e7eb !important; color:#111 !important; }

/* Estilos para seções do modal */
.section-title {
  font-size: 16px;
  font-weight: bold;
  color: #333;
  margin-bottom: 10px;
  border-bottom: 2px solid #e5e7eb;
  padding-bottom: 5px;
}

.section-subtitle {
  font-size: 14px;
  font-weight: 600;
  color: #666;
  margin-bottom: 8px;
  margin-top: 15px;
}

/* Estilos para formatação WYSIWYG */
.format-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #ffffff;
  color: #374151;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
  margin: 0 2px;
}

.format-btn:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
}

.format-btn:active {
  background: #e5e7eb;
  transform: translateY(1px);
}

.format-separator {
  width: 1px;
  height: 24px;
  background: #d1d5db;
  margin: 0 8px;
  display: inline-block;
  vertical-align: middle;
}

.format-select {
  display: inline-block;
  padding: 4px 8px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #ffffff;
  color: #374151;
  font-size: 12px;
  cursor: pointer;
  margin: 0 2px;
  min-width: 120px;
}

.format-select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

/* Ícones de edição nos elementos */
.edit-icon {
  position: absolute;
  top: 5px;
  right: 5px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #ddd;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s ease, background 0.2s ease;
  z-index: 10;
  font-size: 10px;
  color: #666;
}

.edit-icon:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 1);
  color: #333;
}

.edit-icon i {
  font-size: 10px;
  line-height: 1;
}

/* Grid sem altura fixa para ajuste dinâmico */
.grid { overflow-y: auto; }

/* Altura fixa para modal-body para manter dimensão consistente */
.edit-box.active .card .card-body { height: 400px; overflow-y: auto; }

/* Estilos para mobile drag and drop */
@media (max-width: 768px) {
  .layer-title,
  .layer-box,
  .layer-footer,
  .layer-icon:not(.image-placeholder) {
    transition: box-shadow 0.15s ease;
    touch-action: none; /* Previne Scrolls e gestos de zoom no mobile */
  }

  .layer-title.ui-draggable-dragging,
  .layer-box.ui-draggable-dragging,
  .layer-footer.ui-draggable-dragging,
  .layer-icon.ui-draggable-dragging {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3) !important;
    z-index: 1000 !important;
    transform: rotate(1.5deg);
  }

  /* Cursor mobile otimizado */
  .layer-title {
    cursor: grab;
  }

  .layer-title:active,
  .layer-title.ui-draggable-handle:active {
    cursor: grabbing;
  }
  /* Fundo do modal com opacidade e blur - usando pseudo-elemento para não interferir no drag */
  .edit-box::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0);
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    z-index: -1;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(.25,.8,.25,1);
  }

  .edit-box.active::before {
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
  }

  /* Modal ocupa toda largura, colado nas laterais, no topo da barra bottom */
  .edit-box.active .card {
    width: 100vw;
    max-width: 100vw;
    border-radius: 0 !important;
    margin: 0;
    box-shadow: 0 0 0 rgba(0,0,0,.20);
  }

  /* Animação de deslizamento */
  .edit-box {
    transition: bottom .3s cubic-bezier(.25,.8,.25,1), background .3s ease, backdrop-filter .3s ease;
  }
  .edit-box.active {
    bottom: 64px;
    animation: slideUp .3s cubic-bezier(.25,.8,.25,1);
  }
  .edit-box:not(.active) {
    animation: slideDown .3s cubic-bezier(.25,.8,.25,1);
  }

  @keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }

  @keyframes slideDown {
    from { transform: translateY(0); }
    to { transform: translateY(100%); }
  }

  /* Layout vertical para modais mobile: preview em cima, opções embaixo */
  .edit-box.active .card-body .row {
    flex-direction: column;
  }
  .edit-box.active .card-body .col-md-6 {
    width: 100%;
    margin-bottom: 20px;
  }

  /* Ajuste do preview mobile - maior qualidade */
  .edit-box.active #export-preview img {
    max-width: 100%;
    height: auto;
  }
}
