/* ================================== */
/* ПРОФИЛЬ: ВКЛАДКИ И КОНТЕНТ         */
/* ================================== */

/* Вкладки */
.user-profile-tabs {
    display: flex;
    gap: 12px;
    margin: 12px 0 0;
    border-bottom: 1px solid var(--border);
}

.user-profile-tab {
    background: none;
    border: none;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
}

.user-profile-tab.active {
    color: var(--primary);
}

.user-profile-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
    border-radius: 2px;
}

.user-profile-tab:hover:not(.active) {
    color: var(--text);
}

/* Контент вкладок */
.user-profile-tab-content {
    margin-top: 16px;
    max-height: 300px;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Сетка медиа (изображения, видео) */
.user-profile-media-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.user-profile-media-item {
    aspect-ratio: 1 / 1;
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-profile-media-item:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-md);
}

.user-profile-media-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-profile-media-video {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 12px;
    text-align: center;
    padding: 8px;
}

.user-profile-media-video i {
    font-size: 32px;
    color: var(--primary);
}

.user-profile-media-video span {
    word-break: break-word;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Сетка файлов */
.user-profile-files-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.user-profile-file-item {
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    padding: 8px;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 6px;
    overflow: hidden;
}

.user-profile-file-item:hover {
    background: var(--bg-surface);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.user-profile-file-item i {
    font-size: 28px;
    color: var(--primary);
}

.user-profile-file-name {
    font-size: 11px;
    word-break: break-word;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-profile-file-caption {
    font-size: 10px;
    color: var(--text-secondary);
    word-break: break-word;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Голосовые сообщения */
.user-profile-voice-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.user-profile-voice-item {
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.voice-date {
    font-size: 10px;
    color: var(--text-secondary);
    margin-top: 6px;
    text-align: right;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
}

/* Миниатюры изображений и видео (улучшенный вариант) */
.user-profile-media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
}

.user-profile-media-item {
    position: relative;
    aspect-ratio: 1 / 1;
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
}

.user-profile-media-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-profile-media-video {
    position: relative;
    width: 100%;
    height: 100%;
}

.user-profile-media-video video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-profile-media-video .video-play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition);
}

.user-profile-media-item:hover .video-play-overlay {
    opacity: 1;
}

.user-profile-media-video i {
    font-size: 24px;
    color: white;
    text-shadow: 0 1px 2px black;
}

.user-profile-media-video span {
    position: absolute;
    bottom: 4px;
    left: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 10px;
    padding: 2px 4px;
    border-radius: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Сетка файлов (улучшенная) */
.user-profile-files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
}

.user-profile-file-item {
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    padding: 8px;
    cursor: pointer;
    text-align: center;
    transition: background var(--transition);
}

.user-profile-file-item:hover {
    background: var(--bg-surface);
}

.user-profile-file-item i {
    font-size: 28px;
    color: var(--primary);
    margin-bottom: 6px;
}

.user-profile-file-name {
    font-size: 12px;
    word-break: break-word;
    display: block;
}

.user-profile-file-caption {
    font-size: 10px;
    color: var(--text-secondary);
    display: block;
    margin-top: 4px;
}

/* Список голосовых (улучшенный) */
.user-profile-voice-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.user-profile-voice-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-elevated);
    border-radius: var(--radius-full);
    padding: 6px 12px;
}

.voice-play-btn {
    background: var(--primary);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--transition-fast);
}

.voice-play-btn:hover {
    transform: scale(1.05);
}

.voice-info {
    flex: 1;
}

.voice-duration {
    font-size: 12px;
    font-weight: 500;
}

.voice-caption {
    font-size: 11px;
    color: var(--text-secondary);
}

.voice-date {
    font-size: 10px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.empty-tab {
    text-align: center;
    padding: 32px;
    color: var(--text-secondary);
}

/* Плейсхолдер для видео до загрузки */
.video-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 100%;
    background: var(--bg-elevated);
    color: var(--text-secondary);
}

.video-placeholder i {
    font-size: 32px;
    color: var(--primary);
}

.video-placeholder span {
    font-size: 11px;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Миниатюры видео (альтернативный вариант) */
.user-profile-media-video {
    position: relative;
    width: 100%;
    height: 100%;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-profile-media-video img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-elevated);
    color: var(--text-secondary);
}

.video-play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition);
    cursor: pointer;
}

.user-profile-media-item:hover .video-play-overlay {
    opacity: 1;
}

.video-play-overlay i {
    font-size: 32px;
    color: white;
    text-shadow: 0 2px 4px black;
}

/* ================================== */
/* ЭКВАЛАЙЗЕР ДЛЯ ГОЛОСОВЫХ СООБЩЕНИЙ */
/* ================================== */
.voice-equalizer {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 30px;
    margin-left: 8px;
}

.eq-bar {
    width: 4px;
    border-radius: 2px;
    background-color: var(--primary);
    transition: height 0.1s ease;
}

.voice-equalizer.active .eq-bar {
    animation: equalizer 0.8s infinite alternate ease-in-out;
}

.eq-bar.bar1 { height: 12px; animation-delay: 0s; }
.eq-bar.bar2 { height: 18px; animation-delay: 0.1s; }
.eq-bar.bar3 { height: 24px; animation-delay: 0.2s; }
.eq-bar.bar4 { height: 18px; animation-delay: 0.3s; }
.eq-bar.bar5 { height: 12px; animation-delay: 0.4s; }

@keyframes equalizer {
    0% { height: 8px; opacity: 0.6; }
    100% { height: 28px; opacity: 1; }
}

@keyframes equalizerSmooth {
    0% { transform: scaleY(0.4); }
    100% { transform: scaleY(1.2); }
}

/* Для светлой темы */
body.light-theme .eq-bar {
    background-color: var(--primary);
    opacity: 0.8;
}

/* Адаптация под мобильные */
@media (max-width: 768px) {
    .user-profile-tabs {
        gap: 8px;
    }
    .user-profile-tab {
        padding: 6px 12px;
        font-size: 13px;
    }
    .user-profile-media-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 6px;
    }
    .user-profile-files-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: 6px;
    }
    .user-profile-voice-item {
        padding: 4px 10px;
    }
    .voice-play-btn {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    .voice-equalizer {
        gap: 2px;
        margin-left: 4px;
    }
    .eq-bar {
        width: 3px;
    }
}

/* Уважение prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
    .user-profile-tab,
    .user-profile-media-item,
    .user-profile-file-item,
    .voice-play-btn,
    .video-play-overlay,
    .eq-bar {
        transition: none;
        animation: none;
    }
    .user-profile-media-item:hover {
        transform: none;
    }
    .voice-equalizer.active .eq-bar {
        animation: none;
        height: 18px;
    }
}