/*
Theme Name:   FBM Theme
Theme URI:    https://fbm.red
Description:  Профессиональная тема для экосистемы FBM. Расширяет Hello Elementor.
Author:       FBM Agency
Author URI:   https://fbm.red
Template:     hello-elementor
Version:      1.0.0
Text Domain:  fbm-theme
License:      GNU General Public License v2 or later
License URI:  https://www.gnu.org/licenses/gpl-2.0.html
*/

/* ==========================================================================
   FBM Custom Styles
   ========================================================================== */

/* --- Service Descriptions (under ecosystem cards) --- */
.fbm-service-desc {
    font-size: 14px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.75);
    margin-top: 8px;
    padding: 0 4px;
}

/* --- Section Lead (описание под H2 секции) --- */
.fbm-section-lead {
    font-size: 16px;
    line-height: 1.65;
    color: rgba(255, 255, 255, 0.65);
    margin: 6px 0 20px;
    max-width: 720px;
}

/* --- Elementor global button reset для fbm-faq-q --- */
/* Elementor задаёт box-shadow через .elementor-widget-html button — перебиваем */
.elementor-widget-html .fbm-faq-q,
.elementor-widget-html .fbm-faq-q:hover,
.elementor-widget-html .fbm-faq-q:focus,
.elementor-widget-html .fbm-faq-q:active {
    box-shadow: none !important;
    outline: none !important;
    border: none !important;
    background: transparent !important;
    text-shadow: none !important;
}

/* --- FAQ Accordion (JS-аккордеон, совместим с Elementor) --- */
.fbm-faq {
    max-width: 900px;
    margin: 0 auto;
}

.fbm-faq-item {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.fbm-faq-item:last-child {
    border-bottom: none;
}

/* Кнопка-вопрос */
.fbm-faq-q {
    width: 100%;
    background: none;
    border: none;
    outline: none !important;
    box-shadow: none !important;   /* перебиваем Elementor/браузер */
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    font-size: 17px;
    font-weight: 600;
    color: #fff;
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 20px 0;
    transition: color 0.2s ease;
    line-height: 1.4;
    font-family: inherit;
    border-radius: 0;              /* убираем любые скруглённые рамки */
}

/* Убираем браузерный focus-outline (заменяем своим rounded) */
.fbm-faq-q:focus {
    outline: none !important;
    box-shadow: none !important;
}

.fbm-faq-q:focus-visible {
    outline: none !important;
    box-shadow: 0 0 0 2px rgba(255, 76, 52, 0.45) !important;
    border-radius: 6px !important;
}

.fbm-faq-q:hover,
.fbm-faq-item.fbm-faq-open .fbm-faq-q {
    color: #FF4C34;
    box-shadow: none !important;
}

/* Иконка «+» → при открытии rotate(45deg) = красивый «×» */
.fbm-faq-icon {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;            /* круглый бэджик */
    border: 1px solid rgba(255, 255, 255, 0.15);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 300;
    line-height: 1;
    color: rgba(255, 255, 255, 0.5);
    transition: color 0.25s ease, border-color 0.25s ease,
                background 0.25s ease, transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.fbm-faq-q:hover .fbm-faq-icon {
    border-color: rgba(255, 76, 52, 0.4);
    color: #FF4C34;
}

.fbm-faq-item.fbm-faq-open .fbm-faq-icon {
    background: rgba(255, 76, 52, 0.12);
    border-color: rgba(255, 76, 52, 0.5);
    color: #FF4C34;
    transform: rotate(45deg);      /* + → × (не «\») */
}

/* Ответ */
.fbm-faq-answer {
    font-size: 15px;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.7);
    padding: 0 0 20px;
    animation: fbm-fade-in 0.3s ease;
}

.fbm-faq-answer a {
    color: #127BE7;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease, color 0.2s ease;
}

.fbm-faq-answer a:hover {
    color: #0e559c;
    border-bottom-color: #0e559c;
}

@keyframes fbm-fade-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* --- Hashtag Cloud (Подборки) --- */
.fbm-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 16px 0 24px;
}

.fbm-tags a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.8);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.25s ease;
    white-space: nowrap;
}

.fbm-tags a:hover {
    background: rgba(255, 76, 52, 0.15);
    border-color: #FF4C34;
    color: #FF4C34;
    transform: translateY(-1px);
}

.fbm-tags a::before {
    content: '#';
    font-weight: 700;
    opacity: 0.6;
}

