whatsviewer/frontend/style.css

370 lines
6.8 KiB
CSS

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
--bg: #e5ddd5;
--sidebar-bg: #fff;
--sidebar-border: #ddd;
--bubble-self: #dcf8c6;
--bubble-other: #fff;
--bubble-system: #f0f0f0;
--text: #111;
--text-secondary: #667;
--header-bg: #075e54;
--header-text: #fff;
--accent: #25d366;
--hover: #f5f5f5;
--active: #e8f5e9;
--shadow: rgba(0,0,0,0.08);
}
@media (prefers-color-scheme: dark) {
:root {
--bg: #0b141a;
--sidebar-bg: #111b21;
--sidebar-border: #2a3942;
--bubble-self: #005c4b;
--bubble-other: #202c33;
--bubble-system: #182229;
--text: #e9edef;
--text-secondary: #8696a0;
--header-bg: #1f2c34;
--header-text: #e9edef;
--hover: #2a3942;
--active: #2a3942;
--shadow: rgba(0,0,0,0.3);
}
}
html, body {
height: 100%;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
font-size: 14px;
color: var(--text);
background: var(--bg);
}
#app {
display: flex;
height: 100vh;
}
/* Sidebar */
#sidebar {
width: 320px;
min-width: 260px;
background: var(--sidebar-bg);
border-right: 1px solid var(--sidebar-border);
display: flex;
flex-direction: column;
flex-shrink: 0;
}
#sidebar-header {
background: var(--header-bg);
color: var(--header-text);
padding: 14px 16px;
}
#sidebar-header h1 {
font-size: 16px;
font-weight: 600;
margin-bottom: 10px;
}
#search-box { margin-top: 0; }
#search-input {
width: 100%;
padding: 6px 12px;
border: none;
border-radius: 18px;
font-size: 13px;
outline: none;
background: rgba(255,255,255,0.2);
color: var(--header-text);
}
#search-input::placeholder {
color: rgba(255,255,255,0.6);
}
#conversation-list {
overflow-y: auto;
flex: 1;
}
.conv-item {
padding: 12px 16px;
cursor: pointer;
border-bottom: 1px solid var(--sidebar-border);
transition: background 0.15s;
}
.conv-item:hover { background: var(--hover); }
.conv-item.active { background: var(--active); }
.conv-item .conv-name {
font-weight: 600;
font-size: 15px;
margin-bottom: 2px;
}
.conv-item .conv-meta {
font-size: 12px;
color: var(--text-secondary);
}
/* Chat pane */
#chat-pane {
flex: 1;
display: flex;
flex-direction: column;
min-width: 0;
}
#chat-header {
background: var(--header-bg);
color: var(--header-text);
padding: 10px 16px;
display: flex;
align-items: center;
gap: 16px;
flex-shrink: 0;
}
#chat-name {
font-weight: 600;
font-size: 16px;
white-space: nowrap;
}
#search-nav {
margin-left: auto;
display: flex;
align-items: center;
gap: 6px;
}
#search-nav.hidden { display: none; }
#search-nav button {
background: rgba(255,255,255,0.2);
border: none;
color: var(--header-text);
width: 28px;
height: 28px;
border-radius: 50%;
cursor: pointer;
font-size: 12px;
display: flex;
align-items: center;
justify-content: center;
}
#search-nav button:hover { background: rgba(255,255,255,0.3); }
#search-pos {
font-size: 13px;
min-width: 40px;
text-align: center;
}
#chat-messages {
flex: 1;
overflow-y: auto;
padding: 16px;
background: var(--bg);
}
.search-match {
outline: 2px solid #ffeb3b88;
outline-offset: 2px;
}
.search-match.search-current {
outline: 2px solid #ff9800;
outline-offset: 2px;
}
@media (prefers-color-scheme: dark) {
.search-match { outline-color: #7c6f0088; }
.search-match.search-current { outline-color: #ff9800; }
}
/* Date headers */
.date-header {
text-align: center;
margin: 16px 0 8px;
}
.date-header span {
background: var(--bubble-system);
color: var(--text-secondary);
font-size: 12px;
padding: 4px 12px;
border-radius: 8px;
display: inline-block;
box-shadow: 0 1px 1px var(--shadow);
}
/* Message bubbles */
.message {
max-width: 65%;
margin: 2px 0;
padding: 6px 10px;
border-radius: 8px;
position: relative;
word-wrap: break-word;
overflow-wrap: break-word;
box-shadow: 0 1px 1px var(--shadow);
clear: both;
}
.message.self {
background: var(--bubble-self);
margin-left: auto;
border-top-right-radius: 2px;
}
.message.other {
background: var(--bubble-other);
margin-right: auto;
border-top-left-radius: 2px;
}
.message.system {
background: var(--bubble-system);
color: var(--text-secondary);
font-style: italic;
font-size: 12px;
text-align: center;
max-width: 80%;
margin: 8px auto;
border-radius: 8px;
}
.message .sender-name {
font-weight: 600;
font-size: 12px;
margin-bottom: 2px;
color: var(--accent);
}
.message .msg-text {
white-space: pre-wrap;
line-height: 1.4;
}
.message .msg-time {
font-size: 11px;
color: var(--text-secondary);
text-align: right;
margin-top: 2px;
}
/* Media */
.msg-image {
max-width: 300px;
max-height: 300px;
border-radius: 6px;
cursor: pointer;
display: block;
margin: 4px 0;
}
.msg-sticker {
width: 128px;
height: 128px;
object-fit: contain;
display: block;
margin: 4px 0;
}
.msg-video, .msg-audio {
max-width: 300px;
display: block;
margin: 4px 0;
}
.msg-audio { width: 260px; }
.msg-document {
display: inline-flex;
align-items: center;
gap: 8px;
padding: 8px 12px;
background: rgba(0,0,0,0.05);
border-radius: 8px;
text-decoration: none;
color: var(--text);
margin: 4px 0;
font-size: 13px;
}
.msg-document:hover { background: rgba(0,0,0,0.1); }
.msg-document::before {
content: "\1F4CE";
font-size: 18px;
}
/* Self selector */
#self-selector {
padding: 8px 16px;
background: var(--sidebar-bg);
border-top: 1px solid var(--sidebar-border);
font-size: 13px;
}
#self-name {
padding: 4px 8px;
font-size: 13px;
border-radius: 4px;
border: 1px solid var(--sidebar-border);
background: var(--sidebar-bg);
color: var(--text);
}
/* Lightbox */
.lightbox {
position: fixed;
inset: 0;
background: rgba(0,0,0,0.9);
display: flex;
align-items: center;
justify-content: center;
z-index: 1000;
cursor: zoom-out;
}
.lightbox.hidden { display: none; }
.lightbox img {
max-width: 95vw;
max-height: 95vh;
object-fit: contain;
}
/* Search highlight */
mark {
background: #ffeb3b;
color: #000;
border-radius: 2px;
padding: 0 1px;
}
@media (prefers-color-scheme: dark) {
mark {
background: #7c6f00;
color: #fff;
}
}
/* Responsive */
@media (max-width: 600px) {
#sidebar { width: 100%; position: absolute; z-index: 10; height: 100%; }
#chat-pane { width: 100%; }
.message { max-width: 85%; }
#sidebar.hidden-mobile { display: none; }
}