/* ==========================================
   Authentication Pages — Premium UI
   (scoped under .auth-page so it never leaks)
   ========================================== */

.auth-page {
    min-height: 100vh;
    min-height: 100svh;
    height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    position: relative;
    overflow: hidden;
    background: linear-gradient(160deg, #0f141a 0%, #1a2028 45%, #141b23 100%);
}

/* --- Animated background orbs --- */
.auth-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
    pointer-events: none;
    animation: authOrbFloat 18s ease-in-out infinite;
}

.auth-orb-1 {
    width: 420px;
    height: 420px;
    background: radial-gradient(circle, rgba(240, 185, 11, 0.35) 0%, transparent 70%);
    top: -120px;
    left: -100px;
}

.auth-orb-2 {
    width: 360px;
    height: 360px;
    background: radial-gradient(circle, rgba(13, 110, 253, 0.28) 0%, transparent 70%);
    bottom: -100px;
    right: -80px;
    animation-delay: -6s;
    animation-duration: 22s;
}

.auth-orb-3 {
    width: 260px;
    height: 260px;
    background: radial-gradient(circle, rgba(14, 203, 129, 0.18) 0%, transparent 70%);
    top: 55%;
    left: 60%;
    animation-delay: -12s;
    animation-duration: 26s;
}

@keyframes authOrbFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -40px) scale(1.08); }
    66% { transform: translate(-25px, 30px) scale(0.95); }
}

/* subtle grid dots */
.auth-page::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px);
    background-size: 28px 28px;
    pointer-events: none;
}

/* --- Card --- */
.auth-card {
    width: 100%;
    max-width: 440px;
    max-height: calc(100dvh - 48px);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #2b3139 transparent;
    background: #1e2329;
    border: 1px solid #2b3139;
    border-radius: 20px;
    padding: 36px 32px 28px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
    position: relative;
    z-index: 1;
    animation: authCardIn 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.auth-card::-webkit-scrollbar {
    width: 6px;
}

.auth-card::-webkit-scrollbar-thumb {
    background: #2b3139;
    border-radius: 6px;
}

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

/* --- Brand --- */
.auth-brand {
    text-align: center;
    margin-bottom: 26px;
    animation: authLogoIn 0.6s cubic-bezier(0.22, 1, 0.36, 1) 0.05s both;
}

@keyframes authLogoIn {
    from { opacity: 0; transform: scale(0.92); }
    to { opacity: 1; transform: scale(1); }
}

.auth-brand-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    background: linear-gradient(135deg, #f0b90b 0%, #c99409 100%);
    box-shadow: 0 8px 20px rgba(240, 185, 11, 0.3);
}

.auth-brand-icon svg {
    width: 30px;
    height: 30px;
    stroke: #1e2329;
}

.auth-brand-name {
    font-size: 1.15rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.4px;
}

.auth-heading {
    font-size: 1.6rem;
    font-weight: 700;
    color: #ffffff;
    text-align: center;
    margin: 0 0 6px;
}

.auth-subheading {
    font-size: 0.9rem;
    color: #848e9c;
    text-align: center;
    margin: 0 0 26px;
}

/* --- Fields --- */
.auth-field {
    margin-bottom: 18px;
    position: relative;
}

.auth-field label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #c3c9d2;
    margin-bottom: 7px;
    letter-spacing: 0.3px;
}

.auth-input-wrap {
    position: relative;
}

.auth-input-wrap .auth-input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #848e9c;
    transition: color 0.25s ease;
    pointer-events: none;
    display: flex;
}

.auth-input-wrap .auth-input-icon svg {
    width: 18px;
    height: 18px;
}

.auth-field .form-control,
.auth-field .form-select {
    width: 100%;
    background: #171c22;
    border: 1.5px solid #2b3139;
    border-radius: 12px;
    color: #ffffff;
    font-size: 0.95rem;
    padding: 13px 44px 13px 44px;
    transition: border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
    height: auto;
    line-height: 1.4;
}

.auth-field .form-select {
    padding: 13px 14px 13px 44px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23848e9c' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
}

.auth-field .form-select option {
    background: #1e2329;
    color: #fff;
}

.auth-field .form-control::placeholder {
    color: #565f6b;
}

