@import url('https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css');

/* Variáveis CSS para modo claro/escuro */
:root {
  --primary-color: #f9c2d1;
  --secondary-color: #ffffff;
  --text-color: #333333;
  --bg-color: #ffffff;
  --border-color: #e5e7eb;
}

.dark {
  --primary-color: #f9c2d1;
  --secondary-color: #1a1a1a;
  --text-color: #ffffff;
  --bg-color: #333333;
  --border-color: #4b5563;
}

/* Estilos globais */
* {
  transition: all 0.3s ease;
}

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Botões customizados */
.btn-primary {
  background: linear-gradient(135deg, var(--primary-color), #f8b2c8);
  color: #333;
  border: none;
  border-radius: 12px;
  padding: 12px 24px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(249, 194, 209, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(249, 194, 209, 0.4);
}

.btn-secondary {
  background: var(--secondary-color);
  color: var(--text-color);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  padding: 12px 24px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-secondary:hover {
  border-color: var(--primary-color);
  transform: translateY(-1px);
}

/* Cards */
.card {
  background: var(--secondary-color);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

/* Inputs */
.input-field {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  background: var(--secondary-color);
  color: var(--text-color);
  font-size: 16px;
  transition: all 0.3s ease;
}

.input-field:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(249, 194, 209, 0.2);
}

/* Navegação */
.nav-tab {
  padding: 12px 20px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
}

.nav-tab.active {
  background: var(--primary-color);
  color: #333;
}

.nav-tab:not(.active):hover {
  background: rgba(249, 194, 209, 0.2);
}

/* Figurinhas grid - Layout exato do modelo */
.stickers-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 12px;
  padding: 12px;
  max-width: 100%;
  margin: 0;
}

        .sticker-item {
          background-color: #4b5563 !important; /* cinza bem escuro para contraste */
          border-radius: 14px;
          padding: 0;
          margin: 0;
          cursor: pointer;
          transition: all 0.3s ease;
          border: 1px solid #3f4752;
          box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
          min-height: 150px;
          aspect-ratio: 1;
          overflow: hidden;
          display: block !important;
          width: 100% !important;
          height: auto !important;
          visibility: visible !important;
          opacity: 1 !important;
        }

.sticker-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* Ícone colorido removido - bolinhas decorativas eliminadas */

/* Conteúdo da figurinha */
/* .sticker-content removido */

/* FORÇAR VISIBILIDADE DAS FIGURINHAS */
.sticker-item[style*="background-image"] {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  background-color: #4b5563 !important;
}

/* Imagens removidas - usando background-image */

/* Texto da figurinha - removido */

/* Botões de ação */
/* Ações da figurinha - removido */

/* Ícone de favorito - removido */

/* Toggle switch para modo escuro */
.toggle-switch {
  position: relative;
  width: 60px;
  height: 30px;
  background: var(--border-color);
  border-radius: 15px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.toggle-switch.active {
  background: var(--primary-color);
}

.toggle-switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  background: white;
  border-radius: 50%;
  transition: all 0.3s ease;
}

.toggle-switch.active::after {
  transform: translateX(30px);
}

/* Rodapé com Navegação */
.footer-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 6px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  background: transparent;
  border: none;
  color: #9ca3af;
  min-width: 50px;
  position: relative;
  flex: 1;
}

.footer-icon:hover {
  color: #f9c2d1;
  background: rgba(249, 194, 209, 0.1);
  transform: translateY(-2px);
}

.footer-icon.active {
  color: #f9c2d1;
  background: rgba(249, 194, 209, 0.15);
}

.footer-icon.active::before {
  content: '';
  position: absolute;
  top: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  background: #f9c2d1;
  border-radius: 50%;
}

.footer-icon span {
  font-size: 10px;
  font-weight: 500;
  margin-top: 4px;
  transition: all 0.3s ease;
}

/* Botão Flutuante Central */
.floating-action-btn {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #f9c2d1, #f8b2c8);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 20px rgba(249, 194, 209, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  z-index: 10;
}

.floating-action-btn:hover {
  transform: translateX(-50%) translateY(-4px);
  box-shadow: 0 6px 25px rgba(249, 194, 209, 0.5);
}

.floating-action-btn:active {
  transform: translateX(-50%) translateY(-2px);
}

/* Ícone circular do botão central */
/* Ícone interno volta a ser apenas o emoji no centro */

/* Modo escuro para rodapé */
.dark .footer-icon {
  color: #6b7280;
}

.dark .footer-icon:hover {
  color: #f9c2d1;
  background: rgba(249, 194, 209, 0.1);
}

.dark .footer-icon.active {
  color: #f9c2d1;
  background: rgba(249, 194, 209, 0.15);
}

.dark .footer-icon.active::before {
  background: #f9c2d1;
}

/* Sistema de Edição de Figurinhas */
.editable-sticker {
  position: relative;
  cursor: pointer;
  transition: all 0.3s ease;
  border-radius: 12px;
  overflow: hidden;
}

.editable-sticker:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.editable-sticker .sticker-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
}

