/* ============================================================
   TasFacturatie - Unified Auth Pages Design System
   Used by: login.php, verify-2fa.php, auth/forgot-password.php,
            auth/register.php, auth/reset-password.php
   ============================================================ */

:root {
    --tf-primary: #137FEC;
    --tf-primary-dark: #0D5FB8;
    --tf-primary-light: #4FA8FF;
    --tf-primary-50: rgba(19, 127, 236, 0.08);
    --tf-primary-100: rgba(19, 127, 236, 0.16);
    --tf-ink: #0A1628;
    --tf-text: #1a202c;
    --tf-muted: #64748b;
    --tf-border: #e2e8f0;
    --tf-bg-soft: #f8fafc;
    --tf-success: #10b981;
    --tf-danger: #ef4444;
    --tf-warning: #f59e0b;
    --tf-card-radius: 22px;
    --tf-input-radius: 12px;
    --tf-btn-radius: 12px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
}

body.tf-auth {
    min-height: 100vh;
    min-height: 100dvh;
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--tf-text);
    background: #061833;
    background:
        radial-gradient(ellipse at top left, rgba(79, 168, 255, 0.18) 0%, transparent 50%),
        radial-gradient(ellipse at bottom right, rgba(13, 95, 184, 0.35) 0%, transparent 55%),
        linear-gradient(135deg, #061833 0%, #0c2552 45%, #0d5fb8 100%);
    background-attachment: fixed;
    position: relative;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    padding: 2rem 1rem 5rem;
}

/* Decorative blurred orbs in the background */
body.tf-auth::before,
body.tf-auth::after {
    content: '';
    position: fixed;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.45;
    pointer-events: none;
    z-index: 0;
}
body.tf-auth::before {
    width: 480px;
    height: 480px;
    background: radial-gradient(circle, #4FA8FF 0%, transparent 70%);
    top: -160px;
    left: -160px;
}
body.tf-auth::after {
    width: 560px;
    height: 560px;
    background: radial-gradient(circle, #137FEC 0%, transparent 70%);
    bottom: -200px;
    right: -200px;
}

/* ====== Layout ====== */
.tf-auth-shell {
    width: 100%;
    max-width: 460px;
    margin: auto;
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.tf-auth-shell.is-wide { max-width: 560px; }

/* ====== Card ====== */
.tf-card {
    background: #ffffff;
    border-radius: var(--tf-card-radius);
    box-shadow:
        0 30px 80px -20px rgba(6, 24, 51, 0.55),
        0 12px 30px -8px rgba(13, 95, 184, 0.25);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.6);
}

.tf-card-body {
    padding: 2.25rem 2.25rem 2rem;
}

/* ====== Logo ====== */
.tf-logo-wrap {
    text-align: center;
    margin-bottom: 1.5rem;
}
.tf-logo {
    display: inline-block;
    height: 44px;
    width: auto;
    max-width: 100%;
}
.tf-logo-icon { height: 64px; }
.tf-logo-full { height: 48px; }

/* ====== Heading ====== */
.tf-heading {
    text-align: center;
    margin-bottom: 1.75rem;
}
.tf-heading h1 {
    margin: 0 0 0.4rem;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--tf-ink);
    letter-spacing: -0.02em;
}
.tf-heading p {
    margin: 0;
    color: var(--tf-muted);
    font-size: 0.95rem;
}
.tf-heading .tf-email-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.5rem;
    padding: 0.35rem 0.85rem;
    background: var(--tf-primary-50);
    color: var(--tf-primary-dark);
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 500;
    word-break: break-all;
}

/* ====== Section divider ====== */
.tf-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.25rem 0 1rem;
    color: #94a3b8;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}
.tf-divider::before,
.tf-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--tf-border);
}

/* ====== Trial badge ====== */
.tf-trial-badge {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.85rem 1rem;
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
    border-radius: 12px;
    font-size: 0.85rem;
    margin-bottom: 1.25rem;
    border: 1px solid rgba(16, 185, 129, 0.2);
}
.tf-trial-badge i { font-size: 1.1rem; color: #059669; }

.tf-plan-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.65rem;
    padding: 0.4rem 0.9rem;
    background: linear-gradient(135deg, var(--tf-primary) 0%, var(--tf-primary-dark) 100%);
    color: white;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 500;
    box-shadow: 0 4px 14px rgba(19, 127, 236, 0.35);
}

