/* Luna Social Network - Glassmorphism Dark Theme with Sidebar */

:root {
    --bg-1: #1b1b1e;
    --bg-2: #2a2a2e;
    --bg-3: #3d3d42;
    --glass-bg: rgba(255,255,255,0.06);
    --glass-border: rgba(255,255,255,0.12);
    --text-primary: #f0f0f0;
    --text-secondary: #b0b0b0;
    --accent: #7c6fd7;
    --accent-hover: #9d8fff;
    --danger: #ff4d6d;
    --danger-bg: rgba(255,77,109,0.1);
    --danger-border: rgba(255,77,109,0.5);
    --sidebar-width: 240px;
    --font: 'Inter', sans-serif;
}

* { margin:0; padding:0; box-sizing:border-box; }
a { text-decoration: none; color: inherit; }
a:hover { text-decoration: none; }
body {
    font-family: var(--font);
    min-height:100vh;
    background: linear-gradient(135deg, var(--bg-1), var(--bg-2), var(--bg-3));
    background-size:300% 300%;
    animation: gradientShift 25s ease infinite;
    color:var(--text-primary);
    display: flex;
    margin: 0;
    padding: 0;
}
@keyframes gradientShift {
    0% { background-position:0% 50%; }
    50% { background-position:100% 50%; }
    100% { background-position:0% 50%; }
}

/* Сайдбар */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: rgba(0,0,0,0.35);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-right: 1px solid var(--glass-border);
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    z-index: 1000;
}
.sidebar-brand {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 2rem;
    text-align: center;
}
.sidebar-brand a {
    background: linear-gradient(135deg,#fff,#c0bfff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
}
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 1rem;
    border-radius: 10px;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.95rem;
    transition: background 0.2s, color 0.2s;
    text-decoration: none;
}
.sidebar-nav a:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}
.sidebar-nav a.active {
    background: rgba(124,111,215,0.2);
    border: 1px solid rgba(124,111,215,0.4);
    color: #fff;
}
.sidebar-nav a i {
    width: 20px;
    text-align: center;
    color: var(--accent);
}
.sidebar-nav a.active i {
    color: #fff;
}

/* Основной контент */
.container-page {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 2rem;
    max-width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
    width: 100%;
}

/* Стеклянная панель */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
}

/* Компактная форма нового поста */
.post-compose {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem 1rem;
    border-radius: 20px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    margin-bottom: 1.5rem;
}
.post-compose textarea {
    flex: 1;
    resize: vertical;
    min-height: 40px;
    max-height: 120px;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 1rem;
    line-height: 1.4;
    padding: 0.5rem 0;
    font-family: var(--font);
}
.post-compose textarea::placeholder {
    color: rgba(255,255,255,0.5);
}
.compose-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}
.compose-file-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.1);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
}
.compose-file-btn:hover {
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.3);
}
.compose-file-btn svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.compose-submit-btn {
    height: 40px;
    padding: 0 1.2rem;
    border-radius: 12px;
    border: 1px solid rgba(124,111,215,0.4);
    background: rgba(124,111,215,0.2);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}
.compose-submit-btn:hover {
    background: rgba(124,111,215,0.35);
    border-color: rgba(124,111,215,0.6);
}
.compose-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Формы */
.form-group { margin-bottom: 1.2rem; }
.form-label { display:block; margin-bottom:0.4rem; font-size:0.9rem; color:var(--text-secondary); }
.input-wrapper {
    display:flex;
    align-items:center;
    background:rgba(255,255,255,0.07);
    border:1px solid rgba(255,255,255,0.15);
    border-radius:12px;
    padding:0 0.8rem;
    transition:0.3s;
    width:100%;
}
.input-wrapper:focus-within {
    border-color:var(--accent);
    background:rgba(255,255,255,0.1);
}
.input-wrapper i { color:rgba(255,255,255,0.5); margin-right:0.8rem; font-size:1rem; min-width:20px; text-align:center; }
.input-wrapper input, .input-wrapper select {
    background:transparent;
    border:none;
    outline:none;
    color:var(--text-primary);
    padding:0.8rem 0;
    width:100%;
    font-size:1rem;
}
.input-wrapper input::placeholder { color:rgba(255,255,255,0.4); }
.input-wrapper input[type="date"] { color-scheme: dark; }

