/* Login Page Styles */

.btn.btn-login.loading {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    opacity: 0.92;
    cursor: wait;
    pointer-events: none;
}

.btn.btn-login .spinner {
    width: 1.15em;
    height: 1.15em;
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #ffffff;
    border-radius: 50%;
    display: inline-block;
    margin-right: 0;
    vertical-align: middle;
    animation: login-btn-spin 0.65s linear infinite;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.btn.btn-login.loading .btn-login__busy-label {
    font-weight: 600;
    letter-spacing: 0.02em;
}

.login-form--submitting {
    position: relative;
}

.login-form--submitting::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.28);
    pointer-events: none;
    animation: login-form-submit-fade 0.28s ease forwards;
    z-index: 1;
}

@keyframes login-form-submit-fade {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.login-form--submitting .form-group {
    position: relative;
    z-index: 0;
}

.login-form--submitting .btn-login {
    position: relative;
    z-index: 2;
}

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

.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-wrapper .form-input {
    width: 100%;
    padding-right: 2.8rem;
}

.password-toggle-btn {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    color: #9ca3af;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
    line-height: 1;
}

.password-toggle-btn:hover,
.password-toggle-btn:focus {
    color: #374151;
    outline: none;
}

.password-toggle-btn svg {
    width: 20px;
    height: 20px;
    pointer-events: none;
}

.login-container {
    max-width: 450px;
    margin: 0 auto;
    background: var(--bg-white);
    padding: 50px 40px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.login-header {
    text-align: center;
    margin-bottom: 40px;
}

.login-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.login-subtitle {
    font-size: 1rem;
    color: var(--text-light);
}

/* Alert Messages */
.alert {
    padding: 15px 20px;
    margin-bottom: 25px;
    font-weight: 500;
    font-size: 0.95rem;
}

.alert-error {
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
}

.alert-success {
    background-color: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #16a34a;
}

/* Professional login alert styling + auto-dismiss animation */
.login-container .alert {
    position: relative;
    border-radius: 12px;
    margin-bottom: 16px;
    padding: 12px 14px 12px 46px;
    font-size: 0.92rem;
    line-height: 1.4;
    font-weight: 600;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
    transition: opacity 0.35s ease, transform 0.35s ease, max-height 0.35s ease, margin 0.35s ease, padding 0.35s ease;
    overflow: hidden;
}

.login-container .alert::before {
    position: absolute;
    left: 14px;
    top: 13px;
    transform: none;
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 0.95rem;
    line-height: 1;
}

.login-container .alert.alert-error {
    background: linear-gradient(180deg, #fff7f7 0%, #fff1f2 100%);
    border: 1px solid #fecaca;
    color: #b91c1c;
}

.login-container .alert.alert-error::before {
    content: "\f06a"; /* fa-circle-exclamation */
    color: #ef4444;
}

.login-container .alert.alert-success {
    background: linear-gradient(180deg, #f2fff7 0%, #ecfdf3 100%);
    border: 1px solid #bbf7d0;
    color: #166534;
}

.login-container .alert.alert-success::before {
    content: "\f058"; /* fa-circle-check */
    color: #16a34a;
}

.login-container .alert.alert--auto-hide {
    opacity: 0;
    transform: translateY(-6px);
    max-height: 0;
    margin-top: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-width: 0;
}

/* Login Form */
.login-form {
    margin-top: 30px;
}

.form-group {
    margin-bottom: 25px;
}

.form-label {
    display: block;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.form-input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
    background-color: var(--bg-white);
    color: var(--text-dark);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border-radius: 0;
}

.form-input::placeholder {
    color: #94a3b8;
    opacity: 1;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}

/* Better focus visibility for keyboard navigation */
.form-input:focus-visible,
.btn:focus-visible,
.nav-link:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

.password-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
}

.forgot-password-link {
    font-size: 0.9rem;
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

.forgot-password-link:hover {
    color: var(--hover-color);
    text-decoration: underline;
}

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

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text-dark);
}

.checkbox-label input[type="checkbox"] {
    margin-right: 10px;
    width: 18px;
    height: 18px;
    cursor: pointer;
    flex-shrink: 0;
}

.btn-login {
    width: 100%;
    padding: 14px;
    font-size: 1.05rem;
    margin-top: 10px;
}

.login-footer {
    margin-top: 30px;
    padding-top: 25px;
    border-top: 1px solid var(--border-color);
    text-align: center;
    font-size: 0.95rem;
    color: var(--text-light);
}

.register-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.register-link:hover {
    color: var(--hover-color);
    text-decoration: underline;
}

/* Collapsible "resend verification" helper (hidden by default) */
.login-resend-verify {
    margin-top: 1.1rem;
    padding-top: 0.9rem;
    border-top: 1px solid var(--border-color, #e2e8f0);
}

.login-resend-verify__summary {
    list-style: none;
    cursor: pointer;
    color: var(--primary-color);
    font-size: 0.92rem;
    font-weight: 600;
    user-select: none;
}

.login-resend-verify__summary::-webkit-details-marker {
    display: none;
}

.login-resend-verify__summary::after {
    content: '\25BE';
    margin-left: 0.5rem;
    font-size: 0.8rem;
    opacity: 0.8;
}

.login-resend-verify[open] .login-resend-verify__summary::after {
    content: '\25B4';
}

.login-resend-verify__content {
    margin-top: 0.75rem;
}

.login-resend-verify__subtitle {
    margin-bottom: 0.6rem;
    font-size: 0.88rem;
}

.login-form--resend {
    margin-top: 0;
}

.form-group--compact {
    margin-bottom: 0.75rem;
}

.login-code-input {
    text-align: center;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 0.35em;
    font-variant-numeric: tabular-nums;
}

.login-form--code {
    margin-top: 0;
}

.login-form--resend-code {
    margin-top: 12px;
}

.btn-login--compact {
    width: 100%;
}

.login-code-hint {
    margin-top: 14px;
    font-size: 0.88rem;
    line-height: 1.45;
    color: var(--text-light);
    text-align: center;
}

.login-code-back {
    margin-top: 10px;
    text-align: center;
    font-size: 0.9rem;
}

.login-code-back__link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.login-code-back__link:hover {
    text-decoration: underline;
}

.btn-login--biometric {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    margin-bottom: 0.75rem;
    border: 1.5px solid var(--primary-color);
    background: #f0fdf4;
    color: var(--primary-color);
    transition: none;
}

.btn.btn-secondary.btn-login.btn-login--biometric:hover,
.btn.btn-secondary.btn-login.btn-login--biometric:active,
.btn.btn-secondary.btn-login.btn-login--biometric:focus,
.btn.btn-secondary.btn-login.btn-login--biometric:focus-visible {
    background: #f0fdf4;
    color: var(--primary-color);
    border: 1.5px solid var(--primary-color);
    transform: none;
    box-shadow: none;
}

.login-biometric-divider {
    margin: 0 0 1rem;
    text-align: center;
    color: var(--text-light);
    font-size: 0.88rem;
}

.login-biometric-divider span {
    position: relative;
    display: inline-block;
    padding: 0 0.75rem;
    background: var(--bg-white);
}

.login-biometric-divider::before {
    content: '';
    display: block;
    height: 1px;
    background: var(--border-color, #e2e8f0);
    margin-bottom: -0.65rem;
}

/* Biometric WebAuthn modal (shared with login-modal shell) */
/* Biometric WebAuthn modal — full viewport overlay */
.bio-webauthn-modal {
    position: fixed !important;
    inset: 0 !important;
    z-index: 20000 !important;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
    box-sizing: border-box;
}

.bio-webauthn-modal[hidden] {
    display: none !important;
}

.bio-webauthn-modal:not([hidden]) {
    display: flex !important;
}

.bio-webauthn-modal .login-modal__panel::before {
    display: none;
}

.bio-webauthn-modal__panel {
    max-width: 420px;
    width: 100%;
    margin: 0;
    border-radius: 20px 20px 0 0;
}

.bio-webauthn-modal__body {
    padding: 28px 24px 24px;
    text-align: center;
}

.bio-webauthn-modal__icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.65rem;
    background: #ecfdf5;
    color: #16a34a;
}

.bio-webauthn-modal__icon--success {
    background: #ecfdf5;
    color: #16a34a;
}

.bio-webauthn-modal__icon--error {
    background: #fef2f2;
    color: #dc2626;
}

.bio-webauthn-modal__icon--confirm {
    background: #eff6ff;
    color: #2563eb;
}

.bio-webauthn-modal__title {
    margin: 0 0 10px;
    font-size: 1.2rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.35;
}

.bio-webauthn-modal__message {
    margin: 0 0 22px;
    font-size: 0.94rem;
    line-height: 1.55;
    color: #64748b;
}

.bio-webauthn-modal__actions {
    display: flex;
    gap: 10px;
}

.bio-webauthn-modal__actions--single {
    justify-content: center;
}

.bio-webauthn-modal__actions--single .bio-webauthn-modal__btn {
    min-width: 140px;
}

.bio-webauthn-modal__btn {
    flex: 1;
    min-height: 44px;
}

@media (min-width: 520px) {
    .bio-webauthn-modal {
        align-items: center;
        padding: 20px;
    }

    .bio-webauthn-modal__panel {
        border-radius: 20px;
        margin: 0;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .login-container {
        padding: 40px 30px;
        margin: 20px 15px;
        max-width: 100%;
    }

    .login-title {
        font-size: 1.75rem;
        line-height: 1.3;
    }

    .login-subtitle {
        font-size: 0.95rem;
    }

    .form-input {
        padding: 14px 15px;
        font-size: 1rem;
    }

    .btn-login {
        padding: 15px;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .login-container {
        padding: 30px 20px;
        margin: 15px 10px;
        box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
    }

    .login-header {
        margin-bottom: 30px;
    }

    .login-title {
        font-size: 1.5rem;
        line-height: 1.3;
    }

    .login-subtitle {
        font-size: 0.9rem;
    }

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

    .form-label {
        font-size: 0.9rem;
        margin-bottom: 6px;
    }

    .form-input {
        padding: 12px 14px;
        font-size: 0.95rem;
    }

    .alert {
        padding: 12px 16px;
        font-size: 0.9rem;
        margin-bottom: 20px;
    }

    .password-actions {
        margin-top: 6px;
    }

    .forgot-password-link {
        font-size: 0.85rem;
    }

    .checkbox-label {
        font-size: 0.9rem;
    }

    .checkbox-label input[type="checkbox"] {
        width: 16px;
        height: 16px;
        margin-right: 8px;
    }

    .btn-login {
        padding: 13px;
        font-size: 0.95rem;
    }

    .login-footer {
        font-size: 0.9rem;
        padding-top: 20px;
        margin-top: 25px;
    }

    .register-link {
        display: inline-block;
        margin-top: 5px;
    }
}

@media (max-width: 360px) {
    .login-container {
        padding: 25px 18px;
        margin: 10px 8px;
    }

    .login-title {
        font-size: 1.35rem;
    }

    .login-subtitle {
        font-size: 0.85rem;
    }

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

    .btn-login {
        padding: 12px;
        font-size: 0.9rem;
    }

    .login-footer {
        font-size: 0.85rem;
    }
}

