/* ==================== */
/* VARIABLES & RESET */
/* ==================== */
:root {
    --dark: #000;
    --light: #f8f9fa;
    --grey: #777;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 14px;
}

a {
    color: var(--light);
    text-decoration: none;
    cursor: pointer;
}
a:hover { text-decoration: underline; }

body {
    background-color: var(--dark);
    color: var(--light);
    line-height: 1.6;
}

h1 {
    text-align: center;
    font-size: 25px;
}

/* ==================== */
/* LAYOUT & CONTAINERS */
/* ==================== */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1rem;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* ==================== */
/* HEADER & NAVIGATION */
/* ==================== */
.header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--dark);
    padding: 1rem 0;
    border-bottom: 1px solid var(--grey);
    transition: box-shadow 0.3s ease;
}
.header.scrolled { box-shadow: 0 2px 10px rgba(0,0,0,0.1); }

/* Logo */
.logo {
    font-weight: bold;
    font-size: 1.2rem;
}

/* Burger button */
.burger-btn {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 24px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
}

.burger-btn span {
    display: block;
    width: 100%;
    height: 3px;
    background: var(--light);
    transition: all 0.3s ease;
}

/* Мобильное меню (полный экран) */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: var(--dark);
    z-index: 1005;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.mobile-menu-overlay.active {
    transform: translateX(0);
}

/* Кнопка закрытия */
.close-menu-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    color: var(--light);
    font-size: 2rem;
    cursor: pointer;
    z-index: 1002;
    padding: 10px;
}

/* Контент меню */
.mobile-menu-content {
    padding: 80px 20px 20px;
    height: 100%;
}

/* Пункты меню */
.mobile-menu-content .menu-list {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    list-style: none;
}

/* Адаптация */
@media (max-width: 768px) {
    .burger-btn {
        display: flex;
    }
}

.burger-btn span:nth-child(1) { top: 0; }
.burger-btn span:nth-child(2) { top: 50%; transform: translateY(-50%); }
.burger-btn span:nth-child(3) { bottom: 0; }

/* Header content */
.header-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Menu styles */
.menu-list {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
    justify-content: center;
}
.menu-link {
    color: #fff;
    padding: 5px;
}
.menu-link:hover { text-decoration: underline; }

/* Mobile menu */
.mobile-menu {
    position: fixed;
    top: 60px;
    left: -100%;
    width: 80%;
    height: calc(100vh - 60px);
    background: var(--dark);
    z-index: 999;
    padding: 2rem;
    transition: left 0.3s ease;
    overflow-y: auto;
}
.mobile-menu.active { left: 0; }
.mobile-menu .menu-list {
    flex-direction: column;
    gap: 1rem;
}

/* Desktop menu */
.desktop-menu {
    max-width: 800px;
    margin: 0 auto 40px;
    position: relative;
    top: 30px;
    z-index: 500;
    background: var(--dark);
}

/* ==================== */
/* FORM ELEMENTS */
/* ==================== */
.search-icon {
    background: black;  /* Чёрный фон */
    border: none;       /* Убираем границу */
    border-radius: 50%; /* Круглая форма */
    width: 40px;       /* Размер кнопки */
    height: 40px;
    padding: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    user-select: none;
}

.search-icon svg {
    display: block;     /* Убираем лишние отступы */
}
.search-container {
    display: flex;
    align-items: center;
    max-width: 400px;
    margin: 15px 0;
    /* border-bottom: 1px solid var(--grey); */
}
.search-input {
    flex-grow: 1;
    background: transparent;
    border: none;
    padding: 8px 0;
    color: white;
    font-size: 16px;
    outline: none;
    border-top: 1px solid #000;
    border-right: 1px solid #000;
    border-left: 1px solid #000;
    border-bottom: 1px solid var(--grey);
}
.search-input::placeholder {
    font-size: 12px;
    color: var(--grey);
}
.search-btn {
    background: none;
    border: none;
    color: var(--light);
    font-size: 14px;
    cursor: pointer;
    padding: 0 0 0 8px;
    margin-left: 4px;
}
.search-btn-x {
    display: none;
    font-size: 30px;
}
.search-btn:hover { opacity: 0.8; }
.search-icon,
.search-btn-x {
    display: none;
    stroke: currentColor;
}

