/* Estilos de aulapp.cl. El ingreso copia el de la app móvil de Aulapp (repo
   Aulapp/app2026, apps/web: globals.css .auth-* + native-app.css): fondo blanco y
   solo el cuadro, centrado. La pantalla de inicio copia la barra superior y el
   menú de usuario de la app (.app-user-*). */
:root {
  --kc-primary: #ff6115;
  --color-tinta: #1e252d;
  --color-tinta-suave: #5f6974;
  --color-fondo: #f8f5ee;
  --color-linea: #ebe5da;
  --color-critico: #dc2626;
  --motion-fast: 300ms;
  --motion-ease: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: #ffffff;
}

body {
  color: #1e252d;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

input, button { font: inherit; color: inherit; }

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 24px;
  background: #ffffff;
}

.auth-panel-inner {
  width: 100%;
  max-width: 400px;
}

.auth-form-card {
  animation: auth-card-in 900ms cubic-bezier(0.2, 0.8, 0.2, 1) 150ms backwards;
}

@keyframes auth-card-in {
  from { opacity: 0; transform: translateY(24px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.auth-form-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 18px;
  margin-bottom: 2rem;
}

.auth-form-title {
  margin: 0 0 0.4rem;
  line-height: 1.1;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.035em;
  color: #1e252d;
}

.auth-form-sub {
  margin: 0;
  color: #5f6974;
  line-height: 1.5;
  font-size: 15px;
}

.auth-form-icon {
  order: -1;
  width: 76px;
  height: 76px;
  border-radius: 20px;
  flex-shrink: 0;
  box-shadow: 0 14px 30px -14px rgba(255, 97, 21, 0.75);
  animation:
    app-icon-pop 650ms var(--motion-ease) backwards,
    app-icon-float 4.5s ease-in-out 650ms infinite;
}

@keyframes app-icon-pop {
  from { opacity: 0; transform: translateY(10px) scale(0.82) rotate(8deg); }
  to { opacity: 1; transform: none; }
}

@keyframes app-icon-float {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
    box-shadow: 0 14px 30px -14px rgba(255, 97, 21, 0.75);
  }
  50% {
    transform: translateY(-9px) rotate(-6deg);
    box-shadow: 0 26px 38px -18px rgba(255, 97, 21, 0.5);
  }
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 15px;
  font-weight: 600;
}

.auth-field-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}

.auth-field-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #1e252d;
}

.auth-link-small {
  font-size: 13px;
  font-weight: 600;
  color: var(--kc-primary);
  text-decoration: none;
}

.auth-link-small:hover { text-decoration: underline; }

.auth-input {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0 0.95rem;
  border: 1.5px solid #e2dccf;
  border-radius: 14px;
  background: #fcfbf8;
  transition: border-color var(--motion-fast) ease, box-shadow var(--motion-fast) ease, background-color var(--motion-fast) ease;
}

.auth-input:hover { border-color: #cfc6b4; }

.auth-input:focus-within {
  border-color: var(--kc-primary);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(255, 97, 21, 0.14);
}

.auth-input > .material-symbols-outlined {
  font-size: 20px;
  color: #9aa3ad;
  transition: color var(--motion-fast) ease, transform var(--motion-fast) var(--motion-ease);
}

.auth-input:focus-within > .material-symbols-outlined {
  color: var(--kc-primary);
  transform: scale(1.1);
}

.auth-input input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  padding: 0.95rem 0;
  font-size: 16px;
  font-weight: 400;
  box-shadow: none;
  outline: none;
}

.auth-eye {
  display: inline-flex;
  border: none;
  background: transparent;
  padding: 4px;
  border-radius: 8px;
  color: #9aa3ad;
  cursor: pointer;
  transition: color var(--motion-fast) ease, background-color var(--motion-fast) ease;
}

.auth-eye:hover { color: #1e252d; background: #f0eee6; }
.auth-eye .material-symbols-outlined { font-size: 20px; }

.auth-notice {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0.7rem 0.9rem;
  border-radius: 10px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  font-size: 14px;
  animation: motion-rise var(--motion-fast) var(--motion-ease) backwards;
}

.auth-notice[hidden] { display: none; }
.auth-notice .material-symbols-outlined { font-size: 19px; }

@keyframes motion-rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.auth-submit {
  position: relative;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  margin-top: 0.4rem;
  padding: 1rem 1.2rem;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, #ff7a2f 0%, #ff6115 50%, #f04e05 100%);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 14px 30px -12px rgba(255, 97, 21, 0.75);
  transition: transform var(--motion-fast) var(--motion-ease), box-shadow var(--motion-fast) ease;
}

.auth-submit::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 25%, rgba(255, 255, 255, 0.35) 50%, transparent 75%);
  transform: translateX(-120%);
  transition: transform 700ms ease;
}

.auth-submit:hover { transform: translateY(-2px); box-shadow: 0 20px 36px -14px rgba(255, 97, 21, 0.85); }
.auth-submit:hover::after { transform: translateX(120%); }
.auth-submit:active { transform: scale(0.97); }

.auth-submit .material-symbols-outlined {
  font-size: 20px;
  transition: transform var(--motion-fast) var(--motion-ease);
}

.auth-submit:hover .material-symbols-outlined { transform: translateX(4px); }


/* ------------------------------------------------------------ Google */

