/* Личный кабинет - основной контейнер */
.pcm-personal-cabinet-menu {
    position: relative;
    display: inline-block;
    z-index: 1000;
    vertical-align: middle; /* Выравнивание по центру строки */
}

/* Триггер меню - стиль кнопки */
.pcm-cabinet-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0; 
    cursor: pointer;
    padding: 0 10px; /* Отступы как у других иконок */
    background: transparent; /* Прозрачный фон */
    border-radius: 0;
    transition: all 0.3s ease;
    border: none;
    box-shadow: none;
    height: 100%;
}

.pcm-cabinet-trigger:hover {
    background: transparent;
    opacity: 0.8;
}

/* Скрываем текстовое приветствие в шапке, чтобы осталась только иконка */
.pcm-user-greeting {
    display: none; 
}

/* СТИЛИ АВАТАРКИ - делаем как иконку */
.pcm-cabinet-trigger img {
    border-radius: 50%;
    width: 22px;  /* Размер подогнан под иконки Jannah (обычно 20-22px) */
    height: 22px; 
    object-fit: cover;
    border: none; /* Убрали белую рамку */
    box-shadow: none; /* Убрали тень */
    display: block;
    margin: 0;
}


/* Выпадающее меню */
.pcm-cabinet-dropdown {
    position: absolute;
    top: 100%;
    right: -10px; /* Смещение вправо для выравнивания */
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    min-width: 200px; /* КОМПАКТНОСТЬ: Уменьшено */
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1001;
    overflow: hidden;
    margin-top: 15px; /* Отступ от хедера */
}

/* Стрелка меню */
.pcm-cabinet-dropdown::before {
    content: '';
    position: absolute;
    top: -6px;
    right: 18px; /* Подстраиваем под положение иконки */
    width: 12px;
    height: 12px;
    background: #fff;
    border-left: 1px solid #e0e0e0;
    border-top: 1px solid #e0e0e0;
    transform: rotate(45deg);
}

.pcm-personal-cabinet-menu:hover .pcm-cabinet-dropdown,
.pcm-personal-cabinet-menu.active .pcm-cabinet-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Заголовок меню */
.pcm-cabinet-header {
    padding: 10px 15px; /* КОМПАКТНОСТЬ: Уменьшено */
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
}

.pcm-cabinet-header h3 {
    margin: 0;
    font-size: 12px; /* КОМПАКТНОСТЬ: Уменьшено */
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* Список меню */
.pcm-cabinet-menu-list {
    list-style: none;
    margin: 0;
    padding: 4px 0;
}

.pcm-cabinet-menu-list li {
    margin: 0;
}

.pcm-cabinet-menu-list li a {
    display: flex;
    align-items: center;
    gap: 10px; /* КОМПАКТНОСТЬ: Уменьшено */
    padding: 8px 15px; /* КОМПАКТНОСТЬ: Уменьшено */
    color: #333;
    text-decoration: none;
    font-size: 13px; /* КОМПАКТНОСТЬ: Уменьшено */
    font-weight: 500;
    transition: all 0.2s ease;
    position: relative;
    line-height: 1.2;
}

.pcm-cabinet-menu-list li a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 0 3px 3px 0;
    transition: height 0.2s ease;
}

.pcm-cabinet-menu-list li a:hover {
    background: linear-gradient(90deg, rgba(102, 126, 234, 0.08) 0%, transparent 100%);
    color: #667eea;
}

.pcm-cabinet-menu-list li a:hover::before {
    height: 100%;
}

.pcm-cabinet-menu-list li a i {
    font-size: 14px; /* КОМПАКТНОСТЬ: Уменьшено */
    width: 20px; /* КОМПАКТНОСТЬ: Уменьшено */
    text-align: center;
    color: #667eea;
    transition: transform 0.2s ease;
}

.pcm-cabinet-menu-list li a:hover i {
    transform: scale(1.15);
}

.pcm-cabinet-menu-list li a span {
    flex: 1;
}

/* Разделитель перед выходом */
.pcm-cabinet-menu-list li.pcm-logout-item {
    border-top: 1px solid #f0f0f0;
    margin-top: 4px; /* КОМПАКТНОСТЬ: Уменьшено */
    padding-top: 2px;
}

.pcm-cabinet-menu-list li.pcm-logout-item a {
    color: #dc3545;
}

.pcm-cabinet-menu-list li.pcm-logout-item a i {
    color: #dc3545;
}

.pcm-cabinet-menu-list li.pcm-logout-item a:hover {
    background: linear-gradient(90deg, rgba(220, 53, 69, 0.08) 0%, transparent 100%);
    color: #c82333;
}

