/**
 * TWP Floating CTAs — frontend styles
 * Colours are injected as CSS variables by class-twp-fcta-frontend.php
 */

/* ---------- Floating buttons (top-right) ---------- */

.twp-fcta-wrapper {
    position: fixed;
    top: var(--twp-fcta-top, 20px);
    right: 10px;
    z-index: 999997;
    font-family: inherit;
    line-height: 1;
    pointer-events: none; /* let pointer fall through gaps */
}

.twp-fcta-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: auto;
}

.twp-fcta-btn {
    position: relative;
    width: var(--twp-fcta-btn-size, 56px);
    height: var(--twp-fcta-btn-size, 56px);
    border-radius: 50%;
    background: var(--twp-fcta-btn-bg, #303698);
    color: var(--twp-fcta-icon-text, #fff);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none !important;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.18);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    font-size: var(--twp-fcta-icon-font-size, 22px);
    cursor: pointer;
}

.twp-fcta-btn:hover,
.twp-fcta-btn:focus {
    transform: scale(1.08);
    color: var(--twp-fcta-icon-text, #fff);
    box-shadow: 0 5px 18px rgba(0, 0, 0, 0.25);
    outline: none;
}

.twp-fcta-btn i {
    color: var(--twp-fcta-icon-text, #fff);
    pointer-events: none;
    line-height: 1;
}

/* Flyout hover label */
.twp-fcta-label {
    position: absolute;
    right: calc(100% + 14px);
    top: 50%;
    transform: translateY(-50%) translateX(8px);
    background: var(--twp-fcta-flyout-bg, #000);
    color: var(--twp-fcta-flyout-text, #fff);
    padding: 10px 18px;
    border-radius: 24px;
    white-space: nowrap;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.2;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.twp-fcta-btn:hover .twp-fcta-label,
.twp-fcta-btn:focus .twp-fcta-label {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

.twp-fcta-btn .screen-reader-text {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* ---------- Popup (bottom-right) ---------- */

.twp-fcta-popup-container {
    position: fixed;
    bottom: 0px;
    right: 20px;
    z-index: 999998;
    max-width: 400px;
    width: calc(100vw - 40px);
    opacity: 0;
    visibility: hidden;
    transform: translateY(16px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s linear 0.2s;
    pointer-events: none;
}

.twp-fcta-popup-container.twp-fcta-open {
    opacity: 1 !important;
    transform: translateY(0) !important;
    pointer-events: auto !important;
    visibility: visible !important;
    display: block !important;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s linear 0s;
}

/* ---------- Minimized pill (always visible when popup is enabled) ---------- */

.twp-fcta-popup-pill {
    position: fixed;
    bottom: 0px;
    right: 150px;
    z-index: 999997;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 20px;
    border: 0;
    border-radius: 10px 10px 0px 0px;
    background: var(--twp-fcta-popup-btn-bg, #800020);
    color: var(--twp-fcta-popup-btn-text, #fff);
    font-family: inherit;
    font-size: 18px;
    font-weight: 1000;
    line-height: 1.2;
    letter-spacing: 0.3px;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
    text-decoration: none;
}

/* .twp-fcta-popup-pill:hover,
.twp-fcta-popup-pill:focus {
    transform: translateY(-2px);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.32);
    color: var(--twp-fcta-popup-btn-text, #fff);
    background: var(--twp-fcta-popup-btn-bg, #800020);
    outline: none;
} */
.twp-fcta-popup-pill:hover,
.twp-fcta-popup-pill:focus {
    transform: scale(1.04);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.32);
    filter: brightness(1.08);
    color: var(--twp-fcta-popup-btn-text, #fff);
    background: var(--twp-fcta-popup-btn-bg, #800020);
    outline: none;
}

.twp-fcta-popup-pill:focus-visible {
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.32), 0 0 0 3px rgba(255, 255, 255, 0.5),
                0 0 0 5px var(--twp-fcta-popup-btn-bg, #800020);
}

.twp-fcta-popup-pill-text {
    white-space: nowrap;
}

/* When the popup is open, hide the pill (it's the minimized state). */
.twp-fcta-popup-pill.twp-fcta-pill-hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
}

.twp-fcta-popup {
    position: relative;
    background: var(--twp-fcta-popup-bg, #000);
    color: var(--twp-fcta-popup-text, #fff);
    padding: 32px 28px 28px;
    border-radius: 10px 10px 0px 0px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.twp-fcta-popup h3 {
    margin: 0 0 10px;
    padding: 0;
    font-size: 22px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--twp-fcta-popup-text, #fff);
    line-height: 1.2;
}

.twp-fcta-popup p {
    margin: 0 0 22px;
    padding: 0;
    color: var(--twp-fcta-popup-text, #fff);
    opacity: 0.9;
    font-size: 15px;
    line-height: 1.45;
}

.twp-fcta-popup-btn {
    display: block;
    width: 100%;
    box-sizing: border-box;
    background: var(--twp-fcta-popup-btn-bg, #800020);
    color: var(--twp-fcta-popup-btn-text, #fff) !important;
    padding: 16px 20px;
    text-align: center;
    border-radius: 6px;
    text-decoration: none !important;
    font-weight: 1000;
    font-size: 18px;
    line-height: 1.2;
    transition: opacity 0.2s ease, transform 0.15s ease;
}

.twp-fcta-popup-btn:hover,
.twp-fcta-popup-btn:focus {
    opacity: 0.92;
    transform: translateY(-1px);
    color: var(--twp-fcta-popup-btn-text, #fff) !important;
}

.twp-fcta-popup-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: transparent;
    border: 0;
    color: var(--twp-fcta-popup-text, #fff);
    opacity: 0.6;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: opacity 0.15s ease;
}

.twp-fcta-popup-close:hover,
.twp-fcta-popup-close:focus {
    opacity: 1;
    outline: none;
}

/* ---------- Center modal (Gravity Form) ---------- */

.twp-fcta-form-modal {
    position: fixed;
    inset: 0;
    z-index: 1000000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.twp-fcta-form-modal.twp-fcta-form-open {
    display: flex !important;
}

.twp-fcta-form-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    cursor: pointer;
}

.twp-fcta-form-dialog {
    position: relative;
    background: #ffffff;
    color: #1d2327;
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    width: 100%;
    max-width: 560px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    padding: 28px 32px;
    box-sizing: border-box;
}

.twp-fcta-form-title {
    margin: 0 0 18px;
    padding: 0 40px 0 0;
    font-size: 22px;
    font-weight: 600;
    line-height: 1.25;
    color: #1d2327;
}

.twp-fcta-form-body {
    font-size: 15px;
    line-height: 1.5;
    color: #1d2327;
}

.twp-fcta-form-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: transparent;
    border: 0;
    color: #50575e;
    opacity: 0.7;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 50%;
    transition: opacity 0.15s ease, background 0.15s ease;
    z-index: 2;
}

.twp-fcta-form-close:hover,
.twp-fcta-form-close:focus {
    opacity: 1;
    background: rgba(0, 0, 0, 0.06);
    outline: none;
}

/* Lock background scroll while the form modal is open. */
body.twp-fcta-form-lock {
    overflow: hidden;
}
