/* Сброс и базовые настройки */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --black: #0a0a0a;
    --black-soft: #141414;
    --green: #a8ff9e;
    --green-bright: #7dff6e;
    --green-soft: rgba(168, 255, 158, 0.15);
    --white: #ffffff;
    --white-soft: rgba(255, 255, 255, 0.1);
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--black);
    color: var(--white);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Анимированные блобы на фоне (для эффекта стекла) */
.bg-blobs {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
    animation: float 15s ease-in-out infinite;
}

.blob-1 {
    width: 500px;
    height: 500px;
    background: var(--green);
    top: -100px;
    left: -100px;
}

.blob-2 {
    width: 400px;
    height: 400px;
    background: var(--green-bright);
    bottom: -50px;
    right: -50px;
    animation-delay: -5s;
    opacity: 0.3;
}

.blob-3 {
    width: 300px;
    height: 300px;
    background: var(--green);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -10s;
    opacity: 0.2;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(50px, -50px) scale(1.1); }
    66% { transform: translate(-30px, 30px) scale(0.9); }
}

/* ===== LIQUID GLASS HEADER ===== */
.glass-header {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 40px);
    max-width: 1200px;
    padding: 14px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;

    /* Эффект жидкого стекла */
    background: rgba(20, 20, 20, 0.4);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 100px;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        inset 0 -1px 0 rgba(168, 255, 158, 0.05);
    
    z-index: 100;
}

/* Логотип */
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    letter-spacing: 2px;
    font-size: 18px;
}

.logo-dot {
    width: 10px;
    height: 10px;
    background: var(--green);
    border-radius: 50%;
    box-shadow: 0 0 15px var(--green);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.85); }
}

.logo-text {
    color: var(--white);
}

/* Навигация */
.nav {
    display: flex;
    gap: 8px;
}

.nav-link {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
}

.nav-link:hover {
    color: var(--green);
    background: var(--green-soft);
}

.nav-link.active {
    color: var(--green);
    background: var(--green-soft);
    box-shadow: inset 0 0 0 1px rgba(168, 255, 158, 0.2);
}

