/* assets/css/auth.css - Estilos para Login y Registro
   Actualizado con la paleta de colores GraffRoute */
:root {
  /* Colores principales del logo */
  --primary-black: #1a1a1a;
  --accent-cyan: #00ffdd;
  --accent-cyan-dark: #00d4b8;
  --accent-cyan-light: #66fff0;

  /* Colores de apoyo */
  --white: #ffffff;
  --light-gray: #f8f9fa;
  --medium-gray: #6c757d;
  --border-gray: #e9ecef;
  --dark-gray: #343a40;

  /* Colores semánticos */
  --success: #28a745;
  --warning: #ffc107;
  --danger: #dc3545;
  --info: #17a2b8;

  /* Efectos */
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  --shadow-cyan: 0 4px 20px rgba(0, 255, 221, 0.2);
  --transition: all 0.3s ease;

  /* Gradientes */
  --gradient-primary: linear-gradient(
    135deg,
    var(--primary-black),
    var(--dark-gray)
  );
  --gradient-accent: linear-gradient(
    135deg,
    var(--accent-cyan),
    var(--accent-cyan-light)
  );
  --gradient-auth: linear-gradient(
    135deg,
    var(--primary-black) 0%,
    var(--accent-cyan) 100%
  );
}

body {
  background: linear-gradient(
    135deg,
    var(--primary-black) 0%,
    var(--dark-gray) 100%
  );
  min-height: 100vh;
  display: flex;
  align-items: center;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  margin: 0;
  padding: 0;
  position: relative;
}

/* Efecto sutil en el fondo */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(
    circle at 80% 20%,
    rgba(0, 255, 221, 0.03) 0%,
    transparent 60%
  );
  z-index: -1;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Estilos para checkboxes y formularios de Bootstrap */
.form-check {
  display: block;
  min-height: 1.5rem;
  padding-left: 1.5em;
  margin-bottom: 0.125rem;
}

.form-check .form-check-input {
  float: left;
  margin-left: -1.5em;
}

.form-check-input {
  width: 1em;
  height: 1em;
  margin-top: 0.25em;
  vertical-align: top;
  background-color: var(--white);
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  border: 1px solid var(--border-gray);
  border-radius: 0.25em;
  transition: background-color 0.15s ease-in-out,
    background-position 0.15s ease-in-out, border-color 0.15s ease-in-out,
    box-shadow 0.15s ease-in-out;
}

.form-check-input[type="checkbox"] {
  border-radius: 0.25em;
}

.form-check-input:active {
  filter: brightness(90%);
}

.form-check-input:focus {
  border-color: var(--accent-cyan);
  outline: 0;
  box-shadow: 0 0 0 0.25rem rgba(0, 255, 221, 0.25);
}

.form-check-input:checked {
  background-color: var(--accent-cyan);
  border-color: var(--accent-cyan);
}

.form-check-input:checked[type="checkbox"] {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23000' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e");
}

.form-check-input[type="checkbox"]:indeterminate {
  background-color: var(--accent-cyan);
  border-color: var(--accent-cyan);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23000' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M6 10h8'/%3e%3c/svg%3e");
}

.form-check-input:disabled {
  pointer-events: none;
  filter: none;
  opacity: 0.5;
}

.form-check-input[disabled] ~ .form-check-label,
.form-check-input:disabled ~ .form-check-label {
  opacity: 0.5;
}

.form-check-label {
  cursor: pointer;
  color: var(--primary-black);
  font-weight: 500;
}

/* Validación de checkboxes */
.form-check-input.is-valid {
  border-color: var(--success);
}

.form-check-input.is-valid:checked {
  background-color: var(--success);
  border-color: var(--success);
}

.form-check-input.is-valid:focus {
  box-shadow: 0 0 0 0.25rem rgba(40, 167, 69, 0.25);
}

.form-check-input.is-invalid {
  border-color: var(--danger);
}

.form-check-input.is-invalid:focus {
  box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.25);
}

