/* ───────────────────────────────────────────────────────────
   Auth Pages — Login, Register, OTP, Password Reset, etc.
   ─────────────────────────────────────────────────────────── */

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family:
        -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
        Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", Arial,
        sans-serif;
    line-height: 1.6;
    color: #1a1a2e;
    background-color: #fff;
    min-height: 100vh;
    transition:
        background-color 0.3s ease,
        color 0.3s ease;
}

a {
    color: #2563eb;
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ─── Site Layout ───────────────────────────────────────── */
.site {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ─── Header ────────────────────────────────────────────── */
.site-header {
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    transition:
        background-color 0.3s ease,
        border-color 0.3s ease;
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.branding a {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
}

.branding img {
    border-radius: 8px;
    flex-shrink: 0;
}

.app-name {
    font-size: 1.125rem;
    font-weight: 700;
    color: #1a1a2e;
    white-space: nowrap;
    transition: color 0.3s ease;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 12px;
}

.auth-menu {
    color: #1a1a2e;
}

.auth-menu:hover {
    color: #2563eb;
    text-decoration: none;
}
.schema-menu {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 10px;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    font-size: 1.125rem;
    cursor: pointer;
    transition:
        background 0.2s ease,
        border-color 0.2s ease;
    text-decoration: none;
    user-select: none;
}

.schema-menu:hover {
    background: #e5e7eb;
    border-color: #d1d5db;
}

/* ─── Body / Content ────────────────────────────────────── */
.site-body {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

/* ─── Footer ────────────────────────────────────────────── */
.site-footer {
    background: #ffffff;
    /*border-top: 1px solid #e5e7eb;*/
    padding: 20px 0;
    text-align: center;
    transition:
        background-color 0.3s ease,
        border-color 0.3s ease;
}

.copyright p {
    font-size: 0.875rem;
    color: #6b7280;
}

/* ─── Auth Widget Card ──────────────────────────────────── */
.auth-widget {
    width: 100%;
    max-width: 420px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow:
        0 1px 3px rgba(0, 0, 0, 0.08),
        0 1px 2px rgba(0, 0, 0, 0.04);
    padding: 36px 32px;
    transition:
        background-color 0.3s ease,
        box-shadow 0.3s ease;
}

.auth-widget__title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 4px;
    text-align: center;
}

.auth-widget__subtitle {
    font-size: 0.9375rem;
    color: #6b7280;
    margin-bottom: 24px;
    text-align: center;
}

.auth-widget__error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 20px;
    font-size: 0.875rem;
    text-align: center;
}

.auth-widget__divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 24px 0;
    color: #9ca3af;
    font-size: 0.8125rem;
}

.auth-widget__divider::before,
.auth-widget__divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: #e5e7eb;
}

/* ─── Form Elements ─────────────────────────────────────── */
.form-group {
    margin-bottom: 16px;
}

.form-group--inline {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 12px 14px;
    font-size: 0.9375rem;
    font-family: inherit;
    color: #1a1a2e;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    outline: none;
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.form-input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.form-input::placeholder {
    color: #9ca3af;
}

.form-input--error {
    border-color: #ef4444;
}

.form-input--error:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

.form-checkbox {
    width: 18px;
    height: 18px;
    accent-color: #2563eb;
    cursor: pointer;
    flex-shrink: 0;
}

.form-checkbox-label {
    font-size: 0.875rem;
    color: #4b5563;
    cursor: pointer;
    user-select: none;
}

.form-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
    margin-bottom: 20px;
}

.form-footer a {
    font-size: 0.875rem;
}

/* ─── Buttons ───────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 20px;
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition:
        background 0.2s ease,
        opacity 0.2s ease,
        transform 0.1s ease;
    text-decoration: none;
}

.btn:active {
    transform: scale(0.98);
}

.btn--primary {
    background: #2563eb;
    color: #ffffff;
}

.btn--primary:hover {
    background: #1d4ed8;
}

.btn--primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn--loading {
    pointer-events: none;
    opacity: 0.7;
}

.btn--oauth {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 11px 16px;
    font-size: 0.875rem;
    font-weight: 600;
    background: #ffffff;
    color: #374151;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    cursor: pointer;
    transition:
        background 0.2s ease,
        border-color 0.2s ease;
    text-decoration: none;
    font-family: inherit;
}

.btn--oauth:hover {
    background: #f9fafb;
    border-color: #9ca3af;
    text-decoration: none;
}

.btn--oauth img {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.oauth-providers {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ─── OTP Input ─────────────────────────────────────────── */
.otp-inputs {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 20px 0;
}

