/* Reset Password Page Styles - Matching Login Theme */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body.reset-password-page {
    min-height: 100vh;
    min-height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    padding: 1rem;
    overflow: hidden;
}

/* Main Container */
.reset-password-container {
    width: 100%;
    max-width: 460px;
    padding: 2rem;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: calc(100dvh - 2rem);
}

.reset-password-content {
    width: 100%;
}

.reset-password-container h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #000000;
    margin-bottom: 0.25rem;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.reset-password-description {
    font-size: 1rem;
    color: rgba(0, 0, 0, 0.5);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

/* Back to Login Link */
.back-to-login {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: none;
    color: rgba(0, 0, 0, 0.5);
    font-size: 0.9375rem;
    font-family: inherit;
    cursor: pointer;
    padding: 0;
    margin-bottom: 1.5rem;
    transition: color 0.2s ease;
    text-decoration: none;
}

.back-to-login:hover {
    color: #000000;
}

.back-to-login i {
    font-size: 1rem;
}

/* Form */
#twoFactorForm,
#passwordForm {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Input Group */
.input-group {
    position: relative;
}

input[type="text"],
input[type="password"] {
    width: 100%;
    padding: 1rem 1rem;
    font-size: 1.125rem;
    font-family: inherit;
    background: #ffffff;
    border: 1.5px solid rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    color: #000000;
    transition: all 0.2s ease;
    outline: none;
}

input[type="text"]:hover,
input[type="password"]:hover {
    border-color: rgba(0, 0, 0, 0.3);
}

input[type="text"]:focus,
input[type="password"]:focus {
    border-color: rgba(0, 0, 0, 0.35);
    box-shadow: none;
    outline: none;
}

/* Disable autofill background color */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px #ffffff inset !important;
    -webkit-text-fill-color: #000000 !important;
    transition: background-color 5000s ease-in-out 0s;
}

input::placeholder {
    color: rgba(0, 0, 0, 0.35);
}

/* Password Wrapper */
.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrapper input {
    padding-right: 3rem;
}

.toggle-password {
    position: absolute;
    right: 0.75rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: rgba(0, 0, 0, 0.4);
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-password:hover {
    color: #000000;
}

.toggle-password i {
    font-size: 1.25rem;
}

/* TOTP Input styling */
.totp-input {
    text-align: left;
    font-size: 1.75rem !important;
    font-weight: 600;
    letter-spacing: 0.5em;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
}

.totp-input::placeholder {
    letter-spacing: 0.3em;
    font-weight: 400;
    opacity: 0.3;
}

/* Backup Code Input */
.backup-code-input {
    text-align: left;
    font-size: 1.5rem !important;
    font-weight: 600;
    letter-spacing: 0.15em;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    text-transform: uppercase;
}

/* Password Requirements */
.password-requirements {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.requirement {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: rgba(0, 0, 0, 0.5);
    transition: color 0.2s ease;
}

.requirement i {
    font-size: 0.875rem;
    transition: color 0.2s ease;
}

.requirement.met {
    color: #22c55e;
}

.requirement.met i {
    color: #22c55e;
}

/* Field Error */
.field-error {
    font-size: 0.75rem;
    color: #dc2626;
    margin-top: 0.5rem;
    padding-left: 0.125rem;
    min-height: 0;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.field-error:not(:empty) {
    opacity: 1;
}

/* Global Error */
.global-error {
    color: #dc2626;
    font-size: 0.875rem;
    text-align: center;
    margin-top: 1rem;
    min-height: 0;
}

.global-error:empty {
    display: none;
}

/* Submit Button */
.btn-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    font-family: inherit;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    min-height: 48px;
    background: #000000;
    color: #ffffff;
    margin-top: 0.5rem;
    text-decoration: none;
}

.btn-submit:hover:not(:disabled) {
    background: #1a1a1a;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-submit:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: none;
}

.btn-submit:disabled {
    background: rgba(0, 0, 0, 0.15);
    color: rgba(0, 0, 0, 0.4);
    cursor: not-allowed;
}

/* Submit Button Loading State */
.btn-submit .button-loader {
    display: none;
}

.btn-submit.loading .button-text {
    display: none;
}

.btn-submit.loading .button-loader {
    display: flex;
    align-items: center;
    justify-content: center;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner.large {
    width: 40px;
    height: 40px;
    border-width: 3px;
    border-color: rgba(0, 0, 0, 0.15);
    border-top-color: #000000;
}

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

/* Backup Code Section */
.backup-code-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.backup-code-toggle {
    display: inline-block;
    width: 100%;
    background: none;
    border: none;
    color: rgba(0, 0, 0, 0.4);
    font-size: 0.875rem;
    font-family: inherit;
    cursor: pointer;
    padding: 0.5rem;
    transition: color 0.2s ease;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.backup-code-toggle:hover {
    color: rgba(0, 0, 0, 0.6);
}

/* Success/Error/Loading States - Centered Content */
#successStep,
#invalidTokenStep,
#loadingStep {
    text-align: center;
}

#successStep h1,
#invalidTokenStep h1,
#loadingStep h1 {
    text-align: center;
}

#successStep .reset-password-description,
#invalidTokenStep .reset-password-description,
#loadingStep .reset-password-description {
    text-align: center;
}

#successStep .btn-submit,
#invalidTokenStep .btn-submit {
    margin-left: auto;
    margin-right: auto;
}

