/* ============================================================
   GIP - Auth UI - Design tokens (monochrome, Vercel-inspired)

   Tokens here are the source of truth and will be mirrored 1:1
   into tailwind.config.ts in the Next.js admin panel.
   ============================================================ */

:root {
    /* Surfaces */
    --bg-base: #0A0A0A;
    --bg-elevated: #111111;
    --bg-card: rgba(255, 255, 255, 0.02);
    --bg-input: rgba(255, 255, 255, 0.03);

    /* Borders */
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.14);
    --border-focus: rgba(255, 255, 255, 0.28);

    /* Text */
    --fg-primary: #FAFAFA;
    --fg-secondary: #A1A1AA;
    --fg-muted: #71717A;
    --fg-faint: #52525B;

    /* Semantic */
    --danger: #EF4444;
    --warning: #F59E0B;
    --success: #10B981;

    /* Radii */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;

    /* Typography */
    --font-sans: 'Geist', system-ui, -apple-system, sans-serif;
    --font-mono: 'Geist Mono', 'JetBrains Mono', ui-monospace, monospace;

    /* Motion */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --duration-fast: 150ms;
    --duration-base: 250ms;
}

/* Reset & base */

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

html,
body {
    margin: 0;
    padding: 0;
    background: var(--bg-base);
    color: var(--fg-primary);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--fg-primary);
    text-decoration: none;
    transition: opacity var(--duration-fast) var(--ease-out);
}

a:hover {
    opacity: 0.7;
}

/* Background with animated grid */

.auth-bg {
    min-height: 100vh;
    background:
        radial-gradient(ellipse 80% 60% at 50% 0%, rgba(255, 255, 255, 0.03), transparent 70%),
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px) 0 0 / 48px 48px,
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px) 0 0 / 48px 48px,
        var(--bg-base);
    animation: gridShift 80s linear infinite;
}

@keyframes gridShift {
    to {
        background-position: 0 0, 96px 96px, 96px 0, 0 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-bg {
        animation: none;
    }
}

/* Shell + card */

.auth-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    gap: 24px;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 40px;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.02),
        0 20px 60px rgba(0, 0, 0, 0.4);
    animation: cardFadeIn 400ms var(--ease-out);
}

.auth-card--wide {
    max-width: 480px;
}

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

/* Logo / wordmark */

.auth-logo {
    font-family: var(--font-mono);
    font-size: 13px;
    letter-spacing: 0.12em;
    color: var(--fg-primary);
    font-weight: 500;
    text-transform: uppercase;
    margin-bottom: 32px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.auth-logo::before {
    content: '';
    width: 24px;
    height: 24px;
    border: 1px solid var(--fg-primary);
    border-radius: var(--radius-sm);
    display: inline-block;
}

.auth-logo--hero {
    font-size: 28px;
    letter-spacing: 0.18em;
    gap: 16px;
    margin-bottom: 0;
}

.auth-logo--hero::before {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
}

/* Headings */

.auth-h1 {
    font-size: 22px;
    font-weight: 600;
    margin: 0 0 8px;
    letter-spacing: -0.01em;
    color: var(--fg-primary);
}

.auth-subtitle {
    font-size: 14px;
    color: var(--fg-secondary);
    margin: 0 0 32px;
}

/* Form */

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

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

.auth-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--fg-secondary);
    letter-spacing: 0.02em;
}

.auth-input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 11px 14px;
    color: var(--fg-primary);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.4;
    transition:
        border-color var(--duration-fast) var(--ease-out),
        box-shadow var(--duration-fast) var(--ease-out),
        background var(--duration-fast) var(--ease-out);
}

.auth-input::placeholder {
    color: var(--fg-faint);
}

.auth-input:focus {
    outline: none;
    border-color: var(--border-focus);
    background: rgba(255, 255, 255, 0.04);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.04);
}

.auth-input--mono {
    font-family: var(--font-mono);
    letter-spacing: 0.08em;
    text-align: center;
    font-size: 18px;
    padding: 14px;
}

/* Checkbox */

.auth-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.auth-checkbox input[type="checkbox"] {
    appearance: none;
    width: 16px;
    height: 16px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    cursor: pointer;
    position: relative;
    transition:
        background var(--duration-fast),
        border-color var(--duration-fast);
}

.auth-checkbox input[type="checkbox"]:checked {
    background: var(--fg-primary);
    border-color: var(--fg-primary);
}

.auth-checkbox input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    top: 1px;
    left: 4px;
    width: 5px;
    height: 9px;
    border: solid var(--bg-base);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.auth-checkbox span {
    font-size: 13px;
    color: var(--fg-secondary);
}

/* Buttons */

.auth-btn {
    width: 100%;
    border: 0;
    border-radius: var(--radius-md);
    padding: 12px 18px;
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition:
        opacity var(--duration-fast) var(--ease-out),
        background var(--duration-fast) var(--ease-out);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.auth-btn--primary {
    background: var(--fg-primary);
    color: var(--bg-base);
}

.auth-btn--primary:hover {
    opacity: 0.88;
}

.auth-btn--primary:active {
    opacity: 0.75;
}

.auth-btn--ghost {
    background: transparent;
    color: var(--fg-secondary);
    border: 1px solid var(--border-subtle);
}

.auth-btn--ghost:hover {
    color: var(--fg-primary);
    border-color: var(--border-strong);
}

.auth-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Inline link group below form */

.auth-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    font-size: 13px;
    color: var(--fg-secondary);
}

.auth-meta a {
    color: var(--fg-primary);
}

/* Divider */

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 24px 0;
    color: var(--fg-faint);
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-family: var(--font-mono);
}

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

/* Error / status messages */

.auth-alert {
    padding: 12px 14px;
    border-radius: var(--radius-md);
    border: 1px solid;
    font-size: 13px;
    margin-bottom: 16px;
    line-height: 1.5;
}

.auth-alert--error {
    background: rgba(239, 68, 68, 0.06);
    border-color: rgba(239, 68, 68, 0.24);
    color: #FCA5A5;
}

.auth-alert--success {
    background: rgba(16, 185, 129, 0.06);
    border-color: rgba(16, 185, 129, 0.24);
    color: #6EE7B7;
}

.auth-alert--info {
    background: rgba(255, 255, 255, 0.03);
    border-color: var(--border-subtle);
    color: var(--fg-secondary);
}

.auth-validation {
    font-size: 12px;
    color: var(--danger);
    margin-top: 4px;
}

/* QR + secret box for 2FA setup */

.auth-qr {
    background: var(--fg-primary);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    justify-content: center;
    margin: 0 auto 16px;
    max-width: fit-content;
}

.auth-qr img,
.auth-qr svg {
    display: block;
    max-width: 192px;
    height: auto;
}

.auth-secret {
    font-family: var(--font-mono);
    font-size: 13px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 12px;
    color: var(--fg-secondary);
    text-align: center;
    letter-spacing: 0.1em;
    margin-bottom: 16px;
    word-break: break-all;
}

/* Recovery codes grid */

.auth-recovery {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 16px;
}

.auth-recovery code {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--fg-primary);
    padding: 6px 10px;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    text-align: center;
    letter-spacing: 0.05em;
}

/* Footer */

.auth-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--fg-faint);
    letter-spacing: 0.08em;
}

.auth-footer .muted {
    color: var(--fg-faint);
}

/* Utility */

.mono {
    font-family: var(--font-mono);
}

.muted {
    color: var(--fg-muted);
}

.text-center {
    text-align: center;
}
