/* ----------------------------------------------------------------
 * Meshpoint local-dashboard auth pages (/setup and /login).
 *
 * Design-system compliance:
 *   - Reuses canonical tokens declared in dashboard.css (no new
 *     :root, no new fonts).
 *   - Single component prefix `auth-` (BEM).
 *   - Cyan/green over deep navy palette only.
 *   - Boot-in fade is the personality detail for these pages,
 *     reinforced by the radar sweep and the live identity strip.
 * ---------------------------------------------------------------- */

html.auth-shell, html.auth-shell body {
    height: 100vh;
    overflow: hidden;
}

body.auth-body {
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-sans);
}

/* ---- Stage + card ---- */
.auth-stage {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    gap: 1.75rem;
    animation: auth-boot 480ms ease-out both;
}

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

.auth-card {
    width: 100%;
    max-width: 440px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 1.5rem;
}

/* ---- Radar visual ---- */
.auth-radar {
    width: 280px;
    height: 280px;
    margin: 0 auto;
    position: relative;
    border-radius: 50%;
}

.auth-radar__rings {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.auth-radar__sweep {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: conic-gradient(
        from 0deg,
        rgba(6, 182, 212, 0.18) 0deg,
        rgba(6, 182, 212, 0.10) 30deg,
        rgba(6, 182, 212, 0.04) 60deg,
        rgba(6, 182, 212, 0.0)  90deg,
        rgba(6, 182, 212, 0.0)  360deg
    );
    animation: auth-radar-rotate 6s linear infinite;
    transform-origin: center;
    mask: radial-gradient(circle at center, black 0%, black 99%, transparent 100%);
    -webkit-mask: radial-gradient(circle at center, black 0%, black 99%, transparent 100%);
}

@keyframes auth-radar-rotate {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.auth-radar__center {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 6px;
    height: 6px;
    background: var(--accent-green);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 6px var(--accent-green), 0 0 14px rgba(0, 229, 160, 0.5);
    z-index: 2;
}

.auth-radar__center::after {
    content: '';
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    border: 1px solid rgba(0, 229, 160, 0.4);
    animation: auth-radar-pulse 2.4s ease-out infinite;
}

@keyframes auth-radar-pulse {
    0%   { transform: scale(0.5); opacity: 1; }
    100% { transform: scale(2.5); opacity: 0; }
}

/* ---- Live blips ---- */
.auth-radar__blip {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    background: rgba(0, 229, 160, 0.9);
    box-shadow: 0 0 8px rgba(0, 229, 160, 0.6);
    animation: auth-radar-blip 6s ease-out forwards;
    z-index: 1;
}

.auth-radar__blip--strong {
    background: rgba(0, 229, 160, 0.95);
    box-shadow: 0 0 12px rgba(0, 229, 160, 0.8);
}

.auth-radar__blip--medium {
    background: rgba(255, 184, 77, 0.9);
    box-shadow: 0 0 10px rgba(255, 184, 77, 0.6);
}

.auth-radar__blip--weak {
    background: rgba(120, 160, 200, 0.85);
    box-shadow: 0 0 6px rgba(120, 160, 200, 0.4);
}

@keyframes auth-radar-blip {
    0%   { transform: translate(-50%, -50%) scale(0.6); opacity: 0; }
    10%  { transform: translate(-50%, -50%) scale(1.6); opacity: 1; }
    35%  { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(0.8); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .auth-radar__blip { animation-duration: 1s; }
}

/* ---- Identity strip ---- */
.auth-identity {
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 0.65rem 0;
    text-align: center;
    font-family: var(--font-mono);
    line-height: 1.6;
}

.auth-identity__name {
    font-size: 0.8rem;
    color: var(--text-primary);
    font-weight: 600;
    letter-spacing: 0.02em;
}

.auth-identity__meta {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.auth-identity__val  { color: var(--accent-cyan); }
.auth-identity__live { color: var(--accent-green); }

.auth-identity__sep {
    color: var(--text-muted);
    margin: 0 0.4rem;
    opacity: 0.6;
}

/* ---- Heading + copy ---- */
.auth-heading {
    text-align: center;
    margin-bottom: -0.25rem;
}

.auth-heading__title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent-cyan);
    margin-bottom: 0.35rem;
}

.auth-heading__sub {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

/* ---- Form ---- */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.auth-input-wrap { position: relative; }

.auth-input {
    width: 100%;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    padding: 0.7rem 0.9rem;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.auth-input:focus {
    border-color: var(--accent-cyan);
    box-shadow: var(--glow-cyan);
}

.auth-input--error {
    border-color: var(--accent-red);
    animation: auth-input-shake 0.35s ease-out;
}

@keyframes auth-input-shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

.auth-error {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--accent-red);
    min-height: 1rem;
    margin-top: -0.25rem;
    padding-left: 0.2rem;
    line-height: 1.5;
}

/* ---- Setup-only password rules ---- */
.auth-rules {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding: 0.25rem 0.2rem 0;
}

.auth-rule {
    font-size: 0.7rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: color 0.2s;
}

.auth-rule__dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--text-muted);
    opacity: 0.5;
    transition: background 0.2s, opacity 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
}

.auth-rule--ok { color: var(--accent-green); }
.auth-rule--ok .auth-rule__dot {
    background: var(--accent-green);
    opacity: 1;
    box-shadow: 0 0 5px var(--accent-green);
}

/* ---- Submit button ---- */
.auth-button {
    width: 100%;
    padding: 0.85rem;
    background: var(--accent-cyan);
    color: var(--bg-primary);
    border: none;
    border-radius: var(--radius);
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: box-shadow 0.15s, opacity 0.15s, background 0.15s, transform 0.05s;
}

.auth-button:hover:not(:disabled) {
    box-shadow: 0 0 14px rgba(6, 182, 212, 0.55);
}

.auth-button:active:not(:disabled) {
    transform: translateY(1px);
}

.auth-button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.auth-button--loading .auth-button__label,
.auth-button--loading .auth-button__arrow { display: none; }
.auth-button--loading .auth-button__dots   { display: inline-flex; }

.auth-button__dots { display: none; gap: 0.4rem; }

.auth-button__dots span {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--bg-primary);
    animation: auth-dot-pulse 1.1s ease-in-out infinite;
}

