/* ====================== */
/* MODAL NUEVO CLIENTE    */
/* ====================== */

.modal-container {
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  background: white;
  border-radius: 15px;
  box-shadow: var(--sombra);
  animation: fadeIn 0.25s ease-out;
}

/* ====================== */
/* CABECERA DEL MODAL     */
/* ====================== */

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 15px 18px;
  background-color: var(--color-primario);
  color: white;
  border-radius: 15px 15px 0 0;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.15em;
  color: white;
}

.cerrar-modal {
  background: none;
  border: none;
  color: white;
  font-size: 1.8em;
  line-height: 1;
  cursor: pointer;
  padding: 0 5px;
  border-radius: 6px;
}

.cerrar-modal:hover {
  opacity: 0.85;
}

.cerrar-modal:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.7);
  outline-offset: 2px;
}

/* ====================== */
/* FORMULARIO CLIENTE     */
/* ====================== */

#formNuevoCliente {
  padding: 20px;
}

#formNuevoCliente .form-group {
  margin-bottom: 15px;
}

#formNuevoCliente label {
  display: block;
  margin-bottom: 5px;
  font-weight: bold;
  color: var(--color-texto-claro);
  font-size: 0.9em;
}

#formNuevoCliente input,
#formNuevoCliente select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--color-borde);
  border-radius: var(--radio-borde);
  font-size: 0.95em;
  background: white;
}

#formNuevoCliente input:focus,
#formNuevoCliente select:focus {
  outline: 2px solid rgba(0, 170, 170, 0.2);
  border-color: var(--color-primario);
}

#formNuevoCliente small.error-message {
  display: block;
  margin-top: 4px;
  font-size: 0.82em;
  color: var(--color-error);
}

/* ====================== */
/* BOTONES DEL MODAL      */
/* ====================== */

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid var(--color-borde);
}

.btn-guardar {
  background-color: var(--color-secundario);
  color: white;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radio-borde);
  cursor: pointer;
  font-weight: bold;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.btn-cancelar:hover,
.btn-guardar:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

/* ====================== */
/* ANIMACIONES            */
/* ====================== */

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

@keyframes fadeInError {
  from {
    opacity: 0;
    transform: translate(-50%, -20px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

@keyframes fadeOutError {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@keyframes fadeInSuccess {
  from {
    opacity: 0;
    transform: translate(-50%, -20px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

#modal-error-container {
  animation: fadeInError 0.3s ease-out forwards;
}

#modal-error-container.fade-out {
  animation: fadeOutError 0.3s ease-out forwards;
}

#modal-success-container {
  animation: fadeInSuccess 0.3s ease-out forwards;
}

/* Si tu JS añade fade-out al overlay */
.modal-overlay.fade-out {
  opacity: 0;
  transition: opacity 0.25s ease;
}

/* ====================== */
/* RESPONSIVE             */
/* ====================== */

@media (max-width: 600px) {
  .modal-overlay {
    padding: 12px;
  }

  .modal-container {
    width: 100%;
    max-width: 100%;
    border-radius: 12px;
  }

  .modal-header {
    border-radius: 12px 12px 0 0;
    padding: 14px 16px;
  }

  #formNuevoCliente {
    padding: 16px;
  }

  .modal-actions {
    flex-direction: column;
  }

  .btn-cancelar,
  .btn-guardar {
    width: 100%;
  }
}

.modal-container {
  max-height: 90vh;
  overflow-y: auto;
}

