/* ===== Сброс ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

/* ===== Базовые стили ЛК ===== */
.user-body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: #f0f2f5;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ===== Верхняя белая шапка ===== */
.user-header {
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    position: sticky;
    top: 0;
    z-index: 1020;
    min-height: 56px;
}

.user-header__burger {
    background: none;
    border: none;
    font-size: 1.6rem;
    cursor: pointer;
    display: none;               /* скрыт на десктопе */
    line-height: 1;
    padding: 8px;
    margin: 0 -8px;
}

.user-header__logo {
    font-size: 1.2rem;
    font-weight: 700;
    color: #1b5e20;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-header__info {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 0.95rem;
}

.user-header__logout {
    color: #d32f2f;
    text-decoration: none;
    font-weight: 500;
}

/* ===== Главная обёртка меню + контент ===== */
.user-layout {
    display: flex;
    flex: 1;
    align-items: stretch;
}

/* ===== Боковое меню ===== */
.user-sidebar {
    width: 250px;
    background: #1a1d23;
    color: #b0b8c4;
    flex-shrink: 0;
    transition: left 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.user-sidebar__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-weight: 600;
    font-size: 1.1rem;
    color: #fff;
}

.user-sidebar__close {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    display: none;               /* показываем только на мобильных */
}

.user-sidebar__nav {
    display: flex;
    flex-direction: column;
    padding: 8px 0;
}

.user-sidebar__link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    color: inherit;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
    font-size: 0.95rem;
}

.user-sidebar__link:hover,
.user-sidebar__link.active {
    background: rgba(76, 175, 80, 0.15);
    color: #4caf50;
}

.user-sidebar__icon {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

/* ===== Контент ===== */
.user-main {
    flex: 1;
    padding: 24px;
    overflow-x: auto;
    background: #f0f2f5;
}

.user-content {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
    min-height: 100%;
}

/* ===== Дашборд ===== */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
}

.dash-card {
    background: #f9fafb;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    border: 1px solid #e5e7eb;
}

/* ===== Чат ===== */
.chat-wrapper {
    display: flex;
    gap: 20px;
    height: calc(100vh - 200px);
    min-height: 500px;
}

.chat-contacts {
    width: 280px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    padding: 16px;
    overflow-y: auto;
}

.chat-contacts h3 {
    margin-bottom: 12px;
    font-size: 1rem;
    color: #333;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 10px;
    cursor: pointer;
    margin-bottom: 4px;
    transition: background 0.2s;
}

.contact-item:hover {
    background: #f1f8e9;
}

.contact-item__avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #4caf50;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
    overflow: hidden;
}

.contact-item__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.contact-item__info {
    flex: 1;
    min-width: 0;
}

.contact-item__name {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.contact-item__lastmsg {
    font-size: 0.75rem;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-container {
    flex: 1;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    padding: 16px;
}

.chat-header {
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 10px;
    margin-bottom: 10px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 0 4px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-msg {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    max-width: 70%;
}

.chat-msg--own {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-msg__avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #66bb6a;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
    overflow: hidden;
}

.chat-msg__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-msg--own .chat-msg__avatar {
    background: #388e3c;
}

.chat-msg__content {
    background: #f1f1f1;
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 0.9rem;
    line-height: 1.4;
}

.chat-msg--own .chat-msg__content {
    background: #e8f5e9;
    border: 1px solid #c8e6c9;
}

.chat-msg__time {
    font-size: 0.7rem;
    color: #999;
    margin-top: 4px;
}

.chat-input-area {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.chat-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 0.9rem;
}

button.chat-send {
    border-radius: 20px;
    padding: 10px 20px;
    background: #4caf50;
    color: white;
    border: none;
    font-weight: 600;
    cursor: pointer;
}

button.chat-send:hover {
    background: #388e3c;
}

.contact-list h4 {
    padding-left: 8px;
    margin-top: 8px;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #888;
}

/* ===== Адаптивность ===== */
@media (min-width: 769px) {
    .user-sidebar {
        position: static;        /* в потоке */
    }
}

@media (max-width: 768px) {
    .user-header__burger {
        display: block;          /* показываем бургер в шапке */
    }
    .user-sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        height: 100vh;
        width: 260px;
        z-index: 1030;
        border-radius: 0;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.2);
    }
    .user-sidebar.open {
        left: 0;
    }
    .user-sidebar__close {
        display: block;          /* крестик закрытия */
    }
    .user-main {
        padding: 16px;
    }
    .user-content {
        padding: 16px;
    }
    .chat-wrapper {
        flex-direction: column;
        height: auto;
    }
    .chat-contacts {
        width: 100%;
        max-height: 200px;
    }
}
/* ===== Основная структура ЛК ===== */
.user-dashboard-wrapper {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 20px;
    padding: 20px;
    flex: 1;
}

.user-sidebar {
    width: 250px;
    flex-shrink: 0;
    background: #1a1d23;
    color: #b0b8c4;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.user-content {
    flex: 1;
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.05);
    min-width: 0;
}