/* Reset e configurações básicas */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  min-height: 100vh;
  color: #212529;
  line-height: 1.6;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

[data-theme="dark"] body {
  background: linear-gradient(135deg, #1d1d1f 0%, #2d2d30 100%);
  color: #f5f5f7;
}

/* Layout principal */
.page-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  width: 100%;
  position: relative;
}

.cadastro-page {
  width: 100%;
  max-width: 1000px;
  background: white;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
  padding: 40px;
  position: relative;
  overflow: hidden;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

[data-theme="dark"] .cadastro-page {
  background: #2d2d30;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.cadastro-page::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #000, #333, #000);
}

[data-theme="dark"] .cadastro-page::before {
  background: linear-gradient(90deg, #f5f5f7, #86868b, #f5f5f7);
}

/* Header */
.cadastro-header {
  text-align: center;
  margin-bottom: 40px;
  position: relative;
}

.cadastro-header::before {
  content: '';
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 4px;
  background: linear-gradient(90deg, #000, #333);
  border-radius: 2px;
}

[data-theme="dark"] .cadastro-header::before {
  background: linear-gradient(90deg, #f5f5f7, #86868b);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #6c757d;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 20px;
  padding: 8px 16px;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.back-link:hover {
  color: #212529;
  background: #f8f9fa;
}

[data-theme="dark"] .back-link {
  color: #86868b;
}

[data-theme="dark"] .back-link:hover {
  color: #f5f5f7;
  background: #3d3d42;
}

.back-link i {
  width: 16px;
  height: 16px;
}

.cadastro-title {
  font-size: 32px;
  font-weight: 700;
  margin: 0 0 12px;
  color: #212529;
  background: linear-gradient(135deg, #212529, #000);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}

[data-theme="dark"] .cadastro-title {
  background: linear-gradient(135deg, #f5f5f7, #ffffff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.cadastro-subtitle {
  color: #6c757d;
  font-size: 16px;
  margin: 0;
  font-weight: 400;
  line-height: 1.4;
}

[data-theme="dark"] .cadastro-subtitle {
  color: #86868b;
}

/* Formulário */
.form-container {
  width: 100%;
}

#cadastro-form {
  width: 100%;
}

/* Indicador de etapas */
.step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 40px;
  padding: 20px 0;
}

.step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  opacity: 0.5;
  transition: all 0.3s ease;
}

.step-item.active {
  opacity: 1;
}

.step-number {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #dee2e6;
  color: #6c757d;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  transition: all 0.3s ease;
}

.step-item.active .step-number {
  background: linear-gradient(135deg, #000, #333);
  color: white;
}

[data-theme="dark"] .step-item.active .step-number {
  background: linear-gradient(135deg, #f5f5f7, #ffffff);
  color: #1d1d1f;
}

.step-label {
  font-size: 13px;
  font-weight: 600;
  color: #6c757d;
  text-align: center;
  white-space: nowrap;
}

.step-item.active .step-label {
  color: #212529;
}

[data-theme="dark"] .step-item.active .step-label {
  color: #f5f5f7;
}

.step-line {
  flex: 1;
  height: 2px;
  background: #dee2e6;
  max-width: 100px;
  margin: 0 8px;
}

[data-theme="dark"] .step-line {
  background: #4d4d52;
}

/* Etapas do formulário */
.form-step {
  display: none;
}

.form-step.active {
  display: block;
  animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateX(10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Grid orgânico */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin-bottom: 32px;
  align-items: start;
}

/* Etapa 1: layout responsivo */
/* Em telas médias (768px-1023px): 2 colunas */
@media (min-width: 768px) and (max-width: 1023px) {
  #step-1 .form-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Em telas grandes (>= 1024px): 3 colunas com posições fixas */
@media (min-width: 1024px) {
  #step-1 .form-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  /* Garantir que Gênero fique abaixo de Senha e ao lado de Telefone */
  /* Layout: Linha 1: Nome(1) | Email(2) | Senha(3) */
  /*         Linha 2: Cargo(4) | Telefone(5) | Gênero(6) */
  #step-1 .form-grid > .form-group:nth-child(1) {
    /* Nome - linha 1, coluna 1 */
    grid-row: 1;
    grid-column: 1;
  }

  #step-1 .form-grid > .form-group:nth-child(2) {
    /* Email - linha 1, coluna 2 */
    grid-row: 1;
    grid-column: 2;
  }

  #step-1 .form-grid > .form-group:nth-child(3) {
    /* Senha - linha 1, coluna 3 */
    grid-row: 1;
    grid-column: 3;
  }

  #step-1 .form-grid > .form-group:nth-child(4) {
    /* Cargo - linha 2, coluna 1 */
    grid-row: 2;
    grid-column: 1;
  }

  #step-1 .form-grid > .form-group:nth-child(5) {
    /* Telefone - linha 2, coluna 2 */
    grid-row: 2;
    grid-column: 2;
  }

  #step-1 .form-grid > .form-group:nth-child(6) {
    /* Gênero - linha 2, coluna 3 (abaixo de Senha, ao lado de Telefone) */
    grid-row: 2;
    grid-column: 3;
  }
}

@media (min-width: 1024px) {
  .form-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
  }
}

/* Form groups */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
  position: relative;
}

.form-label {
  font-weight: 600;
  color: #212529;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

[data-theme="dark"] .form-label {
  color: #f5f5f7;
}

.form-label i {
  width: 18px;
  height: 18px;
  color: #000;
  opacity: 0.8;
}

[data-theme="dark"] .form-label i {
  color: #f5f5f7;
  opacity: 0.8;
}

.form-label .required {
  color: #dc3545;
  font-size: 18px;
  font-weight: 700;
}

.form-input {
  padding: 16px 20px;
  border: 2px solid #dee2e6;
  border-radius: 12px;
  font-size: 16px;
  background: white;
  color: #212529;
  transition: all 0.3s ease;
  font-family: inherit;
}

/* Campo date completamente vazio quando não preenchido */
.form-input[type="date"] {
  position: relative;
}

.form-input[type="date"]:invalid {
  color: transparent !important;
}

/* Remove completamente o placeholder do input date */
.form-input[type="date"]::-webkit-calendar-picker-indicator {
  opacity: 1;
  cursor: pointer;
  position: absolute;
  right: 12px;
  width: 20px;
  height: 20px;
}

.form-input[type="date"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.form-input[type="date"]::-webkit-datetime-edit-text {
  padding: 0;
}

/* Remove completamente qualquer texto quando vazio */
.form-input[type="date"]:invalid::-webkit-datetime-edit {
  color: transparent !important;
}

.form-input[type="date"]:invalid::-webkit-datetime-edit-text {
  color: transparent !important;
}

.form-input[type="date"]:invalid::-webkit-datetime-edit-month-field {
  color: transparent !important;
}

.form-input[type="date"]:invalid::-webkit-datetime-edit-day-field {
  color: transparent !important;
}

.form-input[type="date"]:invalid::-webkit-datetime-edit-year-field {
  color: transparent !important;
}

.form-input[type="date"]:invalid {
  color: transparent !important;
}

/* Mostra o texto quando tem valor ou está em foco */
.form-input[type="date"]:focus::-webkit-datetime-edit,
.form-input[type="date"]:not(:invalid)::-webkit-datetime-edit,
.form-input[type="date"]:not(:invalid) {
  color: #212529 !important;
}

.form-input[type="date"]:focus::-webkit-datetime-edit-text,
.form-input[type="date"]:not(:invalid)::-webkit-datetime-edit-text {
  color: #212529 !important;
}

.form-input[type="date"]:focus::-webkit-datetime-edit-month-field,
.form-input[type="date"]:not(:invalid)::-webkit-datetime-edit-month-field {
  color: #212529 !important;
}

.form-input[type="date"]:focus::-webkit-datetime-edit-day-field,
.form-input[type="date"]:not(:invalid)::-webkit-datetime-edit-day-field {
  color: #212529 !important;
}

.form-input[type="date"]:focus::-webkit-datetime-edit-year-field,
.form-input[type="date"]:not(:invalid)::-webkit-datetime-edit-year-field {
  color: #212529 !important;
}

[data-theme="dark"] .form-input[type="date"]:focus::-webkit-datetime-edit,
[data-theme="dark"] .form-input[type="date"]:not(:invalid)::-webkit-datetime-edit,
[data-theme="dark"] .form-input[type="date"]:not(:invalid) {
  color: #f5f5f7 !important;
}

[data-theme="dark"] .form-input[type="date"]:focus::-webkit-datetime-edit-text,
[data-theme="dark"] .form-input[type="date"]:not(:invalid)::-webkit-datetime-edit-text {
  color: #f5f5f7 !important;
}

[data-theme="dark"] .form-input[type="date"]:focus::-webkit-datetime-edit-month-field,
[data-theme="dark"] .form-input[type="date"]:not(:invalid)::-webkit-datetime-edit-month-field {
  color: #f5f5f7 !important;
}

[data-theme="dark"] .form-input[type="date"]:focus::-webkit-datetime-edit-day-field,
[data-theme="dark"] .form-input[type="date"]:not(:invalid)::-webkit-datetime-edit-day-field {
  color: #f5f5f7 !important;
}

[data-theme="dark"] .form-input[type="date"]:focus::-webkit-datetime-edit-year-field,
[data-theme="dark"] .form-input[type="date"]:not(:invalid)::-webkit-datetime-edit-year-field {
  color: #f5f5f7 !important;
}

/* Firefox */
.form-input[type="date"] {
  color-scheme: light;
}

[data-theme="dark"] .form-input[type="date"] {
  color-scheme: dark;
}

[data-theme="dark"] .form-input {
  background: #3d3d42;
  border-color: #4d4d52;
  color: #f5f5f7;
}

.form-input:focus {
  outline: none;
  border-color: #000;
  box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

[data-theme="dark"] .form-input:focus {
  border-color: #f5f5f7;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.1);
}

.form-input:hover {
  border-color: #999;
}

.form-input::placeholder {
  color: #6c757d;
  opacity: 0.7;
}

[data-theme="dark"] .form-input::placeholder {
  color: #86868b;
  opacity: 0.7;
}

.form-input.error {
  border-color: #dc3545;
  box-shadow: 0 0 0 4px rgba(220, 53, 69, 0.1);
}

.form-input.valid {
  border-color: #28a745;
  box-shadow: 0 0 0 4px rgba(40, 167, 69, 0.1);
}

.form-help {
  font-size: 13px;
  color: #6c757d;
  margin-top: 6px;
  font-style: italic;
  opacity: 0.8;
}

[data-theme="dark"] .form-help {
  color: #86868b;
}

/* Ações */
.step-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid #dee2e6;
}

/* Botão único na etapa 1 */
#step-1 .step-actions .btn-next {
  width: 100%;
}

/* Botões lado a lado na etapa 2 */
#step-2 .step-actions {
  display: flex;
  flex-direction: row;
}

#step-2 .step-actions .btn-prev {
  flex: 0 0 auto;
  min-width: 120px;
  width: auto;
}

