/* ==========================================================================
   MYUU STUDIO — AUTHENTICATION & USER ACCOUNTS
   Architectural Monochrome Design System (Blanco Total + Escala de Grises)
   ========================================================================== */

/* --------------------------------------------------------------------------
   Ocultación Temporal de Controles de Acceso (Navbar & Mobile)
   Se reactivarán en una fase posterior con la sección de estudiantes.
   -------------------------------------------------------------------------- */
.btn-auth-header,
.user-menu-wrapper,
.mobile-auth-wrapper {
  display: none !important;
}

/* --------------------------------------------------------------------------
   1. Header Auth Controls (Desktop & Mobile)
   -------------------------------------------------------------------------- */
.header-action {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mobile-auth-wrapper {
  padding: 10px 0;
  border-top: 1px solid #EEEEEE;
  border-bottom: 1px solid #EEEEEE;
  margin: 4px 0;
}

.mobile-auth-btn {
  width: 100%;
  justify-content: center;
  padding: 11px 16px;
  font-size: 14px;
}

/* Botón Iniciar Sesión en Navbar */
.btn-auth-header {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: transparent;
  border: 1px solid #D5D5D5;
  color: #111111;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 9999px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}

.btn-auth-header svg {
  width: 15px;
  height: 15px;
  stroke: #111111;
  transition: stroke 0.2s ease;
}

.btn-auth-header:hover {
  background: #111111;
  border-color: #111111;
  color: #FFFFFF;
}

.btn-auth-header:hover svg {
  stroke: #FFFFFF;
}

/* Estado Logueado: Dropdown de Perfil */
.user-menu-wrapper {
  position: relative;
  display: inline-block;
}

.btn-user-profile {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #FAFAFA;
  border: 1px solid #DCDCDC;
  color: #111111;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 5px 12px 5px 6px;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-user-profile:hover {
  background: #F0F0F0;
  border-color: #111111;
}

.user-avatar-badge {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #111111;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: -0.5px;
  text-transform: uppercase;
}

.user-name-label {
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-chevron {
  width: 12px;
  height: 12px;
  stroke: #666666;
  transition: transform 0.2s ease;
}

.user-menu-wrapper.open .user-chevron {
  transform: rotate(180deg);
}

/* Menú Desplegable */
.user-dropdown-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 230px;
  background: #FFFFFF;
  border: 1px solid #E5E5E5;
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12);
  padding: 8px;
  z-index: 120;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.user-menu-wrapper.open .user-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.user-dropdown-header {
  padding: 10px 12px 12px;
  border-bottom: 1px solid #EEEEEE;
  margin-bottom: 6px;
}

.user-dropdown-name {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #111111;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-dropdown-email {
  display: block;
  font-size: 11px;
  color: #777777;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 600;
  color: #333333;
  text-decoration: none;
  background: none;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease;
}

.user-dropdown-item svg {
  width: 15px;
  height: 15px;
  stroke: #777777;
}

.user-dropdown-item:hover {
  background: #F5F5F5;
  color: #111111;
}

.user-dropdown-item:hover svg {
  stroke: #111111;
}

.user-dropdown-item.btn-logout {
  color: #C02020;
}

.user-dropdown-item.btn-logout svg {
  stroke: #C02020;
}

.user-dropdown-item.btn-logout:hover {
  background: #FFF5F5;
  color: #E01010;
}

/* --------------------------------------------------------------------------
   2. Modal Dialog Overlay & Card
   -------------------------------------------------------------------------- */
.auth-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(18, 18, 18, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.auth-modal-backdrop.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.auth-modal-card {
  position: relative;
  width: 100%;
  max-width: 440px;
  background: #FFFFFF;
  border-radius: 16px;
  border: 1px solid #E6E6E6;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.15), 0 4px 16px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  transform: translateY(18px) scale(0.97);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-modal-backdrop.active .auth-modal-card {
  transform: translateY(0) scale(1);
}

/* Botón Cerrar Modal */
.auth-modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid #EEEEEE;
  background: #FAFAFA;
  color: #666666;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 10;
}

.auth-modal-close:hover {
  background: #111111;
  color: #FFFFFF;
  border-color: #111111;
  transform: rotate(90deg);
}

/* Cabecera del Modal */
.auth-card-header {
  padding: 28px 28px 16px;
  text-align: center;
  border-bottom: 1px solid #F0F0F0;
}

.auth-logo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  margin-bottom: 12px;
}

.auth-logo-badge img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: brightness(0);
}

.auth-card-title {
  font-size: 20px;
  font-weight: 800;
  color: #111111;
  letter-spacing: -0.02em;
  margin: 0;
}

.auth-card-subtitle {
  font-size: 13px;
  color: #777777;
  margin: 6px 0 0;
  line-height: 1.4;
}

/* Selector de Pestañas (Tabs) */
.auth-tabs-nav {
  display: flex;
  padding: 4px;
  margin: 18px 28px 0;
  background: #F4F4F4;
  border-radius: 10px;
}