.auth-google {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 54px;
  padding: 0.9rem 1.2rem;
  border: 1.5px solid #e2dccf;
  border-radius: 14px;
  background: #fff;
  color: #1e252d;
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: border-color var(--motion-fast) ease, box-shadow var(--motion-fast) ease, transform var(--motion-fast) var(--motion-ease);
}

.auth-google:hover { border-color: #cfc6b4; box-shadow: 0 10px 24px -16px rgba(30, 37, 45, 0.45); transform: translateY(-1px); }
.auth-google:active { transform: scale(0.98); }
.auth-google:focus-visible { outline: none; border-color: var(--kc-primary); box-shadow: 0 0 0 4px rgba(255, 97, 21, 0.14); }
.auth-google svg { width: 20px; height: 20px; flex-shrink: 0; }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 1.4rem 0;
  color: #9aa3ad;
  font-size: 13px;
}

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

/* ------------------------------------------------------------ Errores */

.auth-error {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0.7rem 0.9rem;
  border-radius: 10px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  font-size: 14px;
  animation: motion-rise var(--motion-fast) var(--motion-ease) backwards;
}

.auth-error[hidden] { display: none; }
.auth-error .material-symbols-outlined { font-size: 19px; }

.auth-form-card.is-error { animation: auth-shake 420ms cubic-bezier(0.36, 0.07, 0.19, 0.97); }

@keyframes auth-shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-7px); }
  40%, 60% { transform: translateX(7px); }
}

.auth-submit:disabled { opacity: 0.75; cursor: progress; transform: none; }

/* Mientras se revisa si ya hay sesión, la pantalla no se muestra. */
.is-checking { visibility: hidden; }

/* ------------------------------------------------- Pantalla de inicio */

.home-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 64px;
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-linea);
}

.home-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--color-tinta);
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.03em;
  text-decoration: none;
}

.home-brand img { width: 34px; height: 34px; }
.home-brand-accent { color: var(--kc-primary); }

.app-user { position: relative; display: flex; align-items: center; gap: 4px; }
.app-user-btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid transparent; background: transparent; border-radius: 999px; padding: 4px 10px 4px 4px; font: inherit; cursor: pointer; color: var(--color-tinta); }
.app-user-btn:hover, .app-user-btn[aria-expanded="true"] { background: var(--color-fondo); border-color: var(--color-linea); }
.app-user-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex-shrink: 0; transition: transform var(--motion-fast) var(--motion-ease); }
.app-user-btn:hover .app-user-avatar { transform: scale(1.06); }
.app-user-initials { display: inline-flex; align-items: center; justify-content: center; background: var(--kc-primary); color: white; font-weight: 700; font-size: 13px; }
.app-user-name { font-size: 14px; font-weight: 600; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-user-caret { display: inline-block; font-size: 11px; color: #6b7a89; transition: transform var(--motion-fast) var(--motion-ease); }
.app-user-btn[aria-expanded="true"] .app-user-caret { transform: rotate(180deg); }
.app-user-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 220px; max-width: calc(100vw - 32px); background: #fff; border: 1px solid var(--color-linea); border-radius: 12px; box-shadow: 0 10px 30px rgba(20, 36, 51, 0.14); padding: 6px; transform-origin: top right; animation: motion-pop var(--motion-fast) var(--motion-ease) backwards; }
.app-user-menu[hidden] { display: none; }
.app-user-menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--color-linea); margin-bottom: 4px; font-size: 13px; }
.app-user-menu-head strong, .app-user-menu-head small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-user-menu-head small { color: var(--color-tinta-suave); font-size: 12.5px; }
.app-user-menu button { display: block; width: 100%; text-align: left; border: none; background: transparent; padding: 9px 10px; font: inherit; font-size: 14px; border-radius: 8px; cursor: pointer; color: var(--color-tinta); }
.app-user-menu button:hover { background: var(--color-fondo); }
.app-user-menu .is-danger { color: var(--color-critico); }
@media (max-width: 640px) { .app-user-name { display: none; } }

@keyframes motion-pop {
  from { opacity: 0; transform: translateY(-4px) scale(0.96); }
  to { opacity: 1; transform: none; }
}

.home-main {
  display: flex;
  justify-content: center;
  padding: 56px 16px 40px;
}

.home-inner {
  width: 100%;
  max-width: 560px;
  animation: auth-card-in 900ms cubic-bezier(0.2, 0.8, 0.2, 1) 100ms backwards;
}

.home-title {
  margin: 0 0 0.4rem;
  font-size: 32px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.035em;
  overflow-wrap: anywhere;
}

.home-sub { margin: 0 0 2rem; color: var(--color-tinta-suave); font-size: 15px; }

.home-role {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 72px;
  padding: 12px 14px;
  border: 1.5px solid var(--color-linea);
  border-radius: 16px;
  background: #fff;
}

.home-role-icon { display: inline-flex; align-items: center; justify-content: center; width: 46px; height: 46px; flex-shrink: 0; border-radius: 12px; background: #fff1e8; color: #c24a0b; font-size: 24px; }
.home-role-text { display: flex; flex-direction: column; min-width: 0; }
.home-role-text small { font-size: 12px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--color-tinta-suave); }
.home-role-text strong { font-size: 17px; line-height: 24px; }

@media (prefers-reduced-motion: reduce) {
  .auth-form-card, .auth-form-icon, .auth-notice, .auth-error, .home-inner, .app-user-menu { animation: none; }
}
