/*
 * Auth pages: login, register, lost password, new password.
 * Everything is scoped under .sublim-auth so nothing leaks into the
 * header, footer or the logged-in My Account dashboard.
 *
 * Contrast (on #fff): text #07071b 19:1, muted #4a4a5a 8.9:1,
 * brand #8b6d6e 4.65:1, brand hover #6f5455 6.9:1.
 * White on #8b6d6e 4.65:1, white on #6f5455 6.9:1.
 */

.sublim-auth-container {
    padding: clamp(16px, 5vw, 48px) 16px clamp(32px, 8vw, 80px);
}

.sublim-auth {
    --auth-text: #07071b;
    --auth-muted: #4a4a5a;
    --auth-brand: #8b6d6e;
    --auth-brand-hover: #6f5455;
    --auth-tint: #ebd2d2;
    --auth-border: #8b6d6e;
    --auth-error-bg: #fdecec;
    --auth-error-text: #7a1620;
    --auth-ok-bg: #eef6ee;
    --auth-ok-text: #1d4d2b;

    box-sizing: border-box;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    padding: clamp(20px, 5vw, 40px);
    background: #fff;
    color: var(--auth-text);
    border: 1px solid var(--auth-tint);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(7, 7, 27, 0.06);
    line-height: 1.5;
}

.sublim-auth *,
.sublim-auth *::before,
.sublim-auth *::after {
    box-sizing: border-box;
}

/* The dashboard grid (woocommerce.css) must not apply to auth forms. */
.sublim-auth .woocommerce {
    display: block;
    max-width: none;
    margin: 0;
    padding: 0;
}

.sublim-auth h1,
.sublim-auth h2 {
    margin: 0 0 24px;
    text-align: center;
    font-size: clamp(1.5rem, 1.2rem + 1.5vw, 2rem);
    line-height: 1.2;
    color: var(--auth-text);
}

.sublim-auth p {
    margin: 0 0 16px;
    color: var(--auth-muted);
    font-size: 1rem;
}

/* Forms */
.sublim-auth form {
    margin: 0;
    padding: 0;
    border: 0;
}

.sublim-auth .form-row,
.sublim-auth .woocommerce-form-row {
    float: none;
    width: 100%;
    margin: 0 0 20px;
    padding: 0;
}

.sublim-auth .clear {
    display: none;
}

.sublim-auth label {
    display: block;
    margin: 0 0 6px;
    color: var(--auth-text);
    font-size: 0.95rem;
    font-weight: 600;
}

.sublim-auth .required {
    color: var(--auth-error-text);
    text-decoration: none;
    border: 0;
}

.sublim-auth .screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.sublim-auth input[type="text"],
.sublim-auth input[type="email"],
.sublim-auth input[type="password"] {
    display: block;
    width: 100%;
    min-height: 48px;
    padding: 12px 14px;
    background: #fff;
    color: var(--auth-text);
    border: 1px solid var(--auth-border);
    border-radius: 6px;
    font: inherit;
    font-size: 16px; /* prevents iOS zoom on focus */
    line-height: 1.3;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.sublim-auth input:focus {
    outline: 2px solid var(--auth-text);
    outline-offset: 2px;
    border-color: var(--auth-text);
}

.sublim-auth .remember-me {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 16px;
}

.sublim-auth .checkbox {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    min-height: 44px;
    font-weight: 500;
    cursor: pointer;
}

.sublim-auth input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin: 0;
    accent-color: var(--auth-brand-hover);
}

/* Links */
.sublim-auth a {
    color: var(--auth-brand-hover);
    text-decoration: underline;
    text-underline-offset: 3px;
    border-radius: 2px;
}

.sublim-auth a:hover {
    color: var(--auth-text);
}

.sublim-auth a:focus-visible {
    outline: 2px solid var(--auth-text);
    outline-offset: 2px;
}

.sublim-auth .lost-password {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    font-size: 0.95rem;
}

.sublim-auth .return-to-login {
    margin: 8px 0 0;
    text-align: center;
}

.sublim-auth .return-to-login a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
}

