:root {
  --background-color: #0a0b08;
  --surface-color: #1a1a1a;
  --primary-color: #edd636;
  --text-primary: #ffffff;
  --text-secondary: #aaaaaa;
  --text-hint: #6c6c6c;
  --border-color: #333333;
  --error-color: #d32f2f;
  --success-color: #16a34a;
  --warning-color: #f59e0b;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background-color: var(--background-color);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  margin: 0;
  padding: 20px;
  display: flex;
  justify-content: center;
}

.container { background-color: var(--background-color); width: 100%; max-width: 600px; }
h1 { color: var(--text-primary); text-align: center; font-weight: bold; font-size: 1.8em; margin-bottom: 2.5rem; }
h2 { color: var(--primary-color); text-transform: uppercase; font-size: 0.9em; font-weight: bold; letter-spacing: 1.2px; margin-top: 2rem; margin-bottom: 1.5rem; padding-bottom: 8px; border-bottom: 1px solid var(--border-color); }

.form-step { display: none; animation: fadeIn 0.5s; }
.form-step.active { display: block; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.form-group { margin-bottom: 20px; }
label { display: block; margin-bottom: 8px; font-size: 0.9em; color: var(--text-secondary); }
.hint { color: var(--text-hint); font-size: 0.8em; margin-top: 5px; display: block; }

input, select, textarea {
  width: 100%;
  padding: 14px;
  background-color: var(--surface-color);
  border: 1px solid var(--surface-color);
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 1em;
  box-sizing: border-box;
  transition: border-color 0.3s;
}

input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary-color); }
input.invalid, select.invalid, textarea.invalid { border: 1px solid var(--error-color); }

/* Estilos específicos para o campo CEP */
#cep {
  transition: all 0.3s ease;
}

#cep:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(237, 214, 54, 0.2);
}

/* Indicadores visuais para o ViaCEP */
#cep[style*="border-color: #007bff"] {
  border-color: #007bff !important;
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.2);
}

#cep[style*="border-color: #28a745"] {
  border-color: #28a745 !important;
  box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.2);
}

#cep[style*="border-color: #dc3545"] {
  border-color: #dc3545 !important;
  box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.2);
}
input[type="file"] { color: var(--text-hint); padding: 10px; }

select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a0a0a0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 1em;
  padding-right: 2.5rem;
}

.btns-group { display: flex; gap: 1rem; margin-top: 2.5rem; }
.btn { flex: 1; padding: 16px; border: none; border-radius: 12px; font-size: 1em; font-weight: bold; cursor: pointer; transition: background-color 0.3s; }
.btn-prev { background-color: #333; color: var(--text-secondary); }
.btn-next, .btn-submit { background-color: var(--primary-color); color: var(--background-color); }
.btn:disabled { background-color: #222; color: #555; cursor: not-allowed; }

.progress-bar { display: flex; justify-content: space-between; position: relative; margin-bottom: 4rem; }
.progress-bar::before { content: ''; position: absolute; top: 50%; left: 0; transform: translateY(-50%); height: 4px; width: 100%; background-color: var(--surface-color); z-index: 1; }
.progress { position: absolute; top: 50%; left: 0; transform: translateY(-50%); height: 4px; width: 0%; background-color: var(--primary-color); z-index: 2; transition: width 0.4s ease; }
.progress-step { width: 30px; height: 30px; background-color: var(--surface-color); border-radius: 50%; display: flex; justify-content: center; align-items: center; border: 3px solid var(--surface-color); z-index: 3; transition: all 0.4s ease; color: var(--text-secondary); }
.progress-step.active { border-color: var(--primary-color); color: var(--text-primary); }
.progress-step::after { content: attr(data-title); position: absolute; top: 120%; font-size: 0.8rem; color: var(--text-secondary); }

.terms-acceptance { display: flex; align-items: flex-start; gap: 10px; margin-top: 20px; }
.terms-acceptance input[type="checkbox"] { width: auto; margin-top: 5px; flex-shrink: 0; }
.terms-acceptance label { flex: 1; margin: 0; line-height: 1.5; color: var(--text-secondary); }
.terms-acceptance a { color: var(--primary-color); text-decoration: underline; font-weight: bold; }
.btn-submit { display: none; }

#camera-container {
  position: relative;
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
  padding: 15px;
  background-color: var(--surface-color);
  border-radius: 12px;
  transition: border 0.3s ease;
}
#camera-preview {
  width: 100%;
  height: auto;
  border-radius: 8px;
  max-height: 400px;
  object-fit: cover;
}
#capture-btn {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--primary-color);
  color: var(--background-color);
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
}
#start-camera-btn { width: 100%; margin-bottom: 10px; }

/* ===== Modais ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(2px);
  z-index: 1000;
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 1001;
}
.modal[hidden],
.modal-overlay[hidden] { display: none; }

.modal-content {
  width: min(520px, 92%);
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 24px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0,0,0,.4);
}

.modal-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 12px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 28px;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 4px solid #222;
  border-top-color: var(--primary-color);
  border-radius: 50%;
  margin: 16px auto 0;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.modal-actions { display: flex; gap: 10px; justify-content: center; margin-top: 18px; }
.btn-modal { flex: 0 0 auto; padding: 10px 16px; border-radius: 10px; background: var(--primary-color); color: var(--background-color); }

/* States */
.modal--loading .modal-icon { background: #222; }
.modal--success .modal-icon { background: rgba(22,163,74,.15); color: var(--success-color); }
.modal--error .modal-icon { background: rgba(211,47,47,.15); color: var(--error-color); }
