@import '../core/variables.css';
@import '../core/base.css';
@import '../core/components.css';

.auth-container {
    position: relative;
    width: 100%;
    max-width: 100%;
    min-height: auto;
    background: var(--color-modal-bg);
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
    margin: 24px auto;
    z-index: 2;
    display: flex;
    flex-direction: column;
}

.forms-wrapper {
    display: flex;
    width: 200%;
    height: 100%;
    transition: transform 0.6s ease-in-out;
    will-change: transform;
}

.auth-container.active .forms-wrapper {
    transform: translateX(-50%);
}

.auth-container-footer {
    margin-top: auto;
}

.form-container {
    flex: 0 0 50%;
    flex-direction: column;
    width: 50%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.form-container h2 {
    color: var(--color-white);
    font-family: var(--font-primary);
    font-size: 20px;
    letter-spacing: 2px;
    font-weight: bold;
    text-align: center;
    margin-top: 24px;
    margin-bottom: 16px;
}

.container-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 5px;
    width: 100%;
}

.container-input-group {
    width: 100%;
}

.container-input {
    display: flex;
    flex-direction: column;
    gap: 3px;
    width: 100%;
}

.login-container {
    z-index: 2;
}

.register-container {
    z-index: 1;
}

.auth-form {
    background: transparent;
    display: flex;
    flex-direction: column;
    padding: 24px 20px;
    justify-content: flex-start;
    width: 100%;
    max-width: 100%;
    gap: 16px;
}

.auth-form h2 {
    color: var(--color-white);
    font-family: var(--font-primary);
    font-size: 20px;
    letter-spacing: 2px;
    margin-bottom: 8px;
    font-weight: bold;
    text-align: center;
}

.auth-form .subtitle {
    color: rgba(255, 255, 255, 0.8);
    font-family: var(--font-primary);
    font-size: 11px;
    letter-spacing: 1.5px;
    margin-bottom: 8px;
    font-weight: bold;
    text-align: center;
}

.input-group {
    position: relative;
    margin-bottom: 2px;
}

.input-group input:not([type="checkbox"]) {
    width: 100%;
    padding: 14px 14px 14px 44px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    font-size: 16px;
    outline: none;
    background: rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    color: var(--color-white);
    font-family: var(--font-primary);
}

.input-group input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.input-group input:focus {
    border-color: var(--color-cyan);
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 0 3px rgba(0, 188, 212, 0.1);
}

.input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: rgba(255, 255, 255, 0.6);
    pointer-events: none;
    z-index: 2;
    transition: color 0.2s ease;
}

.input-group input:focus ~ .input-icon,
.input-group input:not(:placeholder-shown) ~ .input-icon {
    color: var(--color-cyan);
}

.input-group label:not(.checkbox-label) {
    position: absolute;
    left: 44px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.6);
    font-family: var(--font-primary);
    font-size: 13px;
    letter-spacing: 1.5px;
    font-weight: bold;
    pointer-events: none;
    transition: all 0.2s ease;
}

.input-group input:focus + label,
.input-group input:not(:placeholder-shown) + label {
    top: 8px;
    transform: translateY(0);
    font-size: 10px;
    color: var(--color-cyan);
}

.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrapper input {
    padding-right: 50px;
}

.eye-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: rgba(255, 255, 255, 0.6);
    font-size: 18px;
    transition: color 0.3s ease;
    z-index: 3;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.eye-icon:hover {
    color: var(--color-cyan);
}

.remember-group {
    margin-top: 8px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-family: var(--font-primary);
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--color-cyan);
    cursor: pointer;
}

.login-btn,
.signup-btn {
    margin-top: 8px;
    padding: 14px;
    background: var(--color-cyan);
    border: none;
    border-radius: 10px;
    color: var(--color-white);
    font-family: var(--font-primary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    width: 100%;
}

.login-btn:hover,
.signup-btn:hover {
    background: var(--color-success);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 188, 212, 0.4);
}

.login-btn:active,
.signup-btn:active {
    transform: translateY(0);
}

