/* style.css - оптимизированная версия */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #b8d4f5, #789ed4);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* ========== HEADER ========== */
.header {
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    padding: 20px 30px;
    border-radius: 20px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s;
}

.logo:hover {
    transform: scale(1.02);
}

.logo-icon {
    font-size: 36px;
}

.logo-text {
    font-size: 1.6rem;
    font-weight: 600;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    letter-spacing: -0.5px;
}

.logo-sub {
    font-size: 0.75rem;
    color: #888;
    margin-top: 2px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logout-btn {
		content: "";
		display: inline-block;
		width: 20px;
		height: 20px;
		background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2'%3E%3Cpath d='M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4'/%3E%3Cpolyline points='16 17 21 12 16 7'/%3E%3Cline x1='21' y1='12' x2='9' y2='12'/%3E%3C/svg%3E");
		background-size: contain;
		background-repeat: no-repeat;
		transition: transform 0.2s ease, filter 0.2s ease;
}

.logout-btn:hover {
    transform: translateY(-2px);
    filter: brightness(0.1); /* затемняет на 10% */
}

/* ========== ЕДИНЫЙ КОНТЕЙНЕР ДЛЯ КНОПОК НА ПРЕВЬЮ ========== */
.image-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    display: none;
    gap: 5px;
    z-index: 20;
}

.image-item:hover .image-actions {
    display: flex;
}

/* Общие стили для всех кнопок действий */
.image-action-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    color: white;
    font-size: 17px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    padding: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.image-action-btn:hover {
    transform: translateY(-2px);
}

/* Кнопка избранного */
.favorite-btn {
    background: #efab95;
}

.favorite-btn:hover {
    background: #ec997f;
}

/* Настройки */
.settings-btn {
    background: #667eea;
}

.settings-btn:hover {
    background: #5a67d8;
}

/* Удаление */
.delete-btn {
    background: #ff4757;
}

.delete-btn:hover {
    background: #ff6b81;
}

/* Состояние загрузки */
.image-action-btn.loading {
    opacity: 0.5;
    pointer-events: none;
}


/* ========== КНОПКИ ========== */
.admin-btn {
    padding: 8px 8px;
    background: #667eea;
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s;
}

.admin-btn:hover {
    background: #5a67d8;
    transform: translateY(-2px);
}

.admin-btn-danger {
    background: #ff4757;
}

.admin-btn-danger:hover {
    background: #ff6b81;
}


/* ========== ИЗБРАННОЕ ========== */
.favorites-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.favorites-link.active {
    background: rgba(255, 71, 87, 0.15);
    border-radius: 8px;
}

.favorites-count {
    background: #ff4757;
    color: white;
    font-size: 11px;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    margin-left: 4px;
}


#viewerFavoriteBtn:hover {
    transform: scale(1.15);
    background: rgba(0,0,0,0.8);
    animation: heartBeat 0.65s ease-in-out infinite;
}

#viewerFavoriteBtn.favorite-active {
    color: #ff4757;
}

/* Анимация сердечка */
@keyframes heartBeat {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

.heart-beat {
    animation: heartBeat 0.3s ease;
}


/* ========== СЕТКИ ========== */
.albums-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    padding: 10px;
}

.images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    padding: 10px;
}

/* ========== КАРТОЧКИ АЛЬБОМОВ ========== */
.album-card {
    background: white;
    border-radius: 20px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    position: relative;
}

.album-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 35px rgba(0,0,0,0.15);
}

.album-thumb-grid {
    height: 180px;
    background: #f5f5f5;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 2px;
    background-color: #e0e0e0;
}

.album-thumb-item {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-color: #d0d0d0;
}

.album-thumb-empty {
    height: 180px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 56px;
    transition: transform 0.3s;
}

.album-card:hover .album-thumb-empty {
    transform: scale(1.05);
}

