/**
 * InvoiceLink Auth — Ink panel + clean paper form
 */

:root {
    --auth-ink: #0f172a;
    --auth-ink-soft: #1e293b;
    --auth-accent: #4f46e5;
    --auth-accent-hover: #4338ca;
    --auth-accent-soft: #eef2ff;
    --auth-text: #0f172a;
    --auth-muted: #64748b;
    --auth-hero: linear-gradient(145deg, #0f172a 0%, #1e293b 50%, #312e81 100%);
}

html {
    overflow-x: hidden;
}

body.auth-page {
    font-family: 'Plus Jakarta Sans', -apple-system, sans-serif;
    background: var(--auth-hero);
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(20px, 4vw, 40px);
    position: relative;
    overflow-x: hidden;
    width: 100%;
    box-sizing: border-box;
}

body.auth-page::before,
body.auth-page::after {
    content: '';
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    pointer-events: none;
    z-index: 0;
}

body.auth-page::before {
    width: min(480px, 75vw);
    height: min(480px, 75vw);
    top: -140px;
    right: 0;
    background: radial-gradient(circle, rgba(79, 70, 229, 0.25) 0%, transparent 70%);
}

body.auth-page::after {
    width: min(360px, 60vw);
    height: min(360px, 60vw);
    bottom: -100px;
    left: 0;
    background: radial-gradient(circle, rgba(30, 41, 59, 0.5) 0%, transparent 70%);
}

.auth-shell {
    position: relative;
    z-index: 10;
    width: min(920px, calc(100vw - 48px));
    max-width: 920px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.99);
    border-radius: 24px;
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.35);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.12);
    flex-shrink: 0;
}

.auth-shell--split {
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.auth-shell--single {
    width: min(560px, calc(100vw - 48px));
    max-width: 560px;
    padding: clamp(36px, 5vw, 56px);
}

.auth-shell--single.auth-shell--wide {
    max-width: 600px;
    width: min(600px, calc(100vw - 48px));
}

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

.auth-panel {
    padding: clamp(36px, 5vw, 56px);
    background: var(--auth-hero);
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.auth-form {
    padding: clamp(36px, 5vw, 56px);
    background: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.auth-brand,
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 800;
    color: var(--auth-text);
    text-decoration: none;
    margin-bottom: 32px;
}

.auth-panel .brand {
    color: white;
}

.auth-shell--center .auth-brand,
.auth-shell--center .brand {
    justify-content: center;
    margin-bottom: 24px;
}

.auth-brand img,
.brand img {
    width: 36px;
    height: 36px;
    object-fit: contain;
    background: var(--auth-accent);
    padding: 6px;
    border-radius: 10px;
    flex-shrink: 0;
}

.auth-panel .brand img {
    background: rgba(255, 255, 255, 0.15);
}

.auth-panel h1 {
    font-size: clamp(1.75rem, 3vw, 2.1rem);
    font-weight: 800;
    line-height: 1.15;
    color: white;
    margin: 0 0 16px;
    letter-spacing: -0.02em;
}

.auth-panel p {
    color: rgba(255, 255, 255, 0.72);
    font-size: 15px;
    line-height: 1.65;
    margin: 0 0 24px;
}

.trust-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 14px;
}

.trust-list li {
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(255, 255, 255, 0.85);
    font-size: 14px;
    font-weight: 600;
}

.trust-icon {
    color: #a5b4fc;
    font-size: 16px;
    font-weight: 800;
}

.trust-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #818cf8;
    flex-shrink: 0;
}

.free-pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    background: var(--auth-accent-soft);
    color: var(--auth-accent);
    font-size: 11px;
    font-weight: 800;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 12px;
    width: fit-content;
}

.form-title {
    font-size: 1.65rem;
    font-weight: 800;
    color: var(--auth-text);
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.form-subtitle {
    color: var(--auth-muted);
    font-size: 14px;
    margin-bottom: 28px;
}

.auth-header {
    margin-bottom: 28px;
}

.auth-header h1 {
    font-size: 1.65rem;
    font-weight: 800;
    color: var(--auth-text);
    margin: 0 0 8px;
    letter-spacing: -0.02em;
}

.auth-header p {
    color: var(--auth-muted);
    font-size: 14px;
    margin: 0;
}

.google-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: white;
    color: var(--auth-text);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    box-sizing: border-box;
}