/* Buttons */
.sublim-auth .button,
.sublim-auth button[type="submit"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 48px;
    padding: 12px 20px;
    background: var(--auth-brand-hover);
    color: #fff;
    border: 2px solid var(--auth-brand-hover);
    border-radius: 6px;
    font: inherit;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.sublim-auth .button:hover,
.sublim-auth button[type="submit"]:hover {
    background: var(--auth-text);
    border-color: var(--auth-text);
    color: #fff;
}

.sublim-auth .button:focus-visible,
.sublim-auth button:focus-visible {
    outline: 2px solid var(--auth-text);
    outline-offset: 3px;
}

.sublim-auth .button-outline {
    background: #fff;
    color: var(--auth-brand-hover);
    border-color: var(--auth-brand-hover);
}

.sublim-auth .button-outline:hover {
    background: var(--auth-tint);
    border-color: var(--auth-text);
    color: var(--auth-text);
}

/* "or" separator */
.sublim-auth .form-separator {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 24px 0;
}

.sublim-auth .separator-line {
    flex: 1;
    height: 1px;
    background: var(--auth-tint);
}

.sublim-auth .separator-text {
    color: var(--auth-muted);
    font-size: 0.9rem;
}

/* Login / register switch */
.sublim-auth .sublim-login-form,
.sublim-auth .sublim-register-form {
    display: none;
}

.sublim-auth .sublim-login-form.active,
.sublim-auth .sublim-register-form.active {
    display: block;
}

/* Show/hide password */
.sublim-auth .password-input-wrapper {
    position: relative;
}

.sublim-auth .password-input-wrapper input {
    padding-right: 52px;
}

.sublim-auth .password-toggle {
    position: absolute;
    top: 50%;
    right: 2px;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 6px;
    color: var(--auth-muted);
    cursor: pointer;
}

.sublim-auth .password-toggle:hover {
    color: var(--auth-text);
}

/* WooCommerce's own show/hide button (injected around password inputs) */
.sublim-auth .password-input {
    position: relative;
    display: block;
}

.sublim-auth .password-input input {
    padding-right: 52px;
}

.sublim-auth .show-password-input {
    position: absolute;
    top: 0;
    right: 2px;
    width: 44px;
    height: 48px;
    padding: 0;
    margin: 0;
    background: transparent;
    border: 0;
    border-radius: 6px;
    cursor: pointer;
    color: var(--auth-muted);
}

.sublim-auth .show-password-input::after {
    content: "\f06e"; /* Font Awesome eye */
    font-family: "Font Awesome 6 Free", "Font Awesome 5 Free", FontAwesome;
    font-weight: 900;
    font-size: 1rem;
}

.sublim-auth .show-password-input.display-password::after {
    content: "\f070"; /* Font Awesome eye-slash */
}

.sublim-auth .show-password-input:hover {
    color: var(--auth-text);
}

.sublim-auth .password-strength-meter {
    margin-top: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--auth-muted);
}

.sublim-auth .password-strength-meter[data-strength="0"],
.sublim-auth .password-strength-meter[data-strength="1"] { color: var(--auth-error-text); }
.sublim-auth .password-strength-meter[data-strength="2"] { color: #7a4a00; }
.sublim-auth .password-strength-meter[data-strength="3"],
.sublim-auth .password-strength-meter[data-strength="4"] { color: var(--auth-ok-text); }

.sublim-auth .woocommerce-password-hint,
.sublim-auth .woocommerce-password-strength {
    display: block;
    margin-top: 6px;
    font-size: 0.9rem;
    color: var(--auth-muted);
}

/* Notices (printed above the auth card by WooCommerce) */
.sublim-auth-container .woocommerce-error,
.sublim-auth-container .woocommerce-message,
.sublim-auth-container .woocommerce-info,
.sublim-auth .woocommerce-error,
.sublim-auth .woocommerce-message,
.sublim-auth .woocommerce-info {
    box-sizing: border-box;
    max-width: 480px;
    margin: 0 auto 16px;
    padding: 14px 16px;
    list-style: none;
    border: 1px solid transparent;
    border-left-width: 4px;
    border-radius: 6px;
    font-size: 0.95rem;
}

.sublim-auth-container .woocommerce-error,
.sublim-auth .woocommerce-error {
    background: #fdecec;
    color: #7a1620;
    border-color: #7a1620;
}

.sublim-auth-container .woocommerce-message,
.sublim-auth-container .woocommerce-info,
.sublim-auth .woocommerce-message,
.sublim-auth .woocommerce-info {
    background: #eef6ee;
    color: #1d4d2b;
    border-color: #1d4d2b;
}

.sublim-auth .woocommerce-error li,
.sublim-auth-container .woocommerce-error li {
    margin: 0;
}

.sublim-auth .woocommerce-error a,
.sublim-auth .woocommerce-message a {
    color: inherit;
}

/* Small phones: use the full width, drop the heavy card chrome */
@media (max-width: 480px) {
    .sublim-auth-container {
        padding-left: 12px;
        padding-right: 12px;
    }

    .sublim-auth {
        border-radius: 8px;
        box-shadow: none;
    }

    .sublim-auth .remember-me {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sublim-auth * {
        transition: none !important;
    }
}