/* Success/Error Icons */
.success-icon,
.error-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.success-icon i {
    font-size: 4rem;
    color: #22c55e;
}

.error-icon i {
    font-size: 4rem;
    color: #dc2626;
}

/* Loading Spinner */
.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

/* Tablet */
@media (max-width: 768px) {
    body.reset-password-page {
        padding: 1rem;
        align-items: center;
        padding-top: max(1rem, env(safe-area-inset-top));
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }

    .reset-password-container {
        padding: 1.5rem;
        max-width: 100%;
        min-height: calc(100dvh - 2rem);
    }

    .reset-password-container h1 {
        font-size: 1.5rem;
    }

    .reset-password-description {
        font-size: 0.9375rem;
    }

    input[type="text"],
    input[type="password"] {
        font-size: 1rem;
        padding: 0.875rem 1rem;
    }

    .totp-input {
        font-size: 1.5rem !important;
    }
}

/* Mobile */
@media (max-width: 480px) {
    body.reset-password-page {
        min-height: 100svh;
        padding: 0;
    }

    .reset-password-container {
        min-height: 100svh;
        display: flex;
        flex-direction: column;
        justify-content: center;
        padding: 1.25rem;
        padding-top: max(1.5rem, env(safe-area-inset-top));
        padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
    }

    .reset-password-container h1 {
        font-size: 1.375rem;
    }

    .reset-password-description {
        font-size: 0.875rem;
    }
}

/* Small Mobile */
@media (max-width: 360px) {
    .reset-password-container h1 {
        font-size: 1.25rem;
    }

    input[type="text"],
    input[type="password"] {
        font-size: 1rem;
        padding: 0.75rem;
    }

    .totp-input {
        font-size: 1.25rem !important;
        letter-spacing: 0.3em;
    }

    .btn-submit {
        padding: 0.75rem 1rem;
        font-size: 0.9375rem;
        min-height: 44px;
    }
}

/* Large Screens */
@media (min-width: 1024px) {
    .reset-password-container {
        padding: 3rem;
    }

    .reset-password-container h1 {
        font-size: 2rem;
    }
}

/* Prefer Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    input,
    .btn-submit,
    .field-error,
    .requirement {
        transition: none;
    }

    .spinner {
        animation: none;
    }
}

/* ============================================
   DARK MODE
   ============================================ */

@media (prefers-color-scheme: dark) {
    body.reset-password-page {
        background: #0a0a0a;
    }

    .reset-password-container {
        color: #ffffff;
    }

    .reset-password-container h1 {
        color: #ffffff;
    }

    .reset-password-description {
        color: rgba(255, 255, 255, 0.5);
    }

    .back-to-login {
        color: rgba(255, 255, 255, 0.5);
    }

    .back-to-login:hover {
        color: #ffffff;
    }

    input[type="text"],
    input[type="password"] {
        background: rgba(255, 255, 255, 0.05);
        border-color: rgba(255, 255, 255, 0.15);
        color: #ffffff;
    }

    input[type="text"]:hover,
    input[type="password"]:hover {
        border-color: rgba(255, 255, 255, 0.3);
    }

    input[type="text"]:focus,
    input[type="password"]:focus {
        border-color: rgba(255, 255, 255, 0.25);
    }

    input:-webkit-autofill,
    input:-webkit-autofill:hover,
    input:-webkit-autofill:focus,
    input:-webkit-autofill:active {
        -webkit-box-shadow: 0 0 0 1000px #0a0a0a inset !important;
        -webkit-text-fill-color: #ffffff !important;
    }

    input::placeholder {
        color: rgba(255, 255, 255, 0.35);
    }

    .toggle-password {
        color: rgba(255, 255, 255, 0.4);
    }

    .toggle-password:hover {
        color: #ffffff;
    }

    .requirement {
        color: rgba(255, 255, 255, 0.5);
    }

    .requirement.met {
        color: #4ade80;
    }

    .requirement.met i {
        color: #4ade80;
    }

    .field-error {
        color: #f87171;
    }

    .global-error {
        color: #f87171;
    }

    .btn-submit {
        background: #ffffff;
        color: #000000;
    }

    .btn-submit:hover:not(:disabled) {
        background: #f0f0f0;
        box-shadow: 0 4px 12px rgba(255, 255, 255, 0.1);
    }

    .btn-submit:disabled {
        background: rgba(255, 255, 255, 0.15);
        color: rgba(255, 255, 255, 0.4);
    }

    .spinner {
        border-color: rgba(0, 0, 0, 0.2);
        border-top-color: #000000;
    }

    .spinner.large {
        border-color: rgba(255, 255, 255, 0.15);
        border-top-color: #ffffff;
    }

    .backup-code-section {
        border-top-color: rgba(255, 255, 255, 0.1);
    }

    .backup-code-toggle {
        color: rgba(255, 255, 255, 0.4);
    }

    .backup-code-toggle:hover {
        color: rgba(255, 255, 255, 0.6);
    }

    .success-icon i {
        color: #4ade80;
    }

    .error-icon i {
        color: #f87171;
    }
}
