/**
 * Sidebar Styles
 * Стили для боковой панели сайта — исламский стиль
 */

/* Основные стили боковой панели */
.sidebar {
    overflow: visible;
}

/* Каждый дочерний блок sidebar — отдельная карточка */
.sidebar > * {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(34, 139, 34, 0.08);
    margin-bottom: 20px;
    overflow: hidden;
    border: 1px solid rgba(34, 139, 34, 0.1);
    position: relative;
}

.sidebar > *:last-child {
    margin-bottom: 0;
}

/* Декоративная полоса сверху каждого блока */
.sidebar > *::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #228B22, #32CD32, #228B22);
    border-radius: 12px 12px 0 0;
}

/* Секция кнопки "Назад" */
.sidebar-back-section {
}

.sidebar-back-button {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    padding-top: 20px;
    background: linear-gradient(135deg, #f0faf0 0%, #ffffff 100%);
    color: #1f2937;
    text-decoration: none;
    font-weight: 600;
    border: none;
    width: 100%;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.sidebar-back-button:hover {
    background: linear-gradient(135deg, #228B22 0%, #32CD32 100%);
    color: #ffffff;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(34, 139, 34, 0.25);
}

.sidebar-back-button::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;
}

.sidebar-back-button:hover::before {
    left: 100%;
}

.sidebar-back-arrow {
    font-size: 18px;
    font-weight: bold;
    margin-right: 12px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
}

.sidebar-back-button:hover .sidebar-back-arrow {
    background: rgba(255, 255, 255, 0.2);
}

.sidebar-back-text {
    flex: 1;
    text-align: center;
    font-size: 15px;
}

/* Секция меню */
.sidebar-menu-section {
    padding: 24px 20px 20px;
}

.sidebar-menu-title {
    margin: 0 0 16px 0;
    font-size: 17px;
    font-weight: 700;
    color: #1f2937;
    padding-bottom: 12px;
    position: relative;
    text-align: center;
    letter-spacing: 0.3px;
}

.sidebar-menu-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, #228B22, #32CD32);
    border-radius: 2px;
}

/* Декоративные точки вокруг заголовка */
.sidebar-menu-title::before {
    content: '✦';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-70%);
    color: #228B22;
    font-size: 10px;
    opacity: 0.6;
}

.sidebar-menu {
    margin: 0;
}

.sidebar-menu-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.sidebar-menu-item {
    margin-bottom: 6px;
    padding: 0;
}

.sidebar-menu-item:last-child {
    margin-bottom: 0;
}

