@import url('https://fonts.googleapis.com/css2?family=Rye&family=Source+Serif+4:opsz,wght@8..60,400;8..60,600;8..60,700&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Скевоморфизм: дерево / латунь / кожа / пергамент / янтарь пива */
    --primary: #C9971E;        /* латунь — заменяет прежний оранжевый акцент */
    --primary-dark: #8B6914;
    --brass-light: #E8C468;
    --dark: #2E1B10;           /* тёмный орех — заменяет прежний тёмно-синий фон */
    --darker: #6B4226;         /* дуб — панели/карточки вместо прежнего darker-синего */
    --wood-plank: #5A3820;
    --wood-dark: #241408;
    --gray: #9C8564;           /* приглушённый пергамент вместо серого */
    --light: #EDE0C8;          /* пергамент — заменяет прежний светлый текст */
    --white: #FFF8E7;          /* пена/слоновая кость — заменяет чистый белый */
    --leather: #4A2E1C;
    --leather-light: #6B4530;
    --parchment: #EDE0C8;
    --parchment-dark: #D9C89E;
    --amber: #D9992A;
    --amber-dark: #A8681A;
    --ink: #2E1B10;
    --shadow: 0 10px 26px rgba(0,0,0,0.45);
    --radius: 8px;
    --font-display: 'Rye', serif;
    --font-body: 'Source Serif 4', serif;
    --font-mono: 'JetBrains Mono', monospace;
}

body {
    font-family: var(--font-body);
    background:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' seed='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.35'/%3E%3C/svg%3E") repeat,
        radial-gradient(ellipse at 15% 8%, rgba(232,196,104,0.07), transparent 45%),
        radial-gradient(ellipse at 85% 65%, rgba(232,196,104,0.05), transparent 50%),
        linear-gradient(160deg, #01100a 0%, #00150d 100%);
    background-blend-mode: overlay, normal, normal, normal;
    color: var(--white);
    min-height: 100vh;
    padding-top: 70px;
}

/* Процедурная текстура волокна дерева (SVG feTurbulence) — накладывается поверх
   деревянных панелей для убедительной, неповторяющейся зернистости вместо плоских
   градиентных полосок. Используется через фоновое изображение data-URI. */
.wood-grain {
    position: relative;
}
.wood-grain::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.012 0.28' numOctaves='3' seed='7' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.16'/%3E%3C/svg%3E");
    mix-blend-mode: overlay;
    pointer-events: none;
    border-radius: inherit;
}

/* Навигация — латунная рейка на тёмном дубе */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background:
        repeating-linear-gradient(95deg, rgba(0,0,0,0.1) 0px, transparent 2px, transparent 5px),
        linear-gradient(175deg, var(--wood-plank), var(--wood-dark) 140%);
    padding: 0 20px;
    height: 64px;
    display: flex;
    align-items: center;
    box-shadow: 0 4px 14px rgba(0,0,0,0.5), inset 0 -3px 0 var(--primary-dark), inset 0 2px 0 rgba(255,255,255,0.06);
    z-index: 1000;
}

.nav-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.nav-logo {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: normal;
    letter-spacing: 0.02em;
    color: var(--brass-light);
    text-shadow: 0 1px 0 var(--primary-dark), 0 2px 4px rgba(0,0,0,0.6);
    text-decoration: none;
    flex-shrink: 0;
}

.nav-links {
    display: flex;
    gap: 20px;
    align-items: center;
    flex: 1;
}

.nav-links a {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    letter-spacing: 0.03em;
    color: var(--parchment);
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 6px;
    transition: all 0.25s ease;
}

.nav-links a:hover, .nav-links a.active {
    background: linear-gradient(180deg, var(--brass-light), var(--primary) 60%, var(--primary-dark));
    color: #3a2a08;
    box-shadow: inset 0 1px 1px rgba(255,255,255,0.5), 0 2px 6px rgba(0,0,0,0.35);
}

