/*
Theme Name: Personal Full System
Author: Gemini
Description: V16 - Beautiful Gallery & Auto-Covers
Version: 16.0
*/

:root {
    --bg-color: #1d2327;
    --card-color: #2c3338;
    --text-main: #ffffff;
    --text-muted: #a7aaad;
    --accent-color: #2271b1;
    --radius: 24px; /* Чуть больше скругление */
}

* { box-sizing: border-box; }

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding-bottom: 80px;
    transition: background 0.3s, color 0.3s;
    line-height: 1.6;
}

a { text-decoration: none; color: inherit; transition: opacity 0.2s, transform 0.2s; }
a:active { transform: scale(0.98); }
img { max-width: 100%; display: block; height: auto; }
button, input, textarea { font-family: inherit; }

/* --- СЕТКА --- */
.container {
    max-width: 1200px; /* Чуть шире */
    margin: 0 auto;
    padding: 30px 20px;
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 40px;
    align-items: start;
}

/* --- САЙДБАР --- */
.sidebar { position: sticky; top: 30px; }
.profile-card {
    background: var(--card-color);
    border-radius: var(--radius);
    padding: 35px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    border: 1px solid rgba(255,255,255,0.05);
}

.avatar-wrapper img {
    width: 130px; height: 130px;
    border-radius: 50%; object-fit: cover;
    margin-bottom: 20px;
    border: 4px solid var(--accent-color);
    box-shadow: 0 5px 20px rgba(var(--accent-color), 0.3);
}

.profile-name { font-size: 1.6rem; font-weight: 800; margin: 0 0 8px 0; letter-spacing: -0.5px; }
.profile-role { color: var(--text-muted); font-size: 1rem; margin-bottom: 25px; }

.stats {
    display: flex; justify-content: space-between;
    padding: 20px 10px;
    background: rgba(0,0,0,0.1); border-radius: 16px;
    margin-bottom: 25px;
}
.stat-num { font-weight: 800; font-size: 1.2rem; display: block; }
.stat-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; font-weight: 600; letter-spacing: 1px; }

.btn-primary, .btn-secondary {
    width: 100%; padding: 14px; border-radius: 16px; border: none;
    font-weight: 700; cursor: pointer; display: flex; justify-content: center; align-items: center;
    text-align: center; margin-bottom: 12px; font-size: 1rem; transition: 0.2s;
}
.btn-primary { background: var(--accent-color); color: #fff; box-shadow: 0 5px 15px rgba(0,0,0,0.2); }
.btn-primary:hover { filter: brightness(1.1); transform: translateY(-2px); }
.btn-secondary { background: rgba(255,255,255,0.08); color: var(--text-main); }
.btn-secondary:hover { background: rgba(255,255,255,0.12); }

/* --- КОНТЕНТ --- */
.widget-box, .post-card, .comments-area {
    background: var(--card-color);
    border-radius: var(--radius);
    padding: 30px; margin-bottom: 30px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.07);
    border: 1px solid rgba(255,255,255,0.05);
}
.widget-title { margin: 0 0 20px 0; font-size: 1.1rem; font-weight: 700; }

.friends-list { display: flex; gap: 12px; flex-wrap: wrap; }
.friend-item img { width: 50px; height: 50px; border-radius: 16px; border: 2px solid #4cd137; object-fit: cover; transition: 0.2s; }
.friend-item:hover img { transform: scale(1.1); }

.post-header { display: flex; align-items: center; margin-bottom: 20px; }
.post-avatar img { width: 48px; height: 48px; border-radius: 50%; margin-right: 15px; }
.post-title { font-size: 1.5rem; margin: 0 0 15px 0; line-height: 1.3; font-weight: 700; }
.post-actions { display: flex; gap: 25px; margin-top: 25px; padding-top: 20px; border-top: 1px solid rgba(255,255,255,0.1); color: var(--text-muted); font-weight: 600; }
.action-item { cursor: pointer; display: flex; align-items: center; gap: 8px; transition: 0.2s; }
.action-item:hover { color: var(--accent-color); }
.action-item.liked { color: #ff4757; }

/* =========================================
   НОВЫЕ СТИЛИ ДЛЯ АЛЬБОМОВ И ГАЛЕРЕИ
   ========================================= */

/* --- СЕТКА АЛЬБОМОВ (АРХИВ) --- */
.album-grid {
    display: grid;
    /* Автоматические колонки, минимум 250px шириной */
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    margin-top: 30px;
}

.album-card {
    background: var(--card-color);
    border-radius: var(--radius);
    overflow: hidden;
    display: block;
    position: relative;
    aspect-ratio: 4 / 3; /* Соотношение сторон карточки */
    transform: translateZ(0); /* Фикс для Safari */
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.album-card:hover .album-cover img {
    transform: scale(1.05); /* Увеличение картинки при наведении */
}

.album-cover {
    width: 100%;
    height: 100%;
    position: relative;
    background: var(--card-color);
}

.album-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Обрезаем, чтобы заполнить контейнер */
    transition: transform 0.5s ease;
}

/* Заглушка, если нет фото */
.album-placeholder {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted); font-size: 1.2rem; font-weight: 600;
    background: rgba(255,255,255,0.05);
    flex-direction: column; gap: 10px;
}

/* Затемнение поверх картинки */
.album-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.2) 60%, transparent 100%);
}