/* --- Responsive --- */
@media (max-width: 767px) {
    .fbm-faq-q {
        font-size: 15px;
        padding: 16px 0;
    }
    .fbm-faq-answer {
        font-size: 14px;
    }
    .fbm-tags a {
        font-size: 12px;
        padding: 5px 10px;
    }
}

/* ==========================================================================
   FAQ Mobile Fix v3 — адаптив для Elementor HTML-виджетов с .fbm-faq
   Root cause #1: Elementor inline style="width:59.143%" на виджете → обрезание.
   Root cause #2: декоративный шар position:absolute, offset_x:995px → горизонтальный скролл.
   Root cause #3: предыдущий overflow:visible на контейнере УБИРАЛ сдерживание шара.
   Правильная схема: скрыть шар → body overflow-x:hidden → расширить виджет → сбросить padding.
   ========================================================================== */

/* --- 1. Скрываем декоративные шары (ПЕРВЫМ ДЕЛОМ, до любых overflow-изменений) --- */
/* Шары — это elementor-widget-image, сиблинг FAQ-виджета внутри тёмной карточки.
   offset_x:995px → вылезают за правый край viewport → источник горизонтального скролла */
@media (max-width: 1024px) {
    .elementor-widget-html:has(.fbm-faq) ~ .elementor-widget-image {
        display: none !important;
        visibility: hidden !important;
        position: static !important; /* снимаем absolute чтобы не влиял на layout */
    }
}

/* --- 2. Запрет горизонтального скролла на body (не html — надёжнее) --- */
@media (max-width: 1024px) {
    body {
        overflow-x: hidden;
    }
}

/* --- 3. Виджет FAQ: 100% ширины + сброс инлайн-паддингов Elementor --- */
@media (max-width: 1024px) {
    /* Внешний div виджета: Elementor задаёт style="width:59.143%" → перебиваем */
    .elementor-widget-html:has(.fbm-faq) {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
        box-sizing: border-box !important;
    }

    /* Внутренний .elementor-widget-container: Elementor задаёт
     style="padding-top:10px; padding-left:30px; padding-bottom:10px"
     → 30px слева без паддинга справа → контент упирается в правый край */
    .elementor-widget-html:has(.fbm-faq) .elementor-widget-container {
        padding: 24px 24px !important;
        box-sizing: border-box !important;
    }

    /* FAQ блок: полная ширина без переполнения */
    .fbm-faq {
        max-width: 100%;
        width: 100%;
        box-sizing: border-box;
    }

    /* Кнопки: перенос длинных слов, фиксированная иконка */
    .fbm-faq-q {
        word-break: break-word;
        overflow-wrap: break-word;
        white-space: normal;
        box-sizing: border-box;
        max-width: 100%;
    }
}

/* --- 4. Мобильный (<767px): финальная полировка --- */
@media (max-width: 767px) {
    /* Внутренние отступы карточки — чуть плотнее для маленьких экранов */
    .elementor-widget-html:has(.fbm-faq) .elementor-widget-container {
        padding: 20px 16px !important;
    }

    /* Кнопка */
    .fbm-faq-q {
        gap: 10px;
        font-size: 14px;
        padding: 14px 0;
    }

    /* Иконка + — фиксированный размер, не сжимается flex-shrink:0 */
    .fbm-faq-icon {
        flex-shrink: 0;
        width: 24px;
        height: 24px;
        font-size: 17px;
        align-self: flex-start;
        margin-top: 2px;
    }

    .fbm-faq-answer {
        font-size: 13px;
        line-height: 1.65;
        padding-bottom: 16px;
    }
}

/* ==========================================================================
   Nocturne — скрываем плавающую кнопку (дубль кнопки в шапке)
   ========================================================================== */
.nocturne-dark-mode-floating-trigger {
    display: none !important;
}

/* ==========================================================================
   Кнопка «Наверх» — FBM Back to Top
   ========================================================================== */
#fbm-back-to-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(30, 30, 35, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease,
                background 0.25s ease, border-color 0.25s ease;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    text-decoration: none;
}

#fbm-back-to-top.fbm-btt-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

#fbm-back-to-top:hover {
    background: rgba(255, 76, 52, 0.2);
    border-color: #FF4C34;
    color: #FF4C34;
}

#fbm-back-to-top svg {
    width: 18px;
    height: 18px;
    transition: transform 0.2s ease;
}

#fbm-back-to-top:hover svg {
    transform: translateY(-2px);
}

@media (max-width: 767px) {
    #fbm-back-to-top {
        bottom: 16px;
        right: 16px;
        width: 40px;
        height: 40px;
    }
}