/* ====== Forms ====== */
.tf-field {
    margin-bottom: 1.1rem;
}
.tf-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--tf-ink);
    margin-bottom: 0.45rem;
    letter-spacing: 0.01em;
}
.tf-label .tf-required { color: var(--tf-danger); }

.tf-input-group {
    position: relative;
    display: flex;
    align-items: stretch;
    background: #fff;
    border: 1.5px solid var(--tf-border);
    border-radius: var(--tf-input-radius);
    transition: all 0.18s ease;
    overflow: hidden;
}
.tf-input-group:hover { border-color: #cbd5e1; }
.tf-input-group:focus-within {
    border-color: var(--tf-primary);
    box-shadow: 0 0 0 4px var(--tf-primary-100);
}

.tf-input-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    color: var(--tf-muted);
    background: transparent;
    flex-shrink: 0;
    font-size: 1.05rem;
    border-right: 1px solid var(--tf-border);
}

.tf-input {
    flex: 1;
    width: 100%;
    border: 0;
    outline: 0;
    padding: 0.85rem 0.95rem;
    font-size: 0.95rem;
    color: var(--tf-ink);
    background: transparent;
    min-height: 50px;
    font-family: inherit;
}
.tf-input::placeholder { color: #94a3b8; }
.tf-input:disabled { background: var(--tf-bg-soft); cursor: not-allowed; }

/* Inputs without left icon */
.tf-input-group.tf-no-icon .tf-input {
    padding-left: 1.1rem;
}

/* Right-side toggle button (e.g. show password) */
.tf-input-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    background: transparent;
    color: var(--tf-muted);
    border: 0;
    border-left: 1px solid var(--tf-border);
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease;
    font-size: 1rem;
    flex-shrink: 0;
}
.tf-input-toggle:hover { color: var(--tf-primary); background: var(--tf-primary-50); }
.tf-input-toggle:focus-visible { outline: 2px solid var(--tf-primary); outline-offset: -2px; }

/* Two-column form rows */
.tf-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem;
}
.tf-row-3-1 { grid-template-columns: 2fr 1fr; }

/* Code input (2FA) */
.tf-code-input {
    text-align: center;
    font-size: 1.6rem;
    letter-spacing: 0.55em;
    font-family: 'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace;
    font-weight: 600;
    color: var(--tf-ink);
    padding: 1rem 0.5rem;
    text-indent: 0.55em; /* visually center letter-spaced text */
}
.tf-code-input::placeholder {
    letter-spacing: 0.35em;
    color: #cbd5e1;
}

/* Checkbox */
.tf-check {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    margin-bottom: 1.25rem;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--tf-text);
    line-height: 1.45;
}
.tf-check input[type="checkbox"] {
    margin-top: 0.18rem;
    width: 18px;
    height: 18px;
    accent-color: var(--tf-primary);
    cursor: pointer;
    flex-shrink: 0;
}
.tf-check a {
    color: var(--tf-primary);
    text-decoration: none;
    font-weight: 500;
}
.tf-check a:hover { text-decoration: underline; }

/* ====== Buttons ====== */
.tf-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    width: 100%;
    border: 0;
    border-radius: var(--tf-btn-radius);
    padding: 0.95rem 1.25rem;
    font-size: 0.97rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
    min-height: 52px;
    text-decoration: none;
    line-height: 1.2;
    letter-spacing: 0.01em;
}
.tf-btn:disabled { opacity: 0.7; cursor: not-allowed; }

.tf-btn-primary {
    background: linear-gradient(135deg, var(--tf-primary) 0%, var(--tf-primary-dark) 100%);
    color: white;
    box-shadow: 0 8px 24px -8px rgba(19, 127, 236, 0.55);
}
.tf-btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 14px 32px -10px rgba(19, 127, 236, 0.7);
}
.tf-btn-primary:active:not(:disabled) { transform: translateY(0); }

.tf-btn-ghost {
    background: transparent;
    color: var(--tf-muted);
    border: 1.5px solid var(--tf-border);
}
.tf-btn-ghost:hover:not(:disabled) {
    color: var(--tf-primary);
    border-color: var(--tf-primary);
    background: var(--tf-primary-50);
}

