/* =============================================================================
   AUTH DRAWER — Login / Register / Forgot Password
   Slide-in right-side panel for logged-out users.
   Replicates the cart drawer pattern.
   ============================================================================= */

/* -----------------------------------------------------------------------------
   Reset Astra's default button border/shadow on icon-style and text-style
   buttons only. Submit + social buttons define their own borders explicitly.
   ----------------------------------------------------------------------------- */
.store-auth-drawer__close,
.store-auth-drawer__switch-link,
.store-header__account-btn[data-js="open-auth"] {
    border: none !important;
    box-shadow: none !important;
    -webkit-appearance: none;
    appearance: none;
}

/* -----------------------------------------------------------------------------
   Drawer root
   ----------------------------------------------------------------------------- */
.store-auth-drawer {
    position: fixed;
    inset: 0;
    z-index: 9998; /* just below cart drawer at 9999 */
    pointer-events: none;
}

.store-auth-drawer.is-open {
    pointer-events: auto;
}

/* -----------------------------------------------------------------------------
   Overlay
   ----------------------------------------------------------------------------- */
.store-auth-drawer__overlay {
    position: fixed;
    inset: 0;
    background: rgba(26, 26, 26, 0.4);
    opacity: 0;
    transition: opacity var(--duration-normal, 0.3s) ease;
}

.store-auth-drawer.is-open .store-auth-drawer__overlay {
    opacity: 1;
}

/* -----------------------------------------------------------------------------
   Panel
   ----------------------------------------------------------------------------- */
.store-auth-drawer__panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 420px;
    background: var(--color-white);
    transform: translateX(100%);
    transition: transform var(--duration-normal, 0.3s) ease;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.store-auth-drawer.is-open .store-auth-drawer__panel {
    transform: translateX(0);
}

@media (prefers-reduced-motion: reduce) {
    .store-auth-drawer__overlay,
    .store-auth-drawer__panel {
        transition: none;
    }
}

/* -----------------------------------------------------------------------------
   Header
   ----------------------------------------------------------------------------- */
.store-auth-drawer__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: clamp(1.25rem, 4vw, 1.75rem) clamp(1.25rem, 4vw, 1.75rem) 0;
    flex-shrink: 0;
}

.store-auth-drawer__title {
    font-family: var(--font-serif);
    font-weight: 300;
    font-size: clamp(1.25rem, 3vw, 1.5rem);
    color: var(--color-black);
    margin: 0;
    letter-spacing: 0.02em;
}

.store-auth-drawer__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-charcoal);
    padding: 0;
    margin-right: -0.5rem;
    transition: color 0.2s ease;
}

.store-auth-drawer__close:hover {
    color: var(--color-black);
}

.store-auth-drawer__close:focus-visible {
    outline: 2px solid var(--color-gold);
    outline-offset: 2px;
    border-radius: 2px;
}

/* -----------------------------------------------------------------------------
   Body (forms container)
   ----------------------------------------------------------------------------- */
.store-auth-drawer__body {
    padding: clamp(1.5rem, 4vw, 2rem) clamp(1.25rem, 4vw, 1.75rem);
    flex: 1;
}

/* -----------------------------------------------------------------------------
   Individual form
   ----------------------------------------------------------------------------- */
.store-auth-drawer__form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.store-auth-drawer__form[hidden] {
    display: none;
}

/* -----------------------------------------------------------------------------
   Field (label + input pair)
   ----------------------------------------------------------------------------- */
.store-auth-drawer__field {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.store-auth-drawer__label {
    font-family: var(--font-sans);
    font-size: 0.6875rem; /* 11px */
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-gray);
}

.store-auth-drawer__input {
    font-family: var(--font-sans);
    font-size: 1rem; /* 16px — prevents iOS zoom */
    color: var(--color-black);
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--color-sand);
    border-radius: 0;
    padding: 0.625rem 0;
    width: 100%;
    outline: none;
    transition: border-color 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
}

.store-auth-drawer__input:focus {
    border-bottom-color: var(--color-black);
}

.store-auth-drawer__input::placeholder {
    color: var(--color-light-gray);
}

/* -----------------------------------------------------------------------------
   Submit button
   ----------------------------------------------------------------------------- */
.store-auth-drawer__submit {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 48px;
    background: var(--color-gold);
    color: var(--color-white);
    border: none;
    border-radius: 2px;
    box-shadow: none;
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: background 0.2s ease;
    padding: 0 1.5rem;
    margin-top: 0.25rem;
}