.btn-logout {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 700;
    background: linear-gradient(180deg, #c0392b, #922b21);
    color: var(--parchment);
    border: none;
    padding: 7px 16px;
    border-radius: 6px;
    cursor: pointer;
    box-shadow: 0 3px 0 #6b1e15, inset 0 1px 1px rgba(255,255,255,0.2);
    transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.btn-logout:hover {
    transform: translateY(1px);
    box-shadow: 0 2px 0 #6b1e15, inset 0 1px 1px rgba(255,255,255,0.2);
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--brass-light);
    font-size: 1.8rem;
    cursor: pointer;
    flex-shrink: 0;
}

/* Контейнер */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 30px;
}

.header h1 {
    font-family: var(--font-display);
    font-size: 2.2rem;
    font-weight: normal;
    letter-spacing: 0.02em;
    color: var(--brass-light);
    text-shadow: 0 1px 0 var(--primary-dark), 0 2px 5px rgba(0,0,0,0.55);
}

.header p {
    color: var(--gray);
    opacity: 0.9;
    font-style: italic;
}

/* Кнопки — латунь с механическим откликом при нажатии */
.btn-primary {
    font-family: var(--font-mono);
    font-weight: 700;
    letter-spacing: 0.04em;
    background: linear-gradient(180deg, var(--brass-light), var(--primary) 50%, var(--primary-dark));
    color: #3a2a08;
    border: none;
    padding: 11px 24px;
    border-radius: 6px;
    cursor: pointer;
    box-shadow: 0 5px 0 var(--primary-dark), 0 8px 14px rgba(0,0,0,0.35), inset 0 1px 1px rgba(255,255,255,0.6);
    transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 0 var(--primary-dark), 0 10px 18px rgba(0,0,0,0.4), inset 0 1px 1px rgba(255,255,255,0.6);
}
.btn-primary:active {
    transform: translateY(4px);
    box-shadow: 0 1px 0 var(--primary-dark), 0 2px 6px rgba(0,0,0,0.35), inset 0 1px 1px rgba(255,255,255,0.6);
}

/* Фильтры — врезаны в пергамент */
.filters {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 30px;
}

.filters select, .filters input {
    padding: 10px 15px;
    border-radius: 6px;
    border: 1px solid rgba(0,0,0,0.35);
    background: linear-gradient(180deg, rgba(0,0,0,0.18), rgba(0,0,0,0.05));
    color: var(--parchment);
    font-family: var(--font-body);
    font-size: 1rem;
    flex: 1;
    min-width: 150px;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.4);
}

.filters input::placeholder {
    color: var(--gray);
}

/* Сетка карточек */
.beer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
}

/* Карточка пива — этикетка в деревянной рамке */
.beer-card {
    background: linear-gradient(160deg, var(--wood-plank), var(--wood-dark) 130%);
    border-radius: var(--radius);
    overflow: hidden;
    transition: all 0.25s ease;
    box-shadow: var(--shadow), inset 0 0 0 1px rgba(0,0,0,0.35);
    border: 1px solid rgba(201,151,30,0.15);
    padding: 4px;
    display: flex;
    flex-direction: column;
}

.beer-card:hover {
    transform: translateY(-5px) rotate(-0.3deg);
    box-shadow: 0 16px 34px rgba(0,0,0,0.55), inset 0 0 0 1px rgba(0,0,0,0.35);
    border-color: var(--primary);
}

.beer-card img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
    border-radius: 5px 5px 0 0;
}

.beer-card-content {
    background:
        radial-gradient(circle at 88% 6%, rgba(255,255,255,0.45), transparent 30%),
        linear-gradient(170deg, var(--parchment), var(--parchment-dark));
    border-radius: 0 0 5px 5px;
    padding: 8px 10px 10px;
    display: flex;
    flex-direction: column;
    flex: 1;
    box-shadow: inset 0 2px 5px rgba(255,255,255,0.5);
}

/* Push actions to bottom */
.beer-card .actions {
    margin-top: auto !important;
    padding-top: 6px;
}

.beer-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.beer-card-header h3 {
    font-family: var(--font-display);
    font-weight: normal;
    font-size: 1.05rem;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 130px;
}

.favorite-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    transition: transform 0.2s ease;
    color: #8a7250;
    flex-shrink: 0;
}

