:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --dark: #1f2937;
    --light: #f9fafb;
    --gray: #6b7280;
    --white: #ffffff;
    --border: #e5e7eb;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

/* Login page */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.login-card h1 {
    color: var(--primary);
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.subtitle {
    color: var(--gray);
    margin-bottom: 30px;
}

.input-group {
    margin-bottom: 20px;
}

.input-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}

.btn-login {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-login:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.error-message {
    color: var(--danger);
    margin-top: 15px;
    font-size: 0.875rem;
}

/* Main app layout */
.app-container {
    display: flex;
    min-height: 100vh;
    background: var(--light);
}

.sidebar {
    width: 280px;
    background: white;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.logo {
    padding: 30px 24px;
    border-bottom: 1px solid var(--border);
}

.logo h2 {
    color: var(--primary);
    font-size: 1.5rem;
}

.nav-menu {
    flex: 1;
    padding: 24px;
}

.nav-item {
    display: block;
    padding: 12px 16px;
    margin-bottom: 8px;
    color: var(--dark);
    text-decoration: none;
    border-radius: 12px;
    transition: all 0.3s;
    font-weight: 500;
}

.nav-item:hover {
    background: var(--light);
}

.nav-item.active {
    background: var(--primary);
    color: white;
}

.user-info {
    padding: 20px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar-small {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    background-size: cover;
    background-position: center;
}

.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 30px;
}

.chat-header, .profile-header, .admin-header {
    margin-bottom: 30px;
}

.create-post {
    background: white;
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

.create-post h3 {
    margin-bottom: 16px;
    color: var(--dark);
}

#postText {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    margin-bottom: 16px;
}

.drag-drop-area {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 30px;
    text-align: center;
    background: var(--light);
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 16px;
}

.drag-drop-area.drag-over {
    border-color: var(--primary);
    background: rgba(99,102,241,0.05);
}

.selected-file {
    background: var(--light);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 0.875rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--gray);
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-danger {
    background: var(--danger);
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

.post-card {
    background: white;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    transition: all 0.3s;
}

.post-card:hover {
    box-shadow: var(--shadow-lg);
}

/* Стили для аватаров в постах */
.post-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.post-author-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    background-color: var(--primary);
    flex-shrink: 0;
}

.post-author-info {
    flex: 1;
}

.post-author {
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 4px;
}

.post-dates {
    font-size: 0.75rem;
    color: var(--gray);
}

.post-content {
    margin: 16px 0;
    line-height: 1.6;
}
.preserve-formatting {
  white-space: pre;
}

.post-file {
    background: var(--light);
    padding: 12px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 12px 0;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.post-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.btn-edit, .btn-delete {
    padding: 6px 12px;
    font-size: 0.875rem;
    cursor: pointer;
    border: none;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-edit {
    background: var(--white);
    color: white;
}

.btn-edit:hover {
    background: #d97706;
}

.btn-delete {
    background: var(--white);
    color: white;
}

.btn-delete:hover {
    background: #dc2626;
}

/* Иконки для кнопок (без текста) */
.btn-edit::before {
    content: "✏️";
    font-size: 14px;
}

.btn-delete::before {
    content: "🗑️";
    font-size: 14px;
}

/* Profile styles */
.profile-container {
    background: white;
    border-radius: 16px;
    padding: 30px;
}

.avatar-section {
    text-align: center;
    margin-bottom: 30px;
}

.current-avatar {
    width: 120px;
    height: 120px;
    margin: 0 auto 16px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--light);
}

.current-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.profile-form {
    max-width: 500px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--dark);
}

.form-group input, .form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 1rem;
}

/* Admin styles */
.admin-panel .create-user-section {
    background: white;
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 30px;
}

#createUserForm {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 16px;
}

#createUserForm input {
    flex: 1;
    padding: 10px;
    border: 2px solid var(--border);
    border-radius: 8px;
}

.users-table {
    background: white;
    border-radius: 16px;
    overflow-x: auto;
}

.users-table table {
    width: 100%;
    border-collapse: collapse;
}

.users-table th, .users-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.users-table th {
    background: var(--light);
    font-weight: 600;
}

.user-actions {
    display: flex;
    gap: 8px;
}

.loading {
    text-align: center;
    padding: 40px;
    color: var(--gray);
}

@media (max-width: 768px) {
    .sidebar {
        width: 80px;
    }
    .sidebar .logo h2, .sidebar .user-info span {
        display: none;
    }
    .main-content {
        margin-left: 80px;
    }
    .nav-item {
        text-align: center;
        padding: 12px;
    }
}