/* ========================================
   COMPONENTES REUTILIZÁVEIS - Mobile V2
   ======================================== */

/* ========================================
   BUTTONS
   ======================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  min-height: 48px; /* Touch-friendly */
  font-size: 16px;
  font-weight: 600;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  font-family: inherit;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: #1b1d4b;
  color: white;
}

.btn-primary:hover {
  background: #141636;
}

.btn-secondary {
  background: #764ba2;
  color: white;
}

.btn-secondary:hover {
  background: #5f3d85;
}

.btn-outline {
  background: transparent;
  border: 2px solid #667eea;
  color: #667eea;
}

.btn-outline:hover {
  background: #667eea;
  color: white;
}

.btn-danger {
  background: #f44336;
  color: white;
}

.btn-danger:hover {
  background: #d32f2f;
}

.btn-success {
  background: #4caf50;
  color: white;
}

.btn-success:hover {
  background: #388e3c;
}

.btn-block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ========================================
   FORM INPUTS
   ======================================== */

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #212121;
  margin-bottom: 8px;
}

.form-label.required::after {
  content: " *";
  color: #f44336;
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  font-size: 16px; /* 16px para evitar zoom no iOS */
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  background: white;
  font-family: inherit;
  transition: all 0.2s;
}

.form-control:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-control.is-invalid {
  border-color: #f44336;
}

.form-control.is-valid {
  border-color: #4caf50;
}

.form-control:disabled {
  background: #f5f5f5;
  cursor: not-allowed;
}

.form-select {
  width: 100%;
  padding: 12px 16px;
  font-size: 16px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  background: white;
  font-family: inherit;
  cursor: pointer;
}

.form-select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

textarea.form-control {
  min-height: 120px;
  resize: vertical;
}

.form-text {
  font-size: 12px;
  color: #757575;
  margin-top: 4px;
  display: block;
}

.invalid-feedback {
  display: none;
  font-size: 12px;
  color: #f44336;
  margin-top: 4px;
}

.form-control.is-invalid ~ .invalid-feedback {
  display: block;
}

.valid-feedback {
  display: none;
  font-size: 12px;
  color: #4caf50;
  margin-top: 4px;
}

.form-control.is-valid ~ .valid-feedback {
  display: block;
}

/* ========================================
   CHECKBOX E RADIO
   ======================================== */

.form-check {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  cursor: pointer;
  min-height: 48px;
}

.form-check-input {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  cursor: pointer;
  flex-shrink: 0;
}

.form-check-label {
  font-size: 16px;
  color: #212121;
  cursor: pointer;
  flex: 1;
}

/* ========================================
   ALERTS
   ======================================== */

.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.alert-success {
  background: #e8f5e9;
  color: #2e7d32;
  border-left: 4px solid #4caf50;
}

.alert-error,
.alert-danger {
  background: #ffebee;
  color: #c62828;
  border-left: 4px solid #f44336;
}

.alert-warning {
  background: #fff3e0;
  color: #e65100;
  border-left: 4px solid #ff9800;
}

.alert-info {
  background: #e3f2fd;
  color: #1565c0;
  border-left: 4px solid #2196f3;
}

/* ========================================
   BADGES
   ======================================== */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 12px;
  white-space: nowrap;
}

.badge-primary {
  background: #667eea;
  color: white;
}

.badge-success {
  background: #4caf50;
  color: white;
}

.badge-danger {
  background: #f44336;
  color: white;
}

.badge-warning {
  background: #ff9800;
  color: white;
}

.badge-secondary {
  background: #e0e0e0;
  color: #424242;
}

/* ========================================
   LOADING SPINNER
   ======================================== */

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

.spinner-primary {
  border-color: rgba(102, 126, 234, 0.3);
  border-top-color: #667eea;
}

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

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.loading-overlay .spinner {
  width: 48px;
  height: 48px;
  border-width: 4px;
}

/* ========================================
   CARDS
   ======================================== */

.card {
  background: white;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  margin-bottom: 16px;
}

.card-header {
  font-size: 18px;
  font-weight: 700;
  color: #212121;
  margin-bottom: 12px;
}

.card-body {
  font-size: 14px;
  color: #757575;
  line-height: 1.6;
}

.card-footer {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #e0e0e0;
}

/* ========================================
   TOAST NOTIFICATIONS
   ======================================== */

.toast-container {
  position: fixed;
  top: 80px;
  right: 16px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 90%;
}