/* Кнопка стеклянная */
.btn-glass {
    padding: 10px 22px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50px;
    color: var(--white);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-glass:hover {
    background: var(--green-soft);
    border-color: var(--green);
    color: var(--green);
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(168, 255, 158, 0.2);
}

/* ===== ОСНОВНОЙ КОНТЕНТ ===== */
main {
    padding-top: 140px;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero {
    text-align: center;
    max-width: 800px;
    padding: 0 20px;
}

.hero-title {
    font-size: clamp(2.5rem, 6vw, 5rem);
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 24px;
    letter-spacing: -2px;
}

.hero-title span {
    background: linear-gradient(135deg, var(--green) 0%, var(--green-bright) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-text {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 40px;
    line-height: 1.6;
}

.hero-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-primary {
    padding: 14px 32px;
    background: var(--green);
    border: none;
    border-radius: 50px;
    color: var(--black);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 25px rgba(168, 255, 158, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 35px rgba(168, 255, 158, 0.6);
}

/* ===== АДАПТИВНОСТЬ ===== */
@media (max-width: 768px) {
    .glass-header {
        padding: 12px 18px;
    }
    
    .nav {
        display: none;
    }
    
    .logo-text {
        font-size: 16px;
    }
}

/* ===== ФОРМЫ ===== */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 120px 20px 40px;
}

.auth-card {
    width: 100%;
    max-width: 450px;
    padding: 40px;
    background: rgba(20, 20, 20, 0.6);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.auth-title {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 8px;
    text-align: center;
}

.auth-subtitle {
    color: rgba(255, 255, 255, 0.6);
    text-align: center;
    margin-bottom: 32px;
    font-size: 0.95rem;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 8px;
    font-weight: 500;
}

.form-input,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: var(--white);
    font-size: 14px;
    font-family: inherit;
    transition: all 0.3s ease;
}

.form-input:focus,
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--green);
    background: rgba(168, 255, 158, 0.05);
    box-shadow: 0 0 0 3px rgba(168, 255, 158, 0.1);
}

.form-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

select option {
    background: var(--black);
    color: var(--white);
}

.form-submit {
    width: 100%;
    padding: 14px;
    background: var(--green);
    border: none;
    border-radius: 12px;
    color: var(--black);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
    box-shadow: 0 5px 20px rgba(168, 255, 158, 0.3);
}

.form-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(168, 255, 158, 0.5);
}

.auth-footer {
    margin-top: 24px;
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
}

.auth-footer a {
    color: var(--green);
    text-decoration: none;
    font-weight: 600;
}

.auth-footer a:hover {
    text-decoration: underline;
}

.errorlist {
    list-style: none;
    color: #ff6b6b;
    font-size: 0.85rem;
    margin-bottom: 12px;
    padding: 10px 14px;
    background: rgba(255, 107, 107, 0.1);
    border-radius: 8px;
    border-left: 3px solid #ff6b6b;
}

.helptext {
    display: block;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 4px;
}

/* Сообщения (messages) */
.messages {
    position: fixed;
    top: 100px;
    right: 20px;
    z-index: 200;
    max-width: 350px;
}

.message {
    padding: 14px 20px;
    margin-bottom: 10px;
    background: rgba(20, 20, 20, 0.9);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(168, 255, 158, 0.3);
    border-radius: 12px;
    color: var(--white);
    font-size: 0.9rem;
    animation: slideIn 0.4s ease;
}

.message.error { border-color: rgba(255, 107, 107, 0.5); }

@keyframes slideIn {
    from { transform: translateX(400px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ===== ПРОФИЛЬ ===== */
.profile-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 140px 20px 40px;
}

.profile-header {
    display: flex;
    gap: 30px;
    padding: 30px;
    background: rgba(20, 20, 20, 0.5);
    backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    margin-bottom: 24px;
}

.profile-avatar {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--green);
    box-shadow: 0 0 30px rgba(168, 255, 158, 0.3);
    flex-shrink: 0;
}

.profile-info { flex: 1; }

.profile-name {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 4px;
}

.profile-role {
    display: inline-block;
    padding: 4px 12px;
    background: var(--green-soft);
    color: var(--green);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.profile-meta {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
    margin-bottom: 12px;
}

.profile-meta span { margin-right: 16px; }

.profile-bio {
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.6;
    margin-top: 12px;
}

.profile-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

@media (max-width: 700px) {
    .profile-header { flex-direction: column; align-items: center; text-align: center; }
}

/* ===== ЛЕНТА ПОСТОВ ===== */
.feed-container {
    max-width: 640px;
    margin: 0 auto;
    padding: 100px 16px 40px;
}

/* Создание поста */
.post-create {
    background: #141414;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 20px;
}

.post-create-header {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.post-avatar-sm {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.post-avatar-placeholder {
    background: var(--green);
    color: var(--black);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
}

.post-create-input {
    flex: 1;
}

.post-textarea {
    width: 100%;
    background: transparent !important;
    border: none !important;
    color: var(--white);
    resize: none;
    font-family: inherit;
    font-size: 15px;
    padding: 8px 0 !important;
    min-height: 50px;
}

.post-textarea:focus {
    outline: none;
    box-shadow: none !important;
    background: transparent !important;
}

.post-create-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.post-image-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(168, 255, 158, 0.08);
    color: var(--green);
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
}

.post-image-btn:hover {
    background: rgba(168, 255, 158, 0.15);
}

#id_image {
    display: none;
}

.post-image-name {
    flex: 1;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.post-submit-btn {
    background: var(--green);
    color: var(--black);
    border: none;
    padding: 9px 20px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.post-submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(168, 255, 158, 0.3);
}

/* Карточка поста */
.posts-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.post-card {
    background: #141414;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 16px;
    transition: border-color 0.2s;
}

.post-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

.post-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.post-author-link {
    display: flex;
    gap: 10px;
    align-items: center;
    text-decoration: none;
    color: inherit;
    flex: 1;
    min-width: 0;
}

.post-author-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--white);
}

.post-date {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 2px;
}

.post-delete-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 20px;
    line-height: 1;
    transition: all 0.2s;
    flex-shrink: 0;
}

.post-delete-btn:hover {
    background: rgba(255, 107, 107, 0.15);
    color: #ff6b6b;
}

.post-body {
    margin-bottom: 12px;
}

.post-text {
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.5;
    font-size: 15px;
    word-wrap: break-word;
    margin-bottom: 12px;
}

.post-image {
    width: 100%;
    border-radius: 12px;
    max-height: 500px;
    object-fit: cover;
    display: block;
}

.post-footer {
    display: flex;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.post-like-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    padding: 8px 14px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.post-like-btn:hover {
    background: rgba(255, 107, 107, 0.1);
    color: #ff6b6b;
}

.post-like-btn.liked {
    color: #ff6b6b;
}

.post-like-btn.liked .like-icon {
    animation: heartPop 0.3s ease;
}

.like-icon {
    font-size: 18px;
    line-height: 1;
}

@keyframes heartPop {
    0% { transform: scale(1); }
    50% { transform: scale(1.4); }
    100% { transform: scale(1); }
}

/* Пустая лента */
.empty-feed {
    text-align: center;
    padding: 60px 20px;
    background: #141414;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
}

.empty-feed p {
    font-size: 18px;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 8px;
}

.empty-feed-sub {
    font-size: 14px !important;
    color: rgba(255, 255, 255, 0.4) !important;
}

/* ===== АДАПТИВНОСТЬ ===== */
@media (max-width: 768px) {
    .feed-container {
        padding: 90px 12px 80px;
    }
    
    .post-create,
    .post-card {
        border-radius: 14px;
        padding: 14px;
    }
    
    .post-avatar-sm {
        width: 38px;
        height: 38px;
    }
    
    .post-author-name {
        font-size: 14px;
    }
    
    .post-text {
        font-size: 14px;
    }
    
    .post-submit-btn {
        padding: 8px 16px;
        font-size: 13px;
    }
    
    .post-image-btn {
        padding: 7px 12px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .feed-container {
        padding: 80px 8px 80px;
    }
    
    .post-create,
    .post-card {
        border-radius: 12px;
        padding: 12px;
    }
    
    .post-create-header {
        gap: 10px;
    }
    
    .post-create-footer {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .post-image-name {
        order: 3;
        flex-basis: 100%;
    }
    
    .post-image-btn span {
        display: none; /* оставляем только иконку */
    }
    
    .post-submit-btn {
        margin-left: auto;
    }
    
    .post-textarea {
        font-size: 14px;
    }
}

/* Адаптивный хедер для мобилок */
@media (max-width: 600px) {
    .glass-header {
        padding: 12px 16px !important;
    }
    
    .nav {
        gap: 12px !important;
    }
    
    .nav-link {
        font-size: 13px !important;
    }
    
    .logo-text {
        font-size: 18px !important;
    }
}

/* ===== HEADER ACTIONS ===== */
.header-actions {
    display: flex;
    align-items: center;
}

.logo {
    text-decoration: none;
    color: inherit;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ===== MESSAGES ===== */
.messages-container {
    position: fixed;
    top: 90px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 360px;
}

.message {
    padding: 14px 20px;
    border-radius: 12px;
    background: rgba(20, 20, 20, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--white);
    font-size: 14px;
    transition: opacity 0.3s ease, transform 0.3s ease;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.message-success {
    border-left: 3px solid var(--green);
}

.message-error {
    border-left: 3px solid #ff6b6b;
}

.message-info {
    border-left: 3px solid #6ba3ff;
}

.message-warning {
    border-left: 3px solid #ffd56b;
}

/* ===== HERO ===== */
.hero {
    max-width: 1200px;
    margin: 0 auto;
    padding: 140px 24px 80px;
}

.hero-content {
    text-align: center;
    margin-bottom: 80px;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(168, 255, 158, 0.08);
    border: 1px solid rgba(168, 255, 158, 0.2);
    border-radius: 100px;
    color: var(--green);
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 24px;
}

.badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 8px var(--green);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.hero-title {
    font-size: 64px;
    font-weight: 800;
    line-height: 1.05;
    margin-bottom: 24px;
    letter-spacing: -0.02em;
    color: var(--white);
}

.hero-accent {
    background: linear-gradient(135deg, var(--green) 0%, #6ba3ff 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: 18px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 40px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.hero-actions {
    display: flex;
    gap: 14px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-primary,
.btn-secondary {
    display: inline-block;
    padding: 14px 28px;
    border-radius: 100px;
    font-weight: 600;
    font-size: 15px;
    text-decoration: none;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

.btn-primary {
    background: var(--green);
    color: var(--black);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(168, 255, 158, 0.35);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--white);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

/* ===== FEATURES ===== */
.features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    max-width: 1000px;
    margin: 0 auto;
}

.feature-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 28px;
    transition: all 0.3s ease;
}

.feature-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(168, 255, 158, 0.2);
    transform: translateY(-4px);
}

.feature-icon {
    font-size: 36px;
    margin-bottom: 16px;
}

.feature-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--white);
    margin-bottom: 8px;
}

.feature-text {
    font-size: 14px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.5);
}

/* ===== АДАПТИВ ДЛЯ ГЛАВНОЙ ===== */
@media (max-width: 900px) {
    .hero-title {
        font-size: 48px;
    }
    
    .features {
        grid-template-columns: 1fr;
        gap: 14px;
    }
}

@media (max-width: 600px) {
    .hero {
        padding: 110px 16px 60px;
    }
    
    .hero-title {
        font-size: 36px;
    }
    
    .hero-subtitle {
        font-size: 15px;
    }
    
    .btn-primary,
    .btn-secondary {
        padding: 12px 22px;
        font-size: 14px;
        width: 100%;
        text-align: center;
    }
    
    .hero-actions {
        flex-direction: column;
        align-items: stretch;
        max-width: 320px;
        margin: 0 auto;
    }
    
    .messages-container {
        top: 80px;
        right: 12px;
        left: 12px;
        max-width: none;
    }
    
    .feature-card {
        padding: 20px;
    }
}

@media (max-width: 600px) {
    .header-actions .btn-glass {
        padding: 8px 14px;
        font-size: 13px;
    }
}

/* ===== INFINITE SCROLL ===== */
#scroll-sentinel {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 30px 0;
    min-height: 80px;
}

.loader {
    display: flex;
    gap: 8px;
}

.loader-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--green);
    animation: loaderBounce 1.4s ease-in-out infinite;
}