/* Информация об альбоме (поверх картинки) */
.album-info {
    position: absolute;
    bottom: 0; left: 0; width: 100%;
    padding: 25px;
    z-index: 2;
}

.album-title {
    font-weight: 700;
    font-size: 1.3rem;
    margin: 0;
    color: white;
    text-shadow: 0 2px 10px rgba(0,0,0,0.3);
}


/* --- СЕТКА ФОТОГРАФИЙ ВНУТРИ АЛЬБОМА (КРАСИВАЯ!) --- */
.gallery-container { padding: 10px !important; background: transparent !important; box-shadow: none !important; border: none !important;}

/* Превращаем контейнер в CSS Grid */
.gallery-wrapper-js {
    display: grid;
    /* Адаптивная сетка: колонки не меньше 180px */
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
}

/* Стили для самих картинок внутри галереи */
.gallery-wrapper-js img,
/* Поддержка стандартных блоков WP Gallery */
.wp-block-gallery .wp-block-image img,
.gallery-item img {
    width: 100%;
    height: 250px; /* Фиксированная высота для всех фото */
    object-fit: cover; /* Обрезаем лишнее, заполняя квадрат */
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    border: 3px solid transparent; /* Резерв для рамки при наведении */
}

/* Эффект при наведении на фото */
.gallery-wrapper-js img:hover,
.wp-block-gallery .wp-block-image img:hover,
.gallery-item img:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 15px 30px rgba(0,0,0,0.3);
    border-color: var(--accent-color); /* Цветная рамка */
    z-index: 2;
}


/* --- МОДАЛКИ --- */
.modal-overlay {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8); backdrop-filter: blur(8px);
    z-index: 9999; justify-content: center; align-items: center;
    padding: 20px;
}
.modal-content {
    background: var(--card-color); width: 100%; max-width: 500px;
    padding: 35px; border-radius: 28px; position: relative;
    box-shadow: 0 25px 50px rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.08);
}
.modal-close { position: absolute; top: 20px; right: 20px; width: 36px; height: 36px; background: rgba(255,255,255,0.1); border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: 0.2s; }
.modal-close:hover { background: rgba(255,255,255,0.2); }
.form-input, .form-textarea {
    width: 100%; background: rgba(0,0,0,0.2); border: 2px solid rgba(255,255,255,0.08);
    color: var(--text-main); padding: 16px; border-radius: 16px; margin-bottom: 20px;
    font-size: 1rem; outline: none; transition: 0.2s;
}
.form-input:focus, .form-textarea:focus { border-color: var(--accent-color); background: rgba(0,0,0,0.3); }
.form-textarea { min-height: 120px; resize: vertical; }
.comment-tools { margin-bottom: 15px; display: flex; gap: 5px; }
.tool-btn { background: rgba(255,255,255,0.08); border: none; width: 40px; height: 40px; border-radius: 10px; font-size: 1.1rem; cursor: pointer; color: var(--text-main); transition: 0.2s; display: flex; align-items: center; justify-content: center; }
.tool-btn:hover { background: var(--accent-color); color: white; }

/* --- ЛАЙТБОКС --- */
#gallery-lightbox .lightbox-content {
    background: transparent; box-shadow: none; border: none;
    max-width: 100%; width: auto; padding: 0;
    display: flex; flex-direction: column; align-items: center;
}
.lightbox-image-wrap img {
    max-height: 85vh; max-width: 95vw;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.lightbox-actions { margin-top: 20px; }
#lb-like-btn {
    background: rgba(40,40,40,0.8); backdrop-filter: blur(5px);
    border: 2px solid rgba(255,255,255,0.1);
    padding: 12px 28px; border-radius: 50px; color: white;
    font-size: 1.3rem; font-weight: 700; gap: 12px; width: auto; height: auto;
}
#lb-like-btn:hover { transform: scale(1.05); background: white; color: black; border-color: white; }
#lb-like-btn.liked { color: #ff4757; border-color: #ff4757; background: rgba(255, 71, 87, 0.15); }
.lightbox-close { top: -50px; right: -20px; background: none; font-size: 40px; color: white; opacity: 0.8; }
.lightbox-close:hover { background: none; opacity: 1; transform: rotate(90deg); }

