@import url('https://fonts.googleapis.com/css2?family=Nunito:ital,wght@0,200..1000;1,200..1000&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Ysabeau+SC:wght@1..1000&display=swap');

/* Общие стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Nunito", sans-serif;
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-elements);
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #ffae5d;
}

:root {
    --bg-dark: #121212;
    --bg-elements: #1e1e1e;
    --bg-elements-light: #2a2a2a;
    --primary: #ff9e44;
    --primary-glow: rgba(255, 158, 68, 0.15);
    --text-primary: #f5f5f5;
    --text-secondary: #aaaaaa;
    --transition: all 0.3s ease;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.5;
    overflow-x: hidden;
}

/* Анимации */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

.animate {
    opacity: 0;
    animation: fadeIn 0.7s ease forwards;
}

.delay-1 { animation-delay: 0.15s; }
.delay-2 { animation-delay: 0.3s; }
.delay-3 { animation-delay: 0.45s; }
.delay-4 { animation-delay: 0.6s; }
.delay-5 { animation-delay: 0.75s; }

/* Шапка */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 5%;
    background-color: var(--bg-elements);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
    letter-spacing: 1px;
    font-family: "Ysabeau SC", sans-serif;
}

.nav-links {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-links a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    padding: 0.5rem 1rem;
    border-radius: 4px;
}

.nav-links a:hover {
    color: var(--primary);
    background: var(--primary-glow);
}

.user-menu {
    position: relative;
    display: inline-block;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
}

.avatar:hover {
    border-color: var(--primary);
    transform: scale(1.05);
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background-color: var(--bg-elements-light);
    width: 200px;
    border-radius: 8px;
    padding: 0.5rem 0;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: var(--transition);
    z-index: 101;
}

.user-menu:hover .dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: var(--transition);
}

.dropdown a:hover {
    background-color: var(--primary-glow);
    color: var(--primary);
}

.dropdown a i {
    width: 20px;
    text-align: center;
}

/* Основной контент */
.main {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem 0.8rem;
}

.photo-viewer {
    max-width: 100%;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    background: var(--bg-elements);
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
    animation: fadeIn 0.7s ease forwards;
    overflow: visible; /* Предотвращаем обрезку модального окна */
}

.image-container {
    width: 100%;
    max-height: 65vh;
    overflow: hidden;
    border-radius: 8px;
    background-color: var(--bg-elements-light);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.25);
    border: 1px solid var(--primary-glow);
}

.main-image {
    width: 100%;
    max-height: 65vh;
    object-fit: contain;
    display: block;
    transition: var(--transition);
}

.main-image:hover {
    transform: scale(1.02);
}

.photo-info {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 0 0.8rem;
}

