/* =============================================
   FLOATING DISCOVERY BUTTON & POPUP
   Modern Glassmorphism Design 2025/2026
   ============================================= */

/* Button - Gradient with glow */
.floating-discovery-btn {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #0B24FB 0%, #4158f7 50%, #667eea 100%);
    border-radius: 50%;
    cursor: pointer;
    z-index: 10000; /* выше #cookie-law-info-bar (9999) — иначе баннер перехватывает клики */
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 4px 15px rgba(11, 36, 251, 0.4),
        0 8px 30px rgba(11, 36, 251, 0.25);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s;
}
.floating-discovery-btn:hover {
    transform: scale(1.08) translateY(-2px);
    box-shadow:
        0 6px 20px rgba(11, 36, 251, 0.5),
        0 12px 40px rgba(11, 36, 251, 0.35);
}
.floating-discovery-btn svg {
    width: 28px;
    height: 28px;
    fill: #fff;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}
.floating-discovery-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, #0B24FB 0%, #4158f7 50%, #667eea 100%);
    animation: fdp-pulse 2.5s ease-out infinite;
    z-index: -1;
}
@keyframes fdp-pulse {
    0% { transform: scale(1); opacity: 0.5; }
    100% { transform: scale(1.6); opacity: 0; }
}
.floating-discovery-btn.is-hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.8);
}
.floating-discovery-btn.scroll-hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(100px);
}

/* Popup overlay - Gradient backdrop */
.floating-discovery-popup {
    position: fixed;
    inset: 0;
    z-index: 10000; /* выше #cookie-law-info-bar (9999), как и кнопка */
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.35s ease, visibility 0s 0.35s;
}
.floating-discovery-popup.is-active {
    visibility: visible;
    opacity: 1;
    transition: opacity 0.35s ease;
}
.floating-discovery-popup-overlay {
    position: absolute;
    inset: 0;
    background: transparent;
    cursor: pointer;
}