.store-auth-drawer__submit:hover {
    background: var(--color-gold-dark);
}

.store-auth-drawer__submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.store-auth-drawer__submit:focus-visible {
    outline: 2px solid var(--color-gold-dark);
    outline-offset: 2px;
}

/* -----------------------------------------------------------------------------
   Message (error / success)
   ----------------------------------------------------------------------------- */
.store-auth-drawer__message {
    font-family: var(--font-sans);
    font-size: 0.8125rem;
    line-height: 1.5;
    padding: 0.625rem 0.875rem;
    border-radius: 2px;
}

.store-auth-drawer__message[hidden] {
    display: none;
}

.store-auth-drawer__message--error {
    background: #fdf2f2;
    color: #c0392b;
    border: 1px solid #f5c6c6;
}

.store-auth-drawer__message--success {
    background: #f2fdf5;
    color: #27ae60;
    border: 1px solid #c6f0d0;
}

/* -----------------------------------------------------------------------------
   Divider
   ----------------------------------------------------------------------------- */
.store-auth-drawer__divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--color-light-gray);
    font-family: var(--font-sans);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.store-auth-drawer__divider::before,
.store-auth-drawer__divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--color-sand);
}

/* -----------------------------------------------------------------------------
   Social buttons
   ----------------------------------------------------------------------------- */
.store-auth-drawer__social {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.store-auth-drawer__social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    width: 100%;
    min-height: 48px;
    background: var(--color-white);
    border: 1px solid var(--color-sand);
    border-radius: 2px;
    font-family: var(--font-sans);
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--color-charcoal);
    cursor: pointer;
    padding: 0 1rem;
    transition: border-color 0.2s ease;
}

.store-auth-drawer__social-btn:hover {
    border-color: var(--color-light-gray);
}

.store-auth-drawer__social-btn:focus-visible {
    outline: 2px solid var(--color-gold);
    outline-offset: 2px;
    border-radius: 2px;
}

/* -----------------------------------------------------------------------------
   Switch links (e.g. "Forgot password?", "Create an account")
   ----------------------------------------------------------------------------- */
.store-auth-drawer__switch {
    font-family: var(--font-sans);
    font-size: 0.8125rem;
    text-align: center;
    color: var(--color-gray);
    margin: 0;
}

.store-auth-drawer__switch-link {
    color: var(--color-gold);
    text-decoration: none;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    display: inline;
    transition: none;
}

.store-auth-drawer__switch-link:hover,
.store-auth-drawer__switch-link:focus {
    color: var(--color-gold) !important; /* overrides Astra button:hover colour */
    text-decoration: underline !important;
    text-decoration-color: var(--color-gold) !important;
    background: none !important;
}

.store-auth-drawer__switch-link:focus-visible {
    outline: 2px solid var(--color-gold);
    outline-offset: 2px;
    border-radius: 1px;
}

/* -----------------------------------------------------------------------------
   Forgot password note
   ----------------------------------------------------------------------------- */
.store-auth-drawer__forgot {
    text-align: right;
    margin-top: -0.5rem;
}

/* -----------------------------------------------------------------------------
   Nextend Social Login button overrides
   Scope to .store-auth-drawer__social so we only target buttons inside our
   auth drawer, not any other NSL placements on the page.
   The plugin outputs inline background-color on .nsl-button, so !important is
   required to override provider brand colours with our white/sand style.
   ----------------------------------------------------------------------------- */
.store-auth-drawer__social .nsl-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
}

.store-auth-drawer__social .nsl-container a {
    display: flex;
    width: 100%;
    text-decoration: none;
}

.store-auth-drawer__social .nsl-button {
    display: flex !important; /* overrides NSL inline display */
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    width: 100%;
    min-height: 48px; /* 44px touch target minimum */
    background: var(--color-white) !important; /* overrides inline provider brand colour */
    border: 1px solid var(--color-sand);
    border-radius: 2px;
    font-family: var(--font-sans);
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--color-charcoal) !important; /* overrides NSL white text for dark bg */
    cursor: pointer;
    padding: 0 1rem;
    box-sizing: border-box;
    transition: border-color 0.2s ease;
}

.store-auth-drawer__social .nsl-button:hover {
    border-color: var(--color-light-gray);
}

.store-auth-drawer__social a:focus-visible .nsl-button {
    outline: 2px solid var(--color-gold);
    outline-offset: 2px;
    border-radius: 2px;
}

/* SVG icons inside NSL buttons — keep them their original brand colours */
.store-auth-drawer__social .nsl-button svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}