.signup-btn[aria-disabled="true"] {
    opacity: 0.5;
    cursor: not-allowed;
}

.signup-btn[aria-disabled="true"]:hover {
    background: var(--color-cyan);
    transform: none;
    box-shadow: none;
}

.form-footer {
    margin-top: 16px;
    text-align: center;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
}

.form-footer .link {
    color: var(--color-cyan);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.form-footer .link:hover {
    color: var(--color-success);
    text-decoration: underline;
}

.guest-prompt {
    margin-top: 10px;
    text-align: center;
}

.guest-prompt a {
    color: #0cacdf;
    font-family: var(--font-primary);
    font-size: 12px;
    font-style: italic;
    text-decoration: underline;
    letter-spacing: 1px;
    transition: opacity var(--transition-fast) ease;
}

.guest-prompt a:hover {
    opacity: 0.8;
}

.overlay-container {
    position: absolute;
    top: 0;
    left: 50%;
    width: 50%;
    height: 100%;
    overflow: hidden;
    transition: transform 0.6s ease-in-out;
    z-index: 10;
    display: none;
}

.auth-container.active .overlay-container {
    transform: translateX(-100%);
}

.overlay {
    position: relative;
    width: 200%;
    height: 100%;
    background: linear-gradient(135deg, var(--color-forest-green) 0%, var(--color-cyan) 100%);
    transition: transform 0.6s ease-in-out;
}

.auth-container.active .overlay {
    transform: translateX(-50%);
}

.overlay-panel {
    position: absolute;
    top: 0;
    width: 50%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px;
    text-align: center;
}

.overlay-left {
    left: 0;
}

.overlay-right {
    right: 0;
}

.overlay-panel h2 {
    color: var(--color-white);
    font-family: var(--font-primary);
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 12px;
    text-align: center;
}

.overlay-panel p {
    color: rgba(255, 255, 255, 0.9);
    font-family: var(--font-primary);
    font-size: 12px;
    line-height: 1.6;
    margin-bottom: 20px;
    text-align: center;
    max-width: 280px;
}

.btn-ghost {
    background: transparent;
    border: 2px solid var(--color-white);
    border-radius: 30px;
    color: var(--color-white);
    font-family: var(--font-primary);
    font-size: 12px;
    font-weight: 600;
    padding: 10px 28px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-ghost:hover {
    background: var(--color-white);
    color: var(--color-modal-bg);
}

.auth-requirements {
    margin-bottom: 8px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    font-size: 10px;
    color: var(--color-white);
    font-family: var(--font-primary);
}

.auth-requirements ul {
    margin: 4px 0;
    padding-left: 16px;
    list-style: none;
}

.auth-requirements li {
    margin: 2px 0;
    position: relative;
    padding-left: 16px;
}

.auth-requirements li::before {
    content: '✗';
    color: var(--color-error);
    position: absolute;
    left: 0;
}

.auth-requirements li.valid::before {
    content: '✓';
    color: var(--color-success);
}

.custom-file-upload {
    display: inline-block;
    width: 100%;
    padding: 14px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px dashed rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    color: var(--color-white);
    font-family: var(--font-primary);
    font-size: 13px;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 0.5px;
}

.custom-file-upload:hover {
    border-color: var(--color-cyan);
    background: rgba(0, 188, 212, 0.1);
}

.form-container-dummy{
    width: 0%;
    height: 0%;
}

@media (min-width: 480px) {
    .auth-container {
        max-width: 900px;
        min-height: 600px;
        border-radius: var(--border-radius-xl);
        box-shadow: var(--box-shadow-modal);
        margin: auto;
        flex-direction: row;
    }

    .forms-wrapper {
        height: 100%;
        width: 200%;
    }

    .form-container {
        height: 100%;
    }

    .auth-form {
        padding: 40px 50px;
        max-width: 450px;
        gap: 8px;
    }

    .auth-form h2 {
        font-size: 24px;
        margin-bottom: 16px;
    }

    .auth-form .subtitle {
        font-size: 11px;
        margin-bottom: 8px;
    }

    .input-group input:not([type="checkbox"]) {
        padding: 12px 12px 12px 44px;
        font-size: 14px;
    }

    .input-group .input-icon {
        left: 12px;
        width: 18px;
        height: 18px;
    }

    .input-group label:not(.checkbox-label) {
        left: 44px;
        font-size: 13px;
    }

    .input-group input:focus + label,
    .input-group input:not(:placeholder-shown) + label {
        top: 8px;
        font-size: 10px;
    }

    .password-wrapper input {
        padding-right: 50px;
    }

    .remember-group {
        margin-top: 15px;
    }

    .checkbox-label {
        font-size: 12px;
    }

    .login-btn,
    .signup-btn {
        margin-top: 15px;
        padding: 12px;
        font-size: 14px;
    }

    .form-footer {
        margin-top: auto;
        font-size: 12px;
    }

    .container-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 3px;
    }

    .container-input-group:first-child .container-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .container-input-group:nth-child(2) .container-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .container-input-group:nth-child(3) .container-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .overlay-container {
        display: block;
    }

    .form-container-dummy{
        flex: 0 0 50%;
        flex-direction: column;
        width: 50%;
        height: 100%;
        display: flex;
    }
}

@media (min-width: 768px) {
    .auth-form {
        padding: 40px 60px;
    }

    .input-group input:not([type="checkbox"]) {
        padding: 14px 14px 14px 44px;
    }

    .login-btn,
    .signup-btn {
        padding: 14px;
    }

    .overlay-panel {
        padding: 60px;
    }

    .overlay-panel h2 {
        font-size: 24px;
    }

    .overlay-panel p {
        font-size: 13px;
    }

    .form-container-dummy{
        flex: 0 0 50%;
        flex-direction: column;
        width: 50%;
        height: 100%;
        display: flex;
    }
}

@media (min-width: 1024px) {
    .hero-container {
        min-height: 100vh;
        height: 100vh;
    }

    .auth-container {
        min-height: 600px;
    }

    .form-container-dummy{
        flex: 0 0 50%;
        flex-direction: column;
        width: 50%;
        height: 100%;
        display: flex;
    }
}


/* ==========================================================================
   SIGNUP UI ADDITIONS (keep this block last so it overrides the rules above)
   ========================================================================== */

/* ---------- Fit the whole form: no clipping at top or bottom ---------- */

/* The page may grow taller than the screen; never force it to 100vh */
.hero-container {
    height: auto !important;
    min-height: 100dvh;
    justify-content: flex-start;
    padding-bottom: 32px;
}

/* The card keeps its full content height instead of shrinking and clipping */
.auth-container {
    flex-shrink: 0;
    height: auto;
    min-height: 600px;
}

/* Start the form at the top; centring is what cut off the heading */
.form-container {
    justify-content: flex-start;
    height: auto;
}

.forms-wrapper {
    align-items: stretch;
}

.register-container .auth-form,
.login-container .auth-form {
    padding-top: 8px;
    padding-bottom: 28px;
}

.register-container h2 {
    margin-top: 28px;
    margin-bottom: 8px;
}

.container-row {
    align-items: start;
    column-gap: 8px;
    row-gap: 6px;
}

@media (min-width: 480px) {
    .register-container .input-group input:not([type="checkbox"]) {
        padding-top: 11px;
        padding-bottom: 11px;
    }

    .register-container .auth-requirements {
        padding: 6px 8px;
        margin-bottom: 4px;
    }

    .register-container .auth-requirements ul {
        margin: 2px 0;
    }

    .register-container .auth-requirements li {
        margin: 1px 0;
    }

    .register-container .signup-btn {
        margin-top: 10px;
    }

    .register-container .form-footer {
        margin-top: 10px;
        padding-bottom: 4px;
    }
}

@media (min-width: 480px) and (max-width: 1100px) {
    .register-container .auth-form {
        padding-left: 28px;
        padding-right: 28px;
    }
}

/* ---------- Fluid text ---------- */
.form-container h2,
.auth-form h2 {
    font-size: clamp(18px, 4.5vw, 24px);
    letter-spacing: clamp(1px, 0.3vw, 2px);
}

.auth-form .subtitle {
    font-size: clamp(10px, 2.6vw, 12px);
}

.input-group input:not([type="checkbox"]) {
    font-size: clamp(14px, 3.8vw, 16px);
    min-width: 0;
}

/* Floating labels use the real available width (no more "FIRST ...") */
.input-group label:not(.checkbox-label) {
    font-size: clamp(10.5px, 2.8vw, 12px);
    letter-spacing: 0.8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: calc(100% - 58px);
}

/* Labels beside the eye icon reserve room on the right */
.password-wrapper label:not(.checkbox-label) {
    max-width: calc(100% - 92px);
}

.input-group input:focus + label,
.input-group input:not(:placeholder-shown) + label {
    font-size: clamp(9px, 2.4vw, 10px);
}

.auth-requirements {
    font-size: clamp(10px, 2.8vw, 12px);
    line-height: 1.4;
}

.form-footer,
.checkbox-label {
    font-size: clamp(11px, 3vw, 13px);
}

.container-input > p {
    color: rgba(255, 255, 255, 0.85);
    font-family: var(--font-primary);
    font-size: clamp(11px, 3vw, 13px);
    margin: 6px 0 4px;
}

.login-btn,
.signup-btn {
    font-size: clamp(12px, 3.2vw, 14px);
}

@media (max-width: 479px) {
    .container-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    .auth-form {
        padding: 20px 16px;
    }
}

/* ---------- Terms block ---------- */
.terms-section {
    margin-top: 10px;
    text-align: left;
}

.terms-link {
    background: none;
    border: none;
    padding: 0;
    font-family: var(--font-primary);
    font-size: clamp(11px, 3vw, 13px);
    color: var(--color-white);
    text-decoration: underline;
    cursor: pointer;
    text-align: left;
}

.terms-link:hover,
.terms-link:focus-visible {
    color: var(--color-cyan);
}

.terms-hint {
    margin: 6px 0 0;
    font-family: var(--font-primary);
    font-size: clamp(10px, 2.8vw, 12px);
    color: rgba(255, 255, 255, 0.65);
    font-style: italic;
}

.terms-checkboxes {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.terms-check {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-family: var(--font-primary);
    font-size: clamp(11px, 3vw, 13px);
    line-height: 1.4;
    color: var(--color-white);
    cursor: pointer;
    transition: opacity 0.2s ease, color 0.2s ease;
}

.terms-check input[type="checkbox"] {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    margin-top: 1px;
    accent-color: var(--color-cyan);
    cursor: pointer;
}

/* Disabled until the terms are read to the bottom. Keys off the real
   `disabled` attribute, so enabling the checkbox removes this look. */
.terms-check:has(input:disabled) {
    opacity: 0.45 !important;
    color: rgba(255, 255, 255, 0.7) !important;
    cursor: not-allowed !important;
}

.terms-check:has(input:disabled) input {
    cursor: not-allowed !important;
    filter: grayscale(1);
}

.terms-check:has(input:disabled)::after {
    content: "\1F512";
    font-size: 0.9em;
    margin-left: auto;
}

/* ---------- Terms modal ---------- */
.terms-modal {
    padding: 12px;
    box-sizing: border-box;
}

.terms-modal-content {
    background: #2b3a2f;
    color: var(--color-white);
    padding: clamp(16px, 4vw, 25px);
    border-radius: 12px;
    width: 100%;
    max-width: 550px;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    box-sizing: border-box;
}

.terms-modal-content h3 {
    margin: 0 0 12px;
    font-size: clamp(15px, 4vw, 18px);
    border-bottom: 1px solid #444;
    padding-bottom: 8px;
}

.terms-scroll {
    flex: 1 1 auto;
    min-height: 140px;
    max-height: 55vh;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    font-size: clamp(12px, 3.2vw, 13px);
    line-height: 1.55;
    color: #ddd;
    padding: 12px;
    border: 1px solid #444;
    border-radius: 6px;
    background: #1e2821;
    text-align: left;
}

.terms-scroll p {
    margin: 0 0 12px;
}

.terms-modal-footer {
    margin-top: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.terms-progress {
    font-family: var(--font-primary);
    font-size: clamp(10px, 2.8vw, 12px);
    color: rgba(255, 255, 255, 0.7);
}

.terms-close-btn {
    padding: 8px 18px;
    background: #4CAF50;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    transition: opacity 0.2s ease;
    width: auto;
}

.terms-close-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.custom-file-upload {
    box-sizing: border-box;
    font-size: clamp(12px, 3.2vw, 13px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---------- Back to home ---------- */
.auth-back-btn {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 20;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(12, 24, 10, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.25);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    color: var(--color-white);
    font-family: var(--font-primary);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-decoration: none;
    transition: background var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
}

.auth-back-btn .material-symbols-outlined {
    font-size: 20px;
    transition: transform var(--transition-fast);
}

.auth-back-btn:hover {
    background: rgba(0, 188, 212, 0.35);
    border-color: var(--color-cyan);
}

.auth-back-btn:hover .material-symbols-outlined {
    transform: translateX(-3px);
}

.auth-back-btn:focus-visible {
    outline: 2px solid var(--color-cyan);
    outline-offset: 2px;
}

/* Small phones: arrow only, so it never overlaps the card */
@media (max-width: 479px) {
    .auth-back-btn {
        top: 10px;
        left: 10px;
        padding: 8px;
    }

    .auth-back-text {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-back-btn,
    .auth-back-btn .material-symbols-outlined {
        transition: none;
    }
}


/* ==========================================================================
   PHONE LAYOUT (< 480px)
   Why it was too long: both forms sit side by side inside .forms-wrapper, so
   the card was as tall as the SIGN UP form even while SIGN IN was showing,
   and a leftover min-height: 600px plus the 64px header margin added more.
   Now the form that is not showing collapses to zero height, so the card is
   exactly as tall as the form you are looking at.
   Keep this block last.
   ========================================================================== */
@media (max-width: 479px) {

    /* No header on this page: drop the 64px gap, leave room for the back button */
    .hero-container {
        margin-top: 0;
        padding: 56px 12px 24px;
        min-height: 100dvh;
    }

    .auth-container {
        min-height: 0;
        margin: 0 auto;
        border-radius: var(--border-radius-xl);
        box-shadow: var(--box-shadow-modal);
    }

    .forms-wrapper {
        align-items: flex-start;
    }

    /* The form that is not showing takes no height (and no tab stops) */
    .auth-container:not(.active) .register-container,
    .auth-container.active .login-container {
        max-height: 0;
        overflow: hidden;
        visibility: hidden;
        transition: visibility 0s linear 0.6s;
    }

    /* Tighter headings, logo and spacing */
    .form-container h2,
    .register-container h2 {
        margin-top: 18px;
        margin-bottom: 4px;
    }

    .plantellect-logo {
        height: 56px;
    }

    .login-container .auth-form,
    .register-container .auth-form {
        padding: 4px 16px 20px;
        gap: 8px;
    }

    .container-row {
        gap: 6px;
    }

    .remember-group {
        margin-top: 2px;
    }

    .login-btn,
    .signup-btn,
    .register-container .signup-btn {
        margin-top: 6px;
        padding: 12px;
    }

    .form-footer {
        margin-top: 8px;
    }

    .guest-prompt {
        margin-top: 4px;
    }

    /* Sign up: first and last name share a row; icons are hidden to give the
       fields room, so the labels start at the left edge */
    .register-container .container-input-group:first-child .container-row {
        grid-template-columns: 1fr 1fr;
    }

    .register-container .input-icon {
        display: none;
    }

    .register-container .input-group input:not([type="checkbox"]) {
        padding: 18px 12px 6px 12px;
    }

    .register-container .input-group label:not(.checkbox-label) {
        left: 12px;
        max-width: calc(100% - 28px);
    }

    .register-container .password-wrapper label:not(.checkbox-label) {
        max-width: calc(100% - 62px);
    }

    /* Requirement lists run in a row instead of a tall stack */
    .auth-requirements {
        padding: 6px 8px;
        margin-bottom: 2px;
    }

    .auth-requirements ul {
        display: flex;
        flex-wrap: wrap;
        gap: 0 14px;
        margin: 0;
        padding-left: 0;
    }

    .auth-requirements li {
        margin: 1px 0;
    }

    .terms-section {
        margin-top: 4px;
    }

    }


/* ==========================================================================
   SIGN UP: PASSWORD + CONFIRM PASSWORD LABELS WERE CUT OFF ("CONFIRM...")
   The two password fields shared one row, so each was only ~160px wide and the
   label had to reserve room for the lock icon and the eye icon, leaving ~68px
   for the text. They now sit one under the other at full width, so the whole
   label shows. Keep this block last.
   ========================================================================== */
.register-container .container-input-group:nth-child(2) .container-row + .container-row {
    grid-template-columns: 1fr;
}

/* Never clip these two labels with "..." */
.register-container .password-wrapper label:not(.checkbox-label) {
    max-width: calc(100% - 92px);
    text-overflow: clip;
}

/* The same fix at the wider breakpoints, where the labels also keep their
   letter-spacing and size so nothing shrinks */
@media (min-width: 480px) {
    .register-container .password-wrapper label:not(.checkbox-label) {
        font-size: 12px;
        letter-spacing: 0.8px;
    }
}


/* ==========================================================================
   WIDER SIGN IN / SIGN UP BOX (tablet and desktop)
   The card was capped at 900px and each form at 450px, which squeezed the
   fields together. Keep this block last.
   ========================================================================== */
@media (min-width: 768px) {
    .auth-container {
        max-width: 1100px;
    }

    /* Forms use the whole half of the card instead of stopping at 450px */
    .auth-form {
        max-width: none;
    }

    .login-container .auth-form,
    .register-container .auth-form {
        padding-left: clamp(32px, 5vw, 64px);
        padding-right: clamp(32px, 5vw, 64px);
    }

    /* More air between neighbouring fields */
    .container-row {
        column-gap: 18px;
        row-gap: 10px;
    }

    .auth-form {
        gap: 12px;
    }
}

/* Wide enough for password and confirm password to sit side by side again */
@media (min-width: 1200px) {
    .register-container .container-input-group:nth-child(2) .container-row + .container-row {
        grid-template-columns: 1fr 1fr;
    }
}


/* ==========================================================================
   BACK BUTTON + CARD PLACEMENT (auth.html and forgot-pass.html)
   The button sits in the page flow directly above the card, lined up with the
   card's left edge. `margin: auto` on the card used to centre it vertically
   inside the flex column, which left a gap under the button; vertical margins
   are now 0 and the card is centred horizontally with align-self instead.
   Keep this block last.
   ========================================================================== */
.hero-container {
    margin-top: 0;
    padding-top: 24px;
    align-items: stretch;          /* children position themselves with align-self */
}

.auth-container {
    margin-top: 0;
    margin-bottom: 0;
    align-self: center;            /* card stays centred horizontally */
}

.auth-back-btn {
    position: relative;
    top: auto;
    left: auto;
    align-self: flex-start;
    flex: 0 0 auto;
    width: fit-content;
    /* line up with the card: it is centred and at most 1100px wide */
    margin: 0 0 14px max(0px, calc((100% - 1100px) / 2));
}

/* 480-767px the card is capped at 900px but the viewport is narrower, so it
   fills the width and the button needs no offset */
@media (min-width: 480px) and (max-width: 767px) {
    .auth-back-btn {
        margin-left: 0;
    }
}

@media (max-width: 479px) {
    .hero-container {
        padding-top: 16px;
    }

    .auth-back-btn {
        top: auto;
        left: auto;
        margin: 0 0 12px 0;
    }
}

/* The browser's own "show password" eye drew a second eye next to ours. */
input[type="password"]::-ms-reveal,
input[type="password"]::-ms-clear { display: none; }
input[type="password"]::-webkit-credentials-auto-fill-button { visibility: hidden; display: none !important; pointer-events: none; }