/* Add post button */
.add-post-btn,
.add-post-btn-mobile {
    min-width: 50px;
    padding: 10px;
    border: 1px solid var(--light);
    cursor: pointer;
    color: var(--light);
    background: #000;
    transition: all 0.3s ease;
    transform: translateY(0);
    animation: pulse 2s infinite;
    margin-left: 15px;
}
.add-post-btn:hover, .add-post-btn-mobile:hover { transform: translateY(-2px); }
.add-post-btn:active, .add-post-btn-mobile:active { transform: translateY(1px); }
.add-post-btn-mobile {
    display: none;
}

/* Modal form */
.modal {
    display: none;
    position: fixed;
    z-index: 1003;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.8);
    overflow-y: auto;
}
.modal-content {
    background-color: var(--dark);
    border: 1px solid var(--light);
    margin: 5vh auto;
    padding: 2rem;
    width: 90%;
    max-width: 700px;
    position: relative;
}
.close {
    position: absolute;
    right: 1rem;
    top: 1rem;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    color: var(--light);
    user-select: none;
}

/* Form elements */
.form-group {
    margin-bottom: 1.5rem;
}
.form-group label {
    display: block;
    margin-bottom: 0.75rem;
    font-weight: 500;
    font-size: 1.1rem;
}
.form-group select,
.form-group textarea {
    background: var(--dark);
    border: 1px solid var(--light);
    width: 100%;
    padding: 1rem;
    font-size: 1rem;
    color: var(--light);
}
.form-group textarea {
    min-height: 200px;
    resize: vertical;
}
#submit {
    display: block;
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid var(--light);
}
#submit:hover { opacity: 0.9; }
#submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    background-color: var(--grey);
}

/* Form helpers */
.char-counter {
    display: block;
    text-align: right;
    font-size: 0.8rem;
    margin-top: 0.5rem;
    color: #888;
}
.char-counter.warning { color: #ff4444; }
#user-email { display: none !important; }

/* ==================== */
/* CONTENT & POSTS */
/* ==================== */
.post {
    background: var(--dark) !important;
    color: var(--light);
    padding-top: 1.5rem;
    word-wrap: break-word;
}
.post h2 {
    color: var(--light);
    margin-bottom: 0.5rem;
}
.post-meta {
    color: var(--light);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

/* ==================== */
/* UTILITY COMPONENTS */
/* ==================== */
/* Back to top button */
.back-to-top {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 40px;
    height: 40px;
    background: var(--dark);
    border: 1px solid var(--light);
    border-radius: 50%;
    color: white;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.back-to-top.visible {
    opacity: 0.7;
    visibility: visible;
}
.back-to-top:hover { opacity: 1 !important; }

/* Notifications */
.notification-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    z-index: 999;
}
.notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--dark);
    color: var(--light);
    border: 1px solid var(--light);
    padding: 20px 30px;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
    text-align: center;
    max-width: 80%;
    min-width: 300px;
}
.notification.show { opacity: 1; }

