/*
 * Модалка зворотного зв'язку — popup.css | v1.1.0
 * https://st-agro.com
 */

@import url('https://fonts.googleapis.com/css2?family=Exo+2:wght@400;500;600;700&family=Poppins:wght@400;500;600&display=swap');

/* ── Overlay (Non-blocking container pinned to bottom) ── */
#stagro-popup-overlay {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    width: 100%;
    z-index: 999999;
    pointer-events: none;
    display: flex;
    justify-content: center;
    background: transparent !important;
    padding: 0;
    margin: 0;
}

/* ── Bottom Bar Modal Box ── */
#stagro-popup-modal {
    pointer-events: auto;
    position: relative;
    width: 100%;
    max-width: 100%;
    border-radius: 0;
    overflow: visible;
    box-shadow:
        0 -8px 32px rgba(0, 0, 0, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.12);
    animation: stagro-bar-slide-up 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    background-color: var(--stagro-bg, #1a3a1a);
    color: var(--stagro-text, #ffffff);
    font-family: 'Exo 2', 'Poppins', sans-serif;
}

#stagro-popup-overlay.stagro-hiding #stagro-popup-modal {
    animation: stagro-bar-slide-down 0.25s cubic-bezier(0.7, 0, 0.84, 0) forwards;
}

@keyframes stagro-bar-slide-up {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

@keyframes stagro-bar-slide-down {
    from { transform: translateY(0);    opacity: 1; }
    to   { transform: translateY(100%); opacity: 0; }
}

/* ── Top decorative line ── */
.stagro-popup-decor-line {
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--stagro-accent, #5cb226), transparent);
    opacity: 0.9;
    width: 100%;
}

/* ── Texture / subtle pattern ── */
#stagro-popup-modal::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 10% 50%, rgba(92,178,38,0.08) 0%, transparent 40%),
        radial-gradient(circle at 90% 50%, rgba(92,178,38,0.05) 0%, transparent 40%);
    pointer-events: none;
}

/* ── Main Container (Bottom Bar with Top Header & 1-Row Form) ── */
.stagro-popup-container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 24px 76px 24px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    position: relative;
    box-sizing: border-box;
}

/* ── Close button (Centered vertically, 30px from right) ── */
#stagro-popup-close {
    position: absolute;
    top: 50%;
    right: 30px;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border: 1.5px solid rgba(255,255,255,0.25);
    background: rgba(255,255,255,0.12);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    line-height: 1;
    transition: background 0.2s, border-color 0.2s, transform 0.2s;
    z-index: 10;
    flex-shrink: 0;
}
#stagro-popup-close svg {
    display: block;
    width: 14px;
    height: 14px;
    stroke: #ffffff;
    flex-shrink: 0;
}
#stagro-popup-close:hover {
    background: rgba(255,255,255,0.25);
    border-color: rgba(255,255,255,0.5);
    transform: translateY(-50%) rotate(90deg);
}

/* ── Top Bar (Icon + Heading & Subtext at the very top) ── */
.stagro-popup-top-bar {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    text-align: center;
}

/* ── Icon wrapper ── */
.stagro-popup-icon-wrap {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}
.stagro-popup-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(92,178,38,0.15);
    border: 2px solid rgba(92,178,38,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--stagro-accent, #5cb226);
    animation: stagro-pulse 2.5s ease-in-out infinite;
    flex-shrink: 0;
}
.stagro-popup-icon svg {
    width: 22px;
    height: 22px;
}
@keyframes stagro-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(92,178,38,0.25); }
    50%       { box-shadow: 0 0 0 8px rgba(92,178,38,0); }
}