#step-2 .step-actions .btn-cadastrar {
  flex: 1;
  min-width: 200px;
  margin-bottom: 0;
  width: auto;
}

#step-2 .step-actions .btn-next {
  width: auto;
  flex: 1;
}

[data-theme="dark"] .step-actions {
  border-top-color: #4d4d52;
}

.btn-next {
  width: 100%;
  padding: 18px 32px;
  border: none;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: inherit;
  background: linear-gradient(135deg, #000, #333);
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  position: relative;
  overflow: hidden;
}

[data-theme="dark"] .btn-next {
  background: linear-gradient(135deg, #f5f5f7, #ffffff);
  color: #1d1d1f;
}

.btn-next::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s ease;
}

[data-theme="dark"] .btn-next::before {
  background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.2), transparent);
}

.btn-next:hover::before {
  left: 100%;
}

.btn-next:hover {
  background: linear-gradient(135deg, #333, #000);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] .btn-next:hover {
  background: linear-gradient(135deg, #ffffff, #f5f5f7);
}

.btn-next:active {
  transform: translateY(0);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.btn-prev {
  padding: 18px 32px;
  border: 2px solid #dee2e6;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: inherit;
  background: white;
  color: #212529;
}

[data-theme="dark"] .btn-prev {
  background: #3d3d42;
  border-color: #4d4d52;
  color: #f5f5f7;
}

.btn-prev:hover {
  background: #f8f9fa;
  border-color: #999;
}

[data-theme="dark"] .btn-prev:hover {
  background: #4d4d52;
  border-color: #86868b;
}

/* Botão cadastrar */
.btn-cadastrar {
  width: 100%;
  padding: 18px 32px;
  background: linear-gradient(135deg, #000, #333);
  color: white;
  border: none;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  position: relative;
  overflow: hidden;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 24px;
}

[data-theme="dark"] .btn-cadastrar {
  background: linear-gradient(135deg, #f5f5f7, #ffffff);
  color: #1d1d1f;
}

.btn-cadastrar::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s ease;
}

[data-theme="dark"] .btn-cadastrar::before {
  background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.2), transparent);
}

.btn-cadastrar:hover::before {
  left: 100%;
}

.btn-cadastrar:hover {
  background: linear-gradient(135deg, #333, #000);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] .btn-cadastrar:hover {
  background: linear-gradient(135deg, #ffffff, #f5f5f7);
}

.btn-cadastrar:active {
  transform: translateY(0);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.btn-cadastrar.loading {
  pointer-events: none;
  opacity: 0.7;
}

.btn-cadastrar.loading::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border: 2px solid transparent;
  border-top: 2px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

[data-theme="dark"] .btn-cadastrar.loading::after {
  border-top: 2px solid #1d1d1f;
}

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

/* Mensagens */
.mensagem {
  padding: 20px 24px;
  border-radius: 12px;
  margin-bottom: 32px;
  text-align: center;
  font-weight: 600;
  font-size: 15px;
  position: relative;
  border-left: 4px solid;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.mensagem.sucesso {
  background: linear-gradient(135deg, #d4edda, #c3e6cb);
  color: #155724;
  border-left-color: #28a745;
}

.mensagem.erro {
  background: linear-gradient(135deg, #f8d7da, #f5c6cb);
  color: #721c24;
  border-left-color: #dc3545;
}

.mensagem i {
  width: 20px;
  height: 20px;
  margin-right: 8px;
  vertical-align: middle;
}

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

.cadastro-page {
  animation: fadeInUp 0.6s ease-out;
}

.form-group {
  animation: fadeInUp 0.6s ease-out;
  animation-fill-mode: both;
}

.form-group:nth-child(1) { animation-delay: 0.1s; }
.form-group:nth-child(2) { animation-delay: 0.2s; }
.form-group:nth-child(3) { animation-delay: 0.3s; }
.form-group:nth-child(4) { animation-delay: 0.4s; }

.btn-cadastrar {
  animation: fadeInUp 0.6s ease-out 0.5s both;
}

/* Responsividade */
@media (max-width: 1024px) {
  .cadastro-page {
    padding: 36px 28px;
    max-width: 95%;
  }
  
  .form-grid {
    grid-template-columns: 1fr 1fr;
    gap: 20px;
  }
  
  #step-1 .form-grid > .form-group:nth-child(n) {
    grid-row: auto;
    grid-column: auto;
  }
}

@media (max-width: 768px) {
  .page-wrapper {
    padding: 16px;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .cadastro-page {
    padding: 32px 24px;
    border-radius: 16px;
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
  }
  
  .cadastro-header {
    margin-bottom: 32px;
  }
  
  .cadastro-title {
    font-size: 28px;
  }
  
  .cadastro-subtitle {
    font-size: 15px;
  }
  
  .form-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  /* Resetar posições fixas do grid em telas pequenas */
  #step-1 .form-grid > .form-group:nth-child(n) {
    grid-row: auto;
    grid-column: auto;
  }
  
  .step-indicator {
    padding: 12px 0;
    gap: 8px;
    margin-bottom: 32px;
  }
  
  .step-number {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }
  
  .step-label {
    font-size: 11px;
  }
  
  .step-line {
    max-width: 40px;
  }
  
  .form-group {
    margin-bottom: 20px;
  }
  
  .form-label {
    font-size: 14px;
  }
  
  .form-input {
    padding: 14px 16px;
    font-size: 15px;
  }
  
  .btn-next, .btn-prev, .btn-cadastrar {
    padding: 16px 24px;
    font-size: 15px;
  }
  
  .step-actions {
    flex-direction: column;
    gap: 12px;
    margin-top: 32px;
    padding-top: 24px;
  }
  
  .step-actions .btn-cadastrar {
    width: 100%;
    min-width: auto;
    margin-bottom: 0;
  }
  
  .step-actions .btn-prev {
    width: 100%;
    min-width: auto;
  }
  
  .back-link {
    padding: 6px 12px;
    font-size: 13px;
  }
}

@media (max-width: 480px) {
  .page-wrapper {
    padding: 12px;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .cadastro-page {
    padding: 24px 20px;
    border-radius: 12px;
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
  }
  
  .cadastro-header {
    margin-bottom: 24px;
  }
  
  .cadastro-header::before {
    width: 50px;
    height: 3px;
  }
  
  .back-link {
    padding: 6px 10px;
    font-size: 12px;
    margin-bottom: 16px;
  }
  
  .cadastro-title {
    font-size: 24px;
  }
  
  .cadastro-subtitle {
    font-size: 14px;
  }
  
  .form-group {
    margin-bottom: 18px;
  }
  
  .form-label {
    font-size: 13px;
    margin-bottom: 6px;
  }
  
  .form-label i {
    width: 16px;
    height: 16px;
  }
  
  .form-input {
    padding: 12px 14px;
    font-size: 14px;
    border-radius: 10px;
  }
  
  .form-help {
    font-size: 12px;
  }
  
  .form-grid {
    gap: 16px;
  }
  
  .step-indicator {
    padding: 8px 0;
    gap: 6px;
    margin-bottom: 24px;
  }
  
  .step-number {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }
  
  .step-label {
    font-size: 10px;
  }
  
  .step-line {
    max-width: 30px;
    margin: 0 4px;
  }
  
  .btn-next, .btn-prev, .btn-cadastrar {
    padding: 14px 20px;
    font-size: 14px;
    border-radius: 12px;
  }
  
  .step-actions {
    margin-top: 24px;
    padding-top: 20px;
    gap: 10px;
  }
  
  .mensagem {
    padding: 16px 20px;
    font-size: 14px;
  }
}
