/* ============================================
   БОКОВАЯ ПАНЕЛЬ С ИКОНКАМИ
   ============================================ */

.sidebar-panel {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 9998;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px 12px;
    background: rgba(20, 27, 61, 0.95);
    border-radius: 0 20px 20px 0;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Отдельная иконка */
.sidebar-item {
    position: relative;
    cursor: pointer;
}

/* Иконка */
.sidebar-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(91, 140, 255, 0.2), rgba(127, 219, 218, 0.2));
    border-radius: 12px;
    color: #7FDBDA;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.sidebar-icon:hover {
    background: linear-gradient(135deg, rgba(91, 140, 255, 0.4), rgba(127, 219, 218, 0.4));
    border-color: rgba(127, 219, 218, 0.5);
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(127, 219, 218, 0.3);
}

.sidebar-item.active .sidebar-icon {
    background: linear-gradient(135deg, #5B8CFF, #7FDBDA);
    color: white;
    border-color: #7FDBDA;
}

/* Всплывающая подсказка */
.sidebar-tooltip {
    position: absolute;
    left: 70px;
    top: 50%;
    transform: translateY(-50%) translateX(-10px);
    min-width: 220px;
    background: linear-gradient(135deg, #1A2347, #141B3D);
    border-radius: 12px;
    padding: 12px 18px;
    box-shadow: 6px 4px 24px rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(127, 219, 218, 0.3);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    z-index: 9999;
    white-space: nowrap;
}

.sidebar-item:hover .sidebar-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateX(0);
    pointer-events: none; /* Не перехватываем клики, tooltip только для отображения */
}

/* Стрелка подсказки */
.sidebar-tooltip::after {
    content: '';
    position: absolute;
    left: -10px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 8px 10px 8px 0;
    border-color: transparent #1A2347 transparent transparent;
}

/* Текст подсказки */
.sidebar-tooltip-text {
    font-size: 1rem;
    color: #7FDBDA;
    margin: 0;
    font-weight: 600;
    text-align: center;
}

/* Десктопная версия sidebar остается fixed */
.sidebar-panel-desktop {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 9998;
}

/* Скрываем десктопную версию sidebar на мобильных */
@media (max-width: 768px) {
    /* Скрываем десктопную версию sidebar (fixed слева) - везде */
    .sidebar-panel-desktop,
    body > .sidebar-panel,
    /* Скрываем sidebar в статьях на мобильных */
    article ~ .sidebar-panel,
    main ~ .sidebar-panel {
        display: none !important;
    }
    
    /* Мобильная версия sidebar - статичная, под категориями */
    main .sidebar-panel {
        position: relative; /* Статичная позиция вместо fixed */
        left: auto;
        top: auto;
        bottom: auto;
        transform: none;
        flex-direction: row;
        border-radius: 20px;
        padding: 8px 0; /* Уменьшили padding */
        gap: 12px;
        z-index: 10;
        opacity: 1; /* Всегда видимые */
        transition: opacity 0.3s ease, margin-top 0.3s ease;
        max-width: calc(100% - 30px);
        margin: -10px auto 10px; /* Отрицательный margin-top когда меню закрыто */
        justify-content: center;
        background: transparent; /* Убрали фон */
        box-shadow: none; /* Убрали тень */
    }
    
    /* Когда меню категорий открыто, нормальное расстояние */
    .categories-menu.open ~ .sidebar-panel {
        margin-top: 0; /* Убираем отрицательный margin когда меню открыто */
    }
    
    /* При наведении оставляем без изменений */
    main .sidebar-panel:hover {
        opacity: 1;
        background: transparent;
    }
    
    main .sidebar-panel .sidebar-icon {
        width: 44px;
        height: 44px;
    }
    
    main .sidebar-panel .sidebar-tooltip {
        left: 50%;
        top: auto;
        bottom: 50px;
        transform: translateX(-50%) translateY(0);
        min-width: 180px;
        white-space: normal;
        text-align: center;
    }
    
    main .sidebar-panel .sidebar-item:hover .sidebar-tooltip {
        transform: translateX(-50%) translateY(-5px);
    }
    
    main .sidebar-panel .sidebar-tooltip::after {
        left: 50%;
        top: auto;
        bottom: -10px;
        transform: translateX(-50%);
        border-width: 10px 8px 0 8px;
        border-color: #1A2347 transparent transparent transparent;
    }
}

/* Скрываем мобильную версию sidebar на десктопе */
@media (min-width: 769px) {
    main .sidebar-panel {
        display: none;
    }
}

/* Для планшетов - уменьшаем */
@media (max-width: 1024px) {
    .sidebar-panel {
        padding: 8px;
        gap: 8px;
    }
    
    .sidebar-icon {
        width: 40px;
        height: 40px;
    }
    
    .sidebar-tooltip {
        min-width: 240px;
        padding: 12px 16px;
        font-size: 0.9rem;
    }
}

/* ============================================
   МОДАЛЬНОЕ ОКНО
   ============================================ */

.sidebar-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-modal.show {
    opacity: 1;
}

.sidebar-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(5px);
}