.album-title-wrapper {
    padding: 18px;
    text-align: center;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.album-title {
    font-size: 1.1rem;
    color: #333;
    word-break: break-word;
    font-weight: 500;
    cursor: pointer;
    flex: 1;
}

.album-title-input {
    font-size: 1rem;
    padding: 6px 10px;
    border: 2px solid #667eea;
    border-radius: 8px;
    flex: 1;
    text-align: center;
    font-weight: 500;
    background: white;
    min-width: 120px;
}

.album-title-input:focus {
    outline: none;
    border-color: #764ba2;
}

.album-edit-name {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(102,126,234,0.9);
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 10;
    opacity: 0.7;
}

.album-card:hover .album-edit-name {
    opacity: 1;
}

.album-edit-name:hover {
    background: #5a67d8;
    transform: scale(1.05);
    opacity: 1;
}

.album-save-name {
    background: #10b981;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.album-save-name:hover {
    background: #059669;
    transform: scale(1.05);
}

.album-actions {
    padding: 12px;
    text-align: center;
    border-top: 1px solid #eee;
    display: flex;
    gap: 8px;
    justify-content: center;
}

.create-album {
    background: rgba(255,255,255,0.9);
    border: 2px dashed #667eea;
}

.create-album .album-thumb-empty {
    background: rgba(102,126,234,0.1);
    color: #667eea;
}

/* ========== КАРТОЧКИ ИЗОБРАЖЕНИЙ ========== */
.image-item {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    cursor: pointer;
    background: #f5f5f5;
    aspect-ratio: 1;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transition: all 0.3s;
}

.image-item:hover {
    transform: scale(1.03);
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.image-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

.image-item:hover .image-thumb {
    transform: scale(1.05);
}

.upload-area {
    background: rgba(255,255,255,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed #667eea;
    cursor: pointer;
}


/* ========== МОДАЛЬНЫЕ ОКНА ========== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.85);
    z-index: 20000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
    cursor: pointer;
}

.modal-content {
    background: white;
    border-radius: 20px;
    max-width: 90%;
    width: 500px;
    max-height: 85vh;
    overflow-y: auto;
    animation: modalSlideIn 0.2s ease-out;
    cursor: default;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: #333;
    font-size: 1.3rem;
}

.modal-close {
    font-size: 28px;
    cursor: pointer;
    color: #999;
    transition: all 0.3s;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.modal-close:hover {
    color: #333;
    background: #f0f0f0;
    transform: rotate(90deg);
}

.modal-body {
    padding: 25px;
}

.modal-footer {
    padding: 15px 25px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* ========== ПРОСМОТРЩИК ФОТО/ВИДЕО ========== */
#imageViewer {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.95);
    z-index: 10000;
    justify-content: center;
    align-items: center;
}

#imageViewer .modal-content {
    background: transparent;
    max-width: 95vw;
    max-height: 95vh;
    padding: 0;
    overflow: visible;
    display: flex;
    justify-content: center;
    align-items: center;
    width: auto;
    height: auto;
    position: relative;
}

.viewer-image, .viewer-video {
    max-width: 95vw;
    max-height: 95vh;
    width: auto;
    height: auto;
    object-fit: contain;
    animation: zoomIn 0.2s ease-out;
    cursor: default;
    display: block;
    margin: 0 auto;
}

.viewer-image {
    max-width: 95vw;
    max-height: 95vh;
    width: auto;
    height: auto;
    object-fit: contain;
}

.viewer-video {
    background: #000;
    border-radius: 8px;
}

.video-progress-container {
    position: absolute;
    bottom: 70px;
    left: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px;
    z-index: 10002;
    height: 20px;
    opacity: 1;
    transition: opacity 0.4s ease;
}

.video-progress-container.hidden {
    opacity: 0;
    pointer-events: none;
}

.progress-bar-bg {
    flex: 1;
    height: 4px;
    background: rgba(255,255,255,0.25);
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    padding: 10px 0;  /* было 8px — увеличиваем зону касания */
    background-clip: content-box;
}

.progress-bar-fill {
    width: 0%;
    height: 100%;
    background: #ff4757;
    border-radius: 4px;
    position: relative;
    z-index: 2;
    transition: width 0.1s ease;
    pointer-events: none;
}

/* Кружок — виден всегда */
.progress-bar-fill::after {
    content: '';
    position: absolute;
    right: -7px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    background: #ff4757;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.progress-bar-buffer {
    width: 0%;
    height: 100%;
    background: rgba(255,255,255,0.45);
    border-radius: 4px;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    pointer-events: none;
}

.time-current, .time-duration {
    color: white;
    font-size: 11px;
    font-family: monospace;
    min-width: 36px;
    text-align: center;
}

.video-controls {
    position: absolute;
    bottom: 20px;
    left: 20px;
    display: flex;
    gap: 10px;
    z-index: 10002;
}

.video-control-btn {
    background: rgba(0,0,0,0.6);
    border: none;
    color: white;
    font-size: 16px;
    padding: 8px 12px;
    border-radius: 20px;
    cursor: pointer;
    transition: 0.2s;
}

.video-control-btn:hover {
    background: rgba(0,0,0,0.8);
}

.viewer-nav {
    position: fixed;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    padding: 0 30px;
    pointer-events: none;
    z-index: 10001;
}

.viewer-nav-btn {
    width: 56px;
    height: 56px;
    background: rgba(0,0,0,0.6);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 50%;
    color: white;
    font-size: 32px;
    cursor: pointer;
    pointer-events: auto;
    backdrop-filter: blur(5px);
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.viewer-nav-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.1);
}