.auth-field .form-control:focus,
.auth-field .form-select:focus {
    outline: none;
    border-color: #f0b90b;
    background: #1b2129;
    box-shadow: 0 0 0 4px rgba(240, 185, 11, 0.12);
}

.auth-field .form-control:focus ~ .auth-input-icon,
.auth-input-wrap:focus-within .auth-input-icon {
    color: #f0b90b;
}

/* invalid state */
.auth-field.has-error .form-control,
.auth-field.has-error .form-select {
    border-color: #f6465d;
    box-shadow: 0 0 0 4px rgba(246, 70, 93, 0.12);
}

.auth-field .field-error {
    display: none;
    font-size: 0.78rem;
    color: #f6465d;
    margin-top: 6px;
}

.auth-field.has-error .field-error {
    display: block;
    animation: authErrorIn 0.3s ease both;
}

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

/* --- Password eye toggle --- */
.auth-eye {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 38px;
    height: 38px;
    border: none;
    background: transparent;
    color: #848e9c;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    transition: color 0.2s ease, background 0.2s ease;
}

.auth-eye:hover,
.auth-eye:focus-visible {
    color: #f0b90b;
    background: rgba(240, 185, 11, 0.08);
    outline: none;
}

.auth-eye svg {
    width: 20px;
    height: 20px;
    transition: transform 0.2s ease;
}

.auth-eye.is-visible svg {
    transform: scale(1.1);
    color: #f0b90b;
}

/* --- Password strength --- */
.auth-strength {
    margin-top: 8px;
}

.auth-strength-bar {
    height: 4px;
    border-radius: 4px;
    background: #2b3139;
    overflow: hidden;
}

.auth-strength-fill {
    height: 100%;
    width: 0;
    border-radius: 4px;
    transition: width 0.35s ease, background 0.35s ease;
}

.auth-strength-text {
    font-size: 0.72rem;
    color: #848e9c;
    margin-top: 5px;
    min-height: 1em;
}

/* --- Remember / forgot row --- */
.auth-options {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin: -4px 0 20px;
    font-size: 0.83rem;
}

.auth-link {
    color: #f0b90b;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.auth-link:hover {
    color: #ffce3d;
    text-decoration: underline;
}

/* --- Terms checkbox --- */
.auth-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 4px 0 20px;
    font-size: 0.83rem;
    color: #c3c9d2;
}

.auth-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 1px;
    accent-color: #f0b90b;
    flex-shrink: 0;
    cursor: pointer;
}

.auth-check label {
    cursor: pointer;
    line-height: 1.45;
}

/* --- Submit button --- */
.auth-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #f0b90b 0%, #d9a60a 100%);
    color: #1e2329;
    font-size: 0.98rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: transform 0.15s ease, box-shadow 0.25s ease, filter 0.2s ease;
    box-shadow: 0 6px 18px rgba(240, 185, 11, 0.28);
}

.auth-btn:hover {
    filter: brightness(1.07);
    box-shadow: 0 8px 24px rgba(240, 185, 11, 0.4);
    transform: translateY(-1px);
}

.auth-btn:active {
    transform: translateY(0) scale(0.985);
    box-shadow: 0 4px 12px rgba(240, 185, 11, 0.25);
}

.auth-btn:focus-visible {
    outline: 3px solid rgba(240, 185, 11, 0.5);
    outline-offset: 2px;
}

.auth-btn:disabled {
    opacity: 0.75;
    cursor: not-allowed;
    transform: none;
}

.auth-btn .auth-spinner {
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(30, 35, 41, 0.25);
    border-top-color: #1e2329;
    border-radius: 50%;
    animation: authSpin 0.7s linear infinite;
    display: none;
}

.auth-btn.is-loading .auth-spinner {
    display: inline-block;
}

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

/* --- Footer link --- */
.auth-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #2b3139;
    font-size: 0.87rem;
    color: #848e9c;
}

.auth-footer .auth-link {
    margin-left: 4px;
}

.auth-back-home {
    display: block;
    text-align: center;
    margin-top: 16px;
    font-size: 0.8rem;
    color: #565f6b;
    text-decoration: none;
    transition: color 0.2s ease;
}

