/* ===== ТЕМА: ТЁМНАЯ (ПРЕМИУМ) ===== */
[data-theme="dark"] {
    --bg: #0f0f1a;
    --surface: #1a1a2e;
    --surface2: #252540;
    --text: #e0e0e0;
    --text-secondary: #999;
    --primary: #4F8CFF;
    --border: #2a2a3e;
    --danger: #EF4444;
    --success: #22C55E;
    --warning: #F59E0B;
    --gradient: linear-gradient(135deg, #667eea, #764ba2);
}

/* ===== ТЕМА: СВЕТЛАЯ (ПРЕМИУМ) ===== */
[data-theme="light"] {
    --bg: #f8f9fc;
    --surface: #ffffff;
    --surface2: #f0f2f5;
    --text: #1a1a2e;
    --text-secondary: #666;
    --primary: #4F8CFF;
    --border: #e2e8f0;
    --danger: #EF4444;
    --success: #22C55E;
    --warning: #F59E0B;
    --gradient: linear-gradient(135deg, #667eea, #764ba2);
}

/* ===== ОБЩИЕ СТИЛИ ===== */
body {
    background: var(--bg);
    color: var(--text);
    transition: background 0.3s, color 0.3s;
}

/* Фон чата с узором */
.messages-container {
    background: var(--bg);
    background-image: 
        radial-gradient(circle at 20% 50%, var(--surface) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, var(--surface2) 0%, transparent 40%),
        radial-gradient(circle at 50% 80%, rgba(79,140,255,0.03) 0%, transparent 50%);
    background-attachment: fixed;
}

[data-theme="light"] .messages-container {
    background-image: 
        radial-gradient(circle at 20% 50%, #e8ecf4 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, #f0f4ff 0%, transparent 40%),
        radial-gradient(circle at 50% 80%, rgba(79,140,255,0.05) 0%, transparent 50%);
}

/* Плавные переходы */
.msg-bubble, .chat-item, .card, .stat-card, .sidebar, .header {
    transition: background 0.3s, box-shadow 0.3s, border-color 0.3s;
}

/* Премиум тени */
[data-theme="dark"] .msg-bubble {
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
[data-theme="light"] .msg-bubble {
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

/* Стили для профиля */
.premium-profile-card {
    background: linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%);
    border: 1px solid var(--border);
}

/* Анимированный градиент для шапки */
.profile-cover {
    background: var(--gradient);
    background-size: 200% 200%;
    animation: gradientShift 5s ease infinite;
}
@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* Светлые иконки для тёмной темы */
[data-theme="dark"] .icon-btn img,
[data-theme="dark"] .header-actions img,
[data-theme="dark"] .sidebar img[src*="icons"] {
    filter: invert(1) brightness(2);
    opacity: 0.8;
}

[data-theme="dark"] .icon-btn:hover img {
    opacity: 1;
}

/* Инвертировать цвета для SVG иконок */
[data-theme="dark"] img[src*=".svg"] {
    filter: invert(1);
}

/* Для тёмной темы — светлые кнопки */
[data-theme="dark"] .icon-btn {
    color: #ccc;
}

/* Обложки профилей и каналов */
.premium-cover, 
#premium-profile-card > div:first-child,
#channel-profile-overlay [style*="height:160px"],
#premium-profile-overlay [style*="height:140px"],
#premium-profile-overlay [style*="height:150px"],
#premium-profile-overlay [style*="height:120px"],
#channel-profile-overlay [style*="height:150px"],
#channel-profile-overlay [style*="height:120px"] {
    background-size: cover !important;
    background-position: center !important;
    object-fit: cover !important;
}

/* Аватарки */
#premium-profile-card img[style*="width:90px"],
#channel-profile-overlay img[style*="width:80px"],
#channel-profile-overlay img[style*="width:90px"],
#ce-avatar-preview img,
#ch-avatar-preview img,
#pe-avatar-preview img {
    object-fit: cover !important;
}