/* ── Text Wrap (Heading & Subtext at the Top, +30% font-size) ── */
.stagro-popup-text-wrap {
    flex: 0 1 auto;
    text-align: center;
    margin: 0 !important;
    padding: 0 !important;
}
.stagro-popup-heading {
    margin: 0 0 4px 0 !important;
    padding: 0 !important;
    font-size: 1.38rem !important;
    font-weight: 700 !important;
    line-height: 1.25 !important;
    letter-spacing: -0.01em !important;
    color: var(--stagro-text, #ffffff) !important;
    text-align: center !important;
}
.stagro-popup-subtext {
    margin: 0 !important;
    padding: 0 !important;
    font-size: 1.05rem !important;
    font-weight: 400 !important;
    line-height: 1.35 !important;
    color: rgba(255,255,255,0.8) !important;
    text-align: center !important;
}

/* ── CF7 Form — Single Line Row on Desktop (Below Header) ── */
.stagro-popup-form {
    width: 100%;
    max-width: 860px;
    display: flex;
    justify-content: center;
}

.stagro-popup-form .wpcf7 {
    margin: 0;
    padding: 0;
}

.stagro-popup-form .wpcf7-form {
    margin: 0 !important;
    padding: 0 !important;
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: flex-end !important;
    gap: 12px !important;
    width: 100% !important;
}

.stagro-popup-form .wpcf7-form br {
    display: none !important;
}

/* Підтримка структури .one-line та .one-line-bt */
.stagro-popup-form .one-line {
    flex: 1 1 180px !important;
    min-width: 140px !important;
    margin: 0 !important;
    padding: 0 !important;
}

.stagro-popup-form .one-line p {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
}

.stagro-popup-form .one-line label {
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
    font-size: 0.96rem !important;
    font-weight: 500 !important;
    color: rgba(255,255,255,0.78) !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
}

.stagro-popup-form .one-line-bt {
    flex: 0 0 auto !important;
    margin: 0 !important;
    padding: 0 !important;
}

.stagro-popup-form .one-line-bt p {
    margin: 0 !important;
    padding: 0 !important;
    display: flex !important;
    align-items: flex-end !important;
}

/* Запасний варіант для стандартного CF7 p */
.stagro-popup-form .wpcf7-form > p {
    display: flex !important;
    flex-direction: row !important;
    align-items: flex-end !important;
    justify-content: flex-start !important;
    gap: 10px !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
}

.stagro-popup-form .wpcf7-form > p label {
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
    font-size: 0.96rem !important;
    font-weight: 500 !important;
    color: rgba(255,255,255,0.78) !important;
    margin: 0 !important;
    padding: 0 !important;
    flex: 1 1 160px !important;
    min-width: 130px !important;
}

.stagro-popup-form .wpcf7-form > p label:has(input[type="submit"]) {
    display: flex !important;
    flex-direction: row !important;
    align-items: flex-end !important;
    gap: 10px !important;
    flex: 2 1 340px !important;
}

/* Обгортка інпуту */
.stagro-popup-form .wpcf7-form-control-wrap {
    display: block !important;
    width: 100% !important;
    position: relative !important;
}

/* Текстові поля та tel */
.stagro-popup-form input[type="text"],
.stagro-popup-form input[type="tel"],
.stagro-popup-form input[type="email"] {
    display: block !important;
    width: 100% !important;
    height: 42px !important;
    box-sizing: border-box !important;
    background: rgba(255,255,255,0.08) !important;
    border: 1.5px solid rgba(255,255,255,0.2) !important;
    border-radius: 8px !important;
    color: #fff !important;
    font-family: 'Exo 2', sans-serif !important;
    font-size: 0.9rem !important;
    padding: 0 14px !important;
    outline: none !important;
    transition: border-color 0.2s, background 0.2s !important;
    margin: 0 !important;
}

.stagro-popup-form input[type="text"]::placeholder,
.stagro-popup-form input[type="tel"]::placeholder,
.stagro-popup-form input[type="email"]::placeholder {
    color: rgba(255,255,255,0.4) !important;
}

.stagro-popup-form input[type="text"]:focus,
.stagro-popup-form input[type="tel"]:focus,
.stagro-popup-form input[type="email"]:focus {
    border-color: var(--stagro-accent, #5cb226) !important;
    background: rgba(255,255,255,0.12) !important;
    box-shadow: 0 0 0 3px rgba(92,178,38,0.18) !important;
}

/* Кнопка submit */
.stagro-popup-form input[type="submit"],
.stagro-popup-form button[type="submit"] {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 42px !important;
    padding: 0 24px !important;
    background: var(--stagro-accent, #5cb226) !important;
    color: #fff !important;
    font-family: 'Exo 2', sans-serif !important;
    font-size: 0.94rem !important;
    font-weight: 600 !important;
    letter-spacing: 0.02em !important;
    border: none !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    transition: filter 0.2s, transform 0.15s !important;
    box-shadow: 0 4px 14px rgba(92,178,38,0.35) !important;
    box-sizing: border-box !important;
    line-height: 1 !important;
    text-align: center !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    margin: 0 !important;
    width: auto !important;
    min-width: 140px !important;
    -webkit-appearance: none !important;
    appearance: none !important;
}

.stagro-popup-form input[type="submit"]:hover,
.stagro-popup-form button[type="submit"]:hover {
    filter: brightness(1.1) !important;
    transform: translateY(-1px) !important;
}

.stagro-popup-form input[type="submit"]:active,
.stagro-popup-form button[type="submit"]:active {
    transform: translateY(0) !important;
    filter: brightness(0.97) !important;
}

/* CF7 spinner */
.stagro-popup-form .wpcf7-spinner {
    display: none !important;
}

/* Помилки валідації */
.stagro-popup-form .wpcf7-not-valid-tip {
    color: #ff8a80 !important;
    font-size: 0.72rem !important;
    margin-top: 2px !important;
    display: block !important;
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    white-space: nowrap !important;
    z-index: 5 !important;
}

/* Повідомлення про результат */
.stagro-popup-form .wpcf7-response-output {
    border-radius: 8px !important;
    font-size: 0.82rem !important;
    margin: 12px 0 0 !important;
    padding: 10px 16px 10px 60px !important;
    border: 1px solid rgba(92,178,38,0.4) !important;
    background: rgba(92,178,38,0.12) !important;
    color: #b9f080 !important;
    text-align: left !important;
    width: 100% !important;
    box-sizing: border-box !important;
}
.stagro-popup-form .wpcf7-response-output.wpcf7-validation-errors {
    border-color: rgba(255,100,80,0.4) !important;
    background: rgba(255,80,60,0.08) !important;
    color: #ff8a80 !important;
}

/* ── Floating Trigger Button (Bottom Left, Binotel Style) ── */
#stagro-popup-trigger-btn {
    position: fixed !important;
    bottom: 60px !important;
    left: 28px !important;
    z-index: 999990 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    user-select: none !important;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease !important;
    text-decoration: none !important;
    -webkit-tap-highlight-color: transparent !important;
    line-height: 1 !important;
    width: 74px !important;
    height: 74px !important;
}

#stagro-popup-trigger-btn:hover {
    transform: translateY(-4px) scale(1.04);
}

#stagro-popup-trigger-btn.stagro-hidden {
    opacity: 0 !important;
    pointer-events: none !important;
    transform: translateY(30px) scale(0.7) !important;
}

