/* help-button.css - Стили для плавающей кнопки помощи и попапа */
/* Интеграция с дизайн-системой проекта */

/* ==================== ПЛАВАЮЩАЯ КНОПКА ==================== */

.help-fab {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--sea-turquoise);
    color: var(--dark-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 999;
    font-size: 24px;
    font-weight: 700;
    border: 2px solid rgba(255, 255, 255, 0.3);
    animation: fab-appear 0.5s ease-out;
}

@keyframes fab-appear {
    from {
        opacity: 0;
        transform: scale(0.5) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.help-fab:hover {
    transform: scale(1.1) translateY(-2px);
    box-shadow: 0 8px 25px rgba(95, 170, 184, 0.4);
    background: #4a9ca8;
}

.help-fab:active {
    transform: scale(0.95);
}

/* ==================== ПОПАП С ИНСТРУКЦИЕЙ ==================== */

.help-popup {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 380px;
    max-width: calc(100vw - 60px);
    background: var(--card-bg);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
    z-index: 1000;
    border: 1px solid var(--border);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
}

.help-popup.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Заголовок попапа */
.help-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    background: linear-gradient(135deg, var(--sea-turquoise), #4a9ca8);
    color: var(--dark-blue);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.help-popup-header h3 {
    margin: 0;
    font-family: 'Montserrat', Inter, sans-serif;
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: -0.01em;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.help-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: var(--dark-blue);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    font-weight: 600;
    line-height: 1;
}

.help-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* Контент попапа */
.help-popup-content {
    padding: 24px;
    max-height: 60vh;
    overflow-y: auto;
    color: var(--text);
    
    /* Кастомный скроллбар как в таблицах */
    scrollbar-width: thin;
    scrollbar-color: var(--sea-turquoise) var(--section-bg);
}

.help-popup-content::-webkit-scrollbar {
    width: 8px;
}

.help-popup-content::-webkit-scrollbar-track {
    background: var(--section-bg);
    border-radius: 4px;
    margin: 4px 0;
}

.help-popup-content::-webkit-scrollbar-thumb {
    background: var(--sea-turquoise);
    border-radius: 4px;
    border: 2px solid transparent;
    background-clip: content-box;
    transition: all 0.3s ease;
}

.help-popup-content::-webkit-scrollbar-thumb:hover {
    background: var(--sea-turquoise);
    border: 1px solid transparent;
}

/* Секции */
.help-section {
    margin-bottom: 24px;
}

.help-section:last-child {
    margin-bottom: 0;
}

.help-section h4 {
    margin: 0 0 14px 0;
    font-family: 'Montserrat', Inter, sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: var(--sea-turquoise);
    border-bottom: 2px solid var(--border);
    padding-bottom: 8px;
    letter-spacing: -0.01em;
}

.help-section ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.help-section li {
    margin-bottom: 14px;
    font-size: 0.95rem;
    line-height: 1.5;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    color: var(--text);
}

.help-section li:last-child {
    margin-bottom: 0;
}

/* Иконки в списке */
.help-icon-inline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    font-size: 1.3rem;
    color: var(--sea-turquoise);
    background: var(--section-bg);
    border-radius: 8px;
    padding: 4px;
}

/* Текстовый блок для сложного контента */
.help-text-block {
    flex: 1;
    min-width: 0;
}

/* Бейджи периодов */
.period-badges {
    display: inline-flex;
    gap: 4px;
    margin: 4px 0;
    flex-wrap: wrap;
}

.period-badge {
    background: var(--section-bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--sea-turquoise);
    display: inline-block;
}

.help-note {
    color: var(--muted);
    font-size: 0.85rem;
    display: inline-block;
    margin-left: 4px;
}

/* Цветовые точки вместо эмодзи */
.color-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: inline-block;
    min-width: 20px;
}

.color-dot.positive {
    background: var(--green);
    box-shadow: 0 0 0 2px rgba(72, 187, 120, 0.2);
}

.color-dot.neutral {
    background: var(--sea-turquoise);
    box-shadow: 0 0 0 2px rgba(95, 170, 184, 0.2);
}

.color-dot.negative {
    background: var(--red);
    box-shadow: 0 0 0 2px rgba(217, 83, 79, 0.2);
}

/* Цветовые классы для текста */
.positive {
    color: var(--green);
    font-weight: 600;
}

.neutral {
    color: var(--sea-turquoise);
    font-weight: 600;
}

.negative {
    color: var(--red);
    font-weight: 600;
}

/* Футер попапа */
.help-footer {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 2px solid var(--border);
    text-align: center;
    font-style: italic;
    color: var(--muted);
    font-size: 0.9rem;
    background: var(--section-bg);
    padding: 16px 20px;
    border-radius: 12px;
}

.help-footer p {
    margin: 0;
    font-weight: 500;
}

/* ==================== МОБИЛЬНАЯ АДАПТАЦИЯ ==================== */

@media (max-width: 768px) {
    .help-fab {
        bottom: 20px;
        right: 20px;
        width: 48px;
        height: 48px;
        font-size: 20px;
    }
    
    .help-popup {
        bottom: 80px;
        right: 16px;
        left: 16px;
        width: auto;
        max-width: none;
    }
    
    .help-popup-header {
        padding: 16px 20px;
    }
    
    .help-popup-header h3 {
        font-size: 1.1rem;
    }
    
    .help-popup-content {
        padding: 20px;
        max-height: 70vh;
    }
    
    .help-section li {
        font-size: 0.9rem;
        gap: 10px;
    }
    
    .help-icon-inline {
        min-width: 24px;
        font-size: 1.1rem;
        padding: 3px;
    }
    
    .period-badge {
        font-size: 0.75rem;
        padding: 1px 4px;
    }
    
    .help-note {
        font-size: 0.8rem;
        display: block;
        margin-left: 0;
        margin-top: 2px;
    }
    
    .color-dot {
        width: 18px;
        height: 18px;
        min-width: 18px;
    }
}

@media (max-width: 480px) {
    .help-fab {
        bottom: 16px;
        right: 16px;
        width: 44px;
        height: 44px;
        font-size: 18px;
    }
    
    .help-popup {
        bottom: 70px;
    }
    
    .help-popup-content {
        padding: 16px;
    }
    
    .help-section h4 {
        font-size: 0.95rem;
        margin-bottom: 12px;
    }
    
    .help-section li {
        font-size: 0.85rem;
        margin-bottom: 12px;
    }
    
    .help-footer {
        padding: 14px;
        font-size: 0.85rem;
    }
}

/* ==================== ТЕМНАЯ ТЕМА ==================== */

:root[data-theme="dark"] .help-fab {
    background: var(--sea-turquoise);
    color: var(--dark-blue);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

:root[data-theme="dark"] .help-fab:hover {
    box-shadow: 0 8px 25px rgba(95, 170, 184, 0.3);
}

:root[data-theme="dark"] .help-popup {
    background: var(--card-bg);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

:root[data-theme="dark"] .help-popup-header {
    background: linear-gradient(135deg, var(--sea-turquoise), #2a5a68);
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

:root[data-theme="dark"] .help-popup-header h3 {
    color: var(--light-beige);
}

:root[data-theme="dark"] .help-close {
    background: rgba(0, 0, 0, 0.2);
    color: var(--light-beige);
}

:root[data-theme="dark"] .help-close:hover {
    background: rgba(0, 0, 0, 0.3);
}

:root[data-theme="dark"] .help-section h4 {
    color: var(--sea-turquoise);
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

:root[data-theme="dark"] .help-icon-inline {
    background: rgba(255, 255, 255, 0.05);
    color: var(--sea-turquoise);
}

:root[data-theme="dark"] .period-badge {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--sea-turquoise);
}

:root[data-theme="dark"] .color-dot.positive {
    box-shadow: 0 0 0 2px rgba(72, 187, 120, 0.3);
}

:root[data-theme="dark"] .color-dot.neutral {
    box-shadow: 0 0 0 2px rgba(95, 170, 184, 0.3);
}

:root[data-theme="dark"] .color-dot.negative {
    box-shadow: 0 0 0 2px rgba(217, 83, 79, 0.3);
}

:root[data-theme="dark"] .help-footer {
    background: rgba(255, 255, 255, 0.03);
    border-top-color: rgba(255, 255, 255, 0.1);
}

:root[data-theme="dark"] .help-popup-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.03);
}

:root[data-theme="dark"] .help-popup-content::-webkit-scrollbar-thumb {
    background: var(--sea-turquoise);
}