.auth-tab-btn {
  flex: 1;
  padding: 9px 0;
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  color: #666666;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.auth-tab-btn.active {
  background: #FFFFFF;
  color: #111111;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Alertas de Estado (Error / Éxito) */
.auth-alert-box {
  margin: 16px 28px 0;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 12.5px;
  line-height: 1.4;
  display: none;
}

.auth-alert-box.active {
  display: block;
  animation: fadeInDown 0.25s ease;
}

.auth-alert-box.error {
  background: #FFF2F2;
  border: 1px solid #FFD0D0;
  color: #B81414;
}

.auth-alert-box.success {
  background: #F0FFF4;
  border: 1px solid #C6F6D5;
  color: #1B7A38;
}

.auth-alert-box.info {
  background: #F7FAFC;
  border: 1px solid #E2E8F0;
  color: #2D3748;
}

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

/* Cuerpo del Formulario */
.auth-card-body {
  padding: 20px 28px 28px;
}

/* Botón Google OAuth */
.btn-google-oauth {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 11px 16px;
  background: #FFFFFF;
  border: 1px solid #D5D5D5;
  border-radius: 10px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: #222222;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-google-oauth:hover {
  background: #F8F8F8;
  border-color: #111111;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.google-icon-svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* Divisor Visual "o con correo" */
.auth-divider {
  display: flex;
  align-items: center;
  margin: 18px 0;
  color: #999999;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #EBEBEB;
}

.auth-divider span {
  padding: 0 12px;
}

/* Grupos de Inputs */
.auth-field-group {
  margin-bottom: 14px;
}

.auth-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #222222;
  margin-bottom: 6px;
}

.auth-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-input {
  width: 100%;
  padding: 11px 14px;
  background: #FAFAFA;
  border: 1px solid #DCDCDC;
  border-radius: 9px;
  font-family: inherit;
  font-size: 13.5px;
  color: #111111;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.auth-input:focus {
  outline: none;
  background: #FFFFFF;
  border-color: #111111;
  box-shadow: 0 0 0 3px rgba(18, 18, 18, 0.08);
}

.auth-input::placeholder {
  color: #AAAAAA;
}

/* Botón Mostrar/Ocultar contraseña */
.btn-toggle-password {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: #888888;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease;
}

.btn-toggle-password:hover {
  color: #111111;
}

.btn-toggle-password svg {
  width: 16px;
  height: 16px;
}

/* Enlace Olvidé contraseña */
.auth-extra-row {
  display: flex;
  justify-content: flex-end;
  margin-top: -6px;
  margin-bottom: 16px;
}

.auth-link-subtle {
  font-size: 12px;
  color: #666666;
  text-decoration: none;
  transition: color 0.15s ease;
}

.auth-link-subtle:hover {
  color: #111111;
  text-decoration: underline;
}

/* Botón Submit Principal */
.btn-auth-submit {
  width: 100%;
  padding: 12px 18px;
  background: #111111;
  color: #FFFFFF;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-auth-submit:hover {
  background: #2D2D2D;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-auth-submit:active {
  transform: translateY(0);
}

.btn-auth-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Spinner dentro del botón */
.auth-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #FFFFFF;
  border-radius: 50%;
  animation: authSpin 0.7s linear infinite;
  display: none;
}

.btn-auth-submit.loading .auth-spinner {
  display: inline-block;
}

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

/* Vistas Intercambiables */
.auth-view {
  display: none;
}

.auth-view.active {
  display: block;
}

/* Nota inferior */
.auth-footer-note {
  margin-top: 14px;
  text-align: center;
  font-size: 11.5px;
  color: #888888;
  line-height: 1.4;
}

.auth-footer-note a {
  color: #111111;
  text-decoration: underline;
}

/* Banner de configuración (informativo para conectar Supabase) */
.auth-setup-banner {
  margin: 16px 28px 0;
  padding: 10px 12px;
  background: #F4F6FB;
  border: 1px dashed #BAC7E0;
  border-radius: 8px;
  font-size: 11.5px;
  color: #3B5277;
  line-height: 1.4;
}

.auth-setup-banner code {
  background: #E8EDF8;
  padding: 2px 5px;
  border-radius: 4px;
  font-family: var(--font-mono, monospace);
  font-size: 11px;
}

/* Soporte directo para cuentas y academia */
.auth-support-help {
  margin: 0 28px 20px;
  padding-top: 14px;
  border-top: 1px solid #ECECEC;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: center;
  font-size: 11.5px;
  color: #777777;
}

.auth-support-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  flex-wrap: wrap;
}

.auth-support-help a {
  color: #111111;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s ease;
}

.auth-support-help a:hover {
  text-decoration: underline;
}

/* --------------------------------------------------------------------------
   3. Responsive Design
   -------------------------------------------------------------------------- */
@media (max-width: 600px) {
  .auth-modal-card {
    max-width: 100%;
    border-radius: 14px;
  }
  .auth-card-header {
    padding: 22px 20px 14px;
  }
  .auth-tabs-nav,
  .auth-alert-box,
  .auth-setup-banner {
    margin-left: 20px;
    margin-right: 20px;
  }
  .auth-card-body {
    padding: 16px 20px 22px;
  }
}