.otp-input {
    width: 48px;
    height: 56px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    font-family: inherit;
    color: #1a1a2e;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    outline: none;
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.otp-input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.otp-input--filled {
    border-color: #2563eb;
    background: #eff6ff;
}

/* ─── Password Toggle ───────────────────────────────────── */
.password-wrapper {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: #9ca3af;
    font-size: 1rem;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.password-toggle:hover {
    color: #4b5563;
}

/* ─── Challenge / Device Info ────────────────────────────── */
.challenge-info {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 20px;
}

.challenge-info__item {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 0.875rem;
}

.challenge-info__label {
    color: #6b7280;
}

.challenge-info__value {
    color: #1a1a2e;
    font-weight: 500;
}

/* ─── Success State ─────────────────────────────────────── */
.success-state {
    text-align: center;
    padding: 20px 0;
}

.success-state__icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.success-state__title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 8px;
}

.success-state__message {
    font-size: 0.9375rem;
    color: #6b7280;
    margin-bottom: 24px;
}

/* ─── Loading Spinner ───────────────────────────────────── */
.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.spinner--dark {
    border-color: rgba(0, 0, 0, 0.1);
    border-top-color: #2563eb;
}

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

/* ─── Responsive ────────────────────────────────────────── */

/* Tablet (≤ 768px) */
@media (max-width: 768px) {
    .site-header {
        padding: 10px 0;
    }

    .site-body {
        padding: 24px 16px;
    }

    .auth-widget {
        max-width: 400px;
        padding: 28px 24px;
    }

    .auth-widget__title {
        font-size: 1.375rem;
    }

    .app-name {
        font-size: 1rem;
    }

    .branding img {
        height: 40px;
    }
}

/* Mobile (≤ 480px) */
@media (max-width: 480px) {
    .container {
        padding: 0 16px;
    }

    .site-header {
        padding: 8px 0;
    }

    .branding img {
        height: 36px;
    }

    .app-name {
        font-size: 0.9375rem;
    }

    .site-body {
        padding: 16px 12px;
        align-items: flex-start;
        padding-top: 32px;
    }

    .auth-widget {
        max-width: 100%;
        padding: 24px 20px;
        border-radius: 12px;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
    }

    .auth-widget__title {
        font-size: 1.25rem;
    }

    .auth-widget__subtitle {
        font-size: 0.875rem;
        margin-bottom: 20px;
    }

    .form-input {
        padding: 11px 12px;
        font-size: 1rem;
    }

    .btn {
        padding: 11px 16px;
        font-size: 0.9375rem;
    }

    .form-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .otp-inputs {
        gap: 8px;
    }

    .otp-input {
        width: 42px;
        height: 48px;
        font-size: 1.25rem;
    }

    .oauth-providers {
        gap: 8px;
    }

    .site-footer {
        padding: 16px 0;
    }
}

/* Very small screens (≤ 360px) */
@media (max-width: 360px) {
    .auth-widget {
        padding: 20px 16px;
    }

    .auth-widget__title {
        font-size: 1.125rem;
    }

    .otp-input {
        width: 36px;
        height: 42px;
        font-size: 1rem;
    }

    .otp-inputs {
        gap: 6px;
    }
}

/* ─── Dark Mode ─────────────────────────────────────────── */
html.dark body {
    color: #e5e7eb;
    background-color: #0f172a;
}

html.dark .site-header {
    background: #1e293b;
    border-bottom-color: #334155;
}

html.dark .app-name {
    color: #f1f5f9;
}

html.dark .schema-menu {
    background: #334155;
    border-color: #475569;
    color: #f1f5f9;
}

html.dark .schema-menu:hover {
    background: #475569;
    border-color: #64748b;
}

html.dark .site-footer {
    background: #1e293b;
    border-top-color: #334155;
}

html.dark .copyright p {
    color: #94a3b8;
}

html.dark .auth-widget {
    background: #1e293b;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

html.dark .auth-widget__title {
    color: #f1f5f9;
}

html.dark .auth-widget__subtitle {
    color: #94a3b8;
}

html.dark .auth-widget__error {
    background: #450a0a;
    color: #fca5a5;
    border-color: #7f1d1d;
}

html.dark .auth-widget__divider {
    color: #64748b;
}

html.dark .auth-widget__divider::before,
html.dark .auth-widget__divider::after {
    background: #334155;
}

html.dark .form-label {
    color: #cbd5e1;
}

html.dark .form-input {
    color: #f1f5f9;
    background: #0f172a;
    border-color: #475569;
}

html.dark .form-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

html.dark .form-input::placeholder {
    color: #64748b;
}

html.dark .form-checkbox {
    accent-color: #3b82f6;
}

html.dark .form-checkbox-label {
    color: #94a3b8;
}

html.dark .btn--primary {
    background: #3b82f6;
}

html.dark .btn--primary:hover {
    background: #2563eb;
}

html.dark .btn--oauth {
    background: #1e293b;
    border-color: #475569;
    color: #cbd5e1;
}

html.dark .btn--oauth:hover {
    background: #334155;
    border-color: #64748b;
}

html.dark .otp-input {
    color: #f1f5f9;
    background: #0f172a;
    border-color: #475569;
}

html.dark .otp-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

html.dark .otp-input--filled {
    border-color: #3b82f6;
    background: #1e3a5f;
}

html.dark .password-toggle {
    color: #64748b;
}

html.dark .password-toggle:hover {
    color: #94a3b8;
}

html.dark .challenge-info {
    background: #0f172a;
    border-color: #334155;
}

html.dark .challenge-info__label {
    color: #94a3b8;
}

html.dark .challenge-info__value {
    color: #e2e8f0;
}

html.dark .success-state__title {
    color: #f1f5f9;
}

html.dark .success-state__message {
    color: #94a3b8;
}

html.dark a {
    color: #60a5fa;
}

html.dark a:hover {
    color: #93c5fd;
}