.favorite-btn.active {
    color: #c0392b;
    text-shadow: 0 0 14px rgba(192, 57, 43, 0.4);
}

.beer-card .brewery {
    color: #6b5638;
    font-style: italic;
    font-size: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 3px;
}

.beer-card .style-tag {
    display: inline-block;
    background: transparent;
    color: var(--amber-dark);
    border: 1px solid var(--amber-dark);
    padding: 1px 8px;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 0.62rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-weight: 700;
    margin: 3px 0;
}

.beer-card .meta {
    display: flex;
    gap: 8px;
    color: #6b5638;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    margin: 3px 0;
    flex-wrap: wrap;
}

.beer-card .rating {
    color: var(--amber-dark);
    font-weight: bold;
}

.beer-card .description {
    color: #4a3820;
    font-size: 0.78rem;
    margin: 3px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
}

.beer-card .price-location {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #6b5638;
    font-size: 0.75rem;
    margin-top: 5px;
    padding-top: 5px;
    border-top: 1px solid rgba(90,56,32,0.2);
}

.beer-card .price {
    color: #2ecc71;
    font-weight: bold;
    font-size: 0.85rem;
}

.beer-card .actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
    margin-top: 6px;
    align-items: stretch;
}

.beer-card .actions button {
    padding: 5px 4px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: transform 0.15s ease, filter 0.15s ease;
    min-width: 0;
}

/* Кнопка удаления видна только админу — тогда кнопка "Оценить" чуть подвигается
   и уступает место компактной кнопке-корзине сбоку, а не делит ряд поровну */
.beer-card .actions:has(.btn-delete) {
    grid-template-columns: 1fr 40px;
}

.btn-rate {
    background: linear-gradient(180deg, var(--brass-light), var(--primary) 60%, var(--primary-dark));
    color: #3a2a08;
    box-shadow: 0 3px 0 var(--primary-dark), inset 0 1px 1px rgba(255,255,255,0.5);
}

.btn-rate.rated {
    background: linear-gradient(180deg, #4a4436, #322d22 90%);
    color: #9c8564;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.4);
    cursor: not-allowed;
    opacity: 0.85;
}
.btn-rate.rated:hover { transform: none !important; }

.btn-comment {
    background: linear-gradient(180deg, var(--leather-light), var(--leather) 90%);
    color: var(--parchment);
    box-shadow: 0 3px 0 #2e1c11, inset 0 1px 1px rgba(255,255,255,0.15);
}

/* Модалки */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    overflow-y: auto;
}

.modal-content {
    background:
        repeating-linear-gradient(95deg, rgba(0,0,0,0.08) 0px, transparent 2px, transparent 5px),
        linear-gradient(170deg, var(--wood-plank), var(--wood-dark) 130%);
    margin: 40px auto;
    max-width: 600px;
    padding: 30px;
    border-radius: 8px;
    border: 6px solid var(--wood-plank);
    box-shadow: 0 20px 50px rgba(0,0,0,0.55), inset 0 0 0 2px rgba(0,0,0,0.35);
    position: relative;
}

.modal-content .close {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 2rem;
    cursor: pointer;
    color: var(--gray);
    transition: all 0.3s;
}

.modal-content .close:hover {
    color: var(--brass-light);
    transform: rotate(90deg);
}

/* Формы */
form input, form select, form textarea {
    width: 100%;
    padding: 10px 15px;
    margin-bottom: 12px;
    background: linear-gradient(180deg, rgba(0,0,0,0.25), rgba(0,0,0,0.1));
    border: 1px solid rgba(201,151,30,0.3);
    border-radius: 6px;
    color: var(--parchment);
    font-family: var(--font-body);
    font-size: 1rem;
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.45);
}

form input:focus, form select:focus, form textarea:focus {
    outline: none;
    border-color: var(--primary);
}

form textarea {
    min-height: 80px;
    resize: vertical;
}

form button {
    width: 100%;
}

/* Beer detail */
.beer-detail img {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    border-radius: var(--radius);
}

.beer-detail .info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 15px 0;
}

.beer-detail .info-item {
    background: var(--dark);
    padding: 10px;
    border-radius: 6px;
}

