/* ==========================================================================
   AdForm Auth Pages — Modern SaaS Design (V11)
   ========================================================================== */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f8f9fb;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    line-height: 1.5;
}

.auth-container { width: 100%; max-width: 400px; }
.auth-container.wide { max-width: 440px; }

.auth-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 48px 40px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02), 0 8px 16px rgba(0,0,0,0.06);
    border: 1px solid rgba(0,0,0,0.05);
    position: relative;
}

/* ---- Header ---- */
.auth-header { text-align: center; margin-bottom: 32px; }

.auth-logo {
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
}

.auth-logo-mark {
    width: 36px; height: 36px;
    background: #7C3AED;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.auth-logo-mark svg { display: block; }

.auth-header h1 {
    color: #1a1f36;
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.auth-header p,
.auth-description {
    color: #8792a2;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.6;
    text-align: center;
    margin-bottom: 8px;
}

/* Standalone title/description (used outside auth-header wrapper) */
.auth-title {
    color: #1a1f36;
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
    text-align: center;
}

/* ---- Header icon (forgot/reset) ---- */
.auth-icon-box {
    width: 48px; height: 48px;
    background: #f3f0ff;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    color: #7C3AED;
}

/* ---- Input Groups with Floating Labels ---- */
.input-group {
    position: relative;
    margin-bottom: 24px;
}

.input-group input {
    width: 100%;
    background: #ffffff;
    border: 1px solid #e3e8ee;
    border-radius: 6px;
    padding: 16px 14px 8px 14px;
    color: #1a1f36;
    font-size: 16px;
    font-weight: 400;
    outline: none;
    transition: all 0.2s ease;
    font-family: inherit;
}

.input-group input:focus { border-color: #7C3AED; }
.input-group input::placeholder { color: transparent; }

/* Fix browser autofill: keep white background, float label */
.input-group input:-webkit-autofill,
.input-group input:-webkit-autofill:hover,
.input-group input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 30px #ffffff inset !important;
    -webkit-text-fill-color: #1a1f36 !important;
    transition: background-color 5000s ease-in-out 0s;
}

.input-group label {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #8792a2;
    font-size: 16px;
    font-weight: 400;
    pointer-events: none;
    transition: all 0.2s ease;
    background: #ffffff;
    padding: 0 2px;
}

/* Float label on focus, when filled, or when browser autofills */
.input-group input:focus + label,
.input-group input:not(:placeholder-shown) + label,
.input-group input:-webkit-autofill + label {
    top: 0;
    font-size: 12px;
    font-weight: 500;
    color: #7C3AED;
    transform: translateY(-50%);
}

.input-group input:not(:focus):not(:placeholder-shown) + label {
    color: #6b7385;
}

/* Border animation — hidden, using border-color transition instead */
.input-border { display: none; }

/* ---- Input row (side by side) ---- */
.input-row {
    display: flex;
    gap: 12px;
}

.input-row .input-group { flex: 1; }

/* ---- Password toggle ---- */
.input-group:has(.password-toggle) input { padding-right: 42px; }

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

.password-toggle:hover { color: #7C3AED; }

/* ---- Form Options ---- */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 16px;
}

.checkbox-container {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
    color: #6b7385;
    font-weight: 500;
}

.checkbox-container input[type="checkbox"] { display: none; }

.checkmark {
    width: 18px; height: 18px;
    border: 1.5px solid #d1d9e0;
    border-radius: 4px;
    margin-right: 10px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: transparent;
}

.checkbox-container input[type="checkbox"]:checked + .checkmark {
    background: #7C3AED;
    border-color: #7C3AED;
    color: white;
}

.forgot-link {
    color: #7C3AED;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.2s ease;
}

.forgot-link:hover { color: #5B21B6; }

/* ---- Submit Button ---- */
.submit-btn {
    width: 100%;
    background: #7C3AED;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    padding: 14px 20px;
    cursor: pointer;
    font-family: inherit;
    font-size: 16px;
    font-weight: 500;
    position: relative;
    transition: all 0.2s ease;
    overflow: hidden;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.submit-btn:hover {
    background: #6D28D9;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.4);
}

.submit-btn:active { transform: translateY(0); }

.submit-btn:disabled {
    background: #a2a7b5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-text { transition: opacity 0.2s ease; }

.btn-loader {
    position: absolute;
    opacity: 0;
    transition: opacity 0.2s ease;
    color: #ffffff;
}

.submit-btn.loading .btn-text { opacity: 0; }
.submit-btn.loading .btn-loader { opacity: 1; }

/* ---- Secondary link (outline) ---- */
.btn-outline {
    display: inline-block;
    padding: 12px 32px;
    border: 1px solid #e3e8ee;
    border-radius: 6px;
    color: #1a1f36;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-outline:hover { border-color: #7C3AED; color: #7C3AED; }

/* ---- Footer link ---- */
.auth-footer {
    text-align: center;
    font-size: 14px;
    color: #8792a2;
    margin-top: 24px;
}

.auth-footer a {
    color: #7C3AED;
    text-decoration: none;
    font-weight: 500;
}

.auth-footer a:hover { color: #5B21B6; text-decoration: underline; }

/* ---- Back link ---- */
.back-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 24px;
    font-size: 14px;
    color: #8792a2;
    text-decoration: none;
}

.back-link:hover { color: #7C3AED; }

/* ---- Error States ---- */
.error-message {
    color: #f56565;
    font-size: 12px;
    font-weight: 500;
    margin-top: 6px;
    opacity: 0;
    transform: translateY(-4px);
    transition: all 0.2s ease;
}

.error-message.show { opacity: 1; transform: translateY(0); }

.input-group.error input { border-color: #f56565; background: #fef5f5; }
.input-group.error input:focus { border-color: #f56565; }
.input-group.error label { color: #f56565; }
.input-group.error .input-border { background: #f56565; }

/* Alert banner */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.alert-info {
    background: #f0f9ff;
    color: #0369a1;
    border: 1px solid #bae6fd;
}

.alert-success {
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
}

/* ---- Success State ---- */
.success-state {
    display: none;
    text-align: center;
    padding: 8px 0;
}

.success-state.show { display: block; }

.success-icon {
    margin: 0 auto 20px;
}

.success-state h2 {
    color: #1a1f36;
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.success-state p {
    color: #8792a2;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 16px;
}

.email-highlight {
    color: #7C3AED;
    font-weight: 600;
}

/* ---- Password strength ---- */
.password-strength {
    display: flex;
    gap: 4px;
    margin-top: 8px;
}

.password-strength .bar {
    flex: 1;
    height: 3px;
    border-radius: 2px;
    background: #e3e8ee;
    transition: background 0.3s;
}

.password-strength .bar.weak { background: #f56565; }
.password-strength .bar.medium { background: #f59e0b; }
.password-strength .bar.strong { background: #10b981; }

.password-hint {
    font-size: 12px;
    color: #8792a2;
    margin-top: 6px;
}

/* Password rules checklist */
.password-rules {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    margin-top: 10px;
    margin-bottom: 4px;
}

.pw-rule {
    font-size: 12px;
    color: #c1c9d6;
    transition: color 0.2s;
}

.pw-rule::before {
    content: '\25CB';
    margin-right: 4px;
    font-size: 10px;
}

.pw-rule.valid {
    color: #10b981;
}

.pw-rule.valid::before {
    content: '\2713';
}

/* ---- Terms ---- */
.terms {
    font-size: 12px;
    color: #8792a2;
    text-align: center;
    margin-top: 16px;
    line-height: 1.6;
}

.terms a { color: #7C3AED; text-decoration: none; }
.terms a:hover { text-decoration: underline; }

/* ---- OTP Code Input ---- */
.otp-inputs {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin: 24px 0;
}

.otp-inputs input {
    width: 48px; height: 56px;
    border: 1px solid #e3e8ee;
    border-radius: 8px;
    text-align: center;
    font-size: 24px;
    font-weight: 600;
    font-family: 'Courier New', monospace;
    color: #7C3AED;
    outline: none;
    transition: all 0.2s;
}

.otp-inputs input:focus {
    border-color: #7C3AED;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.08);
}

.otp-resend {
    text-align: center;
    font-size: 13px;
    color: #8792a2;
    margin-top: 16px;
}

.otp-resend button {
    background: none;
    border: none;
    color: #7C3AED;
    font-weight: 500;
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
}

.otp-resend button:hover { text-decoration: underline; }
.otp-resend button:disabled { color: #c1c9d6; cursor: not-allowed; text-decoration: none; }

/* ---- SVG icons inline ---- */
.svg-icon { display: inline-block; vertical-align: middle; }

/* ---- Responsive ---- */
@media (max-width: 480px) {
    body { padding: 16px; }
    .auth-card { padding: 36px 28px; border-radius: 8px; }
    .auth-header h1 { font-size: 1.375rem; }
    .form-options { flex-direction: column; align-items: flex-start; gap: 16px; }
    .input-row { flex-direction: column; gap: 0; }
    .otp-inputs input { width: 42px; height: 48px; font-size: 20px; }
}