/* ── Tooltip above button (Shows on hover, like Binotel) ── */
.stagro-trigger-tooltip {
    position: absolute !important;
    bottom: calc(100% + 14px) !important;
    left: 0 !important;
    background: var(--stagro-bg, #1a3a1a) !important;
    color: var(--stagro-text, #ffffff) !important;
    border: 1.5px solid var(--stagro-accent, #5cb226) !important;
    padding: 9px 16px !important;
    border-radius: 12px !important;
    font-family: 'Exo 2', 'Poppins', sans-serif !important;
    font-size: 0.84rem !important;
    font-weight: 600 !important;
    line-height: 1.35 !important;
    white-space: nowrap !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45) !important;
    opacity: 0 !important;
    visibility: hidden !important;
    transform: translateY(8px) scale(0.95) !important;
    transition: opacity 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), visibility 0.3s !important;
    pointer-events: none !important;
    z-index: 10 !important;
}

/* Arrow pointing down to the button circle */
.stagro-tooltip-arrow {
    position: absolute !important;
    top: 100% !important;
    left: 31px !important;
    width: 0 !important;
    height: 0 !important;
    border-left: 7px solid transparent !important;
    border-right: 7px solid transparent !important;
    border-top: 8px solid var(--stagro-accent, #5cb226) !important;
}

.stagro-tooltip-arrow::after {
    content: '' !important;
    position: absolute !important;
    bottom: 2px !important;
    left: -6px !important;
    width: 0 !important;
    height: 0 !important;
    border-left: 6px solid transparent !important;
    border-right: 6px solid transparent !important;
    border-top: 7px solid var(--stagro-bg, #1a3a1a) !important;
}

/* Show tooltip on hover */
#stagro-popup-trigger-btn:hover .stagro-trigger-tooltip {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) scale(1) !important;
}

/* Pulsing waves radiating from circle (2x slower: 4.8s) */
.stagro-trigger-waves {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 74px !important;
    height: 74px !important;
    pointer-events: none !important;
    border-radius: 50% !important;
    z-index: 1 !important;
}

.stagro-wave {
    position: absolute !important;
    inset: 0 !important;
    border-radius: 50% !important;
    background-color: var(--stagro-accent, #5cb226) !important;
    opacity: 0.65 !important;
    animation: stagro-ripple 4.8s cubic-bezier(0.2, 0.6, 0.35, 1) infinite !important;
    pointer-events: none !important;
}

.stagro-wave:nth-child(2) {
    animation-delay: 1.8s !important;
}

@keyframes stagro-ripple {
    0% {
        transform: scale(0.95);
        opacity: 0.75;
    }
    50% {
        opacity: 0.3;
    }
    100% {
        transform: scale(1.45);
        opacity: 0;
    }
}

/* Circle button (-15%: 74px) */
.stagro-trigger-circle {
    position: relative !important;
    width: 74px !important;
    height: 74px !important;
    border-radius: 50% !important;
    background: var(--stagro-accent, #5cb226) !important;
    color: #ffffff !important;
    box-shadow:
        0 8px 24px rgba(92, 178, 38, 0.5),
        0 4px 10px rgba(0, 0, 0, 0.25) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 3 !important;
    overflow: hidden !important;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.35s ease !important;
}

#stagro-popup-trigger-btn:hover .stagro-trigger-circle {
    box-shadow:
        0 12px 30px rgba(92, 178, 38, 0.65),
        0 6px 14px rgba(0, 0, 0, 0.3) !important;
}

/* Icon wrap inside circle (2x slower transition: 0.75s) */
.stagro-trigger-icon-wrap {
    position: absolute !important;
    inset: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    opacity: 1;
    transform: scale(1) rotate(0deg);
    transition: transform 0.75s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.55s ease !important;
}

/* Text wrap inside circle */
.stagro-trigger-text-wrap {
    position: absolute !important;
    inset: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    padding: 6px !important;
    font-family: 'Exo 2', 'Poppins', sans-serif !important;
    font-size: 0.72rem !important;
    font-weight: 800 !important;
    line-height: 1.18 !important;
    letter-spacing: 0.03em !important;
    text-transform: uppercase !important;
    color: #ffffff !important;
    opacity: 0;
    transform: scale(0.4) rotate(20deg);
    transition: transform 0.75s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.55s ease !important;
}

.stagro-trigger-text-wrap span {
    display: block !important;
    width: 100% !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.25) !important;
}

/* State: Show text inside circle (replaces icon) */
#stagro-popup-trigger-btn.stagro-show-text .stagro-trigger-icon-wrap,
#stagro-popup-trigger-btn:hover .stagro-trigger-icon-wrap {
    opacity: 0 !important;
    transform: scale(0.4) rotate(-25deg) !important;
}

#stagro-popup-trigger-btn.stagro-show-text .stagro-trigger-text-wrap,
#stagro-popup-trigger-btn:hover .stagro-trigger-text-wrap {
    opacity: 1 !important;
    transform: scale(1) rotate(0deg) !important;
}