.beer-detail .info-item label {
    color: var(--gray);
    font-size: 0.8rem;
}

.beer-detail .info-item span {
    display: block;
    font-weight: bold;
}

/* Комментарии */
.comments-section {
    margin-top: 20px;
}

.comment-item {
    background: var(--dark);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 10px;
}

.comment-item .comment-header {
    display: flex;
    justify-content: space-between;
    color: var(--gray);
    font-size: 0.9rem;
}

.comment-item .comment-username {
    color: var(--primary);
    font-weight: bold;
}

/* Адаптивность */
@media (max-width: 768px) {
    .mobile-menu-btn {
        display: block;
    }

    .nav-links {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 60px;
        left: 0;
        right: 0;
        background: var(--darker);
        padding: 20px;
        gap: 10px;
        border-bottom: 1px solid var(--primary);
        z-index: 2000;
    }

    .nav-links.open {
        display: flex;
    }

    /* Буст/уведомления/аватар остаются на виду и в свёрнутом виде —
       под гамбургер уходят только пункты навигации (Главная/Форум/События/Админ-панель) */
    .nav-right {
        gap: 8px;
    }
    .nav-username { display: none; }

    .header {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    
    .beer-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        margin: 20px;
        padding: 20px;
    }
    
    .beer-detail .info-grid {
        grid-template-columns: 1fr;
    }

    /* Статусы пользователей */
    .user-status {
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
        margin: 8px 0;
    }

    .user-badge {
        display: inline-block;
        padding: 4px 14px;
        border-radius: 20px;
        font-size: 13px;
        font-weight: 600;
    }

    .badge-admin {
        background: var(--primary);
        color: var(--wood-dark);
    }

    .badge-super {
        background: #e74c3c;
        color: white;
        box-shadow: 0 0 20px rgba(231, 76, 60, 0.3);
    }

    .badge-user {
        background: #2c3e50;
        color: #95a5a6;
    }

    .badge-blocked {
        background: #c0392b;
        color: white;
    }

    /* Профиль */
    .profile-stats {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 15px;
        margin: 15px 0;
    }

    .stat-item {
        text-align: center;
        background: var(--darker);
        padding: 12px;
        border-radius: 8px;
    }

    .stat-number {
        display: block;
        font-size: 24px;
        font-weight: bold;
        color: var(--primary);
    }

    .stat-label {
        font-size: 12px;
        color: #95a5a6;
    }
    
    /* Страница избранного */
    .favorites-empty {
        text-align: center;
        padding: 60px 20px;
    }

    .favorites-empty .empty-icon {
        font-size: 64px;
        margin-bottom: 20px;
    }

    .favorites-empty h3 {
        font-size: 24px;
        color: var(--primary);
        margin-bottom: 10px;
    }

    .favorites-empty p {
        color: var(--gray);
        margin-bottom: 20px;
    }

    /* Профиль - секции */
    .profile-section {
        margin-top: 40px;
    }

    .profile-section h2 {
        color: var(--primary);
        margin-bottom: 20px;
        border-bottom: 1px solid rgba(201, 151, 30, 0.2);
        padding-bottom: 10px;
    }

    .empty-state {
        text-align: center;
        color: var(--gray);
        padding: 40px 20px;
        background: var(--darker);
        border-radius: var(--radius);
    }

    /* Анимация удаления из избранного */
    .beer-card.removing {
        opacity: 0;
        transform: scale(0.8);
        transition: all 0.3s ease;
    }

    /* Избранное в профиле */
    .profile-section .beer-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 20px;
    }

    .profile-section .beer-card {
        height: 100%;
        display: flex;
        flex-direction: column;
    }

    .profile-section .beer-card img {
        height: 150px;
        object-fit: cover;
    }

    .profile-section .beer-card-content {
        flex: 1;
        display: flex;
        flex-direction: column;
    }

    .profile-section .beer-card-content .meta {
        margin-top: auto;
    }

    /* Кнопка удаления (только для админов) */
    .btn-delete {
        background: #e74c3c;
        color: white;
        border: none;
        padding: 8px 12px;
        border-radius: 6px;
        cursor: pointer;
        transition: all 0.3s;
        font-weight: 500;
    }

    .btn-delete:hover {
        background: #c0392b;
        transform: scale(1.05);
    }

    /* Галерея фото */
    .photo-gallery {
        margin: 20px 0;
    }

    .main-photo {
        width: 100%;
        max-height: 400px;
        overflow: hidden;
        border-radius: 12px;
        background: var(--wood-dark);
    }

    .main-photo img {
        width: 100%;
        height: 100%;
        max-height: 400px;
        object-fit: contain;
    }

    .photo-thumbnails {
        display: flex;
        gap: 10px;
        margin: 10px 0;
        flex-wrap: wrap;
    }

    .thumbnail {
        width: 80px;
        height: 80px;
        object-fit: cover;
        border-radius: 8px;
        cursor: pointer;
        border: 3px solid transparent;
        transition: all 0.3s;
    }

    .thumbnail:hover {
        transform: scale(1.05);
    }

    .thumbnail.active {
        border-color: var(--primary);
    }

    #upload-photo-btn {
        margin-top: 10px;
    }

    /* Загрузка фото */
    .photo-upload-section {
        margin: 15px 0;
        padding: 15px;
        background: var(--darker);
        border-radius: 8px;
        border: 1px dashed var(--gray);
    }

    .photo-upload-section label {
        display: block;
        color: var(--light);
        margin-bottom: 10px;
        font-weight: 500;
    }

    .photo-upload-section input[type="file"] {
        width: 100%;
        padding: 10px;
        background: var(--dark);
        border: 1px solid var(--gray);
        border-radius: 6px;
        color: white;
        cursor: pointer;
    }

    .photo-upload-section input[type="file"]::file-selector-button {
        padding: 8px 16px;
        background: var(--primary);
        color: var(--dark);
        border: none;
        border-radius: 4px;
        cursor: pointer;
        font-weight: bold;
        margin-right: 10px;
    }

    .photo-upload-section small {
        display: block;
        color: var(--gray);
        font-size: 12px;
        margin-top: 8px;
    }

    .photo-preview {
        display: flex;
        gap: 10px;
        flex-wrap: wrap;
        margin-top: 10px;
    }

    .preview-thumb {
        width: 80px;
        height: 80px;
        object-fit: cover;
        border-radius: 8px;
        border: 2px solid var(--gray);
        transition: all 0.3s;
    }

    .preview-thumb:hover {
        transform: scale(1.05);
        border-color: var(--primary);
    }

    /* Галерея фото */
    .photo-gallery {
        margin: 20px 0;
    }

    .main-photo {
        width: 100%;
        max-height: 400px;
        overflow: hidden;
        border-radius: 12px;
        background: var(--wood-dark);
    }

    .main-photo img {
        width: 100%;
        height: 100%;
        max-height: 400px;
        object-fit: contain;
    }

    .photo-thumbnails {
        display: flex;
        gap: 10px;
        margin: 10px 0;
        flex-wrap: wrap;
    }

    .thumbnail {
        width: 80px;
        height: 80px;
        object-fit: cover;
        border-radius: 8px;
        cursor: pointer;
        border: 3px solid transparent;
        transition: all 0.3s;
    }

    .thumbnail:hover {
        transform: scale(1.05);
    }

    .thumbnail.active {
        border-color: var(--primary);
    }
}