.pcm-cabinet-menu-list li.pcm-logout-item a:hover i {
    color: #c82333;
}

/* Счетчики уведомлений (опционально) */
.pcm-notification-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: #dc3545;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    border-radius: 8px;
    margin-left: auto;
}

/* Адаптивность */
@media (max-width: 768px) {
    .pcm-cabinet-dropdown {
        position: fixed;
        top: auto !important;
        right: 10px;
        left: 10px;
        bottom: 10px;
        min-width: auto;
        max-height: 80vh;
        overflow-y: auto;
    }
    
    .pcm-cabinet-dropdown::before {
        display: none;
    }
    
    .pcm-cabinet-trigger {
        padding: 8px;
    }
}

@media (max-width: 480px) {
    .pcm-cabinet-menu-list li a {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .pcm-cabinet-header {
        padding: 12px 14px;
    }
}

/* Темная тема (опционально) */
@media (prefers-color-scheme: dark) {
    .pcm-cabinet-trigger {
        background: #2d2d2d;
        color: #e0e0e0;
    }
    
    .pcm-cabinet-trigger:hover {
        background: #3a3a3a;
        border-color: #4a4a4a;
    }
    
    .pcm-user-greeting {
        color: #e0e0e0;
    }
    
    .pcm-cabinet-dropdown {
        background: #2d2d2d;
        border-color: #4a4a4a;
    }
    
    .pcm-cabinet-dropdown::before {
        background: #2d2d2d;
        border-color: #4a4a4a;
    }
    
    .pcm-cabinet-menu-list li a {
        color: #e0e0e0;
    }
    
    .pcm-cabinet-menu-list li.pcm-logout-item {
        border-top-color: #4a4a4a;
    }
}

/* Анимация при загрузке */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.pcm-personal-cabinet-menu.loaded .pcm-cabinet-dropdown {
    animation: fadeInUp 0.4s ease;
}

/* Ripple эффект при клике */
.pcm-cabinet-menu-list li a {
    position: relative;
    overflow: hidden;
}

.pcm-cabinet-menu-list li a .ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(102, 126, 234, 0.3);
    width: 20px;
    height: 20px;
    margin-top: -10px;
    margin-left: -10px;
    pointer-events: none;
    transform: scale(0);
    opacity: 1;
}

.pcm-cabinet-menu-list li a .ripple.animate {
    animation: rippleEffect 0.6s ease-out;
}

@keyframes rippleEffect {
    to {
        transform: scale(15);
        opacity: 0;
    }
}

/* Активный пункт меню */
.pcm-cabinet-menu-list li a.active-menu-item {
    background: linear-gradient(90deg, rgba(102, 126, 234, 0.12) 0%, transparent 100%);
    color: #667eea;
    font-weight: 600;
}

.pcm-cabinet-menu-list li a.active-menu-item::before {
    height: 100%;
}

.active-indicator {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* =========================================
   JANNAH THEME INTEGRATION (FIXES)
   ========================================= */

/* Адаптация под Jannah Header */
.components .pcm-personal-cabinet-menu {
    display: flex;
    align-items: center;
    height: 100%;
}

/* Коррекция положения дропдауна в Jannah */
.components .pcm-cabinet-dropdown {
    top: 25px; /* Положение под шапкой */
    right: -10px; /* Сдвиг вправо, чтобы не обрезалось */
}

/* Важный фикс: убираем конфликты фона при наведении */
.components .pcm-cabinet-trigger:hover {
    background: transparent !important; 
    box-shadow: none !important;
}

/* Z-index фикс для шапки */
#theme-header {
    z-index: 9999;
}

/* Гарантируем, что аватар в хедере не имеет лишних отступов */
.pcm-cabinet-trigger img {
    margin: 0 !important;
    display: block;
}

/* НОВЫЙ БЛОК: Jannah Mobile Fixes (для решения проблемы старого меню) */
/* Скрываем стандартную кнопку входа/регистрации Jannah, если пользователь авторизован,
   чтобы не было конфликта в мобильной версии */
.is-mobile #main-nav .popup-login-icon,
.is-mobile #mobile-nav .popup-login-icon {
    display: none !important;
}

/* Принудительно отображаем наш кабинет, даже если он был скрыт медиа-запросами темы */
.is-mobile .personal-cabinet-icon {
    display: block !important;
}

/* Также убедимся, что на мобильных устройствах не отображается приветствие, а только иконка */
@media (max-width: 768px) {
    .pcm-user-greeting {
        display: none !important;
    }
}