@import url("https://fonts.googleapis.com/css2?family=Open+Sans:wght@200;300;400;500;600;700&display=swap");

/* =============================================
   CSS Global — ATApplication.SSO
   Empresa:     Arquitecturas Tecnológicas
   Autor:       SA
   Estilo:      Glassmorphism Login
   Responsive:  Mobile-first, breakpoints 480px, 768px, 1024px
   ============================================= */

/* === Reset & Base === */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Open Sans", sans-serif;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  width: 100%;
  padding: 0 10px;
  overflow-x: hidden;
}

/* === Fondo con imagen hero === */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: url("../images/loginbackgroundAT.png"), #000;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  z-index: -1;
}

/* === Tarjeta Glassmorphism (contenedor principal) === */
.wrapper {
  width: 100%;
  max-width: 420px;
  border-radius: 12px;
  padding: 40px 30px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  position: relative;
  z-index: 1;
}

/* === Logo === */
.login-logo {
  display: block;
  margin: 0 auto 20px;
  width: 220px;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
}

/* === Título === */
.wrapper h2 {
  font-size: 2rem;
  margin-bottom: 10px;
  color: #fff;
  font-weight: 600;
}

/* === Subtítulo (nombre del proyecto) === */
.wrapper .project-name {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 30px;
  font-weight: 300;
}

/* === Separador visual === */
.divider {
  display: flex;
  align-items: center;
  margin: 20px 0;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.85rem;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.3);
}

.divider::before {
  margin-right: 12px;
}

.divider::after {
  margin-left: 12px;
}

/* === Botones de proveedor OAuth === */
.oauth-buttons {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 10px;
}

.btn-oauth {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 14px 20px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  font-family: "Open Sans", sans-serif;
}

.btn-oauth:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.btn-oauth:active {
  transform: translateY(0);
}

.btn-oauth svg,
.btn-oauth img {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

/* Variante Google */
.btn-oauth.google {
  border-color: rgba(219, 68, 55, 0.5);
}

.btn-oauth.google:hover {
  border-color: #db4437;
  background: rgba(219, 68, 55, 0.15);
}

/* Variante Microsoft */
.btn-oauth.microsoft {
  border-color: rgba(0, 120, 212, 0.5);
}

.btn-oauth.microsoft:hover {
  border-color: #0078d4;
  background: rgba(0, 120, 212, 0.15);
}

/* === Botón genérico (submit, action) === */
button {
  background: #fff;
  color: #000;
  font-weight: 600;
  border: none;
  padding: 12px 20px;
  cursor: pointer;
  border-radius: 6px;
  font-size: 1rem;
  border: 2px solid transparent;
  transition: all 0.3s ease;
  font-family: "Open Sans", sans-serif;
  width: 100%;
}

button:hover {
  color: #fff;
  border-color: #fff;
  background: rgba(255, 255, 255, 0.15);
}

/* === Texto auxiliar (footer de tarjeta) === */
.card-footer {
  margin-top: 30px;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.85rem;
}

.card-footer a {
  color: #efefef;
  text-decoration: none;
  font-weight: 500;
}

.card-footer a:hover {
  text-decoration: underline;
}

/* === Mensaje de error === */
.error-message {
  color: #ff6b6b;
  background: rgba(255, 107, 107, 0.1);
  border: 1px solid rgba(255, 107, 107, 0.3);
  border-radius: 6px;
  padding: 12px 16px;
  margin-bottom: 20px;
  font-size: 0.9rem;
}

/* === Mensaje de éxito === */
.success-message {
  color: #51cf66;
  background: rgba(81, 207, 102, 0.1);
  border: 1px solid rgba(81, 207, 102, 0.3);
  border-radius: 6px;
  padding: 12px 16px;
  margin-bottom: 20px;
  font-size: 0.9rem;
}

/* === Loading spinner === */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  color: rgba(255, 255, 255, 0.8);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* =============================================
   RESPONSIVE BREAKPOINTS
   Mobile-first approach
   ============================================= */

/* --- Extra small: <= 360px (teléfonos pequeños) --- */
@media (max-width: 360px) {
  html {
    font-size: 14px;
  }

  body {
    padding: 0 8px;
  }

  .wrapper {
    padding: 24px 16px;
    border-radius: 8px;
  }

  .login-logo {
    width: 80px;
    margin-bottom: 14px;
  }

  .wrapper h2 {
    font-size: 1.5rem;
  }

  .btn-oauth {
    padding: 12px 14px;
    font-size: 0.9rem;
    gap: 8px;
  }

  .btn-oauth svg,
  .btn-oauth img {
    width: 18px;
    height: 18px;
  }
}

/* --- Small: 361px - 480px (teléfonos estándar) --- */
@media (min-width: 361px) and (max-width: 480px) {
  .wrapper {
    padding: 30px 20px;
  }

  .login-logo {
    width: 100px;
    margin-bottom: 16px;
  }

  .wrapper h2 {
    font-size: 1.6rem;
  }
}

/* --- Medium: 481px - 768px (tablets portrait) --- */
@media (min-width: 481px) and (max-width: 768px) {
  .wrapper {
    max-width: 400px;
    padding: 35px 28px;
  }
}

/* --- Large: 769px - 1024px (tablets landscape, laptops pequeños) --- */
@media (min-width: 769px) and (max-width: 1024px) {
  .wrapper {
    max-width: 420px;
    padding: 40px 30px;
  }
}

/* --- Extra large: >= 1025px (desktops) --- */
@media (min-width: 1025px) {
  .wrapper {
    max-width: 440px;
    padding: 45px 35px;
  }

  .login-logo {
    width: 140px;
    margin-bottom: 24px;
  }

  .wrapper h2 {
    font-size: 2.2rem;
  }

  .btn-oauth {
    padding: 16px 24px;
    font-size: 1.05rem;
  }
}

/* --- Landscape en móviles (altura reducida) --- */
@media (max-height: 500px) and (orientation: landscape) {
  body {
    padding: 10px;
    align-items: flex-start;
  }

  .wrapper {
    padding: 20px;
    margin: 10px auto;
  }

  .wrapper h2 {
    font-size: 1.4rem;
    margin-bottom: 6px;
  }

  .wrapper .project-name {
    margin-bottom: 15px;
  }

  .oauth-buttons {
    gap: 8px;
  }

  .btn-oauth {
    padding: 10px 16px;
  }
}

/* --- Accesibilidad: respeta preferencia de movimiento reducido --- */
@media (prefers-reduced-motion: reduce) {
  .btn-oauth {
    transition: none;
  }

  .btn-oauth:hover {
    transform: none;
  }

  .spinner {
    animation-duration: 1.5s;
  }
}

/* --- Accesibilidad: alto contraste --- */
@media (prefers-contrast: high) {
  .wrapper {
    border: 2px solid #fff;
    background: rgba(0, 0, 0, 0.8);
  }

  .btn-oauth {
    border-width: 3px;
  }
}