/* ===== BUTTON HOVER ANIMATIONS ===== */
.beer-card .actions button:hover {
    transform: translateY(-2px) scale(1.05);
    filter: brightness(1.18);
}
.beer-card .actions button:active {
    transform: scale(0.95);
    filter: brightness(0.9);
}
.favorite-btn:hover {
    transform: scale(1.25);
    color: #e74c3c;
}
.btn-primary:hover, .btn-logout:hover {
    transform: translateY(-2px);
    filter: brightness(1.12);
    transition: transform 0.15s ease, filter 0.15s ease;
}
.btn-primary, .btn-logout {
    transition: transform 0.15s ease, filter 0.15s ease;
}

/* ===== FORUM REDESIGN ===== */
#topics-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

.topic-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: var(--darker);
    border: 1px solid rgba(201,151,30,0.12);
    border-radius: 10px;
    padding: 14px 18px;
    cursor: pointer;
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.topic-item:hover {
    border-color: var(--primary);
    transform: translateX(4px);
    box-shadow: 0 4px 16px rgba(201,151,30,0.12);
}

.topic-info {
    flex: 1;
    min-width: 0;
}

.topic-info h3 {
    font-size: 1rem;
    color: var(--primary);
    margin: 0 0 4px 0;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topic-excerpt {
    font-size: 0.82rem;
    color: var(--gray);
    margin: 0 0 6px 0;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.topic-meta {
    display: flex;
    gap: 14px;
    font-size: 0.75rem;
    color: #666;
}

.topic-meta span {
    display: flex;
    align-items: center;
    gap: 3px;
}

.topic-open-btn {
    flex-shrink: 0;
    padding: 7px 16px;
    font-size: 0.82rem;
    border-radius: 6px;
    white-space: nowrap;
}

/* Forum topic view (inside modal) */
.topic-header {
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(201,151,30,0.2);
    margin-bottom: 16px;
}

.topic-header h2 {
    color: var(--primary);
    margin: 0 0 6px;
}

.topic-header .topic-meta {
    color: var(--gray);
    font-size: 0.82rem;
}

.topic-content {
    color: var(--light);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-top: 10px;
}

.messages-section h4 {
    color: var(--primary);
    margin: 0 0 12px;
    font-size: 0.95rem;
}

.message-item {
    background: rgba(255,255,255,0.03);
    border-left: 3px solid var(--primary);
    border-radius: 0 8px 8px 0;
    padding: 10px 14px;
    margin-bottom: 8px;
}

.message-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

.message-username {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--primary);
}

.message-date {
    font-size: 0.75rem;
    color: var(--gray);
}

.message-item p {
    font-size: 0.9rem;
    color: var(--light);
    margin: 0;
    line-height: 1.5;
}

.reply-section {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid rgba(255,255,255,0.06);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.reply-section textarea {
    background: var(--dark);
    border: 1px solid rgba(201,151,30,0.2);
    border-radius: 8px;
    color: var(--light);
    padding: 10px 12px;
    font-size: 0.9rem;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s;
}

.reply-section textarea:focus {
    border-color: var(--primary);
}

.reply-section button {
    align-self: flex-end;
    padding: 8px 20px;
}

/* Мобильная адаптация форума — блок специально расположен ПОСЛЕ базовых правил
   выше (.topic-item, .message-header и т.д.), а не в общем @media в начале файла:
   при равной специфичности CSS-селекторов побеждает то, что идёт позже в файле,
   так что более ранний media-блок эти правила бы просто не перебил. */
@media (max-width: 768px) {
    .topic-item {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    .topic-info h3 {
        white-space: normal;
    }
    .topic-item-actions {
        justify-content: stretch;
        flex-wrap: wrap;
    }
    .topic-item-actions .topic-open-btn,
    .topic-item-actions .topic-edit-btn,
    .topic-item-actions .topic-delete-btn {
        flex: 1;
        text-align: center;
    }
    .message-header {
        flex-wrap: wrap;
        gap: 6px;
    }
    .reply-section button {
        align-self: stretch;
    }
}

/* ===== Delete button animations (forum topics & messages) ===== */
.topic-delete-btn {
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease !important;
}
.topic-delete-btn:hover {
    transform: translateY(-2px) !important;
    background: rgba(231,76,60,0.3) !important;
    box-shadow: 0 4px 12px rgba(231,76,60,0.3) !important;
}
.topic-delete-btn:active {
    transform: scale(0.96) !important;
}
.msg-delete-btn {
    transition: transform 0.2s ease, background 0.2s ease !important;
}
.msg-delete-btn:hover {
    transform: translateY(-2px) !important;
    background: rgba(231,76,60,0.25) !important;
    box-shadow: 0 3px 8px rgba(231,76,60,0.2) !important;
}
.msg-delete-btn:active {
    transform: scale(0.96) !important;
}