/* =============================================
   ===== CHUDOCHAT HOME PERSONAL — вкладка "Для тебя" =====
   =============================================
   Все классы с префиксом .ch-home-*
   Изолировано, не пересекается с сайдбаром и сообщениями.
   ============================================= */

.ch-home-wrap {
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100%;
    max-width: 100%;
}

/* ===== ЗАГОЛОВОК ===== */
.ch-home-hero {
    text-align: left;
    margin-bottom: 4px;
}

.ch-home-hero h1 {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.25;
    color: #e0e0e0;
    margin: 0 0 8px 0;
}

.ch-home-hero h1 span {
    color: #5a7bff;
}

.ch-home-hero p {
    font-size: 15px;
    line-height: 1.5;
    color: #a0a0a0;
    margin: 0;
    max-width: 640px;
}

body.light .ch-home-hero h1 { color: #0f172a; }
body.light .ch-home-hero p  { color: #475569; }

/* ===== СЕТКА ВЕРХНЕГО БЛОКА: hero + 2x2 ===== */
.ch-home-top {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 12px;
    align-items: stretch;
}

.ch-home-top-quad {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 12px;
}

/* ===== СЕТКИ СРЕДНЕГО И НИЖНЕГО РЯДОВ ===== */
.ch-home-row-6 {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
}

.ch-home-row-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

/* ===== ПЛИТКА ===== */
.ch-home-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 8px;
    padding: 12px 10px;
    background: #1c1c24;
    border: 1px solid #2a2a32;
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s, background 0.2s, transform 0.2s;
    min-height: 96px;
    position: relative;
    overflow: hidden;
}

.ch-home-card:hover {
    border-color: #5a7bff;
    background: #24242e;
    transform: translateY(-2px);
}

body.light .ch-home-card {
    background: #ffffff;
    border-color: #e2e8f0;
}
body.light .ch-home-card:hover {
    background: #f8fafc;
    border-color: #046bd2;
}

/* ===== ЛОГО/АВАТАР ===== */
.ch-home-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 17px;
    color: #ffffff;
    text-transform: uppercase;
    flex-shrink: 0;
    overflow: hidden;
    background: #5a7bff;
}

.ch-home-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ch-home-avatar > span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

/* ===== НАЗВАНИЕ ===== */
.ch-home-title {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.25;
    color: #e0e0e0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
    max-width: 100%;
}

body.light .ch-home-title { color: #0f172a; }

/* ===== БОЛЬШАЯ HERO-ПЛИТКА (левый блок) ===== */
.ch-home-card-hero {
    align-items: flex-start;
    text-align: left;
    justify-content: flex-end;
    padding: 20px;
    min-height: 100%;
    background: linear-gradient(135deg, #1a1f3a 0%, #1c1c24 100%);
    border-color: #2a3a5a;
}

.ch-home-card-hero:hover {
    border-color: #5a7bff;
    background: linear-gradient(135deg, #202650 0%, #1c1c24 100%);
}

body.light .ch-home-card-hero {
    background: linear-gradient(135deg, #e8efff 0%, #ffffff 100%);
    border-color: #b9d9f0;
}
body.light .ch-home-card-hero:hover {
    background: linear-gradient(135deg, #dbe7ff 0%, #ffffff 100%);
    border-color: #046bd2;
}

.ch-home-card-hero .ch-home-avatar {
    width: 60px;
    height: 60px;
    font-size: 26px;
    margin-bottom: 4px;
}

.ch-home-card-hero .ch-home-title {
    font-size: 20px;
    font-weight: 700;
    -webkit-line-clamp: 3;
    line-height: 1.2;
}

/* ===== CTA-ПОДВАЛ ===== */
.ch-home-cta {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.ch-home-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 26px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}

.ch-home-btn-primary {
    background: #5a7bff;
    color: #ffffff;
}
.ch-home-btn-primary:hover {
    background: #4a6adf;
    transform: translateY(-1px);
    color: #ffffff;
}

.ch-home-btn-secondary {
    background: transparent;
    color: #5a7bff;
    border: 2px solid #5a7bff;
}
.ch-home-btn-secondary:hover {
    background: rgba(90, 123, 255, 0.1);
    color: #5a7bff;
}

body.light .ch-home-btn-primary { background: #046bd2; }
body.light .ch-home-btn-primary:hover { background: #035aa8; }
body.light .ch-home-btn-secondary {
    color: #046bd2;
    border-color: #046bd2;
}
body.light .ch-home-btn-secondary:hover {
    background: rgba(4, 107, 210, 0.08);
}

/* ===== ПУСТО (если нет чатов) ===== */
.ch-home-empty {
    text-align: center;
    padding: 40px 20px;
    background: #1c1c24;
    border: 1px dashed #2a2a32;
    border-radius: 14px;
    color: #6a6a7a;
    font-size: 14px;
}

body.light .ch-home-empty {
    background: #ffffff;
    border-color: #e2e8f0;
    color: #94a3b8;
}

/* =============================================
   ===== АДАПТАЦИЯ =====
   ============================================= */

/* Планшеты */
@media (max-width: 1100px) {
    .ch-home-row-6 {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 900px) {
    .ch-home-top {
        grid-template-columns: 1fr;
    }
    .ch-home-top-quad {
        grid-template-columns: repeat(4, 1fr);
        grid-template-rows: 1fr;
    }
    .ch-home-row-6 {
        grid-template-columns: repeat(3, 1fr);
    }
    .ch-home-row-4 {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Мобильные */
@media (max-width: 640px) {
    .ch-home-wrap {
        gap: 12px;
    }
    .ch-home-hero h1 {
        font-size: 22px;
    }
    .ch-home-hero p {
        font-size: 13px;
    }
    .ch-home-top-quad {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto;
    }
    .ch-home-row-6,
    .ch-home-row-4 {
        grid-template-columns: 1fr 1fr;
    }
    .ch-home-card {
        min-height: 90px;
        padding: 10px 8px;
    }
    .ch-home-avatar {
        width: 36px;
        height: 36px;
        font-size: 15px;
    }
    .ch-home-title {
        font-size: 12px;
    }
    .ch-home-card-hero {
        padding: 16px;
    }
    .ch-home-card-hero .ch-home-avatar {
        width: 48px;
        height: 48px;
        font-size: 20px;
    }
    .ch-home-card-hero .ch-home-title {
        font-size: 17px;
    }
}

@media (max-width: 420px) {
    .ch-home-row-6,
    .ch-home-row-4,
    .ch-home-top-quad {
        grid-template-columns: 1fr 1fr;
    }
    .ch-home-hero h1 {
        font-size: 19px;
    }
    .ch-home-avatar {
        width: 34px;
        height: 34px;
        font-size: 14px;
    }
    .ch-home-title {
        font-size: 11px;
    }
    .ch-home-btn {
        padding: 10px 20px;
        font-size: 14px;
        width: 100%;
        justify-content: center;
    }
    .ch-home-cta {
        flex-direction: column;
        gap: 8px;
    }
}