/* ============================================
   ОПТИМИЗИРОВАННЫЙ style.css ДЛЯ ФОТОГАЛЕРЕИ
   СТИЛИ ПЕРЕНЕСЕНЫ ИЗ base.html
   ============================================ */

/* ========== ОСНОВНЫЕ СТИЛИ СТРАНИЦЫ ========== */
body {
    background-color: #f8f9fa;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* ========== НАВИГАЦИЯ ========== */
.navbar-brand {
    font-weight: bold;
    font-size: 1.5rem;
}

/* ========== СТИЛИ ДЛЯ ИЗОБРАЖЕНИЙ (ПЕРЕНЕСЕНО ИЗ base.html) ========== */
.album-cover, .photo-image-3-2 {
    object-fit: cover;           /* Сохранение пропорций с обрезкой */
    background-color: #f8f9fa;   /* Фон для изображений */
}

.default-cover {
    display: flex;               /* Центрирование иконки */
    align-items: center;
    justify-content: center;
    background: #e9ecef;        /* Цвет фона заглушки */
    font-size: 3rem;            /* Размер иконки */
    color: #6c757d;             /* Цвет иконки */
}

/* ========== УНИФИЦИРОВАННЫЕ КАРТОЧКИ ========== */
.card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: none;
    overflow: hidden;
    border-radius: 12px;
    animation: fadeIn 0.5s ease-out;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* ========== ГРИДЫ И СЕТКИ ========== */

/* СЕТКА ДЛЯ АЛЬБОМОВ (3 КОЛОНКИ) */
.album-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

/* СЕТКА ДЛЯ ФОТОГРАФИЙ 3:2 */
.photo-grid-3-2 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

/* ЭЛЕМЕНТ ФОТО В СЕТКЕ */
.photo-item-3-2 {
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    height: auto;
    position: relative; /* Для абсолютного позиционирования чекбоксов */
}

/* ========== ОБЛОЖКИ АЛЬБОМОВ 3:2 ========== */
.album-cover-wrapper {
    width: 100%;
    aspect-ratio: 3/2;
    overflow: hidden;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    position: relative;
}

.album-cover-wrapper img,
.album-cover-wrapper .default-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.album-cover-wrapper a:hover .album-cover {
    transform: scale(1.05);
}

.album-cover-wrapper a:hover .default-cover {
    background: linear-gradient(135deg, #5a6268 0%, #3d4449 100%);
    transform: scale(1.05);
}

/* Затемнение при наведении */
.album-cover-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.3) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.album-cover-wrapper:hover::after {
    opacity: 1;
}

/* ========== МАССОВЫЕ ДЕЙСТВИЯ ========== */
.photo-checkbox {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 10;
    transition: opacity 0.3s ease;
    display: none; /* Скрыты по умолчанию */
}

.photo-checkbox.visible {
    display: block; /* Показываются при активации */
}

.photo-checkbox-input {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

#batchActions {
    transition: all 0.3s ease;
}

/* ========== КНОПКИ И УПРАВЛЕНИЕ ========== */

/* СТИЛИ ДЛЯ КНОПОК */
.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.btn-outline-primary {
    color: #007bff;
    border-color: #007bff;
}

.btn-outline-primary:hover {
    color: #fff;
    background-color: #007bff;
    border-color: #007bff;
}

/* БЛОК ДЕЙСТВИЙ ДЛЯ ФОТО */
.photo-actions {
    padding: 16px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    margin-top: auto;
    display: block;
}

/* Компактные кнопки для фото */
.compact-buttons {
    display: flex;
    flex-wrap: nowrap;
    gap: 3px;
    margin-top: 8px;
}

.compact-btn {
    padding: 2px 6px !important;
    font-size: 11px !important;
    line-height: 1.2 !important;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
    border-radius: 3px !important;
}

/* ========== ВИДЕО ЭЛЕМЕНТЫ ========== */
.video-indicator {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 10;
    max-width: 80px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
}

/* ========== СИСТЕМА ТЕГОВ ========== */
.photo-tags .badge {
    transition: all 0.3s ease;
}

#currentTags .badge {
    transition: all 0.3s ease;
}

/* Плавное появление/исчезновение тегов */
.badge.fade-out {
    opacity: 0;
    transform: scale(0.8);
}

/* Стили для массового управления тегами */
#batchAvailableTags .badge,
#batchRemoveTags .badge {
    cursor: pointer;
    transition: all 0.2s ease;
}

#batchAvailableTags .badge:hover {
    opacity: 0.8;
    transform: scale(1.05);
}

.batch-tag-selected {
    box-shadow: 0 0 0 2px #0d6efd;
}

/* Мини-грид для кликабельных превью */
.photo-grid-mini-clickable {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
    height: 100px;
    width: 100%;
    cursor: pointer;
    transition: opacity 0.2s;
}

.photo-grid-mini-clickable:hover {
    opacity: 0.8;
}

.mini-thumb-clickable {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 3px;
    background-color: #f8f9fa;
    aspect-ratio: 1 / 1;
}

/* Карточки тегов */
.tag-card {
    transition: transform 0.2s;
    min-height: 160px;
}

