/* ====================================================================
   BRUTAL AUTH - Terminal authentication modal
   Clean implementation, no bullshit
   ==================================================================== */

/* ====================================================================
   MODAL OVERLAY
   ==================================================================== */

.brutal-auth-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
}

.brutal-auth-modal.active {
    display: flex;
}

.brutal-auth-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    backdrop-filter: blur(2px) grayscale(1);
}

/* ====================================================================
   CARD CONTAINER
   ==================================================================== */

.brutal-auth-card-container {
    position: relative;
    z-index: 1;
    width: 500px;
}

/* ====================================================================
   CARD FACES - Simple show/hide (no 3D flip bullshit)
   ==================================================================== */

.auth-face {
    width: 100%;
    background: var(--io-surface-raised);
    border: 2px solid var(--io-border);
    padding: var(--io-space-xl);
    display: none;
    position: relative;
    overflow: hidden;
}

.auth-face.active {
    display: block;
    animation: face-appear 0.3s ease;
}

@keyframes face-appear {
    from {
        opacity: 0;
        transform: scale(0.98);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Glitch effect on login/register faces */
.auth-face-login::before,
.auth-face-register::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, var(--io-accent-subtle), transparent);
    animation: glitch-sweep 2.5s infinite;
    pointer-events: none;
}

@keyframes glitch-sweep {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* ====================================================================
   TERMINAL FACE - CRT aesthetic
   ==================================================================== */

.auth-face-terminal {
    background: var(--io-surface-sunken);
    padding: 0;
    display: none;
    min-height: 280px;
    flex-direction: column;
}

.auth-face-terminal.active {
    display: flex;
}

/* Scanlines */
.auth-face-terminal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.3) 2px,
        rgba(0, 0, 0, 0.3) 4px
    );
    pointer-events: none;
    z-index: 10;
    opacity: 0.2;
}

/* CRT glow */
.auth-face-terminal::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at center, transparent 0%, rgba(0, 0, 0, 0.4) 100%);
    pointer-events: none;
    z-index: 9;
}

.terminal-screen {
    flex: 1;
    padding: var(--io-space-xl);
    overflow-y: auto;
    position: relative;
    z-index: 11;
    font-family: var(--io-font-mono);
    font-size: 13px;
    line-height: 1.6;
}

.terminal-line {
    color: var(--io-text-primary);
    margin-bottom: 4px;
    white-space: pre-wrap;
    word-break: break-word;
}

.terminal-line.prompt { color: var(--io-accent); }
.terminal-line.success { color: var(--io-success); }
.terminal-line.error { color: var(--io-error); }
.terminal-line.info { color: var(--io-info); }
.terminal-line.dim { color: var(--io-text-tertiary); font-size: 11px; }

.terminal-cursor {
    display: inline-block;
    width: 8px;
    height: 14px;
    background: var(--io-accent);
    margin-left: 2px;
    animation: cursor-blink 1s step-end infinite;
}

@keyframes cursor-blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* Flicker effect */
.auth-face-terminal.flicker {
    animation: crt-flicker 0.12s;
}

@keyframes crt-flicker {
    0%, 100% { opacity: 1; }
    30% { opacity: 0.85; }
    60% { opacity: 0.95; }
}

.terminal-footer {
    padding: var(--io-space-md) var(--io-space-xl);
    border-top: 1px solid var(--io-border);
    background: var(--io-surface-base);
    text-align: center;
    font-size: 11px;
    color: var(--io-text-tertiary);
    position: relative;
    z-index: 11;
    font-family: var(--io-font-mono);
    letter-spacing: 0.05em;
}

.terminal-footer.active {
    color: var(--io-accent);
    animation: footer-pulse 1.5s ease-in-out infinite;
}

@keyframes footer-pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* ====================================================================
   FORM STYLING
   ==================================================================== */

.auth-header {
    margin-bottom: var(--io-space-xl);
    text-align: center;
}

.auth-title {
    font-size: 18px;
    color: var(--io-accent);
    text-transform: lowercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--io-space-sm);
    font-weight: normal;
}

.auth-subtitle {
    font-size: 11px;
    color: var(--io-text-tertiary);
    letter-spacing: 0.03em;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: var(--io-space-md);
}

.auth-field {
    display: flex;
    align-items: center;
    gap: var(--io-space-sm);
    padding: 12px;
    background: var(--io-surface-base);
    border: 1px solid var(--io-border);
    transition: all 0.2s ease;
}

.auth-field:focus-within {
    border-color: var(--io-accent);
    box-shadow: 0 0 0 1px var(--io-accent), inset 0 0 12px var(--io-accent-subtle);
}

.auth-field i {
    color: var(--io-accent);
    opacity: 0.6;
    font-size: 14px;
}

.auth-field:focus-within i {
    opacity: 1;
}

.auth-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--io-text-primary);
    font-size: 13px;
    font-family: var(--io-font-primary);
    outline: none;
}

.auth-input::placeholder {
    color: var(--io-text-tertiary);
}

.auth-toggle {
    display: flex;
    align-items: center;
    gap: var(--io-space-md);
    font-size: 11px;
    color: var(--io-text-secondary);
    cursor: pointer;
    user-select: none;
}

.auth-toggle input {
    display: none;
}

.toggle-switch {
    width: 36px;
    height: 18px;
    background: var(--io-surface-base);
    border: 1px solid var(--io-border);
    position: relative;
    transition: all 0.2s ease;
}

.toggle-knob {
    width: 14px;
    height: 14px;
    background: var(--io-text-tertiary);
    position: absolute;
    left: 1px;
    top: 1px;
    transition: all 0.2s ease;
}

.auth-toggle input:checked + .toggle-label .toggle-switch {
    background: var(--io-accent-subtle);
    border-color: var(--io-accent);
}

.auth-toggle input:checked + .toggle-label .toggle-knob {
    left: 19px;
    background: var(--io-accent);
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: var(--io-space-sm);
    cursor: pointer;
}

.auth-button {
    padding: 12px;
    background: var(--io-accent);
    color: var(--io-on-accent);
    border: none;
    font-size: 13px;
    font-weight: 600;
    text-transform: lowercase;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--io-font-primary);
    margin-top: var(--io-space-md);
}

.auth-button:hover {
    background: var(--io-accent-bright);
    box-shadow: 0 0 16px var(--io-accent-glow);
}

.auth-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.auth-link {
    text-align: center;
    margin-top: var(--io-space-lg);
    font-size: 11px;
    color: var(--io-text-tertiary);
}

.auth-link a {
    color: var(--io-accent);
    text-decoration: none;
    cursor: pointer;
}

.auth-link a:hover {
    color: var(--io-accent-bright);
}

/* ====================================================================
   APP FILTER
   ==================================================================== */

#app.auth-active {
    filter: grayscale(1) brightness(0.7);
    transition: filter 0.3s ease;
}

/* Add after .auth-field styles (around line 180) */

.auth-field-password {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--io-text-tertiary);
    cursor: pointer;
    padding: 4px;
    font-size: 14px;
    transition: color 0.2s ease;
}

.password-toggle:hover {
    color: var(--io-accent);
}