/* Mini Paleta de Cores */
.mini-palette {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid #e5e7eb;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  z-index: 10;
}

.mini-palette:hover {
  transform: scale(1.2);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.mini-palette::before {
  content: '';
  width: 16px;
  height: 16px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='%23666' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M7 21a4 4 0 01-4-4V5a2 2 0 012-2h4a2 2 0 012 2v12a4 4 0 01-4 4zM21 5a2 2 0 00-2-2h-4a2 2 0 00-2 2v12a4 4 0 004 4h4a2 2 0 002-2V5z'%3E%3C/path%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

/* Modal de Edição */
#editModal {
  backdrop-filter: blur(8px);
}

.color-option, .element-color-option {
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
}

.color-option:hover, .element-color-option:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.color-option.active, .element-color-option.active {
  border-color: #f9c2d1 !important;
  border-width: 3px !important;
  transform: scale(1.1);
  box-shadow: 0 0 0 2px rgba(249, 194, 209, 0.3);
}

/* Preview da Figurinha Editável */
#stickerPreview {
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.editable-preview {
  position: relative;
  max-width: 200px;
  max-height: 200px;
}

.editable-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

.editable-preview .text-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-weight: bold;
  text-align: center;
  pointer-events: none;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
  transition: color 0.3s ease;
}

.editable-preview .element-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  transition: filter 0.3s ease;
}