.auth-button__dots span:nth-child(2) { animation-delay: 0.2s; }
.auth-button__dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes auth-dot-pulse {
    0%, 80%, 100% { opacity: 0.3; }
    40%           { opacity: 1; }
}

/* ---- Recovery / SSH hint ---- */
.auth-recovery {
    border-top: 1px dashed var(--border);
    padding-top: 0.85rem;
    margin-top: 0.25rem;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
    line-height: 1.55;
}

.auth-recovery__label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.4rem;
}

.auth-recovery__cmd {
    display: block;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--accent-cyan);
    padding: 0.4rem 0.6rem;
    margin: 0.15rem auto;
    width: fit-content;
    max-width: 100%;
    overflow-x: auto;
    white-space: nowrap;
    font-size: 0.7rem;
}

/* ---- Footer ---- */
.auth-footer {
    text-align: center;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--text-muted);
    letter-spacing: 0.04em;
    z-index: 1;
}

.auth-footer__sep { margin: 0 0.5rem; opacity: 0.6; }

.auth-footer a {
    color: var(--text-muted);
    text-decoration: none;
    border-bottom: 1px dotted var(--text-muted);
}

.auth-footer a:hover {
    color: var(--accent-cyan);
    border-bottom-color: var(--accent-cyan);
}

/* ---- Reduced motion respect ---- */
@media (prefers-reduced-motion: reduce) {
    .auth-radar__sweep,
    .auth-radar__center::after,
    .auth-button__dots span,
    .auth-stage {
        animation: none !important;
    }
}
