/**
 * WooPlus Auth — v2.21.0 lazy-AJAX redesign add-on.
 *
 * This file adds CSS for the new lazy-loaded tab system on top of the
 * existing auth-frontend.css. It is enqueued AFTER the base file so its
 * rules win cascade tie-breaks.
 *
 * Sections:
 *   1. Panel host (transition between fetched panels)
 *   2. Skeleton loader
 *   3. Refined tab strip (taller, animated icon, scale active)
 *   4. Refined buttons (shimmer hover + loading spinner)
 *   5. Refined inputs (1.5px border, focus glow)
 *   6. Password show/hide toggle
 *   7. Magic-link + passkey panels
 *   8. Dark-mode bridge
 *   9. wp-login.php specific
 */

/* ============================================================================
   1. Panel host — cross-fade between panels with subtle slide.
   ============================================================================ */
.wpu-auth-panel-host {
    position: relative;
    min-height: 0;
    /* Note: NO transform-origin on parent — the .is-leaving / .is-entering
       classes drive the actual movement on innerHTML so the transitions
       only run on the content swap, not on every internal layout shift. */
    transition: opacity .18s ease;
    will-change: opacity;
}
.wpu-auth-panel-host.is-loading {
    opacity: .55;
    pointer-events: none;
}
.wpu-auth-panel-host.is-leaving {
    opacity: 0;
    transform: translateX(8px); /* RTL: slide left as it fades out */
    transition: opacity .14s ease, transform .14s ease;
}
.wpu-auth-panel-host.is-entering {
    animation: wpu-auth-panel-in .26s cubic-bezier(.2, .9, .25, 1);
}
@keyframes wpu-auth-panel-in {
    from { opacity: 0; transform: translateX(-8px); }  /* RTL enter from left */
    to   { opacity: 1; transform: translateX(0); }
}
@media (prefers-reduced-motion: reduce) {
    .wpu-auth-panel-host.is-leaving,
    .wpu-auth-panel-host.is-entering { animation: none; transform: none; }
}

/* ============================================================================
   2. Skeleton loader — three pulsing bars while a tab fetch is in flight.
   ============================================================================ */
.wpu-auth-panel-skeleton {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 4px 0;
}
.wpu-auth-panel-skeleton[hidden] { display: none; }
.wpu-auth-skel-line,
.wpu-auth-skel-input,
.wpu-auth-skel-button {
    background: linear-gradient(90deg,
        rgba(99, 102, 241, .06) 0%,
        rgba(99, 102, 241, .14) 40%,
        rgba(99, 102, 241, .06) 80%);
    background-size: 200% 100%;
    border-radius: 10px;
    animation: wpu-auth-skel-shimmer 1.4s ease-in-out infinite;
}
.wpu-auth-skel-line   { height: 12px; width: 35%; }
.wpu-auth-skel-input  { height: 44px; width: 100%; border-radius: 12px; }
.wpu-auth-skel-button { height: 46px; width: 100%; border-radius: 12px; }
@keyframes wpu-auth-skel-shimmer {
    0%   { background-position:  200% 0; }
    100% { background-position: -200% 0; }
}

/* ============================================================================
   3. Tab strip refinements
   - Taller pill (48px → 52px) with more breathing room.
   - Icon shifts color smoothly to brand on activation.
   - Active tab scales subtly (1 → 1.02) so it lifts above the strip.
   ============================================================================ */
.wpu-auth-tabs {
    /* Override base for higher-fidelity feel: a touch more padding,
       slightly stronger shadow, and a backdrop-blur layer for depth. */
    padding: 5px;
    border-radius: 16px;
    background: rgba(255, 255, 255, .85);
    backdrop-filter: blur(12px) saturate(120%);
    -webkit-backdrop-filter: blur(12px) saturate(120%);
    border: 1px solid rgba(99, 102, 241, .08);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, .8) inset,
        0 8px 24px -12px rgba(99, 102, 241, .25);
}
.wpu-auth-tab {
    /* min height 48px → 52px for fingertip targets */
    min-height: 52px;
    padding: 10px 14px;
    border-radius: 12px;
    transition:
        color .2s ease,
        background-color .2s ease,
        transform .25s cubic-bezier(.2, .9, .25, 1);
    color: #6b7280;
    font-weight: 600;
    letter-spacing: -.005em;
}
.wpu-auth-tab:hover:not(.is-active) {
    color: #374151;
    background: rgba(99, 102, 241, .04);
}
.wpu-auth-tab.is-active {
    color: var(--wpu-auth-primary, #157a41);
    transform: scale(1.02);
}
.wpu-auth-tab.is-active .wpu-auth-tab-icon {
    color: var(--wpu-auth-primary, #157a41);
    transform: scale(1.05);
}
.wpu-auth-tab-icon {
    transition: color .2s ease, transform .25s cubic-bezier(.2, .9, .25, 1);
}
.wpu-auth-tab-label {
    font-size: 13px;
    line-height: 1.2;
}
.wpu-auth-tab:focus-visible {
    outline: 2px solid var(--wpu-auth-primary, #157a41);
    outline-offset: 2px;
}
/* Indicator: gradient pill instead of flat color */
.wpu-auth-tab-indicator {
    background: linear-gradient(135deg,
        rgba(99, 102, 241, .12),
        rgba(139, 92, 246, .14));
    border: 1px solid rgba(99, 102, 241, .18);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, .85) inset,
        0 4px 12px -6px rgba(99, 102, 241, .35);
    transition:
        right .35s cubic-bezier(.34, 1.2, .5, 1),
        width .35s cubic-bezier(.34, 1.2, .5, 1);
}
@media (prefers-reduced-motion: reduce) {
    .wpu-auth-tab,
    .wpu-auth-tab-icon,
    .wpu-auth-tab-indicator { transition: none !important; }
}

/* ============================================================================
   4. Buttons — shimmer hover + integrated loading state
   ============================================================================ */
.wpu-auth-btn {
    /* The base styles already define gradient + shadow — we only add the
       shimmer overlay and the loading-spinner styling. */
    position: relative;
    overflow: hidden;
    isolation: isolate; /* contain the ::before shimmer */
}
.wpu-auth-btn::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg,
        transparent 30%,
        rgba(255, 255, 255, .25) 50%,
        transparent 70%);
    transform: translateX(-100%);
    transition: transform .55s ease;
    pointer-events: none;
    z-index: 1;
}
.wpu-auth-btn:hover:not(:disabled)::before {
    transform: translateX(100%);
}
.wpu-auth-btn > * {
    position: relative;
    z-index: 2;
}