/* Phone shaking / ringing animation */
.stagro-trigger-phone-icon {
    width: 30px !important;
    height: 30px !important;
    display: block !important;
    animation: stagro-phone-ring 5.6s ease-in-out infinite !important;
    transform-origin: 50% 50% !important;
    flex-shrink: 0 !important;
}

.stagro-trigger-phone-icon path[fill] {
    fill: #ffffff !important;
}

.stagro-trigger-phone-icon path[stroke] {
    stroke: #ffffff !important;
    fill: none !important;
}

@keyframes stagro-phone-ring {
    0%, 100% { transform: rotate(0deg) scale(1); }
    3%, 9%, 15%, 21% { transform: rotate(-14deg) scale(1.08); }
    6%, 12%, 18%, 24% { transform: rotate(14deg) scale(1.08); }
    27% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(0deg) scale(1); }
    53%, 59%, 65%, 71% { transform: rotate(-12deg) scale(1.06); }
    56%, 62%, 68%, 74% { transform: rotate(12deg) scale(1.06); }
    77% { transform: rotate(0deg) scale(1); }
}

/* ── Responsive ── */
@media (max-width: 992px) {
    .stagro-popup-container {
        padding: 18px 24px 20px !important;
        gap: 14px !important;
    }
    .stagro-popup-top-bar {
        padding-right: 44px !important;
        box-sizing: border-box !important;
    }
    #stagro-popup-close {
        top: 14px !important;
        right: 16px !important;
        transform: none !important;
    }
    #stagro-popup-close:hover {
        transform: rotate(90deg) !important;
    }
    .stagro-popup-form .one-line {
        flex: 1 1 100% !important;
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
    }
    .stagro-popup-form .one-line-bt {
        flex: 1 1 100% !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    .stagro-popup-form .wpcf7-not-valid-tip {
        position: static !important;
        white-space: normal !important;
        margin-top: 4px !important;
    }
}