.viewer-counter {
    position: fixed;
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(10px);
    padding: 8px 20px;
    border-radius: 30px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    z-index: 10002;
    border: 1px solid rgba(255,255,255,0.2);
    letter-spacing: 0.5px;
    pointer-events: none;
}

.viewer-close {
    position: fixed;
    top: 20px;
    right: 30px;
    width: 48px;
    height: 48px;
    background: rgba(0,0,0,0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 28px;
    font-weight: 300;
    cursor: pointer;
    z-index: 10002;
    transition: all 0.3s;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255,255,255,0.2);
}

.viewer-close:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.1);
}

#viewerDownloadBtn, #viewerDeleteBtn, #viewerSettingsBtn, #viewerFavoriteBtn, #viewerFullscreenBtn {
    position: fixed;
    bottom: 25px;
    background: rgba(0,0,0,0.6);
    border-radius: 50%;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255,255,255,0.2);
    cursor: pointer;
    z-index: 10002;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    width: 44px;
    height: 44px;
    transform-origin: center;
    color: white;
}

/* Позиции для десктопа (справа налево) */
#viewerDownloadBtn {
    right: 50px;
}

#viewerDeleteBtn {
    right: 100px;
    color: #ff6b6b;
}

#viewerSettingsBtn {
    right: 150px;
}

#viewerFullscreenBtn {
    right: 200px;
}

#viewerFavoriteBtn {
    right: 250px;
}

#viewerDeleteBtn:hover {
    color: #ff4757;
    transform: scale(1.15);
    background: rgba(0,0,0,0.8);
}

#viewerSettingsBtn:hover, #viewerDownloadBtn:hover, #viewerFullscreenBtn:hover {
    color: #a0a0ff;
    transform: scale(1.15);
    background: rgba(0,0,0,0.8);
}

/* Для пользователя (когда нет кнопок удалить/настройки) */

body.user-page #viewerDownloadBtn {
    right: 50px;
}

body.user-page #viewerFullscreenBtn {
    right: 100px;
}

body.user-page #viewerFavoriteBtn {
    right: 150px;
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ========== АДМИН-БАР ========== */
.admin-bar {
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(10px);
    color: white;
    padding: 12px 24px;
    position: fixed;
    bottom: 20px;
    right: 20px;
    border-radius: 50px;
    z-index: 1000;
    display: flex;
    gap: 12px;
    font-size: 14px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
}

/* ========== ПОЛЬЗОВАТЕЛИ ========== */
.user-list {
    max-height: 400px;
    overflow-y: auto;
    margin: 10px 0;
}