.toast {
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 280px;
  animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.toast.toast-success {
  border-left: 4px solid #4caf50;
}

.toast.toast-error {
  border-left: 4px solid #f44336;
}

.toast.toast-warning {
  border-left: 4px solid #ff9800;
}

.toast-message {
  flex: 1;
  font-size: 14px;
  color: #212121;
}

.toast-close {
  background: none;
  border: none;
  color: #757575;
  cursor: pointer;
  padding: 4px;
  font-size: 20px;
  line-height: 1;
}

/* ========================================
   DIVIDER
   ======================================== */

.divider {
  height: 1px;
  background: #e0e0e0;
  margin: 24px 0;
}

.divider-text {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 24px 0;
}

.divider-text::before,
.divider-text::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #e0e0e0;
}

.divider-text span {
  padding: 0 16px;
  font-size: 14px;
  color: #757575;
}

/* ========================================
   EMPTY STATE
   ======================================== */

.empty-state {
  text-align: center;
  padding: 48px 24px;
}

.empty-state-icon {
  font-size: 64px;
  color: #e0e0e0;
  margin-bottom: 16px;
}

.empty-state-title {
  font-size: 18px;
  font-weight: 600;
  color: #212121;
  margin-bottom: 8px;
}

.empty-state-text {
  font-size: 14px;
  color: #757575;
  margin-bottom: 24px;
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.text-muted {
  color: #757575;
}

.text-primary {
  color: #667eea;
}

.text-danger {
  color: #f44336;
}

.text-success {
  color: #4caf50;
}

.d-none {
  display: none !important;
}

.d-block {
  display: block !important;
}

.d-flex {
  display: flex !important;
}

.mt-1 {
  margin-top: 8px;
}
.mt-2 {
  margin-top: 16px;
}
.mt-3 {
  margin-top: 24px;
}
.mt-4 {
  margin-top: 32px;
}

.mb-1 {
  margin-bottom: 8px;
}
.mb-2 {
  margin-bottom: 16px;
}
.mb-3 {
  margin-bottom: 24px;
}
.mb-4 {
  margin-bottom: 32px;
}

.p-1 {
  padding: 8px;
}
.p-2 {
  padding: 16px;
}
.p-3 {
  padding: 24px;
}
.p-4 {
  padding: 32px;
}

/* ========================================
   CEP LOOKUP - Feedback Visual
   ======================================== */

.cep-feedback {
  margin-top: 8px;
  font-size: 13px;
  min-height: 24px;
  transition: all 0.3s ease;
}

.cep-feedback.loading {
  color: #667eea;
}

.cep-feedback.success {
  color: #4caf50;
}

.cep-feedback.error {
  color: #f44336;
}

.cep-loading,
.cep-success,
.cep-error {
  display: flex;
  align-items: center;
  gap: 8px;
  animation: fadeIn 0.2s ease-out;
}

.cep-loading .spinner-border {
  width: 14px;
  height: 14px;
  border-width: 2px;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========================================
   CAMPOS AUTO-PREENCHIDOS
   ======================================== */

.form-control.auto-filled,
.form-select.auto-filled {
  background-color: #f0f4ff;
  border-color: #667eea;
  color: #424242;
}

.form-control.auto-filled:read-only,
.form-select.auto-filled:disabled {
  cursor: not-allowed;
  opacity: 0.8;
}

/* Ícone de info para campos auto-preenchidos */
.auto-filled-indicator {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #667eea;
  font-size: 14px;
  pointer-events: none;
}

/* ========================================
   DISCLAIMER (Apelido)
   ======================================== */

.field-disclaimer {
  display: block;
  font-size: 12px;
  color: #9e9e9e;
  margin-top: 4px;
  font-style: italic;
}

/* ========================================
   HIDDEN EMAIL FIELD
   ======================================== */

.hidden-field-info {
  background: #e3f2fd;
  border-left: 3px solid #2196f3;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13px;
  color: #1565c0;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.hidden-field-info svg {
  flex-shrink: 0;
}

/* ========================================
   ETAPA 3 - SUB-STEP INDICATOR
   ======================================== */

.sub-step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  background: #1b1d4b;
  color: white;
  border-radius: 8px;
  margin-bottom: 24px;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.current-substep {
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
}

.total-substeps {
  font-size: 14px;
  font-weight: 500;
  opacity: 0.95;
}

/* ========================================
   SECTION SUBTITLE
   ======================================== */

.section-subtitle {
  font-size: 16px;
  font-weight: 600;
  color: #424242;
  margin: 20px 0 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid #e0e0e0;
}

/* ========================================
   SKIP SECTION
   ======================================== */

.skip-section {
  text-align: center;
  padding: 24px 0;
  margin: 16px 0;
}

.skip-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #667eea;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 6px;
  transition: all 0.2s;
}

.skip-link:hover {
  background: rgba(102, 126, 234, 0.1);
  color: #5568d3;
}

.skip-link:active {
  transform: scale(0.98);
}

/* ========================================
   TEXTAREA COMPLEMENTARY
   ======================================== */

.textarea-complementary {
  min-height: 100px;
  resize: vertical;
  font-family: inherit;
  line-height: 1.5;
}

.textarea-complementary::placeholder {
  color: #9e9e9e;
  font-size: 14px;
}

/* ========================================
   INFO BOX (Step 3.3)
   ======================================== */

.info-box {
  display: flex;
  gap: 12px;
  padding: 16px;
  background: linear-gradient(135deg, #e8f5e9 0%, #f1f8e9 100%);
  border-left: 4px solid #4caf50;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.info-icon {
  flex-shrink: 0;
  color: #4caf50;
  margin-top: 2px;
}

.info-content {
  flex: 1;
}

.info-content strong {
  display: block;
  color: #2e7d32;
  font-size: 15px;
  margin-bottom: 4px;
}

.info-content p {
  margin: 0;
  color: #558b2f;
  font-size: 14px;
  line-height: 1.5;
}

/* ========================================
   BTN PAYMENT (destaque final)
   ======================================== */

.btn-payment {
  background: linear-gradient(135deg, #4caf50 0%, #388e3c 100%) !important;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.btn-payment:hover {
  filter: brightness(1.1);
  box-shadow: 0 6px 16px rgba(76, 175, 80, 0.4);
}

/* ========================================
   CHARACTER COUNTER
   ======================================== */

.character-counter {
  font-size: 12px;
  color: #757575;
  text-align: right;
  margin-top: 4px;
  transition: color 0.2s;
}

/* ========================================
   DIVIDER
   ======================================== */

.divider {
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    #e0e0e0 50%,
    transparent 100%
  );
  margin: 24px 0;
}

/* ========================================
   RESPONSIVE - Mobile
   ======================================== */

@media (max-width: 414px) {
  .cep-feedback {
    font-size: 12px;
  }

  .field-disclaimer {
    font-size: 11px;
  }

  .hidden-field-info {
    font-size: 12px;
    padding: 8px 10px;
  }

  .sub-step-indicator {
    padding: 10px 14px;
  }

  .current-substep {
    font-size: 20px;
  }

  .total-substeps {
    font-size: 13px;
  }

  .section-subtitle {
    font-size: 15px;
  }

  .info-box {
    padding: 12px;
    gap: 10px;
  }

  .info-content strong {
    font-size: 14px;
  }

  .info-content p {
    font-size: 13px;
  }
}

/* ========================================
   MOBILE ALERTS (Bootstrap 5 Dynamic Alerts)
   ======================================== */

/* Alertas dinâmicos criados via JavaScript */
.mobile-alert {
  animation: slideInDown 0.3s ease-out;
  margin-top: 12px !important;
  margin-bottom: 12px !important;
  font-size: 14px;
  line-height: 1.5;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Alertas dentro de form-group */
.form-group .mobile-alert {
  margin-top: 8px !important;
  margin-bottom: 8px !important;
}

/* Alertas no topo do formulário */
.mobile-form > .mobile-alert:first-child {
  margin-top: 0 !important;
  margin-bottom: 16px !important;
}

/* Animação de entrada */
@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Melhorias para botão de fechar */
.mobile-alert .btn-close {
  padding: 8px;
  background-size: 14px;
  opacity: 0.7;
}

.mobile-alert .btn-close:hover {
  opacity: 1;
}

/* Cores mais vibrantes para mobile */
.mobile-alert.alert-danger {
  background-color: #ffebee;
  color: #c62828;
  border-left: 4px solid #f44336;
}

.mobile-alert.alert-warning {
  background-color: #fff3e0;
  color: #e65100;
  border-left: 4px solid #ff9800;
}

.mobile-alert.alert-info {
  background-color: #e3f2fd;
  color: #1565c0;
  border-left: 4px solid #2196f3;
}

.mobile-alert.alert-success {
  background-color: #e8f5e9;
  color: #2e7d32;
  border-left: 4px solid #4caf50;
}

/* Layout flex para melhor alinhamento */
.mobile-alert .d-flex {
  gap: 8px;
}

.mobile-alert .flex-grow-1 {
  flex: 1;
}

/* Responsivo para telas muito pequenas */
@media (max-width: 360px) {
  .mobile-alert {
    font-size: 13px;
    padding: 10px 12px;
  }

  .mobile-alert .btn-close {
    padding: 6px;
    background-size: 12px;
  }
}

/* ========================================
   TEAM FORMATION COMPONENT
   ======================================== */

.team-formation-section {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 20px;
  margin: 20px 0;
}

.section-header h3 {
  font-size: 20px;
  font-weight: 700;
  color: #212121;
  margin-bottom: 8px;
}

.section-header .subtitle {
  font-size: 14px;
  color: #757575;
  margin-bottom: 20px;
}

.team-option {
  background: white;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  border: 2px solid #e0e0e0;
  transition: all 0.2s;
}

.team-option input[type="radio"] {
  display: none;
}

.team-option input[type="radio"]:checked + .team-label {
  border-left: 4px solid #667eea;
  padding-left: 12px;
}

.team-option input[type="radio"]:checked ~ .team-content {
  display: block;
}

.team-label {
  display: block;
  cursor: pointer;
  padding-left: 0;
  transition: all 0.2s;
}

.label-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.label-header .icon {
  font-size: 24px;
}

.label-header .title {
  font-size: 16px;
  font-weight: 600;
  color: #333;
}

.label-description {
  font-size: 14px;
  color: #666;
  margin: 0;
  padding-left: 36px;
}

.team-content {
  display: none;
  padding-top: 16px;
  margin-top: 16px;
  border-top: 1px solid #e0e0e0;
  animation: slideDown 0.3s ease;
}

.team-content.collapsed {
  display: none !important;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Mobile optimizations */
@media (max-width: 414px) {
  .team-formation-section {
    padding: 16px;
    margin: 16px 0;
  }

  .section-header h3 {
    font-size: 18px;
  }

  .label-description {
    font-size: 13px;
  }
}

/* ========================================
   CPF AUTOCOMPLETE - LOADING INDICATOR
   ======================================== */

.cpf-loading-indicator {
  display: none;
  align-items: center;
  margin-top: 8px;
  padding: 12px 16px;
  background: #e3f2fd;
  border-left: 4px solid #2196f3;
  border-radius: 8px;
  font-size: 14px;
  color: #1565c0;
  animation: fadeInUp 0.3s ease-out;
}

.cpf-loading-indicator .loading-text {
  font-weight: 500;
}

/* Animação do spinner Bootstrap */
.spinner-border-sm {
  width: 1rem;
  height: 1rem;
  border-width: 0.15em;
}

/* Campo CPF em estado de loading */
input.loading {
  background-color: #f5f5f5;
  cursor: wait;
  opacity: 0.7;
}

/* Animação de entrada */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Mobile */
@media (max-width: 414px) {
  .cpf-loading-indicator {
    padding: 10px 12px;
    font-size: 13px;
  }
}

/* ========================================
   CAMPOS VERIFICADOS vs MANUAIS
   ======================================== */

/* Campo verificado automaticamente (readonly, dados confiáveis) */
input.verified[readonly],
input.verified:read-only {
  background-color: #e8f5e9 !important;
  border-left: 4px solid #4caf50 !important;
  color: #1b5e20;
  font-weight: 500;
  cursor: not-allowed;
}

/* Campo manual (editável, dados não verificados) */
input.manual-input {
  background-color: #fff3e0 !important;
  border-left: 4px solid #ff9800 !important;
  animation: pulseOrange 2s ease-in-out;
}

input.manual-input:focus {
  background-color: #fff !important;
  border-left-color: #f57c00 !important;
  box-shadow: 0 0 0 0.2rem rgba(255, 152, 0, 0.25);
}

/* Animação sutil para chamar atenção */
@keyframes pulseOrange {
  0%,
  100% {
    border-left-color: #ff9800;
  }
  50% {
    border-left-color: #ffb74d;
  }
}

/* Texto de ajuda para campos manuais */
.field-help {
  font-size: 12px;
  color: #757575;
}

/* Mobile */
@media (max-width: 414px) {
  input.verified[readonly],
  input.manual-input {
    border-left-width: 3px !important;
  }
}
