/* =====================================================
   BILIPEDIA - FLOATING "REQUEST A RESOURCE" WIDGET
   -----------------------------------------------------
   A circular pink button pinned to the right edge that
   expands into a labelled pill on hover, plus the modal
   popup it opens. Uses the site's existing CSS variables
   so it always matches the theme.
===================================================== */

/* -----------------------------------------------------
   1. THE FLOATING BUTTON
----------------------------------------------------- */
.bp-req-fab {
    position: fixed;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1040;

    display: flex;
    align-items: center;
    gap: 0;

    height: 60px;
    width: 60px;
    padding: 0;
    border: none;
    border-radius: 999px;

    background: var(--gradient, linear-gradient(135deg, #fe3372 0%, #fe3372 100%));
    color: #fff;
    cursor: pointer;
    overflow: hidden;
    white-space: nowrap;

    box-shadow: 0 8px 30px rgba(254, 51, 114, .38), 0 2px 8px rgba(20, 21, 26, .12);

    /* Entrance animation - slides in from the right after load */
    animation: bp-req-fab-in .7s cubic-bezier(.22, 1, .36, 1) .4s both;
    transition: width .38s cubic-bezier(.22, 1, .36, 1),
                box-shadow .3s ease,
                transform .3s ease;
}

@keyframes bp-req-fab-in {
    from { opacity: 0; transform: translateY(-50%) translateX(90px) scale(.7); }
    to   { opacity: 1; transform: translateY(-50%) translateX(0)    scale(1); }
}

.bp-req-fab-icon {
    flex: 0 0 60px;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    line-height: 1;
    transition: transform .4s cubic-bezier(.22, 1, .36, 1);
}

.bp-req-fab-icon i { display: block; }

.bp-req-fab-label {
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: .01em;
    opacity: 0;
    padding-right: 4px;
    transform: translateX(-6px);
    transition: opacity .25s ease .06s, transform .3s ease .06s;
}

/* Expand into a pill on hover / keyboard focus */
.bp-req-fab:hover,
.bp-req-fab:focus-visible {
    width: 232px;
    box-shadow: 0 12px 38px rgba(254, 51, 114, .5), 0 3px 10px rgba(20, 21, 26, .16);
}

.bp-req-fab:hover .bp-req-fab-label,
.bp-req-fab:focus-visible .bp-req-fab-label {
    opacity: 1;
    transform: translateX(0);
}

.bp-req-fab:hover .bp-req-fab-icon,
.bp-req-fab:focus-visible .bp-req-fab-icon {
    transform: rotate(90deg);
}

.bp-req-fab:active { transform: translateY(-50%) scale(.96); }

.bp-req-fab:focus-visible {
    outline: 3px solid rgba(254, 51, 114, .45);
    outline-offset: 3px;
}

/* Soft pulsing halo to draw the eye, sits behind the button */
.bp-req-fab-pulse {
    position: absolute;
    right: 0;
    top: 50%;
    width: 60px;
    height: 60px;
    margin-top: -30px;
    border-radius: 50%;
    background: var(--pink, #fe3372);
    opacity: .55;
    z-index: -1;
    pointer-events: none;
    animation: bp-req-pulse 2.6s cubic-bezier(.4, 0, .6, 1) infinite;
}

@keyframes bp-req-pulse {
    0%   { transform: scale(1);    opacity: .5; }
    70%  { transform: scale(1.75); opacity: 0;  }
    100% { transform: scale(1.75); opacity: 0;  }
}

/* Stop the pulse once the user has interacted - it has done its job */
.bp-req-fab:hover .bp-req-fab-pulse,
.bp-req-fab.bp-req-seen .bp-req-fab-pulse { animation: none; opacity: 0; }

/* -----------------------------------------------------
   2. OVERLAY + MODAL
----------------------------------------------------- */
.bp-req-overlay {
    position: fixed;
    inset: 0;
    z-index: 1050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;

    background: rgba(20, 21, 26, .55);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);

    opacity: 0;
    transition: opacity .28s ease;
    overflow-y: auto;
}

.bp-req-overlay[hidden] { display: none; }
.bp-req-overlay.bp-req-open { opacity: 1; }

.bp-req-modal {
    position: relative;
    width: 100%;
    max-width: 560px;
    margin: auto;

    background: var(--bg-card, #fff);
    border-radius: var(--radius-xl, 24px);
    box-shadow: 0 30px 80px rgba(20, 21, 26, .28);

    padding: 34px 32px 28px;

    transform: translateY(26px) scale(.96);
    opacity: 0;
    transition: transform .38s cubic-bezier(.22, 1, .36, 1), opacity .28s ease;
}

.bp-req-overlay.bp-req-open .bp-req-modal {
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* Gradient hairline along the top edge */
.bp-req-modal::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 4px;
    border-radius: var(--radius-xl, 24px) var(--radius-xl, 24px) 0 0;
    background: var(--gradient, linear-gradient(135deg, #fe3372, #fe3372));
}

.bp-req-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;

    border: none;
    border-radius: 50%;
    background: rgba(20, 21, 26, .05);
    color: var(--text-3, #8b8b96);
    font-size: 14px;
    cursor: pointer;
    transition: var(--ease, all .2s ease);
}

.bp-req-close:hover {
    background: var(--pink-dim, rgba(254, 51, 114, .1));
    color: var(--pink, #fe3372);
    transform: rotate(90deg);
}

/* -----------------------------------------------------
   3. MODAL HEADER
----------------------------------------------------- */
.bp-req-modal-head { text-align: center; margin-bottom: 24px; }

.bp-req-modal-badge {
    width: 54px;
    height: 54px;
    margin: 0 auto 14px;
    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 16px;
    background: var(--pink-dim, rgba(254, 51, 114, .1));
    color: var(--pink, #fe3372);
    font-size: 24px;
}

.bp-req-modal-head h2 {
    font-size: 22px;
    font-weight: 800;
    color: var(--text, #14151a);
    margin: 0 0 8px;
    line-height: 1.3;
}

.bp-req-modal-head p {
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-2, #52525b);
    margin: 0;
    max-width: 420px;
    margin-inline: auto;
}

/* -----------------------------------------------------
   4. FORM
----------------------------------------------------- */
.bp-req-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.bp-req-field { margin-bottom: 16px; }

.bp-req-field label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--text, #14151a);
    margin-bottom: 7px;
}

.bp-req-req { color: var(--pink, #fe3372); }

.bp-req-input-wrap { position: relative; display: flex; align-items: center; }

.bp-req-input-wrap i {
    position: absolute;
    left: 14px;
    font-size: 15px;
    color: var(--text-3, #8b8b96);
    pointer-events: none;
    transition: color .2s ease;
}

.bp-req-form input[type="text"],
.bp-req-form input[type="email"],
.bp-req-form textarea {
    width: 100%;
    font-family: inherit;
    font-size: 14px;
    color: var(--text, #14151a);
    background: var(--bg-input, #fff);
    border: 1.5px solid var(--border, rgba(20, 21, 26, .09));
    border-radius: var(--radius, 12px);
    padding: 12px 14px 12px 42px;
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

.bp-req-form textarea {
    padding-left: 14px;
    resize: vertical;
    min-height: 96px;
    line-height: 1.7;
}

.bp-req-form input::placeholder,
.bp-req-form textarea::placeholder { color: var(--text-3, #8b8b96); }

.bp-req-form input:focus,
.bp-req-form textarea:focus {
    outline: none;
    border-color: var(--pink, #fe3372);
    box-shadow: 0 0 0 4px var(--pink-dim, rgba(254, 51, 114, .1));
}

.bp-req-input-wrap:focus-within i { color: var(--pink, #fe3372); }

/* Invalid field state */
.bp-req-form input.bp-req-invalid,
.bp-req-form textarea.bp-req-invalid {
    border-color: #dc2626;
    box-shadow: 0 0 0 4px rgba(220, 38, 38, .1);
    animation: bp-req-shake .4s ease;
}

@keyframes bp-req-shake {
    0%, 100% { transform: translateX(0); }
    25%      { transform: translateX(-5px); }
    75%      { transform: translateX(5px); }
}

.bp-req-error {
    display: none;
    font-size: 12px;
    font-weight: 600;
    color: #dc2626;
    margin-top: 6px;
}

.bp-req-error.bp-req-show { display: block; }

.bp-req-counter {
    text-align: right;
    font-size: 11px;
    color: var(--text-3, #8b8b96);
    margin-top: 5px;
}

/* Honeypot - visually gone, still focusable by bots */
.bp-req-hp {
    position: absolute !important;
    left: -9999px !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* -----------------------------------------------------
   5. SUBMIT BUTTON
----------------------------------------------------- */
.bp-req-submit {
    position: relative;
    width: 100%;
    border: none;
    border-radius: var(--radius, 12px);
    padding: 14px 20px;

    background: var(--gradient, linear-gradient(135deg, #fe3372, #fe3372));
    color: #fff;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;

    box-shadow: var(--shadow-pink, 0 6px 26px rgba(254, 51, 114, .18));
    transition: var(--ease, all .2s ease);
}

.bp-req-submit:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 32px rgba(254, 51, 114, .32);
}

.bp-req-submit:active:not(:disabled) { transform: translateY(0); }

.bp-req-submit:disabled { opacity: .75; cursor: not-allowed; }

.bp-req-submit-text { display: inline-flex; align-items: center; gap: 8px; }

.bp-req-spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(255, 255, 255, .35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: bp-req-spin .7s linear infinite;
}

@keyframes bp-req-spin { to { transform: rotate(360deg); } }

.bp-req-submit.bp-req-loading .bp-req-submit-text { display: none; }
.bp-req-submit.bp-req-loading .bp-req-spinner { display: inline-block; }

/* Form-level alert (server errors, rate limiting) */
.bp-req-alert {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.6;
    border-radius: var(--radius, 12px);
    padding: 11px 14px;
    margin-bottom: 14px;
    background: rgba(220, 38, 38, .08);
    color: #b91c1c;
    border: 1px solid rgba(220, 38, 38, .2);
}

.bp-req-alert[hidden] { display: none; }

.bp-req-privacy {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-3, #8b8b96);
    margin: 14px 0 0;
}

/* -----------------------------------------------------
   6. SUCCESS STATE
----------------------------------------------------- */
.bp-req-success { text-align: center; padding: 16px 0 8px; }
.bp-req-success[hidden] { display: none; }

.bp-req-success-check { width: 84px; height: 84px; margin: 0 auto 18px; }
.bp-req-success-check svg { width: 100%; height: 100%; }

.bp-req-check-circle {
    stroke: var(--pink, #fe3372);
    stroke-width: 3;
    stroke-dasharray: 152;
    stroke-dashoffset: 152;
    animation: bp-req-draw .6s cubic-bezier(.65, 0, .45, 1) forwards;
}

.bp-req-check-mark {
    stroke: var(--pink, #fe3372);
    stroke-width: 4;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    animation: bp-req-draw .35s cubic-bezier(.65, 0, .45, 1) .5s forwards;
}

@keyframes bp-req-draw { to { stroke-dashoffset: 0; } }

.bp-req-success h3 {
    font-size: 20px;
    font-weight: 800;
    color: var(--text, #14151a);
    margin: 0 0 8px;
}

.bp-req-success p {
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-2, #52525b);
    margin: 0 0 22px;
    max-width: 380px;
    margin-inline: auto;
}

.bp-req-success-btn {
    border: 1.5px solid var(--border, rgba(20, 21, 26, .09));
    background: var(--bg-card, #fff);
    color: var(--text, #14151a);
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    border-radius: var(--radius, 12px);
    padding: 11px 28px;
    cursor: pointer;
    transition: var(--ease, all .2s ease);
}

.bp-req-success-btn:hover {
    border-color: var(--pink, #fe3372);
    color: var(--pink, #fe3372);
}

/* -----------------------------------------------------
   7. RESPONSIVE
----------------------------------------------------- */
@media (max-width: 768px) {
    .bp-req-fab {
        right: 16px;
        top: auto;
        bottom: 88px;               /* clear of the cookie banner */
        transform: none;
        width: 56px;
        height: 56px;
        animation-name: bp-req-fab-in-mobile;
    }

    @keyframes bp-req-fab-in-mobile {
        from { opacity: 0; transform: translateX(80px) scale(.7); }
        to   { opacity: 1; transform: translateX(0)    scale(1); }
    }

    .bp-req-fab-icon { flex-basis: 56px; width: 56px; height: 56px; font-size: 22px; }
    .bp-req-fab-pulse { width: 56px; height: 56px; margin-top: -28px; }

    /* No hover on touch: keep it a clean circle */
    .bp-req-fab:hover { width: 56px; }
    .bp-req-fab:hover .bp-req-fab-label { opacity: 0; }
    .bp-req-fab:active { transform: scale(.94); }

    .bp-req-overlay { padding: 0; align-items: flex-end; }

    .bp-req-modal {
        max-width: 100%;
        border-radius: var(--radius-xl, 24px) var(--radius-xl, 24px) 0 0;
        padding: 30px 20px 24px;
        transform: translateY(100%);
    }

    .bp-req-modal::before { border-radius: var(--radius-xl, 24px) var(--radius-xl, 24px) 0 0; }

    .bp-req-overlay.bp-req-open .bp-req-modal { transform: translateY(0); }

    .bp-req-row { grid-template-columns: 1fr; gap: 0; }
    .bp-req-modal-head h2 { font-size: 20px; }
}

/* Prevent the page behind the modal from scrolling */
body.bp-req-locked { overflow: hidden; }

/* -----------------------------------------------------
   8. ACCESSIBILITY - honour reduced-motion preferences
----------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    .bp-req-fab,
    .bp-req-fab-icon,
    .bp-req-fab-label,
    .bp-req-overlay,
    .bp-req-modal,
    .bp-req-check-circle,
    .bp-req-check-mark,
    .bp-req-spinner {
        animation: none !important;
        transition-duration: .01ms !important;
    }
    .bp-req-fab-pulse { display: none; }
    .bp-req-check-circle,
    .bp-req-check-mark { stroke-dashoffset: 0; }
}