.tag-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* Автодополнение тегов */
.tag-suggestions-container {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 10px;
    background: white;
    animation: fadeInUp 0.2s ease-out;
}

.alphabet-group {
    border-bottom: 1px solid #f8f9fa;
    padding-bottom: 8px;
}

.alphabet-group:last-child {
    border-bottom: none;
}

.tag-suggestion {
    transition: all 0.15s ease-in-out;
    transform-origin: center;
}

.tag-suggestion:hover {
    opacity: 0.8;
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* Поле ввода тегов */
#tagsInput:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
    transition: all 0.15s ease-in-out;
}

/* Популярные теги */
#quickTags .badge {
    transition: all 0.15s ease-in-out;
}

#quickTags .badge:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Анимация для списка тегов (если ещё нет в файле) */
@keyframes fadeInUp {
    from { 
        opacity: 0;
        transform: translateY(-10px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========== УТИЛИТЫ И ВСПОМОГАТЕЛЬНЫЕ КЛАССЫ ========== */
.card.h-100 {
    display: flex;
    flex-direction: column;
}

.card-body.d-flex {
    flex-grow: 1;
}

.mt-auto {
    margin-top: auto !important;
}

.d-flex.gap-1 {
    gap: 6px !important;
}

.d-flex.gap-2 {
    gap: 8px !important;
    flex-wrap: wrap;
}

.flex-wrap {
    flex-wrap: wrap;
}

.card-text.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.text-muted {
    font-size: 0.8rem;
    flex-shrink: 0;
    color: #6c757d !important;
}

.flex-grow-1 {
    flex-grow: 1;
}

/* ========== АНИМАЦИИ ========== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes progress-bar-stripes {
    0% { background-position: 1rem 0; }
    100% { background-position: 0 0; }
}

.progress-bar-animated {
    animation: progress-bar-stripes 1s linear infinite;
}

/* ========== АДАПТИВНОСТЬ ========== */

@media (max-width: 1200px) {
    .album-grid-3,
    .photo-grid-3-2 {
        grid-template-columns: repeat(3, 1fr);
        gap: 18px;
    }
}

@media (max-width: 992px) {
    .album-grid-3,
    .photo-grid-3-2 {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    
    .default-cover {
        font-size: 1.75rem;
    }
}

@media (max-width: 768px) {
    .album-grid-3,
    .photo-grid-3-2 {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }
    
    .photo-actions {
        padding: 12px;
    }
    
    .default-cover {
        font-size: 1.5rem;
    }
}

@media (max-width: 576px) {
    .album-grid-3,
    .photo-grid-3-2 {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    /* Скрываем информацию о файле на мобильных */
    .photo-info,
    .file-info,
    .photo-meta,
    .text-muted {
        display: none !important;
    }
    
    /* Показываем только кнопки действий */
    .photo-actions .d-flex.gap-1 {
        display: flex !important;
        justify-content: center;
        margin-top: 8px;
    }
    
    /* Скрываем чекбоксы выбора фото на мобильных */
    .photo-checkbox {
        display: none !important;
    }
    
    /* Компактные кнопки управления альбомом */
    .d-flex.gap-2 > .btn[href*="edit_album"],
    .d-flex.gap-2 > .btn[href*="create_album"], 
    .d-flex.gap-2 > .btn[href*="upload"] {
        width: 44px !important;
        height: 44px !important;
        padding: 0 !important;
        border-radius: 8px !important;
        position: relative;
        overflow: hidden;
        font-size: 0 !important;
    }
    
    .d-flex.gap-2 > .btn[href*="edit_album"]::before {
        content: "✏️";
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        font-size: 18px;
        line-height: 1;
    }
    
    .d-flex.gap-2 > .btn[href*="create_album"]::before {
        content: "➕";
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        font-size: 18px;
        line-height: 1;
    }
    
    .d-flex.gap-2 > .btn[href*="upload"]::before {
        content: "📁";
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        font-size: 18px;
        line-height: 1;
    }
}

/* ========== FANCYBOX ДЛЯ ВИДЕО ========== */
.fancybox-video-container {
    background: black;
    width: calc(100vw - 40px);
    height: calc(100vh - 40px);
    max-width: 100%;
    max-height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.fancybox-video-player {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* ========== АДМИН-ПАНЕЛЬ ========== */

/* Навигационные табы */
.nav-tabs .nav-link {
    font-weight: 500;
    border: none;
    color: #6c757d;
}

.nav-tabs .nav-link.active {
    color: #0d6efd;
    border-bottom: 3px solid #0d6efd;
    background: transparent;
}

/* Карточки админки */
.admin-card:hover {
    transform: translateY(-2px);
    transition: transform 0.2s;
}

/* Прогресс-бары */
.progress {
    height: 8px;
}

/* ========== МОДАЛКИ ========== */

/* Модалка массового управления тегами */
.batch-common-tags {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 10px;
    margin-bottom: 10px;
}

.batch-common-tags .form-check {
    margin-bottom: 5px;
}

.batch-common-tags .badge {
    font-size: 0.8em;
    padding: 4px 8px;
}