.loader-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.loader-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes loaderBounce {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.4;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.feed-end {
    text-align: center;
    padding: 30px 20px;
    color: rgba(255, 255, 255, 0.4);
    font-size: 14px;
}

/* ====== CHAT CONTAINER (КАРКАС) ====== */
.chat-container {
    max-width: 820px;
    margin: 100px auto 24px;
    height: calc(100vh - 140px);
    display: flex;
    flex-direction: column;
    background: rgba(20, 20, 20, 0.55);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

/* === Header === */
.chat-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.02);
    flex-shrink: 0;
}

.chat-back {
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    font-size: 14px;
    padding: 6px 10px;
    border-radius: 8px;
    transition: background 0.2s, color 0.2s;
    flex-shrink: 0;
}
.chat-back:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.chat-peer {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #fff;
    flex: 1;
    min-width: 0;
    padding: 4px 8px;
    border-radius: 10px;
    transition: background 0.2s;
}
.chat-peer:hover {
    background: rgba(255, 255, 255, 0.04);
}

.chat-peer-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid rgba(168, 255, 158, 0.25);
}
.chat-peer-avatar-placeholder {
    background: var(--green);
    color: var(--black);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    border: none;
}

.chat-peer-name {
    font-weight: 600;
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* === Empty state inside chat === */
.chat-empty-small {
    margin: auto;
    text-align: center;
    color: rgba(255, 255, 255, 0.4);
    font-size: 14px;
    padding: 30px;
}

/* === Conversation list (страница /chats/) === */
.chat-list-container {
    max-width: 720px;
    margin: 100px auto 40px;
    padding: 0 20px;
}

.chat-list-title {
    color: #fff;
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 20px;
}

.chat-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-list-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    text-decoration: none;
    color: #fff;
    transition: background 0.2s, border-color 0.2s;
}
.chat-list-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(168, 255, 158, 0.2);
}

