/* ========================================
   ESTATE HELPER LOGIN PAGE
   WordPress native wp-login.php restyled
   Split layout: form left, branding right
   ======================================== */

body.login * {
    box-sizing: border-box;
}

body.login {
    font-family: var(--font-primary, 'Inter', sans-serif);
    min-height: 100vh;
    margin: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: var(--color-white, #FBFBF9) !important;
    color: var(--color-text-primary, #1F2A25);
}

body.login-action-lostpassword .reset-sent-message {
    display: block !important;
}

/* ========================================
   LEFT SIDE — FORM (#login)
   WordPress core sets #login to width: 320px
   which must be overridden with !important
   ======================================== */

#login {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    grid-column: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    padding-top: 80px;
    background: var(--color-white, #FBFBF9);
    position: relative;
}

/* Force any other WordPress elements into the left column so they don't break grid */
body.login > *:not(#login):not(.login-branding) {
    grid-column: 1;
    display: none;
}

/* Logo above form */
.login h1 a {
    display: block;
    width: 100%;
    height: 48px;
    margin: 0 0 24px 0;
    background-size: 32px 32px !important;
    background-position: center top !important;
    background-repeat: no-repeat !important;
    text-indent: -9999px;
    outline: none;
    box-shadow: none;
}

.login h1 a:focus {
    box-shadow: none;
}

/* Mobile logo — hidden on desktop, shown on mobile when branding panel hides */
.mobile-logo {
    display: none;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 32px;
}

.mobile-logo img {
    width: 60px;
    height: 60px;
    margin-bottom: 12px;
    object-fit: contain;
}

.mobile-logo span {
    font-size: 22px;
    font-weight: 700;
    color: var(--color-green-medium, #6B8A6E);
}

/* ========================================
   FORMS
   ======================================== */

/* Form Header (Welcome back, Create account, etc.) */
.form-header {
    margin-bottom: 32px;
    max-width: 400px;
    width: 100%;
}

.form-header h2 {
    font-size: 28px;
    font-weight: 700;
    color: var(--color-text-primary, #1F2A25);
    margin: 0 0 8px 0;
}

.form-header p {
    color: var(--color-text-muted, #6A756F);
    font-size: 15px;
    margin: 0;
}

/* Form Options Row (Remember me + Forgot password?) */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    max-width: 400px;
}

.forgot-link {
    font-size: 14px;
    color: var(--color-green-medium, #6B8A6E);
    text-decoration: none;
    font-weight: 500;
    line-height: 1;
}

.forgot-link:hover {
    text-decoration: underline;
}

/* Register prompt ("Don't have an account? Create one") */
.register-prompt,
#nav.register-prompt {
    text-align: center;
    margin-top: 20px !important;
    margin-bottom: 0 !important;
    font-size: 14px;
    color: var(--color-text-muted, #6A756F) !important;
    max-width: 400px;
    width: 100%;
}

.register-prompt a,
#nav.register-prompt a {
    color: var(--color-green-medium, #6B8A6E) !important;
    text-decoration: none;
    font-weight: 500;
}

.register-prompt a:hover,
#nav.register-prompt a:hover {
    text-decoration: underline;
}

.login form,
#login form,
#loginform,
#registerform,
#lostpasswordform {
    margin: 0 0 1rem 0 !important;
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    width: 100% !important;
    max-width: 400px !important;
}

.login form p {
    margin-bottom: 16px !important;
}

.login form p:last-of-type {
    margin-bottom: 0 !important;
}

/* Ensure labels have space above when following an input */
.login form p + p > label {
    margin-top: 4px;
}

/* Password wrapper spacing — WordPress wraps password in .user-pass-wrap */
.login form .user-pass-wrap {
    margin-bottom: 16px !important;
}

/* Ensure our password toggle wrapper has spacing */
.login-password-wrap {
    margin-bottom: 0;
}

.login form p .login-password-wrap {
    margin-top: 4px;
}

.login label {
    display: block;
    color: var(--color-text-primary, #1F2A25);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 6px;
}

/* Text & email inputs */
.login input[type="text"],
.login input[type="email"] {
    width: 100%;
    padding: 12px 14px;
    margin-top: 4px;
    margin-bottom: 0;
    font-size: 16px;
    line-height: 1.5;
    border: 1px solid var(--color-border, #D9D5CB);
    border-radius: var(--border-radius-sm, 8px);
    background: #fff;
    color: var(--color-text-primary, #1F2A25);
    font-family: inherit;
    -webkit-appearance: none;
    appearance: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

/* Password inputs */
.login input[type="password"] {
    width: 100%;
    padding: 12px 14px;
    margin-top: 0;
    margin-bottom: 0;
    font-size: 16px;
    line-height: 1.5;
    border: 1px solid var(--color-border, #D9D5CB);
    border-radius: var(--border-radius-sm, 8px);
    background: #fff;
    color: var(--color-text-primary, #1F2A25);
    font-family: inherit;
    -webkit-appearance: none;
    appearance: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.login input[type="text"]:focus,
.login input[type="email"]:focus,
.login input[type="password"]:focus {
    border-color: var(--color-green-medium, #6B8A6E);
    outline: none;
    box-shadow: 0 0 0 3px rgba(58, 90, 64, 0.15);
}

.login input::placeholder {
    color: var(--color-text-muted, #6A756F);
}

.login input[type="checkbox"],
#login input[type="checkbox"],
#loginform input[type="checkbox"] {
    width: 16px;
    height: 16px;
    min-width: 16px;
    min-height: 16px;
    margin: 0;
    cursor: pointer;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    border: 2px solid var(--color-border, #D9D5CB) !important;
    border-radius: 4px;
    background: #fff !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    background-size: 12px 12px !important;
    outline: none !important;
    box-shadow: none !important;
    transition: background-color 0.2s, border-color 0.2s;
}

.login input[type="checkbox"]:checked,
#login input[type="checkbox"]:checked,
#loginform input[type="checkbox"]:checked {
    background-color: var(--color-green-medium, #6B8A6E) !important;
    border-color: var(--color-green-medium, #6B8A6E) !important;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3E%3C/svg%3E") !important;
}

input[type=checkbox]:checked::before {
    content: none !important;
}

/* Remember me */
.login form .forgetmenot {
    margin-bottom: 16px;
}

.login form .forgetmenot label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--color-green-medium, #6B8A6E);
    font-weight: 500;
    cursor: pointer;
}

/* Submit button row */
.login form .submit {
    margin-top: 24px;
}

/* Caps lock warning */
.login .wp-pwd .pw-weak,
.login .wp-login-caps-lock-warning {
    display: none !important;
}

/* ========================================
   PRIMARY BUTTON
   ======================================== */

.wp-core-ui .button-primary {
    width: 100%;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 600;
    background: var(--color-green-medium, #6B8A6E) !important;
    border: none !important;
    border-radius: var(--border-radius-sm, 8px);
    color: #fff !important;
    box-shadow: var(--shadow-green, 0 2px 8px rgba(58, 90, 64, 0.3)) !important;
    text-shadow: none !important;
    height: auto;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.wp-core-ui .button-primary:hover,
.wp-core-ui .button-primary:focus {
    background: var(--color-green-dark, #445F47) !important;
    color: #fff !important;
    transform: translateY(-1px);
}

.wp-core-ui .button-primary:active {
    transform: translateY(0);
}

/* ========================================
   PASSWORD TOGGLE
   ======================================== */

/* Hide WordPress core show/hide password controls */
#login .wp-hide-pw,
#login .pw-toggle,
#login input#toggle-password,
#login label[for="toggle-password"],
#login .user-pass-wrap .password-wrapper,
#login .show-password,
#login .hide-password {
    display: none !important;
}

.login-password-wrap {
    position: relative;
    display: block;
    margin-top: 4px;
    margin-bottom: 0;
}

.login-password-wrap input {
    padding-right: 48px !important;
}

.login-password-wrap .login-password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--color-text-muted, #6A756F);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius-sm, 8px);
    transition: color 0.2s, background 0.2s;
}

.login-password-wrap .login-password-toggle:hover {
    color: var(--color-green-medium, #6B8A6E);
    background: rgba(79, 111, 82, 0.08);
}

.login-password-wrap .login-password-toggle:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(79, 111, 82, 0.3);
}

/* ========================================
   MESSAGES & ERRORS
   ======================================== */

/* Hide default WP instructional messages on register & lost password
   (CSS fallback so there's no flash before JS runs) */
body.login-action-register .message,
body.login-action-lostpassword .message {
    display: none;
}

/* JS also marks defaults with this class */
.login .message.wp-default-message {
    display: none;
}

/* Show messages that ARE status updates (errors, success confirmations) */
body.login-action-register #login_error,
body.login-action-lostpassword #login_error,
body.login-action-register .login-error,
body.login-action-lostpassword .login-error {
    display: block;
}

.login .message,
.login .success {
    border-left: 4px solid var(--color-green-medium, #6B8A6E);
    background: #F0FDF4;
    padding: 12px 16px;
    margin-bottom: 20px;
    border-radius: 0 var(--border-radius-sm, 8px) var(--border-radius-sm, 8px) 0;
    font-size: 13px;
    line-height: 1.5;
    box-shadow: none;
    max-width: 400px;
    width: 100%;
}

.login #login_error,
.login .login-error,
.login .notice-error {
    border: none !important;
    border-left: 4px solid #c53030 !important;
    background: #FEF2F2 !important;
    color: #991B1B !important;
    padding: 14px 18px !important;
    margin-bottom: 20px !important;
    border-radius: var(--border-radius-sm, 8px) !important;
    font-size: 14px !important;
    line-height: 1.6 !important;
    box-shadow: none !important;
    max-width: 400px;
    width: 100%;
}

.login #login_error a,
.login .notice-error a {
    color: var(--color-green-medium, #6B8A6E) !important;
    text-decoration: none;
    font-weight: 500;
}

.login #login_error a:hover,
.login .notice-error a:hover {
    text-decoration: underline;
}

/* WordPress notice styles override */
.login .notice:not(.message):not(.notice-error) {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 0 20px 0 !important;
}

.login .notice.notice-error {
    background: #FEF2F2 !important;
    border-left: 4px solid #c53030 !important;
    padding: 14px 18px !important;
    border-radius: var(--border-radius-sm, 8px) !important;
    color: #991B1B !important;
    font-size: 14px !important;
    line-height: 1.6 !important;
}

.login .notice.notice-error p {
    margin: 0 !important;
    color: #991B1B !important;
}

/* Hide "Registration confirmation will be emailed to you" since we auto-login */
#reg_passmail {
    display: none;
}

/* ========================================
   NAV LINKS (#nav, #backtoblog)
   ======================================== */

.login #nav,
.login #backtoblog {
    margin: 12px 0 0 0;
    padding: 0;
    font-size: 14px;
    max-width: 400px;
    width: 100%;
}

.login #nav a,
.login #backtoblog a {
    color: var(--color-green-medium, #6B8A6E);
    text-decoration: none;
    font-weight: 500;
}

.login #nav a:hover,
.login #backtoblog a:hover {
    text-decoration: underline;
}

/* Restyle #backtoblog as top-left "Back to" link */
#backtoblog {
    position: absolute;
    top: 32px;
    left: 32px;
    margin: 0 !important;
    font-size: 14px !important;
}

#backtoblog a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--color-text-muted, #6A756F) !important;
    font-weight: 500 !important;
}

#backtoblog a:hover {
    color: var(--color-green-medium, #6B8A6E) !important;
    text-decoration: none !important;
}

/* ========================================
   RIGHT SIDE — BRANDING PANEL
   ======================================== */

.login-branding {
    grid-column: 2;
    grid-row: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
    background: linear-gradient(135deg, var(--color-green-medium, #6B8A6E) 0%, var(--color-green-dark, #445F47) 100%);
    position: relative;
    overflow: hidden;
}

/* Decorative circles */
.login-branding::before {
    content: '';
    position: absolute;
    top: -100px;
    right: -100px;
    width: 400px;
    height: 400px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    pointer-events: none;
}

.login-branding::after {
    content: '';
    position: absolute;
    bottom: -150px;
    left: -100px;
    width: 500px;
    height: 500px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 50%;
    pointer-events: none;
}

.brand-content {
    text-align: center;
    color: white;
    position: relative;
    z-index: 2;
    max-width: 450px;
}

.brand-logo {
    width: 90px;
    height: 90px;
    background: var(--color-white, #fff);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.brand-logo img {
    width: 60px;
    height: 60px;
    object-fit: contain;
}

.brand-name {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 12px;
    color: #fff;
}

.brand-tagline {
    font-size: 20px;
    margin-bottom: 48px;
    font-weight: 400;
    color: #fff;
}

/* Illustration */
.illustration {
    margin-bottom: 48px;
}

.illustration svg {
    width: 280px;
    height: auto;
}

/* Trust Points */
.trust-points {
    display: flex;
    flex-direction: column;
    gap: 16px;
    text-align: left;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 24px 28px;
}

.trust-point {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 15px;
    color: #fff;
}

.trust-point svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

/* ========================================
   RESET PASSWORD PAGE
   ======================================== */

#resetpassform {
    margin: 0 0 1rem 0 !important;
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    width: 100% !important;
    max-width: 400px !important;
}

/* Hide WordPress password hints */
#resetpassform p.description {
    display: none !important;
}

/* Password field wrapper */
#resetpassform .wp-pwd {
    position: relative;
    margin-bottom: 16px;
}

#resetpassform input[type="password"],
#resetpassform input[type="text"] {
    width: 100%;
    padding: 12px 48px 12px 14px;
    font-size: 16px;
    line-height: 1.5;
    border: 1px solid var(--color-border, #D9D5CB);
    border-radius: var(--border-radius-sm, 8px);
    background: #fff;
    color: var(--color-text-primary, #1F2A25);
    font-family: inherit;
    -webkit-appearance: none;
    appearance: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#resetpassform input[type="password"]:focus,
#resetpassform input[type="text"]:focus {
    border-color: var(--color-green-medium, #6B8A6E);
    outline: none;
    box-shadow: 0 0 0 3px rgba(58, 90, 64, 0.15);
}

/* Hide WordPress core toggle — we inject our own */
#resetpassform .wp-hide-pw {
    display: none !important;
}

/* Strength meter */
#pass-strength-result {
    margin: 8px 0 16px 0 !important;
    padding: 8px 12px !important;
    border-radius: 6px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    text-align: center !important;
    border: none !important;
    background: var(--color-border, #D9D5CB) !important;
    color: var(--color-text-muted, #6A756F) !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

#pass-strength-result.short {
    background: #FECACA !important;
    color: #7F1D1D !important;
}

#pass-strength-result.bad {
    background: #FECACA !important;
    color: #7F1D1D !important;
}

#pass-strength-result.good {
    background: #FDE68A !important;
    color: #78350F !important;
}

#pass-strength-result.strong {
    background: #BBF7D0 !important;
    color: #14532D !important;
}

/* Generate Password button */
#resetpassform .button.button-secondary,
#resetpassform .wp-generate-pw {
    width: 100% !important;
    padding: 12px 24px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    font-family: inherit !important;
    background: transparent !important;
    border: 2px solid var(--color-green-medium, #6B8A6E) !important;
    border-radius: var(--border-radius-sm, 8px) !important;
    color: var(--color-green-medium, #6B8A6E) !important;
    cursor: pointer !important;
    text-shadow: none !important;
    box-shadow: none !important;
    height: auto !important;
    margin-bottom: 16px !important;
    transition: background 0.2s, color 0.2s !important;
}

#resetpassform .button.button-secondary:hover,
#resetpassform .wp-generate-pw:hover {
    background: var(--color-green-medium, #6B8A6E) !important;
    color: #fff !important;
}

/* Save Password submit button */
#resetpassform .submit {
    margin-top: 8px !important;
}

#resetpassform .submit .button-primary,
#resetpassform .submit input[type="submit"] {
    width: 100% !important;
    padding: 16px 24px !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    background: var(--color-green-medium, #6B8A6E) !important;
    border: none !important;
    border-radius: var(--border-radius-sm, 8px) !important;
    color: #fff !important;
    box-shadow: var(--shadow-green, 0 2px 8px rgba(58, 90, 64, 0.3)) !important;
    text-shadow: none !important;
    height: auto !important;
    font-family: inherit !important;
    cursor: pointer !important;
    transition: background 0.2s, transform 0.1s !important;
    opacity: 1 !important;
}

#resetpassform .submit .button-primary:hover,
#resetpassform .submit input[type="submit"]:hover {
    background: var(--color-green-dark, #445F47) !important;
    transform: translateY(-1px) !important;
}

#resetpassform .submit .button-primary:disabled,
#resetpassform .submit input[type="submit"]:disabled {
    background: var(--color-green-medium, #6B8A6E) !important;
    opacity: 0.6 !important;
    cursor: not-allowed !important;
    transform: none !important;
}

/* Weak password confirmation checkbox */
#resetpassform .pw-weak {
    display: none !important;
}

#resetpassform .pw-weak label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--color-text-primary, #1F2A25);
    margin: 0;
}

#resetpassform .pw-weak input[type="checkbox"] {
    margin: 0 !important;
    flex-shrink: 0;
}

/* Reset password page nav */
body.login-action-rp #nav,
body.login-action-resetpass #nav {
    max-width: 400px;
    width: 100%;
}

/* ========================================
   RESPONSIVE — LARGE TABLET (1024px)
   ======================================== */

@media (max-width: 1024px) {
    .login-branding {
        padding: 50px 40px;
    }

    .brand-logo {
        width: 70px;
        height: 70px;
    }

    .brand-logo img {
        width: 44px;
        height: 44px;
    }

    .brand-name {
        font-size: 28px;
    }

    .brand-tagline {
        font-size: 18px;
        margin-bottom: 36px;
    }

    .illustration svg {
        width: 240px;
    }
}

/* ========================================
   RESPONSIVE — TABLET (968px)
   Stack vertically, hide branding panel
   ======================================== */

@media (max-width: 968px) {
    body.login {
        display: block;
    }

    .login-branding {
        display: none;
    }

    #login {
        width: 100% !important;
        min-height: 100vh;
        padding: 80px 24px 50px;
        justify-content: center;
    }

    .form-header h2 {
        font-size: 24px;
    }

    .form-header {
        margin-bottom: 24px;
    }

    /* Show mobile logo when branding panel hides, hide WP logo */
    .mobile-logo {
        display: flex;
        margin-bottom: 40px;
    }

    .login h1 {
        display: none;
    }

    #backtoblog {
        top: 24px;
        left: 24px;
        right: auto;
        text-align: left;
    }

    .login form,
    #login form,
    #loginform,
    #registerform,
    #lostpasswordform,
    .form-options,
    .form-header,
    .register-prompt {
        max-width: 400px !important;
        width: 100% !important;
    }
}

/* ========================================
   RESPONSIVE — MOBILE (768px)
   ======================================== */

@media (max-width: 768px) {
    #login {
        width: 100% !important;
        padding: 70px 16px 40px;
        justify-content: flex-start;
    }

    #backtoblog {
        top: 20px;
        left: 16px;
        right: auto;
        text-align: left;
        font-size: 13px !important;
    }

    .mobile-logo img {
        width: 50px;
        height: 50px;
        margin-bottom: 10px;
    }

    .mobile-logo span {
        font-size: 20px;
    }

    .mobile-logo {
        margin-bottom: 40px;
    }

    .form-header h2 {
        font-size: 22px;
    }

    .form-header p {
        font-size: 14px;
    }

    .form-header {
        margin-bottom: 20px;
    }

    .form-options {
        flex-direction: row;
        align-items: center;
        gap: 0;
    }

    .login input[type="text"],
    .login input[type="email"],
    .login input[type="password"] {
        padding: 10px 12px;
        font-size: 16px;
        min-height: 48px;
    }

    .login-password-wrap input {
        padding-right: 48px !important;
    }

    .login-password-wrap .login-password-toggle {
        width: 44px;
        height: 44px;
        right: 8px;
    }

    .wp-core-ui .button-primary {
        padding: 12px 20px;
        font-size: 15px;
        min-height: 48px;
    }
}

/* ========================================
   RESPONSIVE — SMALL MOBILE (480px)
   ======================================== */

@media (max-width: 480px) {
    #login {
        width: 100% !important;
        padding: 60px 14px 36px;
    }

    .mobile-logo {
        margin-bottom: 40px;
    }

    .mobile-logo img {
        width: 44px;
        height: 44px;
        margin-bottom: 8px;
    }

    .mobile-logo span {
        font-size: 18px;
    }

    .form-header h2 {
        font-size: 20px;
    }

    .login label {
        font-size: 13px;
    }

    .login form .forgetmenot label {
        font-size: 12px;
    }

    .login #nav,
    .login #nav a {
        font-size: 13px;
    }

    #backtoblog {
        font-size: 12px !important;
        top: 16px;
        left: 14px;
    }
}

/* ========================================
   RESPONSIVE — VERY SMALL (375px)
   ======================================== */

@media (max-width: 375px) {
    #login {
        width: 100% !important;
        padding: 56px 12px 30px;
    }

    .mobile-logo img {
        width: 40px;
        height: 40px;
    }

    .mobile-logo span {
        font-size: 16px;
    }

    #backtoblog {
        font-size: 11px !important;
        top: 14px;
        left: 12px;
    }
}