/* ═══════════════════════════════════════════════════
   AI Terminal Login — Terminal/Cyberpunk Theme v2
   Enhanced: accessibility, reduced-motion, focus
   ═══════════════════════════════════════════════════ */

/* ── Font ── */
@font-face {
    font-family: 'Terminal';
    src: url('/static/FZXS16.ttf') format('truetype');
    font-display: swap;
    font-weight: normal;
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f5f5;
    color: #333333;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    line-height: 1.6;
}

/* CRT scanlines removed — light theme */

/* ── Terminal window ── */
.terminal-window {
    width: 100%;
    max-width: 360px;
    background: #ffffff;
    border: none;
    border-radius: 10px;
    box-shadow:
        0 0px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    animation: terminalIn 0.4s ease-out;
}

@keyframes terminalIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Title bar ── */
.term-titlebar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
}

.term-dots {
    display: flex;
    gap: 5px;
    flex-shrink: 0;
}
.term-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}
.term-dot.red   { background: #ff5f57; box-shadow: 0 0 6px rgba(255,95,87,0.2); }
.term-dot.amber { background: #febc2e; box-shadow: 0 0 6px rgba(254,188,46,0.2); }
.term-dot.green { background: #3498db; box-shadow: 0 0 6px rgba(52,152,219,0.3); }

.term-title {
    font-size: 0.72rem;
    color: #666666;
    letter-spacing: 0.04em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Body ── */
.term-body {
    padding: 14px 14px 12px;
    font-size: 0.72rem;
}

/* ── ASCII banner ── */
.ascii-banner {
    font-size: 0.32rem;
    line-height: 1.1;
    white-space: pre;
    text-align: center;
    color: #3498db;
    text-shadow: none;
    margin-bottom: 2px;
    user-select: none;
}

.banner-sub {
    text-align: center;
    font-size: 0.55rem;
    color: #3498db;
    letter-spacing: 0.25em;
    text-shadow: none;
    margin-bottom: 10px;
    user-select: none;
}

/* ── Terminal line ── */
.term-line {
    font-size: 0.62rem;
    color: #555555;
    margin-bottom: 10px;
    padding-left: 2px;
}
.prompt        { color: #3498db; }
.prompt-user   { color: #3498db; text-shadow: 0 0 4px rgba(52,152,219,0.3); }

/* ── Form fields ── */
.form-fields {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.input-label {
    font-size: 0.6rem;
    color: #666666;
    letter-spacing: 0.05em;
    padding-left: 2px;
}

.input-group input[type="tel"],
.input-group input[type="password"],
.input-group input[type="text"] {
    width: 100%;
    padding: 8px 10px;
    background: #ffffff;
    border: 1px dashed #e0e0e0;
    border-radius: 6px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 0.75rem;
    color: #333333;
    caret-color: #3498db;
    transition: border-color 0.3s;
    outline: none;
}

.input-group input::placeholder {
    color: #aaaaaa;
    opacity: 1;
}

.input-group input:hover {
    border-color: #e0e0e0;
}

.input-group input:focus-visible {
    border-color: #3399ff;
    box-shadow: none;
}

.input-group input.input-error-state {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.input-error {
    font-size: 0.6rem;
    color: #ef4444;
    min-height: 1.2em;
    padding-left: 2px;
    transition: opacity 200ms ease;
}

/* ── Password wrapper ── */
.password-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrap input {
    padding-right: 44px !important;
}

.pw-toggle {
    position: absolute;
    right: 2px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    min-width: 32px;
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999999;
    font-size: 0.75rem;
    border-radius: 0px;
    transition: color 200ms ease, background-color 200ms ease;
    line-height: 1;
}
.pw-toggle:hover {
    color: #3498db;
    background: rgba(52, 152, 219, 0.06);
}

/* ── Login button ── */
.login-btn {
    width: 100%;
    padding: 9px;
    background: #4A90D9;
    color: #ffffff;
    border: none;
    border-radius: 20px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 0.75rem;
    font-weight: bold;
    cursor: pointer;
    letter-spacing: 0.04em;
    text-shadow: none;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 36px;
}

.login-btn:hover {
    background: #3a7bc8;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,102,255,0.2);
}

.login-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(52,152,219,0.15);
}

.login-btn:active:not(:disabled) {
    transform: translateY(0) !important;
}

.login-btn:disabled {
    opacity: 0.7;
    cursor: wait;
}

/* ── Button spinner ── */
.btn-text    { display: inline; }
.btn-spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(52,152,219,0.25);
    border-top-color: #3498db;
    border-radius: 50%;
    animation: spin 600ms linear infinite;
}
.login-btn.loading .btn-text    { display: none; }
.login-btn.loading .btn-spinner { display: inline-block; }

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

/* ── Message ── */
.message {
    min-height: 1.4em;
    margin-top: 8px;
    font-size: 0.6rem;
    letter-spacing: 0.03em;
    transition: color 200ms ease;
}
.message.success { color: #3498db; }
.message.error   { color: #ef4444; }

/* ── Footer ── */
.term-footer {
    margin-top: 12px;
    text-align: center;
    font-size: 0.5rem;
    color: #aaaaaa;
    letter-spacing: 0.06em;
}

.blink {
    color: #3498db;
    animation: blink-cursor 1s step-end infinite;
}
@keyframes blink-cursor {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0; }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .terminal-window { animation: none; }
}

/* ── Responsive ── */
@media (max-width: 480px) {
    body { padding: 0.5rem; }
    .terminal-window { max-width: 100%; border-radius: 0px; }
    .term-body { padding: 16px 14px 14px; }
    .ascii-banner { font-size: 0.32rem; }
    .input-group input[type="tel"],
    .input-group input[type="password"],
    .input-group input[type="text"] {
        padding: 14px 12px;
        font-size: 1rem; /* prevent iOS zoom on focus */
    }
    .login-btn { padding: 16px; font-size: 0.9rem; }
}