/* Кнопки */
.btn {
    display:inline-block;
    width:100%;
    padding:0.8rem 1.2rem;
    border-radius:12px;
    border:1px solid rgba(255,255,255,0.2);
    background:rgba(255,255,255,0.1);
    color:var(--text-primary);
    font-weight:600;
    cursor:pointer;
    font-size:1rem;
    transition:all 0.25s;
    text-align:center;
    margin-bottom:0.5rem;
    text-decoration:none !important;
}
.btn:hover {
    background:rgba(255,255,255,0.2);
    border-color:rgba(255,255,255,0.3);
    transform:translateY(-1px);
    box-shadow:0 6px 15px rgba(0,0,0,0.2);
    text-decoration:none;
}
.btn-primary {
    background:rgba(124,111,215,0.2);
    border-color:rgba(124,111,215,0.4);
}
.btn-primary:hover {
    background:rgba(124,111,215,0.35);
    border-color:rgba(124,111,215,0.6);
}
.btn-secondary {
    background:rgba(255,255,255,0.05);
    border-color:rgba(255,255,255,0.15);
}
.btn-sm {
    padding:0.4rem 0.8rem;
    font-size:0.85rem;
    width:auto;
    margin-bottom:0;
}

/* Ссылки */
.link {
    color:var(--accent);
    font-weight:500;
    transition:color 0.2s;
    text-decoration:none;
}
.link:hover { color:var(--accent-hover); text-decoration:underline; }

/* Алерты */
.alert {
    padding:1rem;
    border-radius:12px;
    margin-bottom:1.2rem;
    font-size:0.9rem;
    border:1px solid;
}
.alert-danger {
    background:rgba(255,100,100,0.15);
    border-color:rgba(255,100,100,0.3);
    color:#ffb3b3;
}
.alert-success {
    background:rgba(100,255,170,0.15);
    border-color:rgba(100,255,170,0.3);
    color:#b3ffd9;
}

/* Таблицы */
.table { width:100%; border-collapse:collapse; margin-bottom:1rem; }
.table th, .table td { text-align:left; padding:0.8rem 1rem; border-bottom:1px solid rgba(255,255,255,0.08); }
.table th { color:var(--text-secondary); font-weight:600; font-size:0.85rem; text-transform:uppercase; }
.table code { background:rgba(255,255,255,0.08); padding:0.2rem 0.5rem; border-radius:6px; }

/* Профиль */
.profile-header {
    display:flex;
    gap:1.5rem;
    align-items:flex-start;
}
.profile-avatar {
    width:120px;
    height:120px;
    border-radius:50%;
    object-fit:cover;
    border:3px solid rgba(255,255,255,0.3);
    box-shadow:0 10px 20px rgba(0,0,0,0.3);
    flex-shrink:0;
}
.profile-info { flex:1; }
.profile-info h2 { margin:0; font-size:1.8rem; }
.profile-username {
    color:var(--accent);
    font-weight:600;
    font-size:1.1rem;
    margin-top:0.2rem;
}
.profile-meta {
    color:var(--text-secondary);
    margin-top:0.8rem;
    font-size:0.95rem;
}
.profile-meta div { margin-bottom:0.3rem; }
.profile-meta i { width:20px; color:var(--accent); margin-right:0.5rem; }

/* Посты */
.post-item {
    padding: 1.2rem 1.4rem;
}
.post-header {
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
    width: 100%;
}
.post-header > a:first-child {
    flex-shrink: 0;
}
.post-author {
    flex: 1;
    min-width: 0;
}
.post-author a {
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.95rem;
    line-height: 1.2;
}
.post-author a:hover {
    color: var(--accent);
    text-decoration: underline;
}
.post-date {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.2rem;
}
.delete-post-btn,
.delete-comment-btn {
    margin-left: auto !important;
    flex-shrink: 0;
    align-self: center;
}
.post-content {
    white-space: pre-line;
    word-break: break-word;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text-primary);
    padding: 0.2rem 0;
}
.post-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
}
.attachment-image {
    max-width: 100%;
    max-height: 300px;
    border-radius: 12px;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.2s;
}
.attachment-image:hover {
    transform: scale(1.02);
}
.post-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}
.post-actions .btn {
    margin-bottom: 0;
}
.like-btn.liked {
    color: var(--danger);
    border-color: var(--danger-border);
    background: var(--danger-bg);
}
.like-btn.liked i {
    color: var(--danger);
}