.sidebar-modal-content {
    position: relative;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    background: linear-gradient(135deg, #141B3D, #1A2347);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(127, 219, 218, 0.2);
    display: flex;
    flex-direction: column;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.sidebar-modal.show .sidebar-modal-content {
    transform: scale(1);
}

.sidebar-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(127, 219, 218, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-modal-header h2 {
    margin: 0;
    color: #7FDBDA;
    font-size: 1.5rem;
}

.sidebar-modal-close {
    background: none;
    border: none;
    color: #7FDBDA;
    font-size: 2rem;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.sidebar-modal-close:hover {
    background: rgba(127, 219, 218, 0.1);
    transform: rotate(90deg);
}

.sidebar-modal-body {
    padding: 24px;
    overflow-y: auto;
    color: #E8EAF6;
    line-height: 1.6;
}

/* Стили контента ритуалов */
.ritual-content h3 {
    color: #7FDBDA;
    margin-top: 0;
}

.ritual-content p {
    margin: 12px 0;
}

.ritual-content ul,
.ritual-content ol {
    margin: 12px 0;
    padding-left: 24px;
}

.ritual-content li {
    margin: 8px 0;
}

.breathing-steps {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin: 20px 0;
}

.breathing-steps .step {
    background: rgba(91, 140, 255, 0.1);
    padding: 16px;
    border-radius: 12px;
    border-left: 4px solid #7FDBDA;
}

.breathing-steps .step strong {
    color: #7FDBDA;
    display: block;
    margin-bottom: 8px;
    font-size: 1.1rem;
}

.water-schedule {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin: 20px 0;
}

.time-block {
    background: rgba(91, 140, 255, 0.1);
    padding: 16px;
    border-radius: 12px;
}

.time-block strong {
    color: #7FDBDA;
    display: block;
    margin-bottom: 8px;
}

.alert-box {
    background: rgba(255, 152, 0, 0.1);
    border: 2px solid rgba(255, 152, 0, 0.3);
    border-radius: 12px;
    padding: 16px;
    margin: 20px 0;
    text-align: center;
}

.alert-box strong {
    color: #FFB74D;
    font-size: 1.2rem;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 20px;
}

.btn-primary {
    background: linear-gradient(135deg, #5B8CFF, #7FDBDA);
    color: white;
    font-weight: 600;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(127, 219, 218, 0.4);
}

/* Адаптивность модального окна */
@media (max-width: 768px) {
    .sidebar-modal-content {
        width: 95%;
        max-height: 90vh;
    }
    
    .sidebar-modal-header {
        padding: 16px;
    }
    
    .sidebar-modal-header h2 {
        font-size: 1.2rem;
    }
    
    .sidebar-modal-body {
        padding: 16px;
        font-size: 0.9rem;
    }
}