/* Loading state — replaces text with a spinner */
.wpu-auth-btn.is-loading {
    color: transparent !important;
    pointer-events: none;
}
.wpu-auth-btn.is-loading::after {
    content: "";
    position: absolute;
    inset: 0;
    margin: auto;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, .35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: wpu-auth-spin .7s linear infinite;
    z-index: 2;
}
@keyframes wpu-auth-spin {
    to { transform: rotate(360deg); }
}

.wpu-auth-btn-icon {
    display: inline-flex;
    align-items: center;
    margin-left: 8px; /* RTL — icon sits to the right of the label */
}

/* ============================================================================
   5. Inputs — 1.5px border, slightly stronger focus glow.
   ============================================================================ */
.wpu-auth-input,
.wpu-auth-country {
    border-width: 1.5px;
    transition:
        border-color .18s ease,
        box-shadow .18s ease,
        background-color .18s ease;
}
.wpu-auth-input:hover:not(:focus),
.wpu-auth-country:hover:not(:focus) {
    border-color: #b5bcc5;
}
.wpu-auth-input:focus,
.wpu-auth-country:focus {
    /* The base file already sets the indigo glow; we just bump it
       slightly so it reads on the new card surface. */
    box-shadow: 0 0 0 4px rgba(99, 102, 241, .14);
}

/* OTP code input — give each digit position its own subtle backdrop */
.wpu-auth-code {
    background:
        linear-gradient(transparent 0 96%, rgba(21,122,65,.18) 96% 100%) 0 0/calc(100%/var(--wpu-otp-len, 5)) 100% repeat-x,
        #fff;
}

/* ============================================================================
   6. Password show/hide toggle
   ============================================================================ */
.wpu-auth-pw-wrap {
    position: relative;
    margin-bottom: 16px;
}
.wpu-auth-pw-wrap .wpu-auth-input {
    margin-bottom: 0;
    padding-left: 44px; /* RTL: leave space on the left for the toggle */
}
.wpu-auth-pw-toggle {
    position: absolute;
    top: 50%;
    left: 8px;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 0;
    background: transparent;
    color: #9ca3af;
    cursor: pointer;
    border-radius: 8px;
    transition: color .15s ease, background-color .15s ease;
}
.wpu-auth-pw-toggle:hover {
    color: var(--wpu-auth-primary, #157a41);
    background: rgba(99, 102, 241, .08);
}
.wpu-auth-pw-toggle:focus-visible {
    outline: 2px solid var(--wpu-auth-primary, #157a41);
    outline-offset: 2px;
}

/* ============================================================================
   7. Magic-link + passkey helpers
   ============================================================================ */
.wpu-auth-helper {
    color: #4b5563;
    font-size: 13px;
    line-height: 1.65;
    margin: 0 0 16px;
    padding: 12px 14px;
    background: rgba(99, 102, 241, .05);
    border: 1px solid rgba(99, 102, 241, .12);
    border-radius: 10px;
}
.wpu-auth-passkey-hint {
    color: #6b7280;
    font-size: 12px;
    line-height: 1.6;
    margin: 12px 0 0;
    text-align: center;
}

/* ============================================================================
   8. Dark-mode bridge — only when the DS opts in
   ============================================================================ */
[data-wooplus-theme="dark"] .wpu-auth-tabs {
    background: rgba(30, 30, 40, .55);
    border-color: rgba(255, 255, 255, .06);
}
[data-wooplus-theme="dark"] .wpu-auth-tab { color: #9ca3af; }
[data-wooplus-theme="dark"] .wpu-auth-tab:hover:not(.is-active) {
    color: #e5e7eb;
    background: rgba(255, 255, 255, .04);
}
[data-wooplus-theme="dark"] .wpu-auth-skel-line,
[data-wooplus-theme="dark"] .wpu-auth-skel-input,
[data-wooplus-theme="dark"] .wpu-auth-skel-button {
    background: linear-gradient(90deg,
        rgba(99, 102, 241, .08) 0%,
        rgba(99, 102, 241, .20) 40%,
        rgba(99, 102, 241, .08) 80%);
    background-size: 200% 100%;
}
[data-wooplus-theme="dark"] .wpu-auth-helper {
    background: rgba(99, 102, 241, .10);
    border-color: rgba(99, 102, 241, .22);
    color: #cfe6d7;
}

/* ============================================================================
   9. wp-login.php specific — when our card lives inside the WP login chrome,
      don't try to paint a full-page gradient (the DS skin owns that).
   ============================================================================ */
body.login .wpu-auth-page {
    min-height: 0;
    padding: 0;
    background: transparent;
}
body.login .wpu-auth-bg { display: none; }

/* On wp-login the auth card carries its own (smaller) shadow because the
   DS skin already paints the surrounding gradient panel. */
body.login .wpu-auth-card {
    box-shadow:
        0 1px 0 rgba(255, 255, 255, .8) inset,
        0 18px 38px -16px rgba(15, 23, 42, .25);
}
