/* ==========================
   TOOL CONTAINER
========================== */
.tool-container {
  max-width: 900px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.tool-header {
  text-align: center;
  margin-bottom: 3rem;
}

.tool-header h1 {
  font-size: 2.5rem;
  font-weight: 800;
  color: #03396c;
  margin-bottom: 0.5rem;
}

.tool-header p {
  font-size: 1.1rem;
  color: #495057;
}

/* ==========================
   CARD
========================== */
.card {
  background: #f0f9ff;
  border-radius: 15px;
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: 0 4px 15px rgba(0, 119, 182, 0.1);
}

/* ==========================
   FORMULÁRIOS
========================== */
.form-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 12px;
}

.form-group label {
  font-weight: 600;
  margin-bottom: 6px;
  color: #03396c;
}

.form-control, select, input[type="number"] {
  width: 100%;
  max-width: 250px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #ccc;
  font-size: 0.95rem;
  box-sizing: border-box;
  transition: border 0.2s, box-shadow 0.2s;
}

.form-control:focus, select:focus, input[type="number"]:focus {
  outline: none;
  border-color: #0077b6;
  box-shadow: 0 0 0 2px rgba(0, 119, 182, 0.15);
}

/* ==========================
   INPUT FILE
========================== */
.file-label {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.5rem;
  background: linear-gradient(135deg, #0077b6 0%, #00a8e8 100%);
  color: white;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
}

.file-label:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 119, 182, 0.3);
}

/* ==========================
   BOTOES
========================== */
.btn-primary, .btn-secondary, .btn-success {
  padding: 0.8rem 1.5rem;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-primary {
  background: linear-gradient(135deg, #0077b6 0%, #00a8e8 100%);
  color: white;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 20px rgba(0, 119, 182, 0.4);
}

.btn-secondary {
  background: #6c757d;
  color: white;
}

.btn-success {
  background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
  color: white;
}

/* ==========================
   PREVIEW
========================== */
#previewContainer {
  margin: 20px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#imagePreview {
  max-width: 100%;
  max-height: 420px;
  object-fit: contain;
  border-radius: 10px;
  margin-bottom: 8px;
}

/* ==========================
   TABS
========================== */
.tabs { margin-top: 15px; }
.tab-buttons {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid #ddd;
  margin-bottom: 10px;
}

.tab-btn {
  background: #f1f1f1;
  border: none;
  padding: 8px 14px;
  border-radius: 6px 6px 0 0;
  cursor: pointer;
}

.tab-btn.active {
  background: #fff;
  border-bottom: 2px solid #4f46e5;
}

.tab-content {
  display: none;
  padding: 12px;
  background: #fff;
  border-radius: 0 0 10px 10px;
}

.tab-content.active {
  display: block;
}

/* ==========================
   PALETA DE CORES
========================== */
.palette-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 10px;
}

.palette-grid div {
  width: 15px;
  height: 15px;
  cursor: pointer;
}

/* ==========================
   FORMULARIO INLINE (REDIMENSIONAR)
========================== */
.form-inline {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

/* New stacked fields for editor: ensure full-width fields when stacked */
.form-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.form-row .form-field label { font-weight: 600; margin-bottom: 4px; }
.form-row .form-field input[type=number] { width: 100%; max-width: 250px; }
.form-row .form-field #resizeWidth,
.form-row .form-field #resizeHeight {
  width: 50%;
  max-width: 140px;
}
.form-row .form-field .checkbox { font-weight: 400; }

.form-inline label {
  font-weight: 500;
}

.form-inline input[type=number] {
  width: 100px;
  padding: 6px 8px;
  font-size: 14px;
}

.form-inline label.checkbox {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 10px;
  font-weight: 400;
}

/* ==========================
   EXPORTAR AÇÕES
========================== */
.export-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
}

.btn-export {
  padding: 8px 14px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  color: #fff;
}

.btn-export.css { background: #264de4; }
.btn-export.tailwind { background: #38bdf8; }
.btn-export.json { background: #10b981; }

/* ==========================
   ALERTAS E LOADING
========================== */
.alert {
  padding: 1rem 1.5rem;
  border-radius: 10px;
  margin-top: 1rem;
}

.alert-success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.alert-error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==========================
   RESPONSIVO
========================== */
@media (max-width: 768px) {
  .form-inline input[type=number] { width: 80px; }
  .form-inline { justify-content: flex-start; }
  .tool-header h1 { font-size: 2rem; }
}

.color-box {
  width: 15px;
  height: 15px;
  border: 1px solid #ccc;
}

/* Aumentar o slider de seleção de número de cores (dobrar tamanho) */
#colorSlider {
  width: 95%;
  height: 16px; /* track height doubled */
  -webkit-appearance: none;
  background: transparent;
  margin: 10px 20px 10px 10px; /* top right bottom left */
}

/* WebKit track */
#colorSlider::-webkit-slider-runnable-track {
  height: 16px;
  background: #e6e6e6;
  border-radius: 10px;
}

#colorSlider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 28px; /* thumb doubled */
  height: 28px;
  margin-top: -6px; /* center the thumb on the track */
  border-radius: 50%;
  background: #0077b6;
  border: 3px solid #ffffff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.18);
}

/* Firefox */
#colorSlider::-moz-range-track {
  height: 16px;
  background: #e6e6e6;
  border-radius: 10px;
}

#colorSlider::-moz-range-thumb {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #0077b6;
  border: 3px solid #ffffff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.18);
}

/* Focus styles */
#colorSlider:focus { outline: none; }
#colorSlider:focus::-webkit-slider-runnable-track { box-shadow: 0 0 0 3px rgba(0,119,182,0.12); }
#colorSlider:focus::-moz-range-track { box-shadow: 0 0 0 3px rgba(0,119,182,0.12); }

/* Make editor quality slider match palette slider styles */
#editorQuality {
  width: 95%;
  height: 16px;
  -webkit-appearance: none;
  background: transparent;
  margin: 10px 20px 10px 10px;
}
#editorQuality::-webkit-slider-runnable-track { height:16px; background:#e6e6e6; border-radius:10px; }
#editorQuality::-webkit-slider-thumb { -webkit-appearance:none; width:28px; height:28px; margin-top:-6px; border-radius:50%; background:#0077b6; border:3px solid #fff; box-shadow:0 2px 6px rgba(0,0,0,.18); }
#editorQuality::-moz-range-track { height:16px; background:#e6e6e6; border-radius:10px; }
#editorQuality::-moz-range-thumb { width:28px; height:28px; border-radius:50%; background:#0077b6; border:3px solid #fff; box-shadow:0 2px 6px rgba(0,0,0,.18); }
#editorQuality:focus { outline: none; }
#editorQuality:focus::-webkit-slider-runnable-track { box-shadow: 0 0 0 3px rgba(0,119,182,0.12); }
#editorQuality:focus::-moz-range-track { box-shadow: 0 0 0 3px rgba(0,119,182,0.12); }
