/* ═══════════════════════════════════════════════════════════════
   Trellar — Sign In
   Full-bleed layout: agent-constellation canvas behind everything,
   a single floating glass card carries the form. Palette, fonts and
   card language are shared with the landing page for continuity.
   ═══════════════════════════════════════════════════════════════ */

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-page:        #f9f8fc;
    --bg-card:        rgba(255, 255, 255, 0.92);

    --text-primary:   #1e1b4b;
    --text-secondary: #5b5780;
    --text-muted:     #7d7999;

    --accent-orange:  rgba(176, 113, 49, 0.9);
    --accent-purple:  #7c3aed;
    --accent-green:   #16a34a;
    --accent-teal:    #0f766e;

    --btn-primary-bg:   #1e1b4b;
    --btn-primary-text: #ffffff;

    --border-light: rgba(30, 27, 75, 0.16);
    --border-card:  rgba(30, 27, 75, 0.12);

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;

    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html, body { height: 100%; }

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Exo 2', sans-serif;
    background: var(--bg-page);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    line-height: 1.6;
}

a { text-decoration: none; color: inherit; }

/* ═══════════════════════════════════════════════════════════════
   BACKGROUND CANVAS
   ═══════════════════════════════════════════════════════════════ */

#loginCanvas,
#twofaCanvas {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    display: block;
    pointer-events: none;
}

/* ═══════════════════════════════════════════════════════════════
   BRAND MARK (top-left, links back to the landing page)
   ═══════════════════════════════════════════════════════════════ */

.brand-mark {
    position: fixed;
    top: 28px;
    left: 32px;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: opacity 0.2s ease;
}

.brand-mark:hover { opacity: 0.75; }

.brand-mark-icon { width: 30px; height: 30px; }

.brand-mark-icon .trellar-cube { --cube-size: 30px; }

.brand-mark-text {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.03em;
}

/* ═══════════════════════════════════════════════════════════════
   PAGE / CARD LAYOUT
   ═══════════════════════════════════════════════════════════════ */

.login-page {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
}

.login-card {
    width: 100%;
    max-width: 440px;
    max-height: 100%;
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.98);
    border-radius: var(--radius-xl);
    padding: 30px 36px 24px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 8px 48px rgba(30, 27, 75, 0.12);
    position: relative;
    z-index: 1;
    animation: cardFadeUp 0.75s cubic-bezier(0.22, 1, 0.36, 1) both;
}

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

/* ─── Header ─── */
.login-header .trellar-cube {
    --cube-size: 110px;
    margin: 0 auto 14px;
}

.login-header h1 {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.2;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.login-header p {
    font-size: 0.87rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 20px;
}

/* ─── Form ─── */
.login-form { display: flex; flex-direction: column; gap: 12px; }

.form-field { display: flex; flex-direction: column; gap: 6px; }

.form-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.01em;
}

.input-wrap { position: relative; }

.input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    pointer-events: none;
    transition: color 0.2s ease;
}

.input-wrap:focus-within .input-icon { color: var(--accent-purple); }

.form-input {
    width: 100%;
    padding: 10px 16px 10px 42px;
    background: #ffffff;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    transition: var(--transition);
}

.form-input::placeholder { color: var(--text-muted); }

.form-input:focus {
    border-color: rgba(124, 58, 237, 0.35);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.08);
}

/* ─── Submit ─── */
.login-submit {
    width: 100%;
    padding: 12px 24px;
    margin-top: 4px;
    background: var(--btn-primary-bg);
    color: #ffffff;
    border: none;
    border-radius: 100px;
    font-size: 0.95rem;
    font-weight: 700;
    font-family: inherit;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 16px rgba(30, 27, 75, 0.2);
}

.login-submit:hover {
    background: #2d2a63;
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(30, 27, 75, 0.28);
}

.login-submit:active { transform: translateY(0); }

.login-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* ─── See · Control · Trust legend ─── */
.login-legend {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--border-light);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.03em;
}

.legend-item svg {
    width: 13px;
    height: 13px;
    stroke: var(--accent-purple);
    flex-shrink: 0;
}

.legend-sep {
    color: var(--border-light);
    font-size: 0.7rem;
}

/* ─── Divider ─── */
.divider {
    display: flex;
    align-items: center;
    margin: 16px 0 12px;
    gap: 12px;
    color: var(--text-muted);
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-light);
}

/* ─── Social buttons ─── */
.social-btns { display: flex; flex-direction: column; gap: 8px; }

.social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 9px 16px;
    background: #ffffff;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.87rem;
    font-weight: 600;
    font-family: inherit;
    transition: var(--transition);
}

.social-btn:hover {
    border-color: rgba(30, 27, 75, 0.22);
    background: #fbfaff;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(30, 27, 75, 0.08);
}

.social-btn svg { width: 18px; height: 18px; flex-shrink: 0; }

/* ─── Register link ─── */
.register-link {
    margin-top: 14px;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.register-link a {
    color: var(--accent-purple);
    font-weight: 600;
    transition: opacity 0.2s ease;
}

.register-link a:hover { opacity: 0.75; }

/* ─── OTP code input (2FA step) ─── */
.otp-input {
    padding: 12px 16px;
    text-align: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.4rem;
    font-weight: 600;
    letter-spacing: 0.5em;
}

.otp-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 10px;
}

.back-to-login {
    margin-top: 14px;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.back-to-login a {
    color: var(--accent-purple);
    font-weight: 600;
    transition: opacity 0.2s ease;
}

.back-to-login a:hover { opacity: 0.75; }

/* ─── Errors ─── */
.error-box {
    margin-top: 18px;
    padding: 13px 16px;
    background: rgba(220, 38, 38, 0.06);
    border: 1px solid rgba(220, 38, 38, 0.22);
    border-radius: var(--radius-md);
    animation: errorSlideIn 0.25s ease;
}

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

.error-box ul { list-style: none; }

.error-box li {
    color: #dc2626;
    font-size: 0.82rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.error-box li::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #dc2626;
    flex-shrink: 0;
}

/* ─── Footer micro-copy ─── */
.login-footer {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.login-footer svg {
    width: 13px;
    height: 13px;
    stroke: var(--accent-green);
    flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 480px) {
    .brand-mark { top: 16px; left: 16px; }
    .login-page { padding: 14px; }
    .login-card { padding: 24px 20px 20px; }
    .login-header h1 { font-size: 1.4rem; }
    .login-legend { flex-wrap: wrap; row-gap: 8px; }
}

/* Short viewports (small laptops, browser windows with lots of chrome) */
@media (max-height: 700px) {
    .brand-mark { top: 14px; }
    .login-page { padding: 12px; }
    .login-card { padding: 20px 32px 18px; }
    .login-header .trellar-cube { --cube-size: 80px; margin-bottom: 10px; }
    .login-header h1 { font-size: 1.4rem; margin-bottom: 6px; }
    .login-header p { margin-bottom: 14px; }
    .login-form { gap: 10px; }
    .login-legend { margin-top: 12px; padding-top: 10px; }
    .divider { margin: 12px 0 10px; }
    .social-btns { gap: 6px; }
    .register-link { margin-top: 10px; }
    .login-footer { margin-top: 12px; padding-top: 10px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