/* Animações */
@keyframes colorChange {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

.color-change {
  animation: colorChange 0.3s ease;
}

/* Botão Flutuante de Paleta */
.floating-palette-btn {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f9c2d1, #f8b2c8);
  border: none;
  cursor: pointer;
  box-shadow: 0 8px 25px rgba(249, 194, 209, 0.4);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.floating-palette-btn:hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 12px 35px rgba(249, 194, 209, 0.6);
}

.floating-palette-btn:active {
  transform: translateY(-2px) scale(1.02);
}

.palette-icon {
  position: relative;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.palette-colors {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: white;
  display: flex;
  flex-wrap: wrap;
  padding: 4px;
}

.color-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin: 1px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.color-1 { background-color: #ff0000; }
.color-2 { background-color: #00ff00; }
.color-3 { background-color: #0000ff; }
.color-4 { background-color: #ffff00; }

.palette-brush {
  position: absolute;
  font-size: 20px;
  z-index: 2;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
  animation: brushFloat 2s ease-in-out infinite;
}

@keyframes brushFloat {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-3px) rotate(5deg); }
}

/* Efeito de pulsação */
.floating-palette-btn::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border-radius: 50%;
  background: linear-gradient(45deg, #ff0000, #00ff00, #0000ff, #ffff00);
  z-index: -1;
  animation: paletteRotate 3s linear infinite;
}

@keyframes paletteRotate {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Modo escuro para paleta */
.dark .floating-palette-btn {
  background: linear-gradient(135deg, #1f2937, #374151);
  box-shadow: 0 8px 25px rgba(31, 41, 55, 0.4);
}

.dark .floating-palette-btn:hover {
  box-shadow: 0 12px 35px rgba(31, 41, 55, 0.6);
}

.dark .palette-colors {
  background: #374151;
}

/* Responsividade para Editor */
@media (max-width: 768px) {
  #editModal .grid {
    grid-template-columns: 1fr;
  }
  
  .color-option, .element-color-option {
    width: 8px;
    height: 8px;
  }
  
  .mini-palette {
    width: 20px;
    height: 20px;
  }
  
  .mini-palette::before {
    font-size: 10px;
  }
  
  .floating-palette-btn {
    width: 60px;
    height: 60px;
  }
  
  .palette-icon {
    width: 40px;
    height: 40px;
  }
  
  .color-dot {
    width: 6px;
    height: 6px;
  }
  
  .palette-brush {
    font-size: 16px;
  }
}

/* Responsividade */
@media (max-width: 768px) {
  .stickers-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px;
  }
  
  .card {
    padding: 16px;
  }
  
  .btn-primary, .btn-secondary {
    padding: 10px 20px;
    font-size: 14px;
  }
}

/* Animações */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeIn 0.5s ease-out;
}

/* Toast notifications */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--primary-color);
  color: #333;
  padding: 16px 24px;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

/* Loading spinner */
.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border-color);
  border-top: 4px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Estabilização em iOS / mobile */
html, body {
	overscroll-behavior: none;
	-webkit-overflow-scrolling: auto;
	overflow-x: hidden;
	-webkit-text-size-adjust: 100%;
	-webkit-tap-highlight-color: transparent;
}

/* Evita duplo toque/zoom e gestos indesejados em controles */
button, a, .btn-primary, .btn-secondary, .nav-tab, .toggle-switch {
	touch-action: manipulation;
}

/* Evita seleção/acesso ao menu de contexto em imagens de figurinhas */
.sticker-image, #modalImage {
	-webkit-user-select: none;
	user-select: none;
	-webkit-touch-callout: none;
	background-color: #f5f5f5;
	border: 1px solid #e0e0e0;
}

/* Modal: impedir scroll de fundo quando aberta (aplicado via classe .modal-open no body se necessário) */
body.modal-open {
	overflow: hidden;
}

/* Fundo quadriculado para figurinhas claras */
.checker-bg {
	background-image: linear-gradient(45deg, #f0f0f0 25%, transparent 25%),
		linear-gradient(-45deg, #f0f0f0 25%, transparent 25%),
		linear-gradient(45deg, transparent 75%, #f0f0f0 75%),
		linear-gradient(-45deg, transparent 75%, #f0f0f0 75%);
	background-size: 16px 16px;
	background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
}

.sticker-frame {
	border: 1px solid rgba(0,0,0,0.06);
	border-radius: 8px;
}

/* Modal imagem grande com contraste */
.modal-image-frame {
	border: 1px solid rgba(0,0,0,0.1);
	border-radius: 10px;
	background-color: #f5f5f5;
}

/* Fundo para todas as imagens de figurinhas */
.sticker-item img,
.sticker-image,
#modalImage,
.animated-sticker img {
	background-color: #f5f5f5;
	border: 1px solid #e0e0e0;
}

/* Background-image ocupa todo o espaço automaticamente */

/* Forçar fundo branco nos cartões mesmo no modo escuro */
/* Remover forçar branco no modo escuro: manter fundo cinza para contraste */

.dark .sticker-title {
  color: #333333 !important;
}

.dark .sticker-subtitle {
  color: #666666 !important;
}

/* Modo escuro - fundo mais escuro para contraste */
.dark .sticker-item img,
.dark .sticker-image,
.dark #modalImage,
.dark .animated-sticker img {
	background-color: #2a2a2a;
	border: 1px solid #404040;
}

