Files
nahodka-front/src/styles/chat.css
2026-10-14 02:06:20 +03:00

428 lines
10 KiB
CSS
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/* ── Chat Page (Instagram Direct style) ── */
.chat-page {
display: flex;
flex-direction: column;
flex: 1;
/* Без min-width:0 flex-элемент не может ужаться ниже своего min-content
(его задаёт .chat-list с max-width:560px). На узком экране страница
становилась шире вьюпорта, и кнопка удаления уезжала за правый край. */
min-width: 0;
height: 100vh; height: 100dvh;
background: var(--bg-app);
}
/* Открытый чат: картинка-обои на всю страницу */
.chat-page--open {
background-color: #EAF1E1;
background-image: url('../assets/chat-bg-light.svg');
background-repeat: no-repeat;
background-size: cover;
background-position: center;
}
[data-theme="dark"] .chat-page--open {
background-color: #0F1A26;
background-image: url('../assets/chat-bg-dark.svg');
}
/* Шапка открытого чата — «стекло» поверх ленты (как .f-topbar в MainFeed):
сообщения прокручиваются под ней и видны сквозь лёгкое размытие. */
.chat-page--open { position: relative; }
.chat-page--open .chat-header {
position: absolute;
top: 0;
left: 0;
right: 0;
z-index: 10;
border-bottom: none;
background: transparent;
}
/* Стекло вынесено в псевдоэлемент: он чуть ниже шапки, а маска плавно
гасит и размытие, и подложку к низу — резкой границы не видно. */
.chat-page--open .chat-header::before {
content: "";
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: -24px;
z-index: -1;
pointer-events: none;
background: linear-gradient(
to bottom,
rgba(var(--bg-rgb), 0.09) 0%,
rgba(var(--bg-rgb), 0.045) 55%,
rgba(var(--bg-rgb), 0) 100%
);
-webkit-backdrop-filter: blur(2px) saturate(105%);
backdrop-filter: blur(2px) saturate(105%);
-webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 55%, transparent 100%);
mask-image: linear-gradient(to bottom, #000 0%, #000 55%, transparent 100%);
}
.chat-page--open .chat-messages {
padding-top: calc(var(--chat-header-height, 68px) + 20px);
}
.chat-page--open .chat-messages {
padding-bottom: calc(var(--chat-input-height, 72px) + 20px);
}
/* Поле ввода — такое же «стекло» поверх ленты, зеркально шапке:
слой выходит на 24px вверх и плавно гаснет кверху. */
.chat-page--open .chat-input-area {
position: absolute;
left: 0;
right: 0;
bottom: 0;
z-index: 10;
/* Поле ввода теперь у самого низа страницы — отступ под «домашнюю
полоску» iPhone даём ему, а не .chat-page (см. ниже). */
padding-bottom: env(safe-area-inset-bottom);
}
.chat-page.chat-page--open { padding-bottom: 0; }
.chat-page--open .chat-input-area::before {
content: "";
position: absolute;
top: -24px;
left: 0;
right: 0;
bottom: 0;
z-index: -1;
pointer-events: none;
background: linear-gradient(
to top,
rgba(var(--bg-rgb), 0.09) 0%,
rgba(var(--bg-rgb), 0.045) 55%,
rgba(var(--bg-rgb), 0) 100%
);
-webkit-backdrop-filter: blur(2px) saturate(105%);
backdrop-filter: blur(2px) saturate(105%);
-webkit-mask-image: linear-gradient(to top, #000 0%, #000 55%, transparent 100%);
mask-image: linear-gradient(to top, #000 0%, #000 55%, transparent 100%);
}
.chat-page--open .chat-input-row { border-top: none; }
/* Header */
.chat-header {
display: flex;
align-items: center;
gap: 14px;
padding: 12px 18px;
border-bottom: 1px solid var(--border);
background: transparent;
}
.chat-back-btn {
background: none;
border: 1px solid var(--border);
border-radius: 10px;
color: var(--muted);
font-size: 1.2rem;
cursor: pointer;
padding: 6px 12px;
transition: background .15s, color .15s;
}
.chat-back-btn:hover {
background: var(--hover-bg);
color: var(--text-primary);
}
.chat-header-title {
flex: 1;
color: var(--text-primary);
font-weight: 800;
font-size: 1rem;
}
.chat-header-avatar {
width: 36px;
height: 36px;
border-radius: 50%;
background: var(--bg-input);
border: 2px solid var(--border);
display: flex;
align-items: center;
justify-content: center;
font-size: 1.1rem;
flex-shrink: 0;
overflow: hidden;
}
.chat-header-avatar-img {
width: 100%;
height: 100%;
object-fit: cover;
border-radius: 50%;
}
/* Messages area */
.chat-messages {
flex: 1;
overflow-y: auto;
overscroll-behavior: contain;
padding: 20px;
display: flex;
flex-direction: column;
gap: 8px;
background: transparent;
}
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--muted2); border-radius: 2px; }
.chat-empty {
text-align: center;
color: var(--muted);
font-size: .9rem;
padding: 40px 0;
}
.chat-empty-full {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
color: var(--muted);
font-size: .95rem;
}
/* Bubbles */
.chat-bubble {
max-width: 70%;
padding: 10px 14px;
border-radius: 18px;
font-size: .92rem;
line-height: 1.45;
align-self: flex-start;
background: var(--bg-surface-solid);
border: 1px solid var(--border);
color: var(--text-primary);
word-break: break-word;
}
.chat-bubble.mine {
align-self: flex-end;
background: #3797f0;
border-color: #3797f0;
color: #fff;
}
.chat-bubble-time {
display: block;
margin-top: 4px;
font-size: .68rem;
line-height: 1;
text-align: right;
opacity: .6;
white-space: nowrap;
}
/* Input row */
.chat-input-row {
display: flex;
gap: 8px;
padding: 14px 16px;
border-top: 1px solid var(--border);
background: transparent;
}
.chat-input {
flex: 1;
padding: 12px 18px;
border-radius: 999px;
border: 1px solid var(--border);
background: var(--bg-input);
color: var(--text-primary);
font-family: var(--font);
font-size: .9rem;
outline: none;
transition: border-color .2s, box-shadow .2s;
}
.chat-input::placeholder { color: var(--muted); }
.chat-input:focus { border-color: rgba(var(--teal-rgb), .5); box-shadow: 0 0 0 3px rgba(var(--teal-rgb), .12); }
.chat-send-btn {
padding: 0 20px;
border-radius: 999px;
border: none;
background: var(--teal);
color: #fff;
cursor: pointer;
font-size: 1rem;
font-weight: 900;
transition: background .2s, opacity .2s;
}
.chat-send-btn:hover:not(:disabled) { background: var(--teal2); }
.chat-send-btn:disabled { opacity: .4; cursor: default; }
.chat-input-area {
position: relative;
margin-bottom: 14px;
}
/* ── Chat List ── */
.chat-list {
flex: 1;
overflow-y: auto;
overscroll-behavior: contain;
padding: 8px;
max-width: 560px;
width: 100%;
margin: 0 auto;
}
.chat-list::-webkit-scrollbar { width: 4px; }
.chat-list::-webkit-scrollbar-thumb { background: var(--muted2); border-radius: 2px; }
.chat-list-item {
display: flex;
align-items: center;
gap: 14px;
padding: 12px 16px;
border-radius: 14px;
cursor: pointer;
transition: background .15s;
}
.chat-list-item:hover {
background: var(--hover-bg);
}
.chat-list-avatar {
width: 44px;
height: 44px;
border-radius: 50%;
background: var(--bg-input);
border: 2px solid var(--border);
display: flex;
align-items: center;
justify-content: center;
font-size: 1.15rem;
font-weight: 800;
color: var(--muted);
flex-shrink: 0;
overflow: hidden;
}
.chat-list-avatar-img {
width: 100%;
height: 100%;
object-fit: cover;
border-radius: 50%;
}
.chat-list-info {
flex: 1;
min-width: 0;
}
.chat-list-item.unread .chat-list-name {
font-weight: 800;
}
.chat-list-item.unread .chat-list-preview {
color: var(--text-primary);
font-weight: 700;
}
.chat-list-name {
color: var(--text-primary);
font-weight: 700;
font-size: .9rem;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.chat-list-preview {
color: var(--muted);
font-size: .78rem;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
margin-top: 3px;
}
/* ── Unread Badge ── */
.chat-list-unread-badge {
background: #ff3040;
color: #fff;
font-size: .7rem;
font-weight: 800;
min-width: 20px;
height: 20px;
border-radius: 10px;
display: flex;
align-items: center;
justify-content: center;
padding: 0 6px;
flex-shrink: 0;
}
/* ── Sidebar Unread Badge ── */
.f-sb-unread-badge {
background: #ff3040;
color: #fff;
font-size: .65rem;
font-weight: 800;
min-width: 18px;
height: 18px;
border-radius: 9px;
display: inline-flex;
align-items: center;
justify-content: center;
padding: 0 5px;
margin-left: auto;
}
/* ── Contact Button on Card ── */
/* Стили .f-card-contact живут в styles/card.css (PostOnFeed) */
.chat-list-delete-btn {
background: rgba(255, 71, 87, .08);
border: 1px solid rgba(255, 71, 87, .2);
border-radius: 10px;
color: rgba(255, 71, 87, .5);
cursor: pointer;
padding: 8px;
display: flex;
align-items: center;
justify-content: center;
opacity: 0;
transition: opacity .2s, background .2s, border-color .2s, color .2s;
flex-shrink: 0;
}
.chat-list-item:hover .chat-list-delete-btn {
opacity: 1;
}
.chat-list-delete-btn:hover {
background: rgba(255, 71, 87, .15);
border-color: rgba(255, 71, 87, .4);
color: #ff4757;
}
/* Mobile adjustments */
@media (max-width: 600px) {
.chat-header {
padding: 10px 12px;
}
.chat-input-row {
padding: 10px 12px;
}
.chat-bubble {
max-width: 85%;
}
.chat-list {
padding: 6px 10px;
}
.chat-list-item {
gap: 10px;
padding: 12px 10px;
}
.chat-list-avatar {
width: 40px;
height: 40px;
}
.chat-list-delete-btn {
padding: 8px;
}
}
/* На сенсорных экранах нет hover — показываем кнопку удаления всегда. */
@media (hover: none) {
.chat-list-delete-btn {
opacity: 1;
}
}
/* Безопасная зона под домашним индикатором iPhone (Dynamic Island / iPhone 15+). */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
.chat-page {
padding-bottom: env(safe-area-inset-bottom);
}
.chat-list {
padding-bottom: calc(8px + env(safe-area-inset-bottom));
}
}