* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-dark: #0a0a0f;
    --bg-card: #12121a;
    --bg-input: #1a1a25;
    --accent: #7c3aed;
    --accent-hover: #6d28d9;
    --text: #e4e4e7;
    --text-muted: #71717a;
    --border: #27272a;
    --success: #22c55e;
    --error: #ef4444;
    --warning: #f59e0b;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-dark);
    color: var(--text);
    min-height: 100vh;
}

/* --- Landing --- */

.landing {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
    text-align: center;
}

.landing h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.landing .subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: 2.5rem;
}

.landing .features {
    display: flex;
    gap: 2rem;
    margin-bottom: 3rem;
    flex-wrap: wrap;
    justify-content: center;
}

.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    width: 200px;
    text-align: center;
}

.feature-card .icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.feature-card h3 {
    font-size: 0.95rem;
    margin-bottom: 0.3rem;
}

.feature-card p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

#telegram-login {
    margin-top: 1rem;
}

/* --- Chat layout --- */

.chat-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
}

.chat-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
}

.chat-header .user-info {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.message {
    max-width: 70%;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.message.client {
    align-self: flex-end;
    background: var(--accent);
    color: white;
    border-bottom-right-radius: 4px;
}

.message.operator {
    align-self: flex-start;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}

.message.system {
    align-self: center;
    background: var(--bg-input);
    border: 1px solid var(--border);
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.message img,
.message video,
.message audio {
    max-width: 100%;
    border-radius: 8px;
    margin-top: 0.5rem;
}

.chat-input {
    display: flex;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
}

.chat-input input {
    flex: 1;
    padding: 0.75rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

.chat-input input:focus {
    border-color: var(--accent);
}

.chat-input button,
.btn {
    padding: 0.75rem 1.5rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s;
    font-weight: 500;
}

.chat-input button:hover,
.btn:hover {
    background: var(--accent-hover);
}

/* --- Admin layout --- */

.admin-container {
    display: flex;
    height: 100vh;
}

.sidebar {
    width: 300px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 1rem;
}

.chat-list {
    flex: 1;
    overflow-y: auto;
}

.chat-item {
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s;
}

.chat-item:hover,
.chat-item.active {
    background: var(--bg-input);
}

.chat-item .name {
    font-weight: 500;
    font-size: 0.9rem;
}

.chat-item .preview {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.admin-main .empty-state {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 1rem;
}

.generation-panel {
    padding: 1rem 1.5rem;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    display: flex;
    gap: 0.75rem;
    align-items: end;
}

.generation-panel textarea {
    flex: 1;
    padding: 0.75rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 0.9rem;
    outline: none;
    resize: vertical;
    min-height: 42px;
    max-height: 120px;
    font-family: inherit;
}

.generation-panel textarea:focus {
    border-color: var(--accent);
}

.generation-panel select {
    padding: 0.75rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 0.85rem;
    outline: none;
}

.btn-generate {
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    white-space: nowrap;
}

.btn-generate:hover {
    opacity: 0.9;
}

/* --- Status badges --- */

.status {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status.processing {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.status.done {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
}

.status.error {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error);
}

/* --- Generation indicator --- */

.generating-indicator {
    text-align: center;
    padding: 0.5rem;
    color: var(--warning);
    font-size: 0.85rem;
    animation: pulse 1.5s infinite;
    display: none;
}

.generating-indicator.active {
    display: block;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* --- Scrollbar --- */

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}