.author-info {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.author-info .avatar-container {
    position: relative;
    display: inline-block;
    border-radius: 50%;
}

.author-info .avatar-frame {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
}

.author-info .author-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.author-info .avatar-container.online::after {
    content: '';
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 10px;
    height: 10px;
    background: #4CAF50;
    border-radius: 50%;
    border: 1px solid var(--text-primary);
    z-index: 10;
}

.author-info .avatar-container.offline::after {
    content: '';
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 10px;
    height: 10px;
    background: #ccc;
    border-radius: 50%;
    border: 1px solid var(--text-primary);
    z-index: 10;
}

.author-info a {
    color: var(--text-primary);
    text-decoration: none;
    font-size: 1rem;
    font-weight: 600;
    transition: var(--transition);
}

.author-info a:hover {
    color: var(--primary);
}

.user-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.user-badge {
    background: var(--primary);
    color: var(--bg-dark);
    border-radius: 16px;
    padding: 0.4rem 0.8rem;
    font-size: 0.75rem;
    transition: var(--transition);
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(255, 158, 68, 0.3);
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.no-badge {
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-style: italic;
    margin-top: 8px;
}

.photo-comment {
    color: var(--text-primary);
    font-size: 1rem;
    line-height: 1.5;
    padding: 0.4rem 0;
}

.photo-meta {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    flex-wrap: wrap;
    position: relative;
    z-index: 100;
}

.like-button,
.favorite-button,
.share-button,
.download-button,
.delete-button {
    background: var(--bg-elements-light);
    border: none;
    border-radius: 18px;
    padding: 5px 10px;
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
    backdrop-filter: blur(5px);
    transition: var(--transition);
}

.like-button.liked {
    background: var(--primary);
    color: var(--bg-dark);
}

.like-button.liked .heart-icon {
    color: #e0245e;
}

.favorite-button.favorited {
    background: var(--primary);
    color: var(--bg-dark);
}

.like-button:hover,
.favorite-button:hover,
.share-button:hover,
.download-button:hover,
.delete-button:hover {
    background: var(--primary-glow);
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(255, 158, 68, 0.25);
}

.like-button:active,
.favorite-button:active,
.share-button:active,
.download-button:active,
.delete-button:active {
    animation: pulse 0.5s ease;
}

.heart-icon,
.favorite-icon,
.share-icon,
.download-icon,
.delete-icon {
    font-size: 0.95rem;
}

.photo-date {
    color: var(--text-secondary);
    font-size: 0.9rem;
    animation: fadeIn 0.7s ease forwards;
    animation-delay: 0.5s;
    text-align: right;
    margin-left: auto;
}

.photo-navigation {
    display: flex;
    justify-content: center;
    gap: 0.8rem;
    margin-top: 1rem;
    position: relative;
    z-index: 50;
}

.nav-button {
    background: var(--primary);
    border: none;
    border-radius: 18px;
    padding: 0.5rem 1.2rem;
    cursor: pointer;
    color: var(--bg-dark);
    font-size: 0.85rem;
    font-weight: 600;
    transition: var(--transition);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

.nav-button:hover {
    background: #ffae5d;
    transform: translateY(-2px);
    box-shadow: 0 5px 12px rgba(255, 158, 68, 0.25);
}

/* Модальное окно для скачивания */
.download-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000; /* Высокий z-index для модального окна */
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.download-modal.show {
    display: flex;
    opacity: 1;
}

.download-modal__content {
    background: var(--bg-elements);
    border-radius: 12px;
    padding: 1.5rem;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
    animation: fadeIn 0.7s ease forwards;
    position: relative;
}

.download-modal__title {
    font-size: 1.2rem;
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 1rem;
    text-align: center;
}

.download-modal__options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.download-modal__option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 1rem;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    background: var(--bg-elements-light);
    border-radius: 8px;
    transition: var(--transition);
}

.download-modal__option:hover:not(.disabled) {
    background: var(--primary-glow);
    color: var(--primary);
}

.download-modal__option.disabled {
    color: var(--text-secondary);
    cursor: not-allowed;
    opacity: 0.6;
}

.download-modal__option .unavailable {
    color: #ff4444;
    font-size: 0.8rem;
    font-weight: 400;
}

.download-modal__close {
    background: var(--primary);
    border: none;
    border-radius: 18px;
    padding: 0.6rem 1.5rem;
    cursor: pointer;
    color: var(--bg-dark);
    font-size: 0.9rem;
    font-weight: 600;
    transition: var(--transition);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    width: 100%;
}

.download-modal__close:hover {
    background: #ffae5d;
    transform: translateY(-2px);
    box-shadow: 0 5px 12px rgba(255, 158, 68, 0.25);
}

.download-modal__close:active {
    animation: pulse 0.5s ease;
}

/* Комментарии */
.comments-section {
    max-width: 100%;
    padding: 1.5rem;
    background: var(--bg-elements);
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
    animation: fadeIn 0.7s ease forwards;
}

.comments-section__title {
    font-size: 1.4rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-weight: 600;
}

.comment-form {
    margin-bottom: 1.5rem;
}

.comment-form__textarea {
    width: 100%;
    min-height: 100px;
    padding: 0.8rem;
    border-radius: 8px;
    border: 1px solid var(--text-secondary);
    background: var(--bg-elements-light);
    color: var(--text-primary);
    font-size: 0.9rem;
    resize: vertical;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.comment-form__controls {
    display: flex;
    gap: 0.6rem;
    margin-top: 0.8rem;
}

.comment-form__button {
    background: var(--primary);
    border: none;
    padding: 0.6rem 1.5rem;
    border-radius: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    font-size: 0.9rem;
}

.comment-form__button:hover {
    background: #ffae5d;
    transform: translateY(-2px);
    box-shadow: 0 5px 12px rgba(255, 158, 68, 0.25);
}

.comment-login-message,
.verification-message,
.error-message {
    color: var(--text-secondary);
    text-align: center;
    margin: 1rem 0;
    font-size: 0.9rem;
}

.comment-login-message a {
    color: var(--primary);
    text-decoration: none;
}

.comment-login-message a:hover {
    text-decoration: underline;
}

.comment {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding: 1rem;
    background: var(--bg-elements-light);
    border-radius: 8px;
    margin-bottom: 1rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
    animation: fadeIn 0.7s ease forwards;
}

.comment__content {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.comment__user-info {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.comment__user-info .avatar-frame {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
}

.comment__user-info .comment__avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.comment__avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.comment__user a {
    color: var(--text-primary);
    text-decoration: none;
    font-size: 1rem;
    font-weight: 600;
    transition: var(--transition);
}

.comment__user a:hover {
    color: var(--primary);
}

.comment__text {
    color: var(--text-primary);
    font-size: 0.9rem;
    line-height: 1.5;
}

.comment__timestamp {
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-align: right;
    display: inline-block;
    align-self: flex-end;
}

.comment__actions {
    display: flex;
    gap: 0.6rem;
    margin-top: 0.6rem;
}

.comment__edit,
.comment__delete {
    background: var(--bg-elements-light);
    border: none;
    border-radius: 18px;
    padding: 0.6rem 1.2rem;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
    backdrop-filter: blur(5px);
    transition: var(--transition);
}

.comment__edit:hover,
.comment__delete:hover {
    background: var(--primary-glow);
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(255, 158, 68, 0.25);
}

.comment__edit:active,
.comment__delete:active {
    animation: pulse 0.5s ease;
}

.comment.empty {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: var(--bg-elements-light);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-align: center;
    animation: fadeIn 0.7s ease forwards;
}

/* Связанные посты */
.related-posts-section {
    max-width: 100%;
    padding: 1.5rem;
    background: var(--bg-elements);
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
    animation: fadeIn 0.7s ease forwards;
    margin-top: 1.5rem;
}

.related-posts__title {
    font-size: 1.4rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-weight: 600;
}

.related-posts {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.related-post {
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    background-color: var(--bg-elements-light);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    transition: var(--transition);
}

.related-post:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(255, 158, 68, 0.2);
}

.related-post:hover .post-image {
    transform: scale(1.05);
}

.post-image {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    transition: var(--transition);
}

.subscribers-only-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    background: var(--bg-elements-light);
    border-radius: 8px;
}

.subscribers-only-placeholder i {
    font-size: 2rem;
    color: #FFD700;
    margin-bottom: 0.5rem;
}

.subscribers-only-placeholder p {
    font-size: 0.9rem;
    color: var(--text-primary);
}

.subscribers-only {
    position: absolute;
    top: 10px;
    left: 10px;
    color: #FFD700;
    font-size: 1rem;
    background: rgba(0, 0, 0, 0.7);
    padding: 0.2rem;
    border-radius: 50%;
}

.post-author {
    position: absolute;
    bottom: 3px;
    right: 10px;
}

.post-author .author-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--bg-dark);
    object-fit: cover;
}

.related-posts__empty {
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-align: center;
    padding: 1rem;
    background: var(--bg-elements-light);
    border-radius: 8px;
}

/* Подвал */
footer {
    background-color: var(--bg-elements);
    padding: 2rem 5%;
    margin-top: 4rem;
    text-align: center;
}

.copyright {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Адаптивность */
@media (max-width: 992px) {
    .main {
        padding: 1.5rem 0.8rem;
    }

    .photo-viewer {
        padding: 1rem;
    }

    .image-container {
        max-height: 60vh;
    }

    .comments-section {
        padding: 1rem;
    }

    .related-posts-section {
        padding: 1rem;
        margin-top: 1rem;
    }

    .related-posts {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .nav-links a:not(:last-child) {
        display: none;
    }

    .photo-info {
        padding: 0 0.5rem;
    }

    .author-info .avatar-frame,
    .comment__avatar {
        width: 36px;
        height: 36px;
    }

    .author-info .avatar-container.online::after,
    .author-info .avatar-container.offline::after {
        width: 8px;
        height: 8px;
        bottom: 1px;
        right: 1px;
    }

    .user-badges {
        gap: 6px;
        margin-top: 6px;
    }

    .user-badge {
        padding: 3px 6px;
        font-size: 0.75rem;
    }

    .no-badge {
        font-size: 0.75rem;
        margin-top: 6px;
    }

    .author-info a,
    .comment__user a {
        font-size: 0.9rem;
    }

    .photo-meta {
        gap: 0.6rem;
        justify-content: flex-start;
    }

    .like-button,
    .favorite-button,
    .share-button,
    .download-button,
    .delete-button {
        padding: 4px 8px;
        font-size: 0.8rem;
    }

    .heart-icon,
    .favorite-icon,
    .share-icon,
    .download-icon,
    .delete-icon {
        font-size: 0.9rem;
    }

    .photo-date {
        font-size: 0.85rem;
        text-align: center;
        margin-left: 0;
        width: 100%;
    }

    .photo-navigation {
        flex-direction: row;
        gap: 0.6rem;
    }

    .nav-button {
        padding: 0.4rem 1rem;
        font-size: 0.8rem;
    }

    .comment-form__textarea {
        min-height: 90px;
        font-size: 0.85rem;
    }

    .comment__text {
        font-size: 0.85rem;
    }

    .comment__timestamp {
        font-size: 0.75rem;
    }

    .comment__user-info .avatar-frame {
        width: 36px;
        height: 36px;
    }

    .related-posts {
        grid-template-columns: repeat(2, 1fr);
    }

    .related-post .post-author .author-avatar {
        width: 36px;
        height: 36px;
    }

    .download-modal__content {
        padding: 1rem;
        max-width: 350px;
    }

    .download-modal__title {
        font-size: 1.1rem;
    }

    .download-modal__option {
        font-size: 0.85rem;
        padding: 0.6rem 0.8rem;
    }

    .download-modal__option .unavailable {
        font-size: 0.75rem;
    }

    .download-modal__close {
        font-size: 0.85rem;
        padding: 0.5rem 1rem;
    }
}

@media (max-width: 576px) {
    .main {
        padding: 1rem 0.5rem;
    }

    .photo-viewer {
        padding: 0.8rem;
        border-radius: 8px;
    }

    .image-container {
        max-height: 55vh;
    }

    .comments-section {
        padding: 0.8rem;
    }

    .related-posts-section {
        padding: 0.8rem;
        margin-top: 0.8rem;
    }

    .related-posts__title {
        font-size: 1.2rem;
    }

    .related-posts {
        grid-template-columns: 1fr;
    }

    .related-post .post-author .author-avatar {
        width: 32px;
        height: 32px;
    }

    .subscribers-only-placeholder i {
        font-size: 1.8rem;
    }

    .subscribers-only-placeholder p {
        font-size: 0.8rem;
    }

    .subscribers-only {
        font-size: 0.9rem;
    }

    .author-info .avatar-frame,
    .comment__avatar {
        width: 32px;
        height: 32px;
    }

    .author-info .avatar-container.online::after,
    .author-info .avatar-container.offline::after {
        width: 6px;
        height: 6px;
    }

    .user-badges {
        gap: 5px;
        margin-top: 5px;
    }

    .user-badge {
        padding: 2px 5px;
        font-size: 0.7rem;
    }

    .no-badge {
        font-size: 0.7rem;
        margin-top: 5px;
    }

    .author-info a,
    .comment__user a {
        font-size: 0.85rem;
    }

    .photo-comment {
        font-size: 0.9rem;
    }

    .photo-date {
        font-size: 0.8rem;
    }

    .comments-section__title {
        font-size: 1.2rem;
    }

    .comment__user-info .avatar-frame {
        width: 32px;
        height: 32px;
    }

    .like-button,
    .favorite-button,
    .share-button,
    .download-button,
    .delete-button {
        padding: 3px 6px;
        font-size: 0.75rem;
    }

    .heart-icon,
    .favorite-icon,
    .share-icon,
    .download-icon,
    .delete-icon {
        font-size: 0.85rem;
    }

    .nav-button {
        padding: 0.3rem 0.8rem;
        font-size: 0.75rem;
    }

    .download-modal__content {
        padding: 0.8rem;
        max-width: 300px;
    }

    .download-modal__title {
        font-size: 1rem;
    }

    .download-modal__option {
        font-size: 0.8rem;
        padding: 0.5rem 0.6rem;
    }

    .download-modal__option .unavailable {
        font-size: 0.7rem;
    }

    .download-modal__close {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
}