@media (max-width: 680px) {
    .stagro-popup-container {
        padding: 16px 16px 20px !important;
        gap: 12px !important;
    }
    .stagro-popup-top-bar {
        flex-direction: row !important;
        align-items: center !important;
        justify-content: flex-start !important;
        text-align: left !important;
        padding-right: 38px !important;
        gap: 10px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    .stagro-popup-icon-wrap {
        display: flex !important;
        flex-shrink: 0 !important;
    }
    .stagro-popup-icon {
        width: 36px !important;
        height: 36px !important;
    }
    .stagro-popup-icon svg {
        width: 18px !important;
        height: 18px !important;
    }
    .stagro-popup-text-wrap {
        text-align: left !important;
        flex: 1 1 auto !important;
    }
    .stagro-popup-heading {
        font-size: 1.22rem !important;
        line-height: 1.25 !important;
        text-align: left !important;
        margin: 0 0 2px 0 !important;
    }
    .stagro-popup-subtext {
        font-size: 0.96rem !important;
        line-height: 1.35 !important;
        text-align: left !important;
        margin: 0 !important;
    }
    #stagro-popup-close {
        top: 14px !important;
        right: 14px !important;
        width: 30px !important;
        height: 30px !important;
        transform: none !important;
    }
    #stagro-popup-close:hover {
        transform: rotate(90deg) !important;
    }
    .stagro-popup-form {
        width: 100% !important;
        max-width: 100% !important;
    }
    .stagro-popup-form .wpcf7-form {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px !important;
        width: 100% !important;
    }
    .stagro-popup-form .one-line {
        flex: 1 1 100% !important;
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
    }
    .stagro-popup-form .one-line label {
        font-size: 0.96rem !important;
        width: 100% !important;
    }
    .stagro-popup-form .one-line-bt {
        flex: 1 1 100% !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    .stagro-popup-form .wpcf7-form p {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px !important;
        width: 100% !important;
    }
    .stagro-popup-form .wpcf7-form label {
        flex: 1 1 100% !important;
        font-size: 0.96rem !important;
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
    }
    .stagro-popup-form .wpcf7-form label:has(input[type="submit"]) {
        flex: 1 1 100% !important;
        flex-direction: column !important;
        align-items: stretch !important;
        width: 100% !important;
    }
    .stagro-popup-form input[type="text"],
    .stagro-popup-form input[type="tel"] {
        height: 42px !important;
        font-size: 0.92rem !important;
        width: 100% !important;
    }
    .stagro-popup-form input[type="submit"],
    .stagro-popup-form button[type="submit"] {
        width: 100% !important;
        height: 44px !important;
        margin-top: 4px !important;
        font-size: 0.95rem !important;
    }
    .stagro-popup-form .wpcf7-not-valid-tip {
        position: static !important;
        white-space: normal !important;
        margin-top: 4px !important;
    }
    #stagro-popup-trigger-btn {
        bottom: 76px !important;
        left: 18px !important;
        width: 58px !important;
        height: 58px !important;
    }
    .stagro-trigger-circle {
        width: 58px !important;
        height: 58px !important;
    }
    .stagro-trigger-waves {
        width: 58px !important;
        height: 58px !important;
    }
    .stagro-trigger-phone-icon {
        width: 24px !important;
        height: 24px !important;
    }
    .stagro-trigger-text-wrap {
        font-size: 0.58rem !important;
        padding: 4px !important;
    }
    .stagro-trigger-tooltip {
        display: none !important;
    }
}