/* Loader */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1100;
}
.loader {
    border: 5px solid var(--light);
    border-top: 5px solid var(--grey);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

/* Footer */
.footer {
    background: var(--dark);
    color: var(--grey);
    text-align: center;
    padding: 20px;
    font-size: 12px;
}
.footer a { color: var(--grey); }

/* ==================== */
/* ANIMATIONS */
/* ==================== */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* ==================== */
/* MEDIA QUERIES */
/* ==================== */
@media (max-width: 768px) {
    /* Header */
    .burger-btn { display: flex; }
    .header-content { display: none; }
    .desktop-menu { display: none; }

    /* Burger animation */
    .mobile-menu.active ~ .header-container .burger-btn span:nth-child(1) {
        transform: translateY(9px) rotate(45deg);
    }
    .mobile-menu.active ~ .header-container .burger-btn span:nth-child(2) {
        opacity: 0;
    }
    .mobile-menu.active ~ .header-container .burger-btn span:nth-child(3) {
        transform: translateY(-9px) rotate(-45deg);
    }

    /* Menu */
    .menu-list { flex-direction: column; gap: 5px; }

    /* Modal */
    .modal-content {
        margin: 0;
        width: 100%;
        height: 100%;
        max-width: none;
        padding: 1.5rem;
    }
    .form-group textarea { min-height: 150px; }
    .close { font-size: 2.5rem; right: 1.5rem; top: 0.5rem; }

    .add-post-btn {
        display: none;
    }
    .add-post-btn-mobile {
        display: block;
    }
    .search-icon {
        display: flex;
    }
    .search-input {
        display: none;
    }
}

@media (min-width: 769px) {
    .mobile-menu { display: none; }
}

@media (max-width: 480px) {
    .modal-content { padding: 1rem; }
    .form-group { margin-bottom: 1rem; }
    .form-group select,
    .form-group textarea { padding: 0.75rem; }
}

/* iOS fixes */
@supports (-webkit-touch-callout: none) {
    .header { position: -webkit-sticky; }
}

/* стили для страницы с историей */
/* Стили для контента поста */
.post-content {
    margin: 2rem 0;
    line-height: 1.6;
    white-space: pre-line; /* Сохраняет переносы строк */
}

/* Стили для блока похожих постов */
.similar-title {
    margin: 3rem 0 1rem 0;
    color: #aaa;
    font-size: 1.2rem;
    padding-bottom: 0.5rem;
}

.similar-posts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.similar-post-link {
    display: inline-block;
    margin: 0.3rem;
    padding: 0.5rem 1rem;
    background-color: #222;
    border-radius: 4px;
    color: #ccc;
    text-decoration: none;
    transition: all 0.3s ease;
}

.similar-post-link:hover {
    background-color: #333;
    color: #fff;
}

/* Стили для навигации */
.post-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 3rem;
    padding-top: 1rem;
    border-top: 1px solid #333;
}

.nav-link {
    color: #aaa;
    text-decoration: none;
    transition: color 0.3s ease;
}

.nav-link:hover {
    color: #fff;
}

.nav-link.prev::before {
    content: "← ";
}

.nav-link.next::after {
    content: " →";
}

/* Стили для слайдера */
.post-slider {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    position: relative;
    max-width: 900px;
    margin: 0 auto;
}

.post-content-wrapper {
    flex-grow: 1;
    padding: 0 15px;
}

.slider-arrow {
    position: sticky;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    color: white;
    font-size: 24px;
    text-decoration: none;
    transition: all 0.3s ease;
    z-index: 10;
}

.slider-arrow:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-50%) scale(1.1);
}

.slider-arrow.prev {
    left: 20px;
}

.slider-arrow.next {
    right: 20px;
}

.slider-arrow.disabled {
    visibility: hidden;
}

/* Остальные стили (адаптированные) */
/* Основные стили контейнера */
.post-container {
    display: flex;
    min-height: 80vh;
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
}

/* Стили для навигационных блоков */
.nav-block {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 120px;
    background: rgba(0, 0, 0, 0.3);
    color: #ccc;
    text-decoration: none;
    transition: all 0.3s ease;
    padding: 20px;
    box-sizing: border-box;
    user-select: none;
}

.nav-block:hover {
    background: rgba(33, 33, 33, 0.9);
    color: #fff;
    text-decoration: none;
}

.nav-arrow {
    font-size: 32px;
    margin: 10px 0;
}

.nav-label {
    font-size: 14px;
    text-align: center;
}

/* Стили для контента */
.post-content-wrapper {
    flex-grow: 1;
    padding: 20px;
    max-width: 800px;
    margin: 0 auto;
}

/* Адаптивность */
@media (max-width: 768px) {
    .nav-block {
        width: 80px;
        padding: 10px;
    }
    .nav-arrow {
        font-size: 24px;
    }
    .nav-label {
        font-size: 12px;
    }
}