/* Базовые стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-gold: #c9a03d;
    --primary-gold-dark: #8b6914;
    --primary-gold-light: #e6c87a;
    --dark-bg: #0d0b0f;
    --darker-bg: #07060a;
    --card-bg: #16121c;
    --border-color: #2a1f2c;
    --text-primary: #e8e2d4;
    --text-secondary: #a89f91;
    --blood-red: #8b2a2a;
    --blood-red-light: #c44;
    --rune-blue: #2a5f6b;
    --success-green: #4a7c59;
}

body {
    font-family: 'Roboto', sans-serif;
    background: linear-gradient(135deg, var(--dark-bg) 0%, var(--darker-bg) 100%);
    color: var(--text-primary);
    min-height: 100vh;
}

/* Загрузка */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--darker-bg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-gold);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Контейнеры */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Навигация */
.navbar {
    background: linear-gradient(135deg, rgba(22, 18, 28, 0.95), rgba(7, 6, 10, 0.98));
    border-bottom: 2px solid var(--primary-gold);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.logo {
    font-family: 'Cinzel', serif;
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-gold), var(--primary-gold-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.3s;
}

.nav-link:hover {
    color: var(--primary-gold);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Карточки */
.card, .post-card, .feature-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    padding: 20px;
    transition: all 0.3s ease;
}

.post-card {
    margin-bottom: 20px;
    cursor: pointer;
}

.post-card:hover {
    transform: translateY(-3px);
    border-color: var(--primary-gold);
    box-shadow: 0 5px 20px rgba(201, 160, 61, 0.2);
}

.post-title {
    font-family: 'Cinzel', serif;
    font-size: 20px;
    color: var(--primary-gold);
    margin-bottom: 10px;
}

.post-preview {
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 15px 0;
}

.post-image {
    max-width: 100%;
    border-radius: 10px;
    margin: 15px 0;
    cursor: pointer;
}

/* Кнопки */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-family: 'Cinzel', serif;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-gold), var(--primary-gold-dark));
    color: var(--darker-bg);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(201, 160, 61, 0.4);
}

.btn-secondary {
    background: var(--card-bg);
    border: 1px solid var(--primary-gold);
    color: var(--primary-gold);
}

.btn-secondary:hover {
    background: var(--primary-gold);
    color: var(--darker-bg);
}

.btn-block {
    width: 100%;
}

/* Формы */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--primary-gold);
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    background: var(--darker-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: inherit;
    transition: all 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-gold);
    box-shadow: 0 0 10px rgba(201, 160, 61, 0.3);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

/* Аутентификация */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 200px);
    padding: 20px;
}