/* Content card - Glassmorphism with local backdrop */
.fdp-content {
    position: absolute;
    bottom: 28px;
    right: 28px;
    width: 360px;
    background:
        radial-gradient(ellipse at 20% 20%, rgba(11, 36, 251, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(11, 36, 251, 0.12) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 100%, rgba(102, 126, 234, 0.1) 0%, transparent 40%),
        rgba(10, 15, 30, 0.93);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border-radius: 24px;
    padding: 32px 28px 28px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.3),
        0 24px 80px rgba(11, 36, 251, 0.25),
        0 0 120px 40px rgba(10, 15, 30, 0.5);
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
    overflow: visible;
}
.floating-discovery-popup.is-active .fdp-content {
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* Decorative gradient orb */
.fdp-content::before {
    content: '';
    position: absolute;
    top: -60px;
    right: -60px;
    width: 180px;
    height: 180px;
    background: radial-gradient(circle, rgba(11, 36, 251, 0.3) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    z-index: -1;
}
.fdp-content::after {
    content: '';
    position: absolute;
    bottom: -40px;
    left: -40px;
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, rgba(65, 88, 247, 0.25) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    z-index: -1;
}

/* Close button - positioned on corner */
.fdp-close {
    position: absolute;
    top: -14px;
    right: -14px;
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #0B24FB 0%, #4158f7 100%);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.25);
    cursor: pointer;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 50%;
    transition: all 0.25s ease;
    box-shadow: 0 4px 12px rgba(11, 36, 251, 0.4);
    z-index: 10;
}
.fdp-close:hover {
    background: linear-gradient(135deg, #0919c7 0%, #3347e5 100%);
    border-color: rgba(255, 255, 255, 0.4);
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 6px 16px rgba(11, 36, 251, 0.5);
}

/* Header */
.fdp-header {
    margin-bottom: 24px;
}
.fdp-header h4 {
    margin: 0 0 8px;
    font-size: 22px;
    font-weight: 700;
    background: linear-gradient(135deg, #fff 0%, rgba(255,255,255,0.85) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.3;
    letter-spacing: -0.02em;
}
.fdp-header p {
    margin: 0;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.65);
    line-height: 1.5;
}

/* Form */
.fdp-form {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.fdp-form input,
.fdp-form textarea {
    width: 100%;
    padding: 14px 16px;
    margin-bottom: 14px;
    font-family: inherit;
    font-size: 15px;
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    outline: none;
    transition: all 0.25s ease;
    box-sizing: border-box;
}
.fdp-form input::placeholder,
.fdp-form textarea::placeholder {
    color: rgba(255, 255, 255, 0.6);
}
.fdp-form input:focus,
.fdp-form textarea:focus {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(11, 36, 251, 0.5);
    box-shadow: 0 0 0 3px rgba(11, 36, 251, 0.15);
}
.fdp-form textarea {
    resize: none;
    min-height: 80px;
}

/* Fix textarea placeholder visibility (override base.css opacity) */
.fdp-form textarea::-webkit-input-placeholder {
    color: rgba(255, 255, 255, 0.5) !important;
    opacity: 1 !important;
}
.fdp-form textarea::-moz-placeholder {
    color: rgba(255, 255, 255, 0.5) !important;
    opacity: 1 !important;
}
.fdp-form textarea:-ms-input-placeholder {
    color: rgba(255, 255, 255, 0.5) !important;
    opacity: 1 !important;
}
.fdp-form textarea::placeholder {
    color: rgba(255, 255, 255, 0.5) !important;
    opacity: 1 !important;
}

/* Custom validation styles */
.fdp-form input:invalid:not(:placeholder-shown),
.fdp-form textarea:invalid:not(:placeholder-shown) {
    border-color: rgba(251, 11, 71, 0.5);
    box-shadow: 0 0 0 3px rgba(251, 11, 71, 0.15);
}
.fdp-form input:valid:not(:placeholder-shown),
.fdp-form textarea:valid:not(:placeholder-shown) {
    border-color: rgba(11, 36, 251, 0.5);
    box-shadow: 0 0 0 3px rgba(11, 36, 251, 0.15);
}

/* Custom validation tooltip */
.fdp-form-field {
    position: relative;
}
.fdp-validation-tooltip {
    position: absolute;
    left: 0;
    bottom: 100%;
    margin-bottom: 8px;
    padding: 10px 14px;
    background: linear-gradient(135deg, #0B24FB 0%, #4158f7 100%);
    border-radius: 10px;
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transform: translateY(5px);
    transition: all 0.25s ease;
    z-index: 100;
    box-shadow: 0 4px 15px rgba(11, 36, 251, 0.4);
    display: flex;
    align-items: center;
    gap: 8px;
}
.fdp-validation-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 20px;
    border: 6px solid transparent;
    border-top-color: #4158f7;
}
.fdp-validation-tooltip.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.fdp-validation-tooltip svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Submit button - Gradient with shimmer */
.fdp-submit {
    position: relative;
    width: 100%;
    padding: 16px 24px;
    margin-top: 6px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, #0B24FB 0%, #2d45fc 33%, #4d66fd 66%, #667eea 100%);
    background-size: 200% 200%;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s ease;
    letter-spacing: 0.02em;
    box-shadow:
        0 4px 15px rgba(11, 36, 251, 0.4),
        0 2px 6px rgba(0, 0, 0, 0.1);
}
.fdp-submit::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    transition: left 0.5s ease;
}
.fdp-submit:hover {
    background-position: 100% 0;
    transform: translateY(-2px);
    box-shadow:
        0 6px 20px rgba(11, 36, 251, 0.5),
        0 4px 10px rgba(0, 0, 0, 0.15);
}
.fdp-submit:hover::before {
    left: 100%;
}
.fdp-submit:active {
    transform: translateY(0);
}
.fdp-submit-loading {
    display: none;
}
.fdp-form.is-loading .fdp-submit-text {
    display: none;
}
.fdp-form.is-loading .fdp-submit-loading {
    display: inline;
}
.fdp-form.is-loading .fdp-submit {
    opacity: 0.7;
    pointer-events: none;
}

/* Success state */
.fdp-success {
    display: none;
    text-align: center;
    padding: 20px 8px;
}
.fdp-success-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 20px;
    background: #0B24FB;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fdp-success-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 4px 20px rgba(11, 36, 251, 0.4);
}
@keyframes fdp-success-pop {
    0% { transform: scale(0); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}
.fdp-success-icon svg {
    width: 36px;
    height: 36px;
    color: #fff;
}
.fdp-success h4 {
    margin: 0 0 12px;
    font-size: 22px;
    font-weight: 700;
    background: linear-gradient(135deg, #fff 0%, rgba(255,255,255,0.9) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.01em;
}
.fdp-success p {
    margin: 0 0 8px;
    font-size: 15px;
    color: rgba(255, 255, 255, 0.75);
    line-height: 1.5;
}
.fdp-success p strong {
    color: #4d66fd;
    font-weight: 600;
}
.fdp-success-note {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
}
.fdp-content.is-success .fdp-header,
.fdp-content.is-success .fdp-form,
.fdp-content.is-success .fdp-close {
    display: none;
}
.fdp-content.is-success .fdp-success {
    display: block;
}

/* Home v2: hero-слайдер держит стрелки near-bottom на мобилке — поднимаем
   кнопку чата выше зоны стрелок, чтобы они не перекрывались */
@media (max-width: 768px) {
    .page-template-page-home-v2-php .floating-discovery-btn {
        bottom: 100px;
    }
}

/* Mobile */
@media (max-width: 480px) {
    .floating-discovery-btn {
        bottom: 20px;
        right: 20px;
        width: 58px;
        height: 58px;
    }
    .fdp-content {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        border-radius: 24px 24px 0 0;
        transform: translateY(100%);
        padding: 28px 24px 32px;
    }
    .floating-discovery-popup.is-active .fdp-content {
        transform: translateY(0);
    }
    .fdp-content::before,
    .fdp-content::after {
        display: none;
    }
    .fdp-close {
        top: 16px;
        right: 16px;
    }
}

/* Hide on contact page */
.page-template-page-contact .floating-discovery-btn,
.page-template-page-contact .floating-discovery-popup,
.page-custom-contact .floating-discovery-btn,
.page-custom-contact .floating-discovery-popup {
    display: none !important;
}