.chat-list-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.chat-list-avatar-placeholder {
    background: var(--green);
    color: var(--black);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
}

.chat-list-content {
    flex: 1;
    min-width: 0;
}
.chat-list-name {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 3px;
}
.chat-list-last {
    color: rgba(255, 255, 255, 0.5);
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.chat-list-meta {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    flex-shrink: 0;
}

.chat-empty {
    text-align: center;
    padding: 80px 20px;
    color: rgba(255, 255, 255, 0.5);
}
.chat-empty-sub {
    margin-top: 8px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.4);
}

.chat-encrypted-badge {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(168, 255, 158, 0.12);
    color: var(--green, #a8ff9e);
    border: 1px solid rgba(168, 255, 158, 0.25);
    font-weight: 600;
    letter-spacing: 0.3px;
}

/* === Messages area === */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
    width: 8px;
}
.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}
.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}
.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.chat-msg {
    display: flex;
    max-width: 75%;
    animation: msgFadeIn 0.2s ease-out;
}
@keyframes msgFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.chat-msg-mine {
    align-self: flex-end;
    justify-content: flex-end;
}
.chat-msg-theirs {
    align-self: flex-start;
    justify-content: flex-start;
}

.chat-msg-bubble {
    padding: 10px 14px;
    border-radius: 16px;
    position: relative;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.chat-msg-mine .chat-msg-bubble {
    background: var(--green, #a8ff9e);
    color: #0a0a0a;
    border-bottom-right-radius: 4px;
}

.chat-msg-theirs .chat-msg-bubble {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-bottom-left-radius: 4px;
}

.chat-msg-text {
    font-size: 14.5px;
    line-height: 1.4;
    white-space: pre-wrap;
}

.chat-msg-time {
    font-size: 10.5px;
    margin-top: 4px;
    opacity: 0.6;
    text-align: right;
}
.chat-msg-mine .chat-msg-time {
    color: rgba(0, 0, 0, 0.55);
}
.chat-msg-theirs .chat-msg-time {
    color: rgba(255, 255, 255, 0.45);
}

/* === Compose form === */
.chat-form {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 12px 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.02);
}

.chat-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 10px 14px;
    color: #fff;
    font-size: 14.5px;
    font-family: inherit;
    resize: none;
    outline: none;
    line-height: 1.4;
    max-height: 120px;
    transition: border-color 0.2s, background 0.2s;
}
.chat-input:focus {
    border-color: rgba(168, 255, 158, 0.4);
    background: rgba(255, 255, 255, 0.07);
}
.chat-input::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.chat-send-btn {
    background: var(--green, #a8ff9e);
    color: #0a0a0a;
    border: none;
    padding: 10px 22px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.2s, opacity 0.2s;
    flex-shrink: 0;
}
.chat-send-btn:hover {
    box-shadow: 0 0 14px rgba(168, 255, 158, 0.4);
}
.chat-send-btn:active {
    transform: scale(0.97);
}
.chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* === Responsive === */
@media (max-width: 640px) {
    .chat-container {
        margin-top: 70px;
        height: calc(100vh - 80px);
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
    .chat-list-container {
        margin-top: 80px;
    }
    .chat-msg {
        max-width: 88%;
    }
    .chat-encrypted-badge {
        display: none;
    }
}

.btn-message {
    display: inline-block;
    padding: 10px 20px;
    background: rgba(168, 255, 158, 0.12);
    color: var(--green, #a8ff9e);
    border: 1px solid rgba(168, 255, 158, 0.3);
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: background 0.2s, box-shadow 0.2s;
}
.btn-message:hover {
    background: rgba(168, 255, 158, 0.2);
    box-shadow: 0 0 14px rgba(168, 255, 158, 0.25);
}

/* === User directory === */
.directory-container {
    max-width: 1100px;
    margin: 100px auto 40px;
    padding: 0 20px;
}

.directory-title {
    color: #fff;
    font-size: 28px;
    margin-bottom: 24px;
}

.directory-search {
    display: flex;
    gap: 10px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.directory-search-input,
.directory-search-select {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 10px 14px;
    color: #fff;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s, background 0.2s;
}
.directory-search-input {
    flex: 1;
    min-width: 240px;
}
.directory-search-input:focus,
.directory-search-select:focus {
    border-color: rgba(168, 255, 158, 0.4);
    background: rgba(255, 255, 255, 0.07);
}
.directory-search-input::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.directory-search-btn {
    background: var(--green, #a8ff9e);
    color: #0a0a0a;
    border: none;
    padding: 10px 22px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: box-shadow 0.2s, transform 0.1s;
}
.directory-search-btn:hover {
    box-shadow: 0 0 14px rgba(168, 255, 158, 0.4);
}
.directory-search-btn:active { transform: scale(0.97); }

.directory-clear {
    align-self: center;
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
    font-size: 13px;
    padding: 0 8px;
}
.directory-clear:hover { color: #fff; }

.directory-count {
    color: rgba(255, 255, 255, 0.55);
    font-size: 13px;
    margin-bottom: 18px;
}

.directory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
}

.directory-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 20px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    text-decoration: none;
    color: #fff;
    transition: background 0.2s, border-color 0.2s, transform 0.15s;
}
.directory-card:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(168, 255, 158, 0.3);
    transform: translateY(-2px);
}

.directory-avatar {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 12px;
}
.directory-avatar-placeholder {
    background: var(--green, #a8ff9e);
    color: #0a0a0a;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 28px;
}

.directory-name {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 4px;
    word-break: break-word;
}

.directory-role {
    font-size: 11px;
    color: var(--green, #a8ff9e);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.directory-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
}

.directory-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 30px;
}
.page-link {
    color: var(--green, #a8ff9e);
    text-decoration: none;
    padding: 8px 14px;
    border: 1px solid rgba(168, 255, 158, 0.3);
    border-radius: 8px;
    font-size: 13px;
    transition: background 0.2s;
}
.page-link:hover {
    background: rgba(168, 255, 158, 0.1);
}
.page-current {
    color: rgba(255, 255, 255, 0.6);
    font-size: 13px;
}

.directory-empty {
    text-align: center;
    padding: 60px 20px;
    color: rgba(255, 255, 255, 0.5);
}
.directory-empty-sub {
    margin-top: 8px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.35);
}