.user-item {
    padding: 12px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.user-item:hover {
    background: #f8f9fa;
}

.user-item strong {
    color: #333;
}

.user-item small {
    color: #999;
    font-size: 11px;
}

/* ========== ФОРМЫ ========== */
select, input[type="text"], input[type="password"] {
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    width: 100%;
    margin: 8px 0;
    font-size: 14px;
    transition: border-color 0.3s;
}

select:focus, input:focus {
    outline: none;
    border-color: #667eea;
}

/* ========== ПРОГРЕСС ЗАГРУЗКИ ========== */
.upload-progress {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: white;
    padding: 15px 20px;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    z-index: 2000;
    min-width: 280px;
    border-left: 4px solid #667eea;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: #f0f0f0;
    border-radius: 3px;
    overflow: hidden;
    margin-top: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    width: 0%;
    transition: width 0.3s;
}

/* ========== УВЕДОМЛЕНИЯ ========== */
.notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #10b981;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    z-index: 999999;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    pointer-events: none;
    animation: notificationSlideIn 0.3s ease;
}

.notification.error {
    background: #ef4444;
}

@keyframes notificationSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes notificationSlideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* ========== ВЫБОР ФОНА ========== */
.bg-picker-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 30px;
    transition: all 0.3s;
    color: #333;
    backdrop-filter: blur(5px);
}

.bg-picker-btn:hover {
    background: rgba(255,255,255,0.4);
    transform: scale(1.05);
}

.bg-picker-panel {
    position: fixed;
    top: 80px;
    right: 20px;
    background: rgba(255,255,255,0.98);
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    width: 320px;
    max-width: calc(100vw - 40px);
    z-index: 10001;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.bg-picker-panel.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.bg-picker-header {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.bg-picker-header h4 {
    margin: 0;
    color: #333;
}

.bg-picker-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.bg-picker-close:hover {
    background: #f0f0f0;
    color: #333;
}

.bg-picker-body {
    padding: 20px;
    max-height: 70vh;
    overflow-y: auto;
}

.bg-picker-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: none;
}

.bg-picker-overlay.active {
    display: block;
}

.gradient-preset {
    height: 60px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.gradient-preset:hover {
    transform: scale(1.02);
    border-color: #667eea;
}

/* ========== DRAG & DROP ========== */
body.drag-over-active::before {
    content: "📸 Отпустите для загрузки в альбом";
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(102, 126, 234, 0.95);
    color: white;
    padding: 20px 40px;
    border-radius: 50px;
    font-size: 18px;
    font-weight: bold;
    z-index: 10000;
    pointer-events: none;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    backdrop-filter: blur(5px);
    white-space: nowrap;
}

/* ========== СТАТУС ДОСТУПА ========== */
.access-status-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #667eea;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
}

.access-status-btn .access-icon {
    font-size: 14px;
}


/* ========== АНИМАЦИИ ========== */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#createUserResult {
    animation: slideDown 0.3s ease;
}