.sidebar-menu-link {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(135deg, #f8fdf8 0%, #f0f9f0 100%);
    border: 1px solid rgba(34, 139, 34, 0.08);
    border-radius: 8px;
    color: #1f2937;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: background 0.4s cubic-bezier(0.4, 0, 0.2, 1), color 0s, border-color 0.4s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.4s cubic-bezier(0.4, 0, 0.2, 1), transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.sidebar-menu-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #228B22;
    border-radius: 0 2px 2px 0;
    opacity: 0;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-menu-link:hover {
    background: linear-gradient(135deg, #228B22 0%, #2ea82e 100%);
    color: #ffffff;
    border-color: #228B22;
    transform: translateX(4px);
    box-shadow: 0 3px 10px rgba(34, 139, 34, 0.2);
    text-decoration: none;
}

.sidebar-menu-link:hover::before {
    opacity: 0;
}

/* Волна слева направо при hover, справа налево при уходе */
.sidebar-menu-link::after {
    content: '';
    position: absolute;
    top: 0;
    right: 100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
    transition: right 0.5s ease, left 0.5s ease;
    left: auto;
    pointer-events: none;
    z-index: 1;
}

.sidebar-menu-link:hover::after {
    right: -100%;
}

/* Активный пункт (текущая страница) */
.sidebar-menu-link--active {
    background: linear-gradient(135deg, #228B22 0%, #1e7a1e 100%);
    color: #ffffff;
    border-color: #228B22;
    pointer-events: none;
    box-shadow: 0 3px 10px rgba(34, 139, 34, 0.25);
}

.sidebar-menu-link--active::before {
    opacity: 1;
    background: #FFD700;
    width: 4px;
}

/* Секция QR-кода */
.sidebar-qr-section {
    text-align: center;
    padding: 24px 20px 20px;
}

.sidebar-qr-image {
    width: 100%;
    max-width: 200px;
    height: auto;
    display: block;
    margin: 0 auto;
    border-radius: 8px;
    border: 2px solid rgba(34, 139, 34, 0.15);
    padding: 8px;
    background: #fafff8;
}

.sidebar-qr-description {
    margin: 15px 0 0 0;
    font-size: 13px;
    color: #6b7280;
    line-height: 1.5;
}

/* Адаптивность */
@media (max-width: 768px) {
    .sidebar {
        margin-bottom: 30px;
    }

    .sidebar > * {
        margin-bottom: 14px;
    }
    
    .sidebar-back-button {
        padding: 12px 15px;
        padding-top: 16px;
    }
    
    .sidebar-back-text {
        font-size: 14px;
    }
    
    .sidebar-back-arrow {
        font-size: 16px;
        margin-right: 10px;
        width: 28px;
        height: 28px;
    }
    
    .sidebar-menu-section {
        padding: 20px 15px 15px;
    }

    .sidebar-menu-title {
        font-size: 16px;
    }
    
    .sidebar-menu-link {
        padding: 10px 14px;
        font-size: 13px;
    }
    
    .sidebar-qr-description {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .sidebar-back-button {
        padding: 10px 12px;
        padding-top: 14px;
    }
    
    .sidebar-back-text {
        font-size: 13px;
    }
    
    .sidebar-back-arrow {
        font-size: 14px;
        margin-right: 8px;
        width: 26px;
        height: 26px;
    }
    
    .sidebar-menu-section {
        padding: 16px 12px 12px;
    }

    .sidebar-menu-link {
        padding: 9px 12px;
        font-size: 13px;
    }
    
    .sidebar-qr-description {
        font-size: 11px;
    }
}

/* Анимации */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.sidebar-back-button {
    /* без анимации появления */
}

.sidebar-menu-item {
    opacity: 0;
    animation: slideInRight 0.4s ease forwards;
}

.sidebar-menu-item:nth-child(1) { animation-delay: 0.1s; }
.sidebar-menu-item:nth-child(2) { animation-delay: 0.15s; }
.sidebar-menu-item:nth-child(3) { animation-delay: 0.2s; }
.sidebar-menu-item:nth-child(4) { animation-delay: 0.25s; }
.sidebar-menu-item:nth-child(5) { animation-delay: 0.3s; }
.sidebar-menu-item:nth-child(6) { animation-delay: 0.35s; }
.sidebar-menu-item:nth-child(7) { animation-delay: 0.4s; }
.sidebar-menu-item:nth-child(8) { animation-delay: 0.45s; }
.sidebar-menu-item:nth-child(9) { animation-delay: 0.5s; }
.sidebar-menu-item:nth-child(10) { animation-delay: 0.55s; }

/* Секция новостей в sidebar */
.sidebar-news-section {
    padding: 20px;
}

.sidebar-news-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sidebar-news-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: 8px;
    background: linear-gradient(135deg, #f8fdf8 0%, #f0f9f0 100%);
    border: 1px solid rgba(34, 139, 34, 0.08);
    text-decoration: none;
    transition: background 0.4s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.4s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.4s cubic-bezier(0.4, 0, 0.2, 1), transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.sidebar-news-card:hover {
    background: linear-gradient(135deg, #228B22 0%, #2ea82e 100%);
    border-color: #228B22;
    transform: translateX(4px);
    box-shadow: 0 3px 10px rgba(34, 139, 34, 0.2);
    text-decoration: none;
}

/* Волна на карточках sidebar (Наши проекты, Наши акции, Последние новости) */
.sidebar-news-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
    transition: right 0.5s ease;
    pointer-events: none;
    z-index: 1;
}

.sidebar-news-card:hover::after {
    right: -100%;
}

.sidebar-news-card:hover .sidebar-news-card__title,
.sidebar-news-card:hover .sidebar-news-card__date {
    color: #ffffff;
}

.sidebar-news-card__img {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    border-radius: 6px;
    overflow: hidden;
}

.sidebar-news-card__img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.sidebar-news-card__body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.sidebar-news-card__date {
    font-size: 11px;
    color: #228B22;
    font-weight: 500;
    display: block;
    margin-bottom: 4px;
    transition: color 0s;
}

.sidebar-news-card__title {
    font-size: 13px;
    font-weight: 600;
    color: #1f2937;
    line-height: 1.3;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0s;
}

/* Печать */
@media print {
    .sidebar {
        display: none;
    }
}