/* --- АДАПТИВ --- */
.mobile-nav { display: none; }
@media (max-width: 1024px) {
    .container { grid-template-columns: 280px 1fr; gap: 30px; padding: 20px; }
    .album-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
}
@media (max-width: 768px) {
    .container { grid-template-columns: 1fr; }
    .sidebar { position: relative; top: 0; }
    .profile-card { text-align: left; display: flex; align-items: center; gap: 25px; padding: 25px; }
    .avatar-wrapper img { width: 90px; height: 90px; margin-bottom: 0; border-width: 3px; }
    .profile-info-block { flex-grow: 1; }
    .profile-name { font-size: 1.4rem; }
    .profile-role { margin-bottom: 5px; }
    .stats { display: none; }
    .sidebar .btn-primary, .sidebar .btn-secondary { display: none; }
    .album-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 15px; }
    .album-card { aspect-ratio: 1 / 1; }
    .album-title { font-size: 1.1rem; }
    .gallery-wrapper-js { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
    .gallery-wrapper-js img { height: 180px; border-radius: 12px; }
    
    .mobile-nav {
        display: flex; position: fixed; bottom: 0; left: 0; width: 100%;
        background: rgba(30,30,30,0.9); backdrop-filter: blur(10px);
        padding: 15px 20px; justify-content: space-between; align-items: center;
        z-index: 1000; border-top: 1px solid rgba(255,255,255,0.1);
        box-shadow: 0 -10px 30px rgba(0,0,0,0.2);
    }
    .nav-item { font-size: 1.6rem; opacity: 0.6; color: var(--text-main); padding: 10px; border-radius: 12px; transition: 0.2s; }
    .nav-item.active { opacity: 1; color: var(--accent-color); background: rgba(var(--accent-color-rgb), 0.1); }
    #mobile-create { background: var(--accent-color); color: white; opacity: 1; box-shadow: 0 5px 15px rgba(var(--accent-color-rgb), 0.4); }
}

/* =========================================
   КРАСИВАЯ СЕТКА ФОТОГРАФИЙ ВНУТРИ АЛЬБОМА
   ========================================= */

/* Убираем лишние отступы у главного контейнера в single-photo_album.php */
.gallery-container {
    padding: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
}

/* Основная сетка. Применяется к нашему оберточному диву И к стандартным галереям WP */
.gallery-wrapper-js,
.wp-block-gallery,
.gallery {
    display: grid !important;
    /* Адаптивные колонки: минимум 200px шириной, влезает сколько сможет */
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)) !important;
    gap: 20px !important; /* Расстояние между фото */
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important; /* Убираем точки если это список */
}

/* Сброс стилей для элементов-оберток внутри стандартной галереи WP */
.wp-block-gallery .wp-block-image,
.gallery-item {
    margin: 0 !important;
    width: auto !important; /* Сбрасываем фиксированные ширины WP */
    display: flex;
    flex-direction: column;
}

/* СТИЛИЗАЦИЯ САМИХ КАРТИНОК */
/* Таргетируем картинки в нашем блоке, в блоках WP и старых галереях */
.gallery-wrapper-js img,
.wp-block-gallery .wp-block-image img,
.gallery-icon img,
/* Дополнительно: если картинки просто вставлены в текст без галереи */
.gallery-wrapper-js > p > img, 
.gallery-wrapper-js > a > img {
    width: 100% !important;
    height: 250px !important; /* Фиксированная высота для идеальной плитки */
    object-fit: cover !important; /* Обрезаем лишнее, заполняя квадрат */
    border-radius: 16px !important; /* Скругление углов */
    cursor: pointer;
    transition: all 0.3s ease-out !important;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    display: block !important;
    background: var(--card-color); /* Фон пока грузится */
}

