/* ============================================================
   Store admin · Auth (login del admin de tienda)
   ------------------------------------------------------------
   Layout autocontenido para /admin/iniciar-sesion: shell con
   brand chica arriba, card centrado con form, link de retorno
   abajo. No depende del chrome de /crear-tienda.
   ============================================================ */

/* Neutralizamos los wrappers globales del layout.php cuando
   estamos en el login del admin: el .sa-auth-shell provee su
   propio fondo, min-height y centrado. */
body.page-store-admin-auth {
    background: var(--sa-bg);
}
body.page-store-admin-auth .site-shell {
    min-height: 0;
    padding: 0;
}
body.page-store-admin-auth .container,
body.page-store-admin-auth .container.page-container,
body.page-store-admin-auth .page-container {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
}

.sa-auth-shell {
    min-height: 100vh;
    background: var(--sa-bg);
    color: var(--sa-text);
    font-family: var(--sa-font);
    display: grid;
    grid-template-rows: auto 1fr auto;
}

.sa-auth-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: calc(16px + env(safe-area-inset-top, 0px)) clamp(16px, 4vw, 32px) 16px;
}
.sa-auth-header__brand {
    display: inline-flex;
    align-items: center;
    color: var(--sa-text);
    text-decoration: none;
}
.sa-auth-header__brand:hover { text-decoration: none; color: var(--sa-text); }
.sa-auth-header__brand .site-brand-logo {
    height: 24px;
    width: auto;
    display: block;
}
.sa-auth-header__brand .site-brand-logo--dark {
    display: none;
}
html.store-admin-theme-dark .sa-auth-header__brand .site-brand-logo--dark,
body.store-admin-theme-dark .sa-auth-header__brand .site-brand-logo--dark {
    display: block;
}
html.store-admin-theme-dark .sa-auth-header__brand .site-brand-logo--light,
body.store-admin-theme-dark .sa-auth-header__brand .site-brand-logo--light {
    display: none;
}
.sa-auth-header__logo {
    height: 28px;
    width: auto;
    display: block;
}

.sa-auth-main {
    display: grid;
    place-items: center;
    padding: 32px clamp(16px, 4vw, 32px) calc(48px + env(safe-area-inset-bottom, 0px));
}

.sa-auth-card {
    width: min(100%, 420px);
    display: grid;
    gap: 18px;
    padding: 24px;
    background: var(--sa-surface);
    border: 1px solid var(--sa-border);
    border-radius: var(--sa-radius-lg);
}

.sa-auth-card__copy {
    display: grid;
    gap: 6px;
}
.sa-auth-card__copy h1 {
    font-size: clamp(1.25rem, 2.2vw, 1.5rem);
    line-height: 1.2;
    letter-spacing: -0.02em;
    font-weight: 700;
}
.sa-auth-card__copy h2 {
    margin: 0;
    color: var(--sa-text);
    font-size: 16px;
    line-height: 1.25;
    font-weight: 700;
    letter-spacing: -0.02em;
}
.sa-auth-card__copy p {
    color: var(--sa-muted);
    font-size: 13px;
    line-height: 1.45;
}
.sa-auth-card__copy--compact {
    margin-bottom: 14px;
}

.sa-auth-form {
    display: grid;
    gap: 14px;
}
.sa-auth-form .sa-field[hidden] {
    display: none;
}
.sa-auth-card .sa-input,
.sa-auth-card .iti,
.sa-auth-card .iti__tel-input,
.sa-auth-card .iti input[type="tel"] {
    border-radius: var(--sa-radius-sm) !important;
}
.sa-auth-card .iti {
    overflow: visible;
}
.sa-phone-fallback {
    display: grid;
    grid-template-columns: minmax(118px, 0.42fr) minmax(0, 1fr);
    gap: 8px;
}

.sa-auth-form .sa-form-actions {
    display: grid;
    justify-content: stretch;
    gap: 8px;
}
.sa-auth-form .sa-form-actions .sa-btn,
.sa-auth-primary-action {
    width: 100%;
    justify-content: center;
}
.sa-auth-secondary-actions {
    display: grid;
    gap: 8px;
    margin-top: 10px;
}
.sa-auth-secondary-actions .sa-btn {
    width: 100%;
    justify-content: center;
}
.sa-auth-code-channels {
    gap: 10px;
    grid-template-columns: 1fr;
}
.sa-auth-code-channels .sa-check-card {
    margin: 0;
}

.sa-store-choice-title {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 0;
}

.sa-check-card__copy .sa-store-role-badge {
    display: inline-flex;
    align-items: center;
    min-height: 20px;
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(var(--sa-primary-rgb), 0.10);
    color: var(--sa-primary);
    font-size: 11px;
    font-weight: 750;
    line-height: 1;
}

.sa-check-card__copy .sa-store-role-badge--owner {
    background: #ecfdf5;
    color: #047857;
}

.sa-check-card__copy .sa-store-role-badge--admin {
    background: rgba(var(--sa-primary-rgb), 0.10);
    color: var(--sa-primary);
}

.sa-check-card__copy .sa-store-role-badge--operador {
    background: #f8fafc;
    color: #475569;
}

.sa-auth-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 1px;
}

.sa-auth-divider > span {
    width: 100%;
    height: 1px;
    background: var(--sa-border);
}

.sa-auth-signup {
    display: grid;
    gap: 8px;
    padding-top: 2px;
}

.sa-auth-signup p {
    margin: 0;
    color: var(--sa-muted);
    font-size: 13px;
    line-height: 1.45;
}

.sa-auth-signup .sa-btn {
    justify-content: center;
}

/* Toggle ojito (mostrar/ocultar contraseña) --------------- */
.sa-password-field {
    position: relative;
    display: block;
}
.sa-password-field > input {
    padding-right: 38px;
}
.sa-password-toggle {
    position: absolute;
    top: 0;
    bottom: 0;
    right: 4px;
    margin: auto 0;
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--sa-muted);
    cursor: pointer;
    border-radius: var(--sa-radius-xs);
}
.sa-password-toggle:hover {
    color: var(--sa-text);
    background: var(--sa-surface-hover);
}

.sa-auth-footer {
    padding: 0 clamp(16px, 4vw, 32px) 24px;
    text-align: center;
    color: var(--sa-muted);
    font-size: 12px;
}
.sa-auth-footer a { color: var(--sa-muted); text-decoration: underline; }
.sa-auth-footer a:hover { color: var(--sa-text); }

@media (max-width: 520px) {
    .sa-phone-fallback {
        grid-template-columns: 1fr;
    }
}