.auth-back-home:hover {
    color: #848e9c;
}

/* --- Alerts inside auth card --- */
.auth-page .alert {
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 0.87rem;
    margin-bottom: 20px;
    animation: authErrorIn 0.35s ease both;
}

.auth-page .alert-danger {
    background: rgba(246, 70, 93, 0.1);
    border: 1px solid rgba(246, 70, 93, 0.35);
    color: #f6465d;
}

.auth-page .alert-success {
    background: rgba(14, 203, 129, 0.1);
    border: 1px solid rgba(14, 203, 129, 0.35);
    color: #0ecb81;
}

.auth-page .alert-success .btn {
    margin-top: 10px;
}

.auth-page .alert.is-shaking {
    animation: authShake 0.45s ease both;
}

@keyframes authShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-5px); }
    80% { transform: translateX(5px); }
}

/* helper text under inputs */
.auth-hint {
    font-size: 0.74rem;
    color: #565f6b;
    margin-top: 6px;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .auth-page {
        padding: max(12px, env(safe-area-inset-top)) 14px max(12px, env(safe-area-inset-bottom));
    }

    .auth-card {
        padding: 24px 20px 20px;
        border-radius: 18px;
        max-height: calc(100dvh - 24px);
    }

    .auth-brand {
        margin-bottom: 18px;
    }

    .auth-brand-icon {
        width: 48px;
        height: 48px;
        margin-bottom: 10px;
    }

    .auth-heading {
        font-size: 1.35rem;
    }

    .auth-subheading {
        margin-bottom: 20px;
    }

    .auth-field {
        margin-bottom: 14px;
    }

    .auth-field .form-control,
    .auth-field .form-select {
        padding: 13px 44px;
        font-size: 1rem; /* prevents iOS zoom on focus */
    }

    .auth-check {
        margin-bottom: 16px;
    }

    .auth-btn {
        padding: 15px;
        font-size: 1rem;
        min-height: 52px;
    }

    .auth-footer {
        margin-top: 18px;
        padding-top: 16px;
    }

    .auth-back-home {
        margin-top: 12px;
    }
}

/* Short screens (register form, landscape phones) — compact mode */
@media (max-height: 780px) {
    .auth-card {
        padding-top: 22px;
        padding-bottom: 18px;
    }

    .auth-brand {
        margin-bottom: 12px;
    }

    .auth-brand-icon {
        width: 40px;
        height: 40px;
        margin-bottom: 8px;
        border-radius: 12px;
    }

    .auth-brand-icon svg {
        width: 22px;
        height: 22px;
    }

    .auth-brand-name {
        font-size: 0.95rem;
    }

    .auth-heading {
        font-size: 1.25rem;
        margin-bottom: 4px;
    }

    .auth-subheading {
        font-size: 0.82rem;
        margin-bottom: 16px;
    }

    .auth-field {
        margin-bottom: 11px;
    }

    .auth-field label {
        font-size: 0.75rem;
        margin-bottom: 5px;
    }

    .auth-field .form-control,
    .auth-field .form-select {
        padding-top: 11px;
        padding-bottom: 11px;
        font-size: 0.92rem;
    }

    .auth-check {
        margin-bottom: 12px;
        font-size: 0.78rem;
    }

    .auth-options {
        margin-bottom: 14px;
    }

    .auth-footer {
        margin-top: 14px;
        padding-top: 12px;
    }

    .auth-back-home {
        margin-top: 10px;
    }
}

@media (max-height: 560px) {
    .auth-brand-name {
        display: none;
    }

    .auth-brand-icon {
        width: 34px;
        height: 34px;
        margin-bottom: 4px;
    }
}

@media (max-width: 360px) {
    .auth-card {
        padding: 24px 18px 20px;
    }

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

    .auth-brand-icon {
        width: 48px;
        height: 48px;
    }
}

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
    .auth-orb {
        animation: none;
    }

    .auth-card,
    .auth-brand {
        animation: none;
    }

    .auth-btn,
    .auth-eye svg,
    .auth-field .form-control,
    .auth-field .form-select {
        transition: none;
    }

    .auth-page .alert.is-shaking {
        animation: none;
    }
}