/* ========== ПЛИТКА СОЗДАНИЯ ПАПКИ ========== */
.create-folder-area {
    background: rgba(255,255,255,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed #667eea;
    cursor: pointer;
}

.create-folder-area:hover {
    transform: scale(1.03);
}

/* ========== ИКОНКИ НА КАРТОЧКАХ ========== */
.album-controls-icons {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 5px;
    z-index: 20;
    opacity: 0;
    transition: opacity 0.2s;
}

.album-card:hover .album-controls-icons {
    opacity: 1;
}

.album-icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(0,0,0,0.7);
    border: none;
    color: white;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.album-icon-btn:hover {
    background: rgba(0,0,0,0.9);
    transform: scale(1.05);
}

.album-icon-btn.danger:hover {
    background: #ff4757;
}

.folder-actions {
    margin-top: 10px;
    padding: 0 12px 12px 12px;
    display: flex;
    gap: 8px;
    justify-content: center;
    border-top: none;
}

/* ========== КНОПКА НАЗАД НАД СЕТКОЙ ========== */
.back-header-container {
    margin-bottom: 20px;
    padding: 0 10px;
}

.back-header-btn {
    background: rgba(102, 126, 234, 0.9);
    border: none;
    font-size: 14px;
    cursor: pointer;
    padding: 8px 20px;
    border-radius: 20px;
    transition: all 0.3s;
    color: white;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.back-header-btn:hover {
    background: #5a67d8;
    transform: translateY(-2px);
}


.upload-progress {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 350px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    z-index: 10000;
    overflow: hidden;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.upload-progress-header {
    padding: 12px 15px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    font-weight: 500;
    font-size: 13px;
}

.progress-bar {
    height: 4px;
    background: #e5e7eb;
}

.progress-fill {
    width: 0%;
    height: 100%;
    background: #10b981;
    transition: width 0.3s ease;
}

.upload-progress-stats {
    padding: 10px 15px;
    font-size: 12px;
    color: #666;
    border-bottom: 1px solid #e5e7eb;
}

.upload-progress-files {
    max-height: 200px;
    overflow-y: auto;
    padding: 5px 0;
}

.upload-file-item {
    padding: 8px 15px;
    font-size: 12px;
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid #f0f0f0;
}

.upload-file-item.completed {
    color: #10b981;
}

.upload-file-item.uploading {
    color: #667eea;
    font-weight: 500;
}

.upload-file-item span {
    font-family: monospace;
}


.video-preparing {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-height: 300px;
    color: #fff;
    text-align: center;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 12px;
    padding: 40px 20px;
}

.video-preparing-icon {
    font-size: 64px;
    margin-bottom: 20px;
    animation: pulse 2s infinite;
}

.video-preparing-title {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 10px;
}

.video-preparing-subtitle {
    font-size: 16px;
    color: #aaa;
    margin-bottom: 30px;
}

.video-preparing-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.05); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}


/* ========== МАССОВЫЕ ДЕЙСТВИЯ ========== */
.bulk-actions-panel {
    grid-column: 1 / -1;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 15px 20px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(102, 126, 234, 0.15);
    animation: slideDown 0.3s ease;
}

.selected-count {
    font-weight: 600;
    color: #333;
    font-size: 14px;
    padding: 6px 14px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.selected-count::before {
    content: '✓';
    color: #667eea;
    font-weight: bold;
}

.bulk-actions-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ===== СТИЛИЗОВАННЫЙ ЧЕКБОКС ===== */
.file-checkbox,
.favorite-checkbox {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 22px;
    height: 22px;
    cursor: pointer;
    z-index: 25;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    appearance: none;
    -webkit-appearance: none;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid rgba(102, 126, 234, 0.5);
    border-radius: 6px;
    backdrop-filter: blur(4px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    margin: 0;
}

/* Специфичный цвет для чекбокса избранного */
.favorite-checkbox {
    border-color: rgba(255, 71, 87, 0.5);
}

.file-checkbox:hover,
.favorite-checkbox:hover {
    border-color: #667eea;
    background: rgba(255, 255, 255, 1);
    transform: scale(1.05);
}

.favorite-checkbox:hover {
    border-color: #ff4757;
}

.file-checkbox:checked,
.favorite-checkbox:checked {
    opacity: 1;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
    background-size: 14px;
    background-position: center;
    background-repeat: no-repeat;
}

.file-checkbox:checked {
    background-color: #667eea;
    border-color: #667eea;
}

.favorite-checkbox:checked {
    background-color: #ff4757;
    border-color: #ff4757;
}

.image-item:hover .file-checkbox,
.image-item:hover .favorite-checkbox,
.selection-mode .file-checkbox,
.selection-mode .favorite-checkbox {
    opacity: 1;
}

/* Анимация появления чекбокса */
.image-item:hover .file-checkbox,
.image-item:hover .favorite-checkbox {
    animation: checkboxPop 0.2s ease;
}

@keyframes checkboxPop {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* Состояние выбранного элемента */
.image-item.selected {
    outline: 3px solid #667eea;
    outline-offset: -3px;
    border-radius: 12px;
}

/* Для избранного - красный outline */
.favorite-checkbox:checked ~ .image-thumb,
.image-item:has(.favorite-checkbox:checked) {
    /* Можно добавить специфичный стиль если нужно */
}

.image-item.selected::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.12), rgba(118, 75, 162, 0.08));
    border-radius: 12px;
    pointer-events: none;
}

/* Для избранного - красноватый оттенок выделения */
.image-item:has(.favorite-checkbox:checked)::after {
    background: linear-gradient(135deg, rgba(255, 71, 87, 0.12), rgba(255, 107, 129, 0.08));
}

/* ===== МОДАЛЬНОЕ ОКНО ВЫБОРА ПАПКИ ===== */
.folders-list {
    max-height: 350px;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    margin: 15px 0;
    background: #fafbfc;
}

.folder-option {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}

.folder-option:last-child {
    border-bottom: none;
}

.folder-option:hover {
    background: #f0f4ff;
}

.folder-option.selected {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.folder-option input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #d1d5db;
    border-radius: 50%;
    margin: 0;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    flex-shrink: 0;
}

.folder-option input[type="radio"]:checked {
    border-color: #667eea;
    background: #667eea;
    box-shadow: inset 0 0 0 4px white;
}

.folder-option.selected input[type="radio"] {
    border-color: white;
    background: white;
    box-shadow: inset 0 0 0 4px #667eea;
}

.folder-option .folder-name {
    flex: 1;
    font-weight: 500;
}

.folder-option .folder-path {
    font-size: 11px;
    color: #999;
    font-family: monospace;
}

.folder-option.selected .folder-path {
    color: rgba(255, 255, 255, 0.75);
}

/* Чекбокс для папок */
.folder-checkbox {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 22px;
    height: 22px;
    cursor: pointer;
    z-index: 25;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    appearance: none;
    -webkit-appearance: none;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid rgba(102, 126, 234, 0.5);
    border-radius: 6px;
    backdrop-filter: blur(4px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    margin: 0;
}

.folder-checkbox:hover {
    border-color: #667eea;
    background: rgba(255, 255, 255, 1);
    transform: scale(1.05);
}

.folder-checkbox:checked {
    background: #667eea;
    border-color: #667eea;
    opacity: 1;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
    background-size: 14px;
    background-position: center;
    background-repeat: no-repeat;
}

.album-card:hover .folder-checkbox,
.selection-mode .folder-checkbox {
    opacity: 1;
}

.album-card:hover .folder-checkbox {
    animation: checkboxPop 0.2s ease;
}

.album-card.selected {
    outline: 3px solid #667eea;
    outline-offset: -3px;
    border-radius: 20px;
}

.album-card.selected::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.12), rgba(118, 75, 162, 0.08));
    border-radius: 20px;
    pointer-events: none;
}

/* Обновленная панель с информацией о выделении */
.selected-count {
    font-weight: 600;
    color: #333;
    font-size: 14px;
    padding: 6px 14px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.selected-count span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.selected-count span:not(:last-child)::after {
    content: '•';
    margin-left: 8px;
    color: #999;
}


/* ========== ИСПРАВЛЕНИЯ ДЛЯ МОБИЛЬНОЙ ВЕРСИИ ========== */
    
@media (max-width: 768px) {
    
    .header {
        padding: 10px 12px;
        flex-direction: column;
        align-items: stretch;
    }
    
    /* Верхняя строка: логотип слева, кнопки справа */
    .header-top {
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        width: 100%;
    }
    
    /* Если нет .header-top, создаём через flex */
    .header {
        display: flex;
        flex-direction: column;
    }
    
    .header > div:first-child {
        display: flex;
        align-items: center;
        width: 100%;
    }
    
    /* Логотип */
    .logo {
        flex-shrink: 0;
    }
    
    .logo-icon {
        font-size: 22px;
    }
    
    .logo-text {
        font-size: 1rem;
    }
    
    /* Название альбома - под логотипом */
    .logo-sub {
        font-size: 0.6rem;
        color: #888;
        margin-top: 2px;
        display: block;
        white-space: nowrap;
        max-width: 150px;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    /* Блок с кнопками справа вверху */
    .user-info {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 5px;
        flex-shrink: 0;
		margin-left: auto;  /* ← прижимает вправо */
		margin-top: -45px;  /* ← отступ сверху */
    }
    
    /* Имя пользователя */
    .user-info > span {
		order: 3;  /* Имя пользователя */
		font-size: 11px;
		white-space: nowrap;
    }
    
    /* Кнопка выйти - без фона, только иконка */
    .logout-btn {
        font-size: 0;
        padding: 5px;
        background: transparent;
        color: #666;
        text-decoration: none;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 4px;
		order: 4;
    }
    
	.logout-btn::before {
		content: "";
		display: inline-block;
		width: 16px;
		height: 16px;
		background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2'%3E%3Cpath d='M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4'/%3E%3Cpolyline points='16 17 21 12 16 7'/%3E%3Cline x1='21' y1='12' x2='9' y2='12'/%3E%3C/svg%3E");
		background-size: contain;
		background-repeat: no-repeat;
	}
    
    .logout-btn:hover {
        background: rgba(0, 0, 0, 0.05);
    }
    
    /* Скрываем текст внутри logout-btn */
    .logout-btn * {
        display: none;
		order: 4;
    }
    
    /* Кнопка выбора фона */
    .bg-picker-btn {
        font-size: 16px;
        padding: 5px;
		order: 1;  /* Фон */
    }
    
	.favorites-link {
		position: relative;
		font-size: 0;
		padding: 5px;
		text-decoration: none;
		display: inline-flex;
		align-items: center;
		justify-content: center;
		background: transparent;
		order: 2;  /* Избранное */
		
	}

	.favorites-link::before {
		content: "❤️";
		font-size: 16px;
	}

	.favorites-count {
		position: absolute;
		top: -2px;
		right: -2px;
		background: #ff4757;
		color: white;
		font-size: 8px;
		min-width: 14px;
		height: 14px;
		border-radius: 7px;
		padding: 0 3px;
		display: inline-flex !important;
		align-items: center;
		justify-content: center;
		line-height: 1;
	}
	
	.favorites-count:empty {
    display: none !important;
	}
    
    /* Кнопка "Назад" если есть */
    .user-info .bg-picker-btn[onclick*="goBack"] {
        margin-right: 2px;
    }

    
    /* 2. АДМИН-БАР */
    .admin-bar {
        bottom: 8px;
        right: 8px;
        left: 8px;
        width: auto;
        max-width: calc(100vw - 16px);
        border-radius: 25px;
        padding: 8px 12px;
        justify-content: center;
        z-index: 999;
        gap: 8px;
    }
    
    .admin-bar .admin-btn {
        padding: 5px 10px;
        font-size: 11px;
        white-space: nowrap;
    }
    
    body.admin-page .container {
        padding-bottom: 65px;
    }
    
    /* 3. КНОПКИ В ПРОСМОТРЩИКЕ */
    #viewerDownloadBtn, 
    #viewerDeleteBtn, 
    #viewerSettingsBtn, 
	#viewerFullscreenBtn, 
    #viewerFavoriteBtn {
        font-size: 18px !important;
        width: 32px !important;
        height: 32px !important;
        bottom: 10px !important;
    }
    
    /* Компактное расположение */
    #viewerDownloadBtn {
        right: 10px !important;
    }
    
    #viewerDeleteBtn {
        right: 48px !important;
    }
    
    #viewerSettingsBtn {
        right: 86px !important;
    }
    
    #viewerFullscreenBtn {
        right: 124px !important;
    }
    
    #viewerFavoriteBtn {
        right: 162px !important;
    }
    
    /* Для пользователя */
    body.user-page #viewerFavoriteBtn {
        right: 86px !important;
    }
	
    body.user-page #viewerFullscreenBtn {
        right: 48px !important;
    }
    
    body.user-page #viewerDownloadBtn {
        right: 10px !important;
    }
    
    /* Счетчик */
    .viewer-counter {
        bottom: 10px !important;
        font-size: 10px !important;
        padding: 4px 10px !important;
    }
    
    /* Кнопка закрытия */
    .viewer-close {
        top: 10px !important;
        right: 10px !important;
        width: 32px !important;
        height: 32px !important;
        font-size: 20px !important;
    }
    
    /* Кнопки навигации */
    .viewer-nav-btn {
        width: 36px !important;
        height: 36px !important;
        font-size: 22px !important;
    }
    
    .viewer-nav {
        padding: 0 10px !important;
    }
}


/* Скрытые предзагруженные видео (на всякий случай, если попадут в DOM) */
video[data-preload="true"] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
    z-index: -1;
}