.google-btn:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 24px 0;
    color: #94a3b8;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e2e8f0;
}

.mode-switch {
    display: inline-flex;
    background: #f1f5f9;
    padding: 4px;
    border-radius: 12px;
    margin-bottom: 24px;
    width: fit-content;
}

.mode-switch button {
    border: none;
    background: transparent;
    color: var(--auth-muted);
    font-size: 13px;
    font-weight: 600;
    padding: 8px 20px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.mode-switch button.active {
    background: white;
    color: var(--auth-accent);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.auth-page .form-group {
    margin-bottom: 20px;
}

.auth-page .form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 8px;
}

.auth-page .form-input,
.auth-page .form-group input,
.auth-page .form-group textarea {
    width: 100%;
    padding: 12px 14px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s;
    box-sizing: border-box;
}

.auth-page .form-input:focus,
.auth-page .form-group input:focus,
.auth-page .form-group textarea:focus {
    outline: none;
    border-color: var(--auth-accent);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.auth-page .form-hint,
.auth-page .helper-text {
    font-size: 12px;
    color: var(--auth-muted);
    margin-top: 6px;
    display: block;
}

.otp-row {
    display: flex;
    gap: 12px;
    align-items: stretch;
    flex-wrap: wrap;
}

.otp-row .form-input {
    flex: 1 1 180px;
    min-width: 0;
}

.otp-hint {
    font-size: 12px;
    color: var(--auth-muted);
    margin-top: 6px;
}

#sendOtpBtn {
    background: var(--auth-ink);
    color: white;
    border: none;
    padding: 0 20px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    flex: 0 0 auto;
    min-height: 46px;
}

.auth-page .btn-primary,
.auth-page .btn-continue {
    background: var(--auth-accent) !important;
    color: white;
    border: none;
    padding: 14px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}

.auth-page .btn-primary:hover,
.auth-page .btn-continue:hover:not(:disabled) {
    background: var(--auth-accent-hover) !important;
}

.auth-page .btn-continue:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.form-meta {
    text-align: right;
    margin-bottom: 24px;
}

.form-meta a {
    color: var(--auth-accent);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
}

.footer-link {
    text-align: center;
    margin-top: 28px;
    font-size: 14px;
    color: var(--auth-muted);
}

.footer-link a {
    color: var(--auth-accent);
    text-decoration: none;
    font-weight: 700;
}

.welcome-message {
    background: var(--auth-accent-soft);
    border-left: 3px solid var(--auth-accent);
    padding: 16px;
    border-radius: 10px;
    margin-bottom: 24px;
    text-align: left;
}

.welcome-message p {
    color: #475569;
    font-size: 14px;
    line-height: 1.6;
    margin: 0;
}

.auth-page .alert {
    margin-bottom: 20px;
    border-radius: 10px;
    font-size: 13px;
}

.auth-page .spinner,
.auth-page .loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: auth-spin 0.8s linear infinite;
    vertical-align: middle;
}

.auth-page .spinner-lg {
    width: 40px;
    height: 40px;
    border-width: 4px;
    margin: 0 auto 16px;
    display: block;
}

.auth-page .spinner-lg.spinner-dark {
    border-color: rgba(79, 70, 229, 0.15);
    border-top-color: var(--auth-accent);
}

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

@media (max-width: 850px) {
    .auth-shell--split {
        grid-template-columns: 1fr;
        width: min(450px, calc(100vw - 32px));
    }

    .auth-panel {
        display: none;
    }

    .auth-form {
        padding: 32px 24px;
    }

    .otp-row {
        flex-direction: column;
    }

    #sendOtpBtn {
        width: 100%;
    }
}

@media (max-width: 600px) {
    .auth-shell--single {
        padding: 32px 24px;
    }
}