/* Feedback de validación */
.invalid-feedback {
  display: none;
  width: 100%;
  margin-top: 0.25rem;
  font-size: 0.875em;
  color: var(--danger);
}

.valid-feedback {
  display: none;
  width: 100%;
  margin-top: 0.25rem;
  font-size: 0.875em;
  color: var(--success);
}

.was-validated .form-check-input:invalid ~ .invalid-feedback,
.form-check-input.is-invalid ~ .invalid-feedback {
  display: block;
}

.was-validated .form-check-input:valid ~ .valid-feedback,
.form-check-input.is-valid ~ .valid-feedback {
  display: block;
}

/* Estilos de fila y columna básicos */
.row {
  display: flex;
  flex-wrap: wrap;
  margin-right: -0.75rem;
  margin-left: -0.75rem;
}

.col-md-6 {
  flex: 0 0 auto;
  width: 50%;
  padding-right: 0.75rem;
  padding-left: 0.75rem;
}

@media (max-width: 767.98px) {
  .col-md-6 {
    width: 100%;
  }
}

/* Small text helper */
.small,
small {
  font-size: 0.875em;
}

.text-muted {
  --bs-text-opacity: 1;
  color: var(--medium-gray) !important;
}

/* Position relative helper */
.position-relative {
  position: relative !important;
}

/* Margin bottom helpers */
.mb-3 {
  margin-bottom: 1rem !important;
}

.mb-0 {
  margin-bottom: 0 !important;
}

.me-1 {
  margin-right: 0.25rem !important;
}

.me-2 {
  margin-right: 0.5rem !important;
}

/* Width helpers */
.w-100 {
  width: 100% !important;
}

/* Alertas personalizadas */
.alert {
  --bs-alert-bg: transparent;
  --bs-alert-padding-x: 1rem;
  --bs-alert-padding-y: 1rem;
  --bs-alert-margin-bottom: 1rem;
  --bs-alert-color: inherit;
  --bs-alert-border-color: transparent;
  --bs-alert-border: 1px solid var(--bs-alert-border-color);
  --bs-alert-border-radius: 0.375rem;
  position: relative;
  padding: var(--bs-alert-padding-y) var(--bs-alert-padding-x);
  margin-bottom: var(--bs-alert-margin-bottom);
  color: var(--bs-alert-color);
  background-color: var(--bs-alert-bg);
  border: var(--bs-alert-border);
  border-radius: var(--bs-alert-border-radius);
}

.alert-dismissible {
  padding-right: 3rem;
}

.alert-dismissible .btn-close {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 2;
  padding: 1.25rem 1rem;
}

.btn-close {
  box-sizing: content-box;
  width: 1em;
  height: 1em;
  padding: 0.25em 0.25em;
  color: #000;
  background: transparent
    url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23000'%3e%3cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3e%3c/svg%3e")
    center/1em auto no-repeat;
  border: 0;
  border-radius: 0.375rem;
  opacity: 0.5;
  cursor: pointer;
  transition: opacity 0.15s ease-in-out;
}

.btn-close:hover {
  opacity: 0.75;
}

.btn-close:focus {
  outline: 0;
  box-shadow: 0 0 0 0.25rem rgba(0, 255, 221, 0.25);
  opacity: 1;
}

.btn-close:disabled {
  pointer-events: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
  opacity: 0.25;
}

/* Fade animation for alerts */
.fade {
  transition: opacity 0.15s linear;
}

.fade:not(.show) {
  opacity: 0;
}

.show {
  opacity: 1;
}

/* Container básico */
.container {
  width: 100%;
  padding-right: 0.75rem;
  padding-left: 0.75rem;
  margin-right: auto;
  margin-left: auto;
}

@media (min-width: 576px) {
  .container {
    max-width: 540px;
  }
}

@media (min-width: 768px) {
  .container {
    max-width: 720px;
  }
}

@media (min-width: 992px) {
  .container {
    max-width: 960px;
  }
}

@media (min-width: 1200px) {
  .container {
    max-width: 1140px;
  }
}