.auth-card {
    background: var(--card-bg);
    border: 2px solid var(--primary-gold);
    border-radius: 20px;
    padding: 40px;
    max-width: 450px;
    width: 100%;
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-header i {
    font-size: 48px;
    color: var(--primary-gold);
    margin-bottom: 10px;
}

.auth-header h2 {
    font-family: 'Cinzel', serif;
    color: var(--primary-gold);
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.auth-footer a {
    color: var(--primary-gold);
    text-decoration: none;
}

/* Профиль */
.profile-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.profile-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 30px;
    text-align: center;
}

.profile-avatar-wrapper {
    position: relative;
    width: 150px;
    margin: 0 auto 20px;
}

.profile-avatar {
    width: 150px;
    height: 150px;
    background: linear-gradient(135deg, var(--primary-gold), var(--primary-gold-dark));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 60px;
    cursor: pointer;
    transition: transform 0.3s;
}

.profile-avatar:hover {
    transform: scale(1.05);
}

.avatar-edit-btn {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background: var(--primary-gold);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.profile-name {
    font-family: 'Cinzel', serif;
    font-size: 28px;
    margin-bottom: 10px;
}

.admin-name {
    color: #2ecc71 !important;
}

.level-section {
    margin: 20px 0;
}

.level-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 14px;
}

.level-bar {
    background: var(--darker-bg);
    border-radius: 10px;
    height: 20px;
    overflow: hidden;
}

.level-progress {
    background: linear-gradient(90deg, var(--primary-gold), var(--primary-gold-light));
    height: 100%;
    transition: width 0.5s ease;
}

.profile-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.stat {
    text-align: center;
}

.stat i {
    font-size: 24px;
    color: var(--primary-gold);
    margin-bottom: 10px;
}

.stat-value {
    font-size: 24px;
    font-weight: bold;
    margin: 5px 0;
}

.chat-item[draggable="true"] {
    cursor: grab;
}

.chat-item[draggable="true"]:active {
    cursor: grabbing;
}

.pin-icon {
    opacity: 0.3;
    transition: opacity 0.2s;
    font-size: 14px;
}

.pin-icon:hover {
    opacity: 1;
}

.pin-icon.pinned {
    opacity: 1;
    color: #c9a03d;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Чат */
.chat-app {
    display: flex;
    gap: 20px;
    height: calc(100vh - 150px);
    min-height: 500px;
}

.chat-sidebar {
    width: 320px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-search {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    position: relative;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 10;
}


.search-result {
    padding: 10px 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.2s;
}

.search-result:hover {
    background: var(--darker-bg);
}

.chats-list {
    flex: 1;
    overflow-y: auto;
}

.chat-item {
    padding: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background 0.2s;
    border-bottom: 1px solid var(--border-color);
}

.chat-item:hover {
    background: var(--darker-bg);
}

.chat-item.active {
    background: linear-gradient(90deg, rgba(201, 160, 61, 0.1), transparent);
    border-left: 3px solid var(--primary-gold);
}

.chat-avatar {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary-gold), var(--primary-gold-dark));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.chat-info {
    flex: 1;
    min-width: 0;
}

.chat-name {
    font-weight: bold;
    margin-bottom: 5px;
}

.chat-last-msg {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-main {
    flex: 1;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.chat-title {
    font-family: 'Cinzel', serif;
    font-size: 18px;
    color: var(--primary-gold);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.message {
    margin-bottom: 15px;
}

.message.own {
    text-align: right;
}

.message-content {
    display: inline-block;
    max-width: 70%;
    padding: 10px 15px;
    border-radius: 15px;
    background: var(--darker-bg);
    border: 1px solid var(--border-color);
}

.message.own .message-content {
    background: linear-gradient(135deg, var(--primary-gold), var(--primary-gold-dark));
    color: var(--darker-bg);
}

.message-author {
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 5px;
}

.message-time {
    font-size: 10px;
    opacity: 0.6;
    margin-top: 5px;
}

.chat-input-area {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
}

.chat-input-area input {
    flex: 1;
}

/* Админ панель */
.admin-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

.admin-section {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 30px;
}

.admin-section h2 {
    font-family: 'Cinzel', serif;
    color: var(--primary-gold);
    margin-bottom: 20px;
}

.users-list {
    max-height: 500px;
    overflow-y: auto;
}

.user-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
}

.user-item:hover {
    background: var(--darker-bg);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-avatar {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary-gold), var(--primary-gold-dark));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.role-select {
    padding: 8px 15px;
    background: var(--darker-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
}

.stat-card {
    text-align: center;
    padding: 20px;
    background: var(--darker-bg);
    border-radius: 10px;
}

.stat-card .stat-value {
    font-size: 32px;
    font-weight: bold;
    color: var(--primary-gold);
}

/* Герой секция */
.hero-section {
    background: linear-gradient(135deg, rgba(13, 11, 15, 0.9), rgba(7, 6, 10, 0.95));
    padding: 80px 20px;
    text-align: center;
    border-bottom: 1px solid var(--primary-gold);
}

.hero-title {
    font-family: 'Cinzel', serif;
    font-size: 48px;
    background: linear-gradient(135deg, var(--primary-gold), var(--primary-gold-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 20px;
}

.hero-subtitle {
    font-size: 20px;
    color: var(--text-secondary);
    margin-bottom: 30px;
}

.hero-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Особенности */
.features-section {
    padding: 60px 20px;
}

.section-title {
    font-family: 'Cinzel', serif;
    font-size: 32px;
    text-align: center;
    color: var(--primary-gold);
    margin-bottom: 40px;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}

.feature-card {
    text-align: center;
}

.feature-card i {
    font-size: 48px;
    color: var(--primary-gold);
    margin-bottom: 20px;
}

.feature-card h3 {
    margin-bottom: 15px;
}

/* Пустые состояния */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

/* Уведомления */
.notification {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--card-bg);
    border: 1px solid var(--primary-gold);
    padding: 12px 24px;
    border-radius: 30px;
    color: var(--primary-gold);
    z-index: 1100;
    animation: slideUp 0.3s ease;
    white-space: nowrap;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Адаптивность */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .chat-app {
        flex-direction: column;
        height: auto;
    }

    .chat-sidebar {
        width: 100%;
        max-height: 300px;
    }

    .chat-main {
        min-height: 400px;
    }

    .message-content {
        max-width: 85%;
    }

    .hero-title {
        font-size: 32px;
    }

    .hero-subtitle {
        font-size: 16px;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .profile-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .notification {
        white-space: normal;
        text-align: center;
        max-width: 90%;
        font-size: 12px;
    }
}

/* Кастомный скроллбар */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--darker-bg);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-gold);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-gold-light);
}
/* Модальные окна */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: linear-gradient(135deg, var(--card-bg), var(--darker-bg));
    border: 2px solid var(--primary-gold);
    border-radius: 20px;
    padding: 0;
    max-width: 90%;
    width: auto;
    min-width: 300px;
    max-height: 85vh;
    overflow: hidden;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.3);
}

.modal-header h2 {
    font-family: 'Cinzel', serif;
    color: var(--primary-gold);
    font-size: 1.5rem;
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 28px;
    cursor: pointer;
    transition: color 0.3s;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.close-btn:hover {
    color: var(--primary-gold);
    background: rgba(255, 255, 255, 0.1);
}

.modal-body {
    padding: 25px;
    overflow-y: auto;
    max-height: calc(85vh - 70px);
}

/* Анимации */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Стили для плиток постов - ЭТО ГЛАВНОЕ */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 20px;
}

.post-card {
    background: linear-gradient(135deg, #1a1a2e, #0f0f1a);
    border: 1px solid #2a1f2c;
    border-radius: 15px;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.post-card:hover {
    transform: translateY(-5px);
    border-color: #c9a03d;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.post-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.post-content {
    padding: 15px;
    flex: 1;
}

.post-title {
    font-size: 18px;
    margin-bottom: 10px;
    color: #c9a03d;
}

.post-preview {
    font-size: 14px;
    color: #a89f91;
    line-height: 1.5;
    margin-bottom: 15px;
}

.post-stats {
    display: flex;
    gap: 15px;
    padding-top: 10px;
    border-top: 1px solid #2a1f2c;
    font-size: 13px;
    color: #a89f91;
}

/* Адаптив для телефонов */
@media (max-width: 768px) {
    .posts-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}



/* Для планшетов */
@media (max-width: 992px) {
    .posts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Для телефонов */
@media (max-width: 576px) {
    .posts-grid {
        grid-template-columns: 1fr;
    }
}

.post-card {
    background: linear-gradient(135deg, #1a1a2e, #0f0f1a);
    border: 1px solid #2a1f2c;
    border-radius: 15px;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.post-card:hover {
    transform: translateY(-5px);
    border-color: #c9a03d;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.post-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    background: #0f0f1a;
}

.post-content {
    padding: 15px;
    flex: 1;
}

.post-title {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 10px;
    color: #c9a03d;
    line-height: 1.4;
}

.post-preview {
    font-size: 13px;
    color: #a89f91;
    line-height: 1.5;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-stats {
    display: flex;
    gap: 15px;
    padding-top: 10px;
    border-top: 1px solid #2a1f2c;
    font-size: 12px;
    color: #a89f91;
}

.post-author {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.author-avatar-img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.author-name {
    font-size: 13px;
    font-weight: 500;
}


.post-date {
    font-size: 10px;
    color: #6a6f8a;
}
/* Бейджи для ролей */
.role-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: bold;
    margin-left: 8px;
    vertical-align: middle;
}

.role-badge.admin {
    background: #2ecc71;
    color: #0a0a0a;
}

.role-badge.moderator {
    background: #9b59b6;
    color: white;
}

.delete-message-btn {
    opacity: 0;
    transition: opacity 0.2s ease;
}

.message:hover .delete-message-btn {
    opacity: 1;
}

.delete-message-btn:hover {
    color: #ff4444 !important;
}

.moderator-name {
    color: #9b59b6 !important;
}

/* Аватарки в сообщениях чата */
.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.file-download-link:hover {
    color: #ffaa66 !important;
    text-decoration: underline !important;
}
/* Анимация для модального окна с картинкой */
.custom-modal img {
    animation: zoomIn 0.3s ease;
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.image-modal img, .video-modal video {
    animation: zoomIn 0.3s ease;
}
/* Бейдж непрочитанных сообщений */
.unread-badge {
    background: #ff4444;
    color: white;
    border-radius: 20px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: bold;
    min-width: 20px;
    text-align: center;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { transform: translateY(-50%) scale(1); }
    50% { transform: translateY(-50%) scale(1.1); }
    100% { transform: translateY(-50%) scale(1); }
}