/* ====== Alerts ====== */
.tf-alert {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    font-size: 0.88rem;
    margin-bottom: 1.1rem;
    line-height: 1.5;
    border: 1px solid transparent;
}
.tf-alert i { font-size: 1.05rem; flex-shrink: 0; margin-top: 0.05rem; }
.tf-alert-danger {
    background: #fef2f2;
    color: #991b1b;
    border-color: #fecaca;
}
.tf-alert-success {
    background: #f0fdf4;
    color: #166534;
    border-color: #bbf7d0;
}
.tf-alert-info {
    background: #eff6ff;
    color: #1e40af;
    border-color: #bfdbfe;
}

/* ====== Helper rows / links ====== */
.tf-row-helpers {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.4rem;
    font-size: 0.85rem;
}
.tf-link {
    color: var(--tf-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.15s ease;
}
.tf-link:hover { color: var(--tf-primary-dark); text-decoration: underline; }
.tf-link-muted { color: var(--tf-muted); }
.tf-link-muted:hover { color: var(--tf-ink); }

.tf-foot-link {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.4rem;
    border-top: 1px solid var(--tf-border);
    color: var(--tf-muted);
    font-size: 0.9rem;
}
.tf-foot-link a { color: var(--tf-primary); font-weight: 600; text-decoration: none; }
.tf-foot-link a:hover { text-decoration: underline; }

/* Page-level footer (copyright) */
.tf-page-footer {
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.78rem;
    padding: 0.5rem 0 0;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
.tf-page-footer a {
    color: rgba(255, 255, 255, 0.95);
    text-decoration: none;
    margin: 0 0.4rem;
    font-weight: 500;
}
.tf-page-footer a:hover { text-decoration: underline; }

/* ====== Tablet ====== */
@media (max-width: 768px) {
    body.tf-auth { padding: 1.5rem 0.85rem 4rem; }
    .tf-card-body { padding: 1.75rem 1.5rem 1.5rem; }
    .tf-heading h1 { font-size: 1.4rem; }
}

/* ====== Mobile ====== */
@media (max-width: 480px) {
    body.tf-auth { padding: 1rem 0.6rem 3.5rem; }
    .tf-card { border-radius: 18px; }
    .tf-card-body { padding: 1.4rem 1.15rem 1.25rem; }
    .tf-logo-full { height: 38px; }
    .tf-logo-icon { height: 56px; }
    .tf-heading { margin-bottom: 1.25rem; }
    .tf-heading h1 { font-size: 1.25rem; }
    .tf-heading p { font-size: 0.875rem; }
    .tf-input { font-size: 16px; min-height: 48px; } /* Avoid iOS zoom */
    .tf-input-icon { width: 42px; }
    .tf-btn { min-height: 50px; font-size: 0.95rem; }
    .tf-row { grid-template-columns: 1fr; gap: 0; }
    .tf-row .tf-field { margin-bottom: 1rem; }
    .tf-row.tf-keep-cols { grid-template-columns: 1fr 1fr; gap: 0.65rem; }
    .tf-code-input { font-size: 1.35rem; letter-spacing: 0.4em; text-indent: 0.4em; }
}

/* ====== Tiny screens ====== */
@media (max-width: 360px) {
    .tf-card-body { padding: 1.15rem 1rem 1rem; }
    .tf-heading h1 { font-size: 1.15rem; }
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
    .tf-btn, .tf-input-group, .tf-link { transition: none; }
    .tf-btn-primary:hover:not(:disabled) { transform: none; }
}

/* ====== Utility helpers (no Bootstrap dependency) ====== */
.d-none { display: none !important; }
.spinner-border {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    vertical-align: -0.125em;
    border: 0.18em solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: tf-spin .75s linear infinite;
}
.spinner-border-sm { width: 0.95rem; height: 0.95rem; border-width: 0.16em; }
@keyframes tf-spin { to { transform: rotate(360deg); } }

/* Session-expired splash (used on CSRF failure) */
.tf-splash {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.tf-splash-card {
    background: white;
    border-radius: var(--tf-card-radius);
    padding: 2.25rem 2rem;
    box-shadow: 0 30px 80px -20px rgba(6, 24, 51, 0.55);
    text-align: center;
    max-width: 400px;
    width: 100%;
}
.tf-splash-card i { font-size: 2.75rem; color: var(--tf-warning); }
.tf-splash-card h4 { margin: 0.85rem 0 0.4rem; color: var(--tf-ink); font-weight: 700; }
.tf-splash-card p { color: var(--tf-muted); font-size: 0.9rem; margin: 0 0 1rem; line-height: 1.5; }
.tf-splash-card .spinner-border { color: var(--tf-primary); width: 1.4rem; height: 1.4rem; }