/* Эффект при наведении на фото */
.gallery-wrapper-js img:hover,
.wp-block-gallery .wp-block-image img:hover,
.gallery-icon img:hover {
    transform: translateY(-7px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
    z-index: 2;
}

/* Убираем подписи к фото, чтобы не ломали сетку (по желанию) */
.wp-element-caption, .gallery-caption {
    display: none !important;
}

/* АДАПТИВ ДЛЯ МОБИЛЬНЫХ (Фото поменьше) */
@media (max-width: 768px) {
    .gallery-wrapper-js, .wp-block-gallery, .gallery {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)) !important;
        gap: 10px !important;
    }
    .gallery-wrapper-js img, .wp-block-gallery .wp-block-image img, .gallery-icon img {
        height: 180px !important; /* Уменьшаем высоту на телефонах */
        border-radius: 12px !important;
    }
}

/* --- ОФОРМЛЕНИЕ СПИСКА ФАЙЛОВ И ДОКУМЕНТОВ --- */

.file-list-container {
    display: grid;
    grid-template-columns: 1fr; /* Список столбиком, можно изменить на сетку */
    gap: 15px;
}

/* Превращаем ссылки на файлы в карточки */
.file-list-container a {
    display: flex;
    align-items: center;
    background: var(--card-color);
    padding: 20px;
    border-radius: 16px;
    text-decoration: none;
    transition: 0.2s;
    border: 1px solid rgba(255,255,255,0.05);
    font-weight: 600;
    color: var(--text-main);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.file-list-container a:hover {
    transform: translateX(5px);
    border-color: var(--accent-color);
    background: rgba(255,255,255,0.08);
}

/* Добавляем иконку перед ссылкой автоматически */
.file-list-container a::before {
    content: '⬇'; /* Значок скачивания */
    display: flex; justify-content: center; align-items: center;
    width: 40px; height: 40px;
    background: var(--accent-color);
    border-radius: 50%;
    margin-right: 15px;
    color: white;
    font-size: 1.2rem;
}

/* Специфические иконки для типов файлов (если ссылки заканчиваются на...) */
.file-list-container a[href$=".pdf"]::before { content: '📄'; background: #ff4757; }
.file-list-container a[href$=".doc"]::before, 
.file-list-container a[href$=".docx"]::before { content: '📝'; background: #3742fa; }
.file-list-container a[href$=".xls"]::before, 
.file-list-container a[href$=".xlsx"]::before { content: '📊'; background: #2ed573; }
.file-list-container a[href$=".zip"]::before, 
.file-list-container a[href$=".rar"]::before { content: '📦'; background: #ffa502; }

/* Анимация при наведении на папки */
.doc-folder:hover .album-cover span { transform: scale(1.2); transition: 0.3s; }
.file-folder:hover .album-cover span { transform: rotate(15deg); transition: 0.3s; }

/* --- СТИЛИ ДЛЯ ВИДЕО --- */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
}
.video-card {
    background: var(--card-color);
    border-radius: 16px;
    overflow: hidden;
    transition: 0.2s;
    border: 1px solid rgba(255,255,255,0.05);
}
.video-card:hover { transform: translateY(-5px); box-shadow: 0 10px 30px rgba(0,0,0,0.3); }

.video-thumb {
    height: 160px;
    background: #000;
    position: relative;
    display: flex; align-items: center; justify-content: center;
}
.video-thumb img { width: 100%; height: 100%; object-fit: cover; opacity: 0.8; }
.play-icon {
    position: absolute; font-size: 3rem; color: white; opacity: 0.9;
    text-shadow: 0 0 20px rgba(0,0,0,0.5);
}
.video-info { padding: 15px; }
.video-title { margin: 0; font-size: 1.1rem; font-weight: 600; line-height: 1.4; }

/* Внутри видео-поста */
.video-container iframe, .video-container video {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

/* --- СТИЛИ ДЛЯ АУДИО --- */
.audio-list { display: flex; flex-direction: column; gap: 10px; }
.audio-item {
    display: flex; align-items: center; justify-content: space-between;
    background: var(--card-color); padding: 15px 20px;
    border-radius: 50px;
    border: 1px solid rgba(255,255,255,0.05);
    transition: 0.2s;
    text-decoration: none;
}
.audio-item:hover {
    background: rgba(255,255,255,0.05);
    transform: translateX(5px);
    border-color: var(--accent-color);
}
.audio-icon { margin-right: 15px; font-size: 1.5rem; }
.audio-name { font-weight: 600; font-size: 1rem; }
.audio-play-btn { color: var(--accent-color); font-size: 1.2rem; }

/* Плеер внутри поста */
.audio-player-container audio { width: 100%; margin-top: 10px; }