@media (min-width: 1400px) {
  .container {
    max-width: 1320px;
  }
}

/* Spinner personalizado */
.spinner-border {
  display: inline-block;
  width: 2rem;
  height: 2rem;
  vertical-align: -0.125em;
  border: 0.25em solid currentcolor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spinner-border 0.75s linear infinite;
}

.spinner-border-sm {
  width: 1rem;
  height: 1rem;
  border-width: 0.2em;
}

@keyframes spinner-border {
  to {
    transform: rotate(360deg);
  }
}

/* Ocultar One Tap de Google y otros elementos de Google automáticos */
#credential_picker_container,
.g_id_signin,
[data-auto-prompt="false"],
.g_id_oneTap {
  display: none !important;
}

.auth-container {
  background: var(--white);
  border-radius: 20px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  max-width: 900px;
  margin: 2rem auto;
  position: relative;
  border: 1px solid rgba(0, 255, 221, 0.1);
}

.auth-header {
  background: var(--gradient-primary);
  color: var(--white);
  padding: 2.5rem 2rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.auth-header::before {
  content: "";
  position: absolute;
  top: -50%;
  right: -20%;
  width: 40%;
  height: 200%;
  background: var(--accent-cyan);
  opacity: 0.05;
  transform: rotate(15deg);
}

.auth-header h2 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  position: relative;
  z-index: 1;
}

.auth-header p {
  font-size: 1.1rem;
  opacity: 0.95;
  margin: 0;
  position: relative;
  z-index: 1;
}

.auth-tabs {
  display: flex;
  background: var(--light-gray);
  border-bottom: 1px solid var(--border-gray);
}

.auth-tab {
  flex: 1;
  padding: 1.25rem;
  text-align: center;
  background: var(--border-gray);
  border: none;
  cursor: pointer;
  transition: var(--transition);
  font-weight: 600;
  font-size: 1rem;
  color: var(--primary-black);
  position: relative;
}

.auth-tab:hover {
  background: #dee2e6;
  color: var(--accent-cyan-dark);
}

.auth-tab.active {
  background: var(--white);
  color: var(--accent-cyan-dark);
  border-bottom: 3px solid var(--accent-cyan);
}

.auth-tab.active::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 50px;
  height: 3px;
  background: var(--gradient-accent);
  border-radius: 2px;
}

.auth-form {
  padding: 2.5rem;
  display: none;
  max-height: 70vh;
  overflow-y: auto;
}

.auth-form.active {
  display: block;
}

.form-label {
  font-weight: 600;
  color: var(--primary-black);
  margin-bottom: 0.5rem;
}

.form-control {
  border-radius: 12px;
  border: 2px solid var(--border-gray);
  padding: 0.875rem 1rem;
  transition: var(--transition);
  font-size: 1rem;
  background: var(--white);
  color: var(--primary-black);
}

.form-control:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 0.2rem rgba(0, 255, 221, 0.15);
  outline: none;
}

.form-control.is-valid {
  border-color: var(--success);
}

.form-control.is-invalid {
  border-color: var(--danger);
}

.btn-auth {
  border-radius: 12px;
  padding: 0.875rem 2rem;
  font-weight: 600;
  font-size: 1rem;
  transition: var(--transition);
  border: none;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: var(--gradient-accent);
  color: var(--primary-black);
  font-weight: 700;
}

.btn-primary:hover {
  background: var(--accent-cyan-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-cyan);
}

.btn-google {
  background: #db4437;
  border: none;
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  font-weight: 600;
}

.btn-google:hover {
  background: #c23321;
  color: var(--white);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(219, 68, 55, 0.3);
}

.divider {
  text-align: center;
  margin: 2rem 0;
  position: relative;
}

.divider::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border-gray);
}

.divider span {
  background: var(--white);
  padding: 0 1.5rem;
  color: var(--medium-gray);
  font-weight: 500;
}

