:root {
    --bg-color: #17212b; 
    --sidebar-bg: #17212b;
    --chat-bg: #0e1621;
    --active-item: #2b5278;
    --text-primary: #fff;
    --msg-in: #182533;
    --msg-out: #2b5278;
    --font-size: 16px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Vazirmatn', sans-serif;
    background: var(--bg-color);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    font-size: var(--font-size);
}

.app-layout { display: flex; height: 100%; }

/* سایدبار */
.sidebar {
    width: 320px;
    background: var(--sidebar-bg);
    border-left: 1px solid rgba(0,0,0,0.2);
    display: flex; flex-direction: column;
    flex-shrink: 0;
}
.search-box {
    padding: 10px; background: rgba(0,0,0,0.15); display: flex; align-items: center;
}
.search-box input {
    background: transparent; border: none; color: #fff; width: 100%; outline: none; margin-right: 10px; font-family: inherit;
}
.channels-list { flex: 1; overflow-y: auto; }
.channel-item {
    display: flex; padding: 10px 15px; cursor: pointer; align-items: center; border-bottom: 1px solid rgba(0,0,0,0.05); transition: 0.2s;
}
.channel-item:hover { background: rgba(255,255,255,0.05); }
.channel-item.active { background: var(--active-item); }
.ch-img { width: 50px; height: 50px; border-radius: 50%; object-fit: cover; margin-left: 12px; background: #333; }
.ch-info { flex: 1; overflow: hidden; }
.ch-name { font-weight: bold; display: block; font-size: 0.95rem; margin-bottom: 3px; }
.ch-count { font-size: 0.75rem; color: #aaa; background: rgba(0,0,0,0.3); padding: 2px 8px; border-radius: 12px; float: left; }

/* چت */
.chat-area {
    flex: 1; display: flex; flex-direction: column;
    background-color: var(--chat-bg);
    background-image: url('https://w.wallhaven.cc/full/vg/wallhaven-vg8885.jpg');
    background-blend-mode: overlay;
    position: relative;
}
.chat-header {
    background: var(--sidebar-bg); padding: 10px 15px; display: flex; align-items: center; box-shadow: 0 1px 3px rgba(0,0,0,0.3); z-index: 10;
}
.header-info { display: flex; align-items: center; }
#header-img { width: 42px; height: 42px; border-radius: 50%; margin-left: 12px; object-fit: cover; }
.header-text h3 { margin: 0; font-size: 1rem; }
.header-text span { font-size: 0.8rem; color: #8899a6; }

.messages-container { flex: 1; overflow-y: auto; padding: 20px 15%; display: flex; flex-direction: column; gap: 8px; }

/* پیام‌ها */
.message {
    max-width: 85%; padding: 8px 12px; border-radius: 12px; position: relative;
    background: var(--msg-in); align-self: flex-start;
    border-bottom-left-radius: 2px; line-height: 1.6;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.message img { max-width: 100%; border-radius: 8px; display: block; margin-bottom: 8px; cursor: pointer; }
.message iframe { width: 100%; aspect-ratio: 16/9; border: none; border-radius: 8px; margin-bottom: 8px; }
.msg-sender { color: #64b5f6; font-size: 0.85rem; font-weight: bold; display: block; margin-bottom: 4px; }
.msg-source { font-size: 0.75rem; color: #68798b; display: block; margin-top: 6px; text-align: left; }

/* ورودی */
.input-area { background: var(--sidebar-bg); padding: 10px; display: flex; gap: 10px; align-items: center; }
.input-area input { flex: 1; background: #0e1621; border: none; padding: 12px; border-radius: 8px; color: #fff; outline: none; font-family: inherit; }
.send-btn { background: none; border: none; color: #64b5f6; font-size: 1.4rem; cursor: pointer; padding: 0 10px; }

/* مودال */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: flex; justify-content: center; align-items: center; z-index: 1000; backdrop-filter: blur(2px); }
.hidden { display: none !important; }
.modal-content { background: #fff; color: #333; padding: 25px; border-radius: 10px; width: 90%; max-width: 350px; box-shadow: 0 10px 25px rgba(0,0,0,0.5); }
.modal-content input { width: 100%; padding: 10px; margin: 10px 0; border: 1px solid #ddd; border-radius: 6px; background: #f9f9f9; }
.modal-buttons { display: flex; justify-content: flex-end; gap: 10px; margin-top: 15px; }
.confirm { background: #2b5278; color: white; border: none; padding: 8px 20px; border-radius: 6px; cursor: pointer; }
.cancel { background: transparent; color: #666; border: none; padding: 8px 15px; cursor: pointer; }

/* موبایل */
.back-btn { display: none; background: none; border: none; color: white; font-size: 1.2rem; margin-left: 15px; cursor: pointer; }
@media (max-width: 768px) {
    .sidebar { width: 100%; }
    .chat-area { display: none; width: 100%; position: absolute; top: 0; left: 0; height: 100%; z-index: 20; }
    .chat-area.active { display: flex; }
    .back-btn { display: block; }
    .messages-container { padding: 15px; }
}