/* Modal de Termos - Altura Otimizada */
.terms-modal {
  display: none !important; /* FORÇA O MODAL A FICAR OCULTO INICIALMENTE */
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  /* Centralização perfeita */
  align-items: center;
  justify-content: center;
}

.terms-modal-content {
  background-color: #ffffff;
  padding: 0;
  border-radius: 12px;
  width: 90%;
  max-width: 520px;
  /* ALTURA OTIMIZADA - Se ajusta ao conteúdo */
  max-height: 85vh;
  min-height: auto;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  animation: modalSlideIn 0.3s ease-out;
  display: flex;
  flex-direction: column;
  /* Remove margens automáticas já que usamos flexbox no pai */
  margin: 0;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.terms-modal-header {
  background: linear-gradient(135deg, #059669, #10b981);
  color: white;
  padding: 18px 20px;
  text-align: center;
  position: relative;
  /* Não cresce */
  flex-shrink: 0;
}

.terms-modal-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.terms-close-button {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
}

.terms-close-button:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.terms-modal-body {
  padding: 18px 20px;
  /* PERMITE SCROLL APENAS NO BODY SE NECESSÁRIO */
  overflow-y: auto;
  flex: 1;
  /* Altura mínima para não ficar muito pequeno */
  min-height: 200px;
}

.terms-content {
  margin-bottom: 15px;
}

.terms-content h3 {
  color: #059669;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
}

.terms-content p {
  color: #374151;
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 10px;
}

.terms-content ul {
  color: #374151;
  font-size: 14px;
  line-height: 1.6;
  margin-left: 20px;
  margin-bottom: 12px;
}

.terms-content li {
  margin-bottom: 6px;
}

.terms-warning {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border: 1px solid #f59e0b;
  border-radius: 8px;
  padding: 12px;
  margin: 12px 0;
}

.terms-warning p {
  color: #92400e;
  font-weight: 600;
  margin: 0;
  font-size: 13px;
}

.terms-agreement {
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  padding: 15px;
  margin: 12px 0;
}

.terms-checkbox-container {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 0;
}

.terms-checkbox {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  cursor: pointer;
  accent-color: #059669;
  flex-shrink: 0;
}

.terms-checkbox-label {
  color: #374151;
  font-size: 14px;
  line-height: 1.4;
  cursor: pointer;
  flex: 1;
}

.terms-checkbox-label strong {
  color: #1f2937;
  font-weight: 600;
}

.terms-modal-footer {
  padding: 18px 20px;
  border-top: 1px solid #e5e7eb;
  background: #f9fafb;
  /* Não cresce */
  flex-shrink: 0;
}

.terms-continue-button {
  background: linear-gradient(135deg, #059669, #10b981);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 14px 24px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
}

.terms-continue-button:hover:not(:disabled) {
  background: linear-gradient(135deg, #047857, #059669);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(5, 150, 105, 0.4);
}

.terms-continue-button:disabled {
  background: #9ca3af;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Seções de informação otimizadas */
.user-info-section {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 12px;
}

.user-info-section h3 {
  color: #059669;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 10px;
  text-align: center;
}

.user-info-section p {
  color: #374151;
  font-size: 13px;
  line-height: 1.4;
  margin-bottom: 6px;
}

.object-info-section {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 12px;
}

.object-info-section h3 {
  color: #0c4a6e;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 10px;
  text-align: center;
}

.object-status h4 {
  color: #1e40af;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
}

.object-status p {
  color: #0369a1;
  font-size: 12px;
  line-height: 1.4;
  margin-bottom: 10px;
}

.tax-info-modal {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
}

.tax-info-modal .tax-badge {
  background: #dc2626;
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tax-info-modal .tax-value {
  font-size: 14px;
  font-weight: 700;
  color: #dc2626;
  background: #fef2f2;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid #fecaca;
}

/* RESPONSIVIDADE OTIMIZADA */
@media (max-width: 768px) {
  .terms-modal-content {
    width: 92%;
    max-width: 450px;
    max-height: 90vh;
  }

  .terms-modal-header {
    padding: 16px 18px;
  }

  .terms-modal-header h2 {
    font-size: 17px;
  }

  .terms-modal-body {
    padding: 16px 18px;
    min-height: 180px;
  }

  .terms-modal-footer {
    padding: 16px 18px;
  }

  .terms-continue-button {
    padding: 12px 20px;
    font-size: 15px;
  }

  .user-info-section,
  .object-info-section {
    padding: 12px;
    margin-bottom: 10px;
  }

  .terms-agreement {
    padding: 12px;
    margin: 10px 0;
  }

  .terms-warning {
    padding: 10px;
    margin: 10px 0;
  }
}

@media (max-width: 480px) {
  .terms-modal-content {
    width: 96%;
    max-width: 380px;
    max-height: 92vh;
  }

  .terms-modal-header {
    padding: 14px 16px;
  }

  .terms-modal-header h2 {
    font-size: 16px;
  }

  .terms-modal-body {
    padding: 14px 16px;
    min-height: 160px;
  }

  .terms-modal-footer {
    padding: 14px 16px;
  }

  .terms-continue-button {
    padding: 12px 18px;
    font-size: 14px;
  }

  .user-info-section,
  .object-info-section {
    padding: 10px;
    margin-bottom: 8px;
  }

  .terms-agreement {
    padding: 10px;
    margin: 8px 0;
  }

  .terms-warning {
    padding: 8px;
    margin: 8px 0;
  }

  .terms-close-button {
    right: 12px;
    width: 28px;
    height: 28px;
    font-size: 20px;
  }
}