/* Комментарии */
.comment-item {
    border-bottom: 1px solid rgba(255,255,255,0.08);
    padding: 0.8rem 0;
}
.comment-item:last-child {
    border-bottom: none;
}
.comment-header {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    margin-bottom: 0.4rem;
}
.comment-header > a:first-child {
    flex-shrink: 0;
}
.comment-author {
    flex: 1;
    min-width: 0;
}
.comment-author a {
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.9rem;
}
.comment-author a:hover {
    color: var(--accent);
    text-decoration: underline;
}
.comment-date {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-left: 0.3rem;
}
.comment-content {
    margin: 0.3rem 0 0.3rem 2.2rem;
    white-space: pre-line;
    word-break: break-word;
    font-size: 0.95rem;
    line-height: 1.4;
}
.comment-actions {
    margin-left: 2.2rem;
    display: flex;
    gap: 0.5rem;
    align-items: center;
}
.comments-count {
    font-weight: 600;
}

/* Пагинация */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin: 1.5rem 0;
}
.pagination .btn {
    margin-bottom: 0;
}
.pagination-info {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Прогрессбар */
.upload-progress-item {
    display:flex;
    flex-direction:column;
    gap:0.3rem;
    margin-bottom:0.5rem;
    padding:0.5rem;
    background:rgba(255,255,255,0.05);
    border-radius:8px;
}
.progress-bar {
    width:100%;
    height:8px;
    background:rgba(255,255,255,0.1);
    border-radius:4px;
    overflow:hidden;
}
.progress-bar-fill {
    height:100%;
    background:var(--accent);
    width:0%;
    transition: width 0.3s;
}
.progress-percent {
    font-size:0.8rem;
    color:var(--text-secondary);
}
.attachment-preview {
    display:flex;
    align-items:center;
    gap:0.5rem;
    padding:0.5rem;
    background:rgba(255,255,255,0.05);
    border-radius:8px;
}
.attachment-preview img {
    width:50px;
    height:50px;
    object-fit:cover;
    border-radius:6px;
}
.attachment-preview .file-info {
    font-size:0.85rem;
    flex:1;
}
.attachment-preview .remove-attachment {
    cursor:pointer;
    color:var(--text-secondary);
    background:none;
    border:none;
    font-size:1.2rem;
    transition:color 0.2s;
}
.attachment-preview .remove-attachment:hover {
    color:var(--danger);
}

/* Аватарки */
.avatar-small {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.avatar-xs {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.4);
}

/* Адаптивность */
@media (max-width: 768px) {
    .sidebar {
        width: 60px;
        padding: 1rem 0.5rem;
    }
    .sidebar-brand {
        font-size: 1.2rem;
        margin-bottom: 1.5rem;
    }
    .sidebar-nav a span {
        display: none;
    }
    .sidebar-nav a {
        justify-content: center;
        padding: 0.7rem;
    }
    .sidebar-nav a i {
        margin-right: 0;
    }
    .container-page {
        margin-left: 60px;
        max-width: calc(100% - 60px);
        padding: 1rem;
    }
    .post-compose {
        flex-wrap: wrap;
    }
    .compose-actions {
        width: 100%;
        justify-content: flex-end;
    }
}


/* Тосты */
.toast-container {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.toast {
    background: rgba(30,30,35,0.9);
    backdrop-filter: blur(15px);
    color: var(--text-primary);
    padding: 12px 18px;
    border-radius: 12px;
    border-left: 4px solid var(--accent);
    box-shadow: 0 10px 20px rgba(0,0,0,0.4);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s, transform 0.3s;
    max-width: 350px;
    word-wrap: break-word;
    font-size: 0.95rem;
}
.toast.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Уведомления на странице */
.notification-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.notification-item:last-child {
    border-bottom: none;
}
.notification-item.unread {
    background: rgba(124,111,215,0.05);
}
.notification-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: rgba(124,111,215,0.15);
    color: var(--accent);
    font-size: 1.2rem;
}
.notification-content {
    flex: 1;
    font-size: 0.95rem;
}
.notification-date {
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-top: 0.2rem;
}
.mark-read-btn {
    flex-shrink: 0;
    align-self: center;
}

.notification-item {
    cursor: pointer;
    transition: background 0.2s;
}
.notification-item:hover {
    background: rgba(255,255,255,0.03);
}
.notification-item .mark-read-btn:hover {
    /* чтобы кнопка не меняла курсор */
}