/* -------------------------------------------------------------
   CCAmbassador Login Drawer & Form Styles
   MU Plugin: ccambassador-user-registration
---------------------------------------------------------------- */

/* 1. Authorised Access / Login Link */
.cc-authorised-access-link {
    color: var(--color-primary) !important;
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    font-family: var(--font-secondary);
    font-size: 1.6rem;
    font-weight: 400;
    line-height: 1.5;
    letter-spacing: -0.176px;
    text-decoration: underline;
    white-space: nowrap;
    cursor: pointer;

    .page-title-group & {
        text-align: right;
    }

    &.cc-loading {
        opacity: 0.6;
        pointer-events: none;
        cursor: wait;
    }
}

/* 2. Dedicated Slide-out Login Drawer */
.cc-login-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    inset: 0 0 0 auto;
    margin: 0;
    border: none;
    height: 100vh;
    height: 100dvh;
    width: 568px;
    max-width: 90vw;
    background-color: #fff;
    box-shadow: -2px 0 6px 0 rgba(0, 0, 0, 0.16);
    z-index: 99999;
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out, visibility 0.3s ease-in-out;
    padding-inline: clamp(1rem, 5vw, 4rem);
    padding-block: 8.8rem;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
    overscroll-behavior: contain;
    visibility: hidden;

    &.is-open,
    &.open {
        visibility: visible;
        transform: translateX(0);
    }

    &::-webkit-scrollbar {
        width: 8px;

        &-thumb {
            background: transparent;
            border-radius: 10px;
        }
    }

    &:hover {
        scrollbar-color: #e8e6e6 transparent;

        &::-webkit-scrollbar-thumb {
            background: #e8e6e6;
        }
    }

    @media screen and (max-width: 730px) {
        width: 100vw;
        max-width: 100vw;
        padding-bottom: max(3.6rem, calc(1.6rem + env(safe-area-inset-bottom)));
    }

    /* WordPress Admin Bar offset */
    body.admin-bar & {
        top: 32px;
        height: calc(100vh - 32px);
        height: calc(100dvh - 32px);
        height: calc(100svh - 32px);

        @media screen and (max-width: 782px) {
            top: 46px;
            height: calc(100vh - 46px);
            height: calc(100dvh - 46px);
            height: calc(100svh - 46px);
        }
    }

    .cc-drawer-close {
        background: none;
        border: none;
        position: absolute;
        top: 2.4rem;
        right: 2.4rem;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        color: #000;
        padding: 1rem;
        transition: color 0.2s ease;
        z-index: 10;

        &:hover {
            color: var(--black-40, #666);
        }

        svg {
            display: block;
        }
    }

    .cc-login-drawer-content {
        .cc-loading {
            text-align: center;
            font-style: italic;
            color: #999;
            padding-top: 4rem;
        }
    }
}

/* 3. Login Form Styles */
.cc-sidebar-login-container {
    width: 312px;
    margin-inline: auto;

    .cc-detail-title {
        margin-bottom: 4rem;
        color: #1E1E1E;
        font-size: 3.6rem;
        line-height: 1.5;
        letter-spacing: -0.684px;
        font-weight: 600;
    }

    .cc-login-error-message,
    .cc-login-success-message {
        display: none;
        padding: 1.2rem 1.6rem;
        font-size: 1.4rem;
        border-radius: 4px;
        margin-bottom: 2rem;
        line-height: 1.4;
    }

    .cc-login-error-message {
        background-color: #fdf2f2;
        border-left: 4px solid #de350b;
        color: #de350b;
    }

    .cc-login-success-message {
        background-color: #f3faf7;
        border-left: 4px solid #00a86b;
        color: #00a86b;
    }

    form {
        margin-bottom: 7.2rem;
    }

    .cc-form-group {
        margin-bottom: 2.4rem;

        label {
            display: block;
            color: #49454F;
            font-size: 1.4rem;
            line-height: 2.4rem;
            letter-spacing: 0.15px;
            margin-bottom: 0.4rem;
        }

        input {
            width: 100%;
            border-radius: 4px;
            border: 1px solid #C8C8C8;
            padding: 1.2rem 2rem;
            font-size: 1.6rem;
            box-sizing: border-box;

            &::placeholder {
                color: #AFAEAE;
                font-size: 1.6rem;
                line-height: 1.5;
                letter-spacing: 0.15px;
            }

            &:focus-visible {
                outline-offset: 0;
                border-color: var(--color-primary, #005a9c);
            }
        }
    }

    .cc-form-row {
        color: #000;
        font-size: 1.6rem;
        line-height: 2.4rem;
        margin-bottom: 4rem;

        a.cc-forgot-password-link {
            color: var(--color-accent, #005a9c);
            font-weight: 600;
            text-decoration: none;

            &:hover {
                text-decoration: underline;
            }
        }
    }

    .cc-submit-row {
        display: block;

        button[type="submit"],
        .btn-primary {
            width: 100%;

            &:disabled,
            &.cc-loading {
                background-color: var(--black-20, #ccc);
                color: #666;
                cursor: not-allowed;
                pointer-events: none;
                opacity: 0.7;
            }
        }
    }

    .cc-register-prompt {
        display: block;

        p {
            margin-bottom: 1.6rem;
            color: #000;
            text-align: center;
            font-size: 1.6rem;
            line-height: 2.4rem;
            letter-spacing: 0.15px;
        }

        a.btn {
            width: 100%;
            text-decoration: none;
            display: inline-block;
            text-align: center;
            box-sizing: border-box;
        }

        p:last-of-type {
            margin-top: 2.4rem;
            line-height: 140%;
            letter-spacing: -0.176px;
        }
    }

    .cf-turnstile-disclaimer {
        font-size: 1.1rem;
        color: #767676;
        margin-top: 1.6rem;
        margin-bottom: 0;
        text-align: center;
        width: 100%;
        line-height: 1.5;

        a {
            color: inherit;
            text-decoration: underline;
        }
    }
}