/* Corrección para centrar los iconos de mostrar/ocultar contraseña */
.password-toggle {
  position: absolute;
  right: 15px;
  transform: translateY(-160%);
  border: none;
  background: none;
  color: var(--medium-gray);
  cursor: pointer;
  transition: var(--transition);
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  z-index: 10;
}

.password-toggle:hover {
  color: var(--accent-cyan);
  background: rgba(0, 255, 221, 0.1);
}

.password-toggle i {
  font-size: 14px;
  line-height: 1;
}

/* Ajustar padding del input cuando tiene botón de toggle */
.position-relative .form-control {
  padding-right: 45px;
}

.alert {
  border-radius: 12px;
  border: none;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}

.alert-danger {
  background: #f8d7da;
  color: #721c24;
  border-left: 4px solid var(--danger);
}

.alert ul {
  margin: 0;
  padding-left: 1.5rem;
}

.back-link {
  position: absolute;
  top: 20px;
  left: 20px;
  color: var(--white);
  text-decoration: none;
  font-size: 1.1rem;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 25px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.back-link:hover {
  color: var(--accent-cyan);
  transform: translateX(-5px);
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(0, 255, 221, 0.3);
}

.form-check-label {
  color: var(--primary-black);
  font-weight: 500;
}

.form-check-label a {
  color: var(--accent-cyan-dark);
  text-decoration: none;
}

.form-check-label a:hover {
  text-decoration: underline;
  color: var(--accent-cyan);
}

.text-muted {
  color: var(--medium-gray) !important;
  font-size: 0.875rem;
}

.text-muted:hover {
  color: var(--accent-cyan-dark) !important;
  text-decoration: none;
}

/* Animaciones */
.auth-container {
  opacity: 0;
  transform: translateY(20px);
  animation: slideInUp 0.6s ease forwards;
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.form-control {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Estados de validación mejorados */
.form-control.is-valid {
  border-color: var(--success);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%2328a745' d='m2.3 6.73.94-.94 1.46-1.46L3.24 3l.94-.94L5.6 3.46l.94.94-.94.94L4.14 6.8z'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right calc(0.375em + 0.1875rem) center;
  background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.form-control.is-invalid {
  border-color: var(--danger);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath d='M5.8 5.8L8.2 8.2M8.2 5.8L5.8 8.2'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right calc(0.375em + 0.1875rem) center;
  background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

/* Responsive Design */
@media (max-width: 768px) {
  .auth-container {
    margin: 1rem;
    max-width: none;
  }

  .auth-header {
    padding: 2rem 1.5rem;
  }

  .auth-header h2 {
    font-size: 1.75rem;
  }

  .auth-form {
    padding: 2rem 1.5rem;
  }

  .back-link {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 9999;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
  }

  .auth-tab {
    padding: 1rem;
    font-size: 0.9rem;
  }
}

@media (max-width: 576px) {
  body {
    padding: 1rem 0;
  }

  .auth-container {
    margin: 1rem 0.5rem;
  }

  .auth-form {
    padding: 1.5rem 1rem;
    max-height: none;
  }

  .auth-header {
    padding: 1.5rem 1rem;
  }

  .auth-header h2 {
    font-size: 1.5rem;
  }

  .auth-header p {
    font-size: 1rem;
  }

  .btn-auth {
    padding: 0.75rem 1.5rem;
  }

  .back-link {
    position: fixed;
    top: 15px;
    left: 15px;
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
    z-index: 9999;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
  }

  .back-link span {
    display: none;
  }

  .back-link i {
    margin-right: 0;
  }
}
/* Loading state */
.btn-auth:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

.btn-auth.loading::after {
  content: "";
  width: 16px;
  height: 16px;
  border: 2px solid transparent;
  border-top: 2px solid currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-left: 0.5rem;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Efectos especiales para GraffRoute */
.btn-primary::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: var(--transition);
}

.btn-primary:hover::before {
  left: 100%;
}

/* Glow effect más sutil para elementos interactivos */
.auth-container:hover {
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
}

.form-control:focus {
  box-shadow: 0 0 0 0.2rem rgba(0, 255, 221, 0.15);
}
