/* =========================================================
   IMPORTAÇÃO DA FONTE CUSTOMIZADA
   ========================================================= */
@font-face {
  font-family: "RB Campton Neue";
  src: url("RBCamptonNeue-Bold.ttf") format("truetype");
  font-weight: bold;
  font-style: normal;
}

:root {
  --green: #115c40;
  --light-green: #e2f0e9;
  --yellow: #f8c100;
  --gray-border: #cbd5e1;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background-image: url("background.jpg");
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  color: #333;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0;
  padding: 20px;
  min-height: 100vh;
}

/* Animação do Título */
.header-container {
  text-align: center;
  margin-bottom: 30px;
  position: relative;
  overflow: hidden;
  padding: 10px 40px;
  width: 100%;
  max-width: 900px;
}

h1 {
  font-family: "RB Campton Neue", "Arial Black", Impact, sans-serif;
  color: var(--green);
  margin: 0;
  position: relative;
  z-index: 2;
  font-size: 2.5rem;
  text-shadow:
    1px 1px 0px white,
    -1px -1px 0px white,
    1px -1px 0px white,
    -1px 1px 0px white;
}

.bola {
  position: absolute;
  font-size: 2rem;
  top: 10px;
  left: -50px;
  animation: rolarBola 4s linear infinite;
  z-index: 1;
}

@keyframes rolarBola {
  0% { transform: translateX(0) rotate(0deg); }
  100% { transform: translateX(120vw) rotate(1080deg); }
}

/* Layout Principal */
.main-container {
  display: flex;
  flex-direction: column;
  gap: 30px;
  width: 100%;
  max-width: 900px;
  align-items: center;
  z-index: 2;
}

.left-panel {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.right-panel {
  width: 100%;
  max-width: 400px;
  display: flex;
  justify-content: center;
}

@media (min-width: 768px) {
  .main-container {
    flex-direction: row;
    align-items: flex-start;
    justify-content: center;
  }
}

/* Controles do Formulário */
.controls {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 30px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

label {
  font-weight: 600;
  font-size: 0.85rem;
  color: #475569;
  margin-bottom: 6px;
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

input[type="text"],
select {
  padding: 12px 16px;
  border: 2px solid var(--gray-border);
  border-radius: 8px;
  width: 100%;
  box-sizing: border-box;
  font-family: inherit;
  font-size: 1rem;
  background: #f8fafc;
  color: #1e293b;
  transition: all 0.3s ease;
}

input[type="text"]:focus,
select:focus {
  outline: none;
  border-color: var(--green);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(17, 92, 64, 0.1);
}

input[type="file"] {
  padding: 10px;
  border: 2px dashed var(--gray-border);
  border-radius: 8px;
  width: 100%;
  box-sizing: border-box;
  background: #f8fafc;
  cursor: pointer;
  transition: all 0.3s ease;
  color: #64748b;
  font-size: 0.9rem;
}

input[type="file"]:hover {
  border-color: var(--green);
  background: #f1f5f9;
}

input[type="file"]::file-selector-button {
  background: var(--light-green);
  color: var(--green);
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  margin-right: 15px;
  transition: background 0.2s;
}

input[type="file"]::file-selector-button:hover {
  background: #cce3d6;
}

input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  background: transparent;
}

input[type="range"]:focus {
  outline: none;
}

input[type="range"]::-webkit-slider-runnable-track {
  width: 100%;
  height: 6px;
  cursor: pointer;
  background: #cbd5e1;
  border-radius: 4px;
}

input[type="range"]::-webkit-slider-thumb {
  height: 20px;
  width: 20px;
  border-radius: 50%;
  background: var(--green);
  cursor: pointer;
  -webkit-appearance: none;
  margin-top: -7px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  transition: transform 0.1s;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  background: var(--yellow);
}

/* Área de Preview Principal */
.preview-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  touch-action: none;
  border: 3px solid var(--green);
}

.photo-mask {
  position: absolute;
  top: var(--mask-top);
  left: var(--mask-left);
  width: var(--mask-width);
  height: var(--mask-height);
  border-radius: var(--mask-radius-css);
  overflow: hidden;
  z-index: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #f0f0f0;
}

.user-photo {
  position: absolute;
  top: 50%;
  left: 50%;
  cursor: grab;
  transform-origin: center;
  max-width: none;
}

.template-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  z-index: 10;
  pointer-events: none;
}

/* Texto no Preview */
.nome-display {
  position: absolute;
  bottom: 12.5%;
  left: 52%;
  transform: translateX(-50%);
  width: 52%;
  text-align: center;
  font-size: 1.05rem;
  font-weight: 900;
  color: #004c3f;
  text-transform: uppercase;
  font-family: "RB Campton Neue", "Arial Black", Impact, sans-serif;
  letter-spacing: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
  z-index: 20;
  pointer-events: none;
}

/* Botões Inferiores */
.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  width: 100%;
}

button {
  flex: 1;
  min-width: 120px;
  padding: 16px;
  border: none;
  border-radius: 10px;
  font-size: 1.05rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

button:active {
  transform: scale(0.96);
}

.btn-download {
  background: var(--green);
  color: white;
}

.btn-download:hover {
  background: #0d4631;
  box-shadow: 0 6px 12px rgba(17, 92, 64, 0.3);
}

.btn-print {
  background: var(--yellow);
  color: var(--green);
}

.btn-print:hover {
  background: #e5b300;
  box-shadow: 0 6px 12px rgba(248, 193, 0, 0.3);
}

.btn-share {
  background: #2563eb;
  color: white;
}

.btn-share:hover {
  background: #1d4ed8;
  box-shadow: 0 6px 12px rgba(37, 99, 235, 0.3);
}

/* Footer */
footer {
  margin-top: 40px;
  font-size: 0.95rem;
  color: black;
  text-align: center;
  width: 100%;
  z-index: 2;
}

footer a {
  color: black;
  text-decoration: none;
  font-weight: bold;
}

footer a:hover {
  text-decoration: underline;
}

/* Canvas escondido */
#renderCanvas {
  display: none;
}