/* right-sidebar.css — FINAL GRID LAYOUT */

/* --- GENERAL --- */
.rs-header {
    display: flex; align-items: center; justify-content: space-between;
    background: var(--bg-header); border-bottom: 1px solid var(--border-light);
    height: 50px; padding: 0 15px; position: relative; z-index: 20;
}
.rs-tabs { display: flex; gap: 15px; height: 100%; }
.rs-tab {
    height: 100%; display: flex; align-items: center; font-size: 12px; font-weight: 700;
    color: var(--text-secondary); cursor: pointer; border-bottom: 2px solid transparent;
    text-transform: uppercase; letter-spacing: 0.5px; transition: 0.2s;
}
.rs-tab.active { color: var(--accent-blue); border-bottom-color: var(--accent-blue); }

.rs-menu-btn {
    width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
    color: var(--text-secondary); cursor: pointer; border-radius: 50%; transition: 0.2s;
}
.rs-menu-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

.rs-dropdown {
    display: none; position: absolute; top: 45px; right: 10px;
    background: var(--bg-sidebar); border: 1px solid var(--border-light);
    border-radius: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.5); width: 180px; z-index: 1000; padding: 6px 0;
}
.rs-dropdown.show { display: block; animation: fadeIn 0.15s ease-out; }

.rs-dd-item {
    padding: 10px 15px; font-size: 13px; color: var(--text-primary);
    cursor: pointer; display: flex; align-items: center; gap: 10px; transition: 0.1s;
}
.rs-dd-item:hover { background: var(--bg-hover); color: var(--accent-blue); }

.rs-content {
    flex: 1; overflow-y: auto; display: none; background: var(--bg-body); padding: 4px;
}
.rs-content.active { display: flex; flex-direction: column; }
#profiles-list { display: flex; flex-direction: column; gap: 0; }

.profiles-search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    margin: 5px 4px 7px;
    padding: 6px 8px;
    border: 1px solid rgba(71, 85, 105, 0.75);
    border-radius: 6px;
    background: rgba(255,255,255,0.05);
    color: var(--text-secondary);
}

.profiles-search-bar input {
    min-width: 0;
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 650;
}

.profiles-search-bar input::placeholder {
    color: #64748b;
}

.profiles-search-bar:focus-within {
    border-color: var(--accent-blue);
    background: rgba(30, 41, 59, 0.72);
}

.profiles-search-clear {
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 5px;
    background: transparent;
    color: #64748b;
    cursor: pointer;
}

.profiles-search-clear:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.06);
}

.profiles-search-empty {
    padding: 22px 10px;
    text-align: center;
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
}

/* --- BOTS WRAPPER --- */
.profile-wrapper {
    background: transparent;
    border-radius: 8px;
    border: 1px solid transparent; /* Скрытый бордер по умолчанию */
    margin-bottom: 0; 
    transition: all 0.2s;
    overflow: hidden;
}

/* Активный блок (Header + List) обводится целиком */
.profile-wrapper.expanded-wrapper {
    background: var(--bg-sidebar);
    border-color: var(--accent-blue); /* ОБВОДКА ВСЕГО БЛОКА */
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.profile-card {
    display: flex; align-items: center; gap: 10px; padding: 8px 10px;
    cursor: pointer; background: var(--bg-sidebar); border: 1px solid var(--border-light);
    border-radius: 8px; transition: background 0.15s;
    position: relative; z-index: 2;
}
.profile-wrapper.expanded-wrapper .profile-card {
    border-color: transparent; /* Убираем бордер карточки, т.к. есть внешний */
    border-bottom: 1px solid var(--border-light);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    background: #1e293b;
}

.p-avatar { width: 28px; height: 28px; border-radius: 6px; object-fit: cover; }
.p-name { font-weight: 700; font-size: 13px; color: var(--text-primary); }

.profile-details {
    margin-top: 0;
    background: #131c2e;
    padding-bottom: 5px;
}

.controls-row { padding: 8px; display: flex; flex-direction: column; gap: 8px; border-bottom: 1px solid rgba(255,255,255,0.05); margin-bottom: 4px; }
.tabs-local { display: flex; gap: 4px; }
.tab-local {
    font-size: 10px; padding: 4px; border-radius: 4px; cursor: pointer;
    background: rgba(255,255,255,0.05); color: var(--text-secondary); font-weight: 600; flex: 1; text-align: center; border: 1px solid transparent;
}
.tab-local.active { background: var(--accent-blue); color: #0f172a; }
.filters { display: flex; gap: 6px; align-items: center; }
.search-input {
    flex: 1; padding: 4px 8px; border-radius: 4px; border: 1px solid var(--border-light);
    background: rgba(0,0,0,0.2); color: var(--text-primary); font-size: 11px; outline: none;
}
.search-input:focus { border-color: var(--accent-blue); }
.toggle-online { display: flex; align-items: center; gap: 5px; font-size: 10px; cursor: pointer; color: var(--text-secondary); }
.toggle-switch { width: 24px; height: 12px; background: #475569; border-radius: 10px; position: relative; }
.toggle-switch::after { content: ''; position: absolute; width: 10px; height: 10px; background: #FFF; border-radius: 50%; top: 1px; left: 1px; transition: 0.2s; }
.toggle-switch.on { background: var(--accent-blue); }
.toggle-switch.on::after { left: 13px; }

/* --- CLIENT ITEM GRID --- */
.clients-list-container {
    display: flex;
    flex-direction: column;
    padding: 0 4px;
}

.client-item {
    display: grid;
    /* 1. Аватар (28px) 
       2. Имя (1fr - забирает всё место, толкает ID вправо) 
       3. ID (auto) 
       4. Действия (auto) 
       5. Время (auto - всегда в конце) 
    */
    grid-template-columns: 28px 1fr auto auto auto;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 8px;
    margin-bottom: 2px;
    background: #1e293b;
    border-radius: 6px;
    cursor: pointer;
    transition: 0.1s;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.client-item.client-item-unanswered {
    background: rgba(2, 132, 199, 0.12);
    box-shadow: inset 0 0 0 1px rgba(2, 132, 199, 0.55);
}

.client-item:hover {
    background: #334155;
}

.client-item.client-item-unanswered:hover {
    background: rgba(2, 132, 199, 0.18);
}

.ci-avatar-wrap {
    position: relative;
    width: 26px;
    height: 26px;
}

.ci-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.ci-dot {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 6px;
    height: 6px;
    background: #475569;
    border: 1px solid #131c2e;
    border-radius: 50%;
}

.ci-dot.online {
    background: #4CAF50;
}

.ci-name {
    font-weight: 600;
    font-size: 12px;
    color: #f1f5f9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ci-id {
    font-size: 11px;
    color: #94a3b8; /* Светлее чем было */
    font-family: sans-serif;
    white-space: nowrap;
    margin-right: 4px;
}

.ci-unanswered-mark {
    display: inline-block;
    margin-right: 4px;
    color: #38bdf8;
    font-weight: 800;
    line-height: 1;
}

.ci-actions {
    display: flex;
    align-items: center;
    gap: 8px; /* Отступ между иконками */
    justify-content: flex-end;
}

.ci-badge {
    background: var(--accent-blue);
    color: #0f172a;
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700; /* Не такой жирный как было (800) */
    min-width: 16px;
    text-align: center;
    line-height: 1;
}

.ci-icon {
    font-size: 14px; /* Увеличил размер для удобства клика */
    color: #64748b;
    transition: 0.2s;
    cursor: pointer;
}

.ci-icon:hover {
    color: var(--accent-blue);
    transform: scale(1.1);
}

.ci-time {
    font-size: 9px;
    color: #64748b;
    font-weight: 500;
    text-align: right;
    white-space: nowrap;
    min-width: 40px;
}

/* Активная звезда (Saved/Followed) */
.ci-icon.active-star {
    font-weight: 900; /* fa-solid */
    color: #fbbf24;   /* Желтый/Золотой */
}

/* Активное сердце (Liked) */
.ci-icon.active-heart {
    font-weight: 900; /* fa-solid */
    color: #ef4444;   /* Красный */
    animation: heartPop 0.3s ease-out;
}

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

/* History (Old) */
.history-item { background: #1e293b; border: 1px solid var(--border-light); border-radius: 8px; padding: 10px; margin-bottom: 8px; font-size: 12px; }

.vip-online-list {
    height: 100%;
    overflow-y: auto;
    padding: 12px;
}

.vip-empty {
    height: 100%;
    min-height: 220px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-secondary);
    text-align: center;
    font-size: 12px;
}

.vip-empty i {
    font-size: 28px;
    color: #fbbf24;
    opacity: 0.75;
}

.vip-empty span {
    font-size: 11px;
    color: #64748b;
}

.vip-online-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    color: #f8fafc;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.vip-online-head button {
    height: 24px;
    padding: 0 10px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 6px;
    background: rgba(15, 23, 42, 0.8);
    color: #94a3b8;
    font-size: 10px;
    font-weight: 800;
    cursor: pointer;
}

.vip-online-head button:hover {
    color: #f8fafc;
    border-color: rgba(56, 189, 248, 0.45);
}

.vip-online-item {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    padding: 10px;
    margin-bottom: 8px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.82);
    cursor: pointer;
}

.vip-online-item:hover {
    border-color: rgba(251, 191, 36, 0.45);
    background: rgba(30, 41, 59, 0.9);
}

.vip-online-avatar {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    object-fit: cover;
}

.vip-online-main {
    min-width: 0;
}

.vip-online-name {
    color: #f8fafc;
    font-size: 13px;
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vip-online-meta {
    display: flex;
    gap: 8px;
    margin-top: 4px;
    color: #94a3b8;
    font-size: 11px;
    min-width: 0;
}

.vip-online-meta span:first-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vip-online-badge {
    padding: 4px 7px;
    border-radius: 6px;
    background: rgba(251, 191, 36, 0.12);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.22);
    font-size: 10px;
    font-weight: 900;
}
.h-header { display: flex; justify-content: space-between; margin-bottom: 6px; }
.h-bot-info { display: flex; align-items: center; gap: 6px; }
.h-bot-ava { width: 16px; height: 16px; border-radius: 4px; }
.h-bot-name { color: var(--accent-blue); font-weight: 700; font-size: 11px; }
.h-time { color: #cbd5e1; font-size: 10px; font-weight: 650; font-variant-numeric: tabular-nums; }
.h-message { color: var(--text-primary); line-height: 1.3; margin-bottom: 8px; }
.h-client-info { display: flex; align-items: center; justify-content: flex-end; gap: 6px; font-size: 10px; color: var(--text-secondary); border-top: 1px solid rgba(255,255,255,0.05); padding-top: 4px; }
.h-client-ava { width: 14px; height: 14px; border-radius: 50%; }


/* Стабилизация высоты лоадера и пустого списка */
.clients-list-container {
    display: flex;
    flex-direction: column;
    padding: 0 4px;
    min-height: 50px; /* Резервируем место, чтобы не было схлопывания в ноль */
    transition: min-height 0.3s ease;
}

/* Анимация появления каждого клиента внутри списка */
.client-item {
    animation: slideIn 0.2s ease forwards;
}

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

/* =========================================
   DATABASE CARDS (TRASH & BLACKLIST)
   ========================================= */
.db-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-sidebar); 
    border: 1px solid var(--border-light);
    border-radius: 6px;    /* Было 10px, сделали более строгим */
    padding: 8px;          /* Уменьшили паддинг */
    margin-bottom: 6px;    /* Уменьшили расстояние между плашками */
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.db-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3); /* Тень чуть аккуратнее под новый размер */
    border-color: #475569;
}

/* Цветовые акценты (Полоски слева) */
.db-card.trash-card { border-left: 3px solid #ef4444; }
.db-card.blacklist-card { border-left: 3px solid #f59e0b; }

/* Левая часть: Клиент */
.db-card-client {
    display: flex;
    align-items: center;
    gap: 10px; /* Сделали ближе аватарку к тексту */
    cursor: pointer;
    flex: 1;
    min-width: 0; 
}

.db-client-ava {
    width: 32px;  /* Уменьшили аватарку на 25% (было 42px) */
    height: 32px; 
    border-radius: 6px;
    object-fit: cover; 
    border: 1px solid var(--border-light);
    background: #0f172a;
}

.db-client-info {
    display: flex; 
    flex-direction: column; 
    gap: 1px; /* Текст стал плотнее */
    min-width: 0;
}

.db-client-name {
    font-size: 12px; /* Чуть меньше шрифт (было 13px) */
    font-weight: 700; 
    color: var(--text-primary);
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis;
}

.db-client-id {
    font-size: 9px; 
    color: var(--text-muted); 
    font-family: 'Orbitron', monospace;
    letter-spacing: 0.5px;
}

/* Правая часть: Бот и Кнопки */
.db-card-meta {
    display: flex; 
    flex-direction: column; 
    align-items: flex-end; 
    gap: 4px; /* Прижали кнопку ближе к бейджику бота (было 8px) */
    flex-shrink: 0;
}

.db-bot-badge {
    display: flex; 
    align-items: center; 
    gap: 4px;
    background: rgba(0, 0, 0, 0.25); 
    padding: 2px 6px; /* Более узкий бейджик */
    border-radius: 4px; 
    border: 1px solid rgba(255,255,255,0.05);
}

.db-bot-badge img { 
    width: 12px;  /* Было 14px */
    height: 12px; 
    border-radius: 3px; 
    object-fit: cover; 
}

.db-bot-badge span { 
    font-size: 8px; /* Было 9px */
    font-weight: 800; 
    color: var(--text-secondary); 
    text-transform: uppercase; 
}

/* Кнопки действий */
.db-action-btn {
    background: transparent; 
    border: 1px solid; 
    border-radius: 4px;
    padding: 3px 10px; /* Ужали высоту кнопки (было 5px 12px) */
    font-size: 8px;    /* Было 9px */
    font-weight: 800; 
    cursor: pointer;
    display: flex; 
    align-items: center; 
    gap: 4px; 
    transition: all 0.2s;
    letter-spacing: 0.5px;
}

.db-btn-restore { color: #94a3b8; border-color: #475569; }
.db-btn-restore:hover { background: rgba(16, 185, 129, 0.1); color: #10b981; border-color: #10b981; }

.db-btn-unblock { color: #94a3b8; border-color: #475569; }
.db-btn-unblock:hover { background: rgba(245, 158, 11, 0.1); color: #f59e0b; border-color: #f59e0b; }

/* Пагинация и Пустые состояния остались без изменений */
.db-pagination {
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    margin-top: 15px; 
    padding-top: 15px; 
    border-top: 1px solid var(--border-light);
}

.db-page-btn {
    background: var(--bg-hover); 
    border: none; 
    color: #fff;
    border-radius: 6px; 
    padding: 6px 12px; 
    cursor: pointer; 
    transition: 0.2s;
}

.db-page-btn:hover:not(:disabled) { background: var(--accent-blue); color: #0f172a; }
.db-page-btn:disabled { opacity: 0.2; cursor: default; }
.db-page-info { font-size: 11px; color: var(--text-muted); font-weight: 800; }

.db-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}
.db-empty-state i {
    font-size: 30px;
    margin-bottom: 10px;
    opacity: 0.3;
}
.db-empty-state div {
    font-size: 12px;
    font-weight: 600;
}
