/* ===== ПОПАП С ФОТО ===== */

/* Оверлей */
#photoPopupOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
    backdrop-filter: blur(5px);
    cursor: pointer;
}

/* Контент попапа */
.photo-popup-content {
    max-width: 800px;
    width: 100%;
    max-height: 95vh;
    background: var(--bg-card);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.8);
    border: 1px solid var(--border-card);
    cursor: default;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Кнопка закрытия */
.photo-popup-content .close-btn {
    position: absolute;
    top: 12px;
    right: 16px;
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    background: rgba(0,0,0,0.6);
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    border: none;
    z-index: 10;
    line-height: 1;
}
.photo-popup-content .close-btn:hover {
    transform: rotate(90deg);
    background: rgba(0,0,0,0.8);
}

/* Блок с фото */
.photo-popup-content .photo-viewer {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    max-height: 60vh;
    overflow: hidden;
    background: var(--bg-body);
    position: relative;
    flex-shrink: 0;
}
.photo-popup-content .photo-viewer img {
    max-width: 100%;
    max-height: 60vh;
    object-fit: contain;
}

/* ===== СТРЕЛКИ ПО БОКАМ ОТ ФОТО (ВАЖНО!) ===== */
.photo-popup-content .photo-nav {
    position: absolute !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    color: #fff !important;
    font-size: 32px !important;
    cursor: pointer !important;
    background: rgba(0,0,0,0.5) !important;
    border: none !important;
    border-radius: 50% !important;
    width: 44px !important;
    height: 44px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s ease !important;
    z-index: 20 !important;
    user-select: none !important;
    line-height: 1 !important;
    padding: 0 !important;
}
.photo-popup-content .photo-nav:hover {
    background: rgba(0,0,0,0.8) !important;
    transform: translateY(-50%) scale(1.1) !important;
}
.photo-popup-content .photo-nav.prev {
    left: -30px !important;
    right: auto !important;
}
.photo-popup-content .photo-nav.next {
    right: -30px !important;
    left: auto !important;
}

/* Мета-информация */
.photo-popup-content .photo-meta {
    padding: 16px 20px;
    background: var(--bg-card);
    overflow-y: auto;
    border-top: 1px solid var(--border-card);
    flex: 1;
    min-height: 0;
}

.photo-popup-content .photo-author {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 4px;
    color: var(--text-primary);
}
.photo-popup-content .photo-author a {
    color: var(--accent-primary);
    text-decoration: none;
}

.photo-popup-content .photo-date {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 8px;
}

.photo-popup-content .photo-text {
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 12px;
}

.photo-popup-content .photo-actions {
    display: flex;
    gap: 20px;
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 12px;
    align-items: center;
    flex-wrap: wrap;
}
.photo-popup-content .photo-actions .like-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    transition: color 0.2s ease;
    padding: 4px 8px;
    border-radius: 8px;
}
.photo-popup-content .photo-actions .like-btn:hover {
    color: #ff6b6b;
}
.photo-popup-content .photo-actions .photo-counter {
    margin-left: auto;
    font-size: 13px;
    background: var(--bg-input);
    padding: 2px 12px;
    border-radius: 12px;
}

/* Комментарии в попапе */
.photo-popup-content .comments-section {
    border-top: 1px solid var(--border-card);
    padding-top: 12px;
    margin-top: 8px;
    max-height: 200px;
    overflow-y: auto;
}
.photo-popup-content .comment-item {
    padding: 8px 0;
    border-bottom: 1px solid var(--border-card);
}
.photo-popup-content .comment-item:last-child {
    border-bottom: none;
}
.photo-popup-content .comment-author {
    font-weight: 600;
    color: var(--accent-primary);
    font-size: 13px;
}
.photo-popup-content .comment-author a {
    color: var(--accent-primary);
    text-decoration: none;
}
.photo-popup-content .comment-text {
    color: var(--text-primary);
    font-size: 14px;
    margin: 2px 0;
}
.photo-popup-content .comment-date {
    color: var(--text-muted);
    font-size: 11px;
}
.photo-popup-content .no-comments {
    color: var(--text-muted);
    font-size: 14px;
    padding: 8px 0;
}

/* Форма комментария в попапе */
.photo-popup-content .photo-popup-compose {
    flex-shrink: 0;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
    background: var(--bg-card);
    border-top: 1px solid var(--border-card);
}
.photo-popup-content .comment-form {
    display: flex;
    align-items: stretch;
    gap: 8px;
    margin: 0;
    width: 100%;
}
.photo-popup-content .comment-form input {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 44px;
    padding: 8px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-input);
    border-radius: 20px;
    color: var(--text-input);
    font-size: 16px;
    outline: none;
}
.photo-popup-content .comment-form input:focus {
    border-color: var(--accent-primary);
}
.photo-popup-content .comment-form button {
    flex: 0 0 auto;
    min-height: 44px;
    min-width: 96px;
    padding: 0 16px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border: none;
    border-radius: 20px;
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.3s ease;
}
.photo-popup-content .comment-form button:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 20px var(--accent-glow);
}

.photo-popup-content .guest-note {
    background: rgba(124,92,252,0.15);
    border: 1px solid var(--accent-primary);
    border-radius: 12px;
    padding: 12px 16px;
    text-align: center;
    margin-bottom: 12px;
}
.photo-popup-content .guest-note a {
    color: var(--accent-primary);
    font-weight: 600;
    text-decoration: none;
}

/* Адаптив */
@media (max-width: 768px) {
    #photoPopupOverlay {
        padding: 0;
        align-items: stretch;
        height: 100dvh;
        max-height: 100dvh;
    }
    .photo-popup-content {
        max-width: 100%;
        width: 100%;
        height: 100dvh;
        max-height: 100dvh;
        border-radius: 0;
        overflow: hidden;
    }
    .photo-popup-content .photo-viewer {
        min-height: 140px;
        max-height: 36dvh;
        flex-shrink: 0;
    }
    .photo-popup-content .photo-viewer img {
        max-height: 36dvh;
    }
    .photo-popup-content .photo-nav {
        width: 44px !important;
        height: 44px !important;
        font-size: 24px !important;
    }
    .photo-popup-content .photo-nav.prev {
        left: 8px !important;
    }
    .photo-popup-content .photo-nav.next {
        right: 8px !important;
    }
    .photo-popup-content .photo-meta {
        padding: 12px 16px;
    }
}

/* ===== СТРЕЛКИ НАВИГАЦИИ СНАРУЖИ ПОПАПА (photo_popup_ajax) ===== */
.photo-nav-outer {
    position: fixed !important;
    color: #fff !important;
    font-size: 36px !important;
    cursor: pointer !important;
    background: rgba(0,0,0,0.7) !important;
    border: none !important;
    border-radius: 50% !important;
    width: 48px !important;
    height: 48px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 10001 !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5) !important;
    pointer-events: auto !important;
    line-height: 1 !important;
    padding: 0 !important;
    font-weight: 300 !important;
    top: 32% !important;
    transform: translateY(-50%) !important;
}
.photo-nav-outer:hover {
    background: rgba(0,0,0,0.9) !important;
    transform: translateY(-50%) scale(1.1) !important;
}
.photo-nav-outer.prev {
    left: calc(50% - 400px - 60px) !important;
    right: auto !important;
}
.photo-nav-outer.next {
    right: calc(50% - 400px - 60px) !important;
    left: auto !important;
}
@media (max-width: 768px) {
    .photo-nav-outer {
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        min-height: 44px !important;
        font-size: 28px !important;
        top: 35% !important;
    }
    .photo-nav-outer.prev {
        left: 10px !important;
    }
    .photo-nav-outer.next {
        right: 10px !important;
    }
}

[data-theme="light"] #photoPopupOverlay {
    background: rgba(17, 24, 39, 0.52);
}
[data-theme="light"] .photo-popup-content {
    box-shadow: 0 20px 60px rgba(17, 24, 39, 0.18);
    border-color: rgba(0, 0, 0, 0.08);
}
[data-theme="light"] .photo-popup-content .close-btn {
    background: rgba(17, 24, 39, 0.55);
    color: #fff;
}