/* style.css */

/* ===== فونت وزیر ===== */
@font-face {
    font-family: 'Vazir';
    src: url('https://cdn.jsdelivr.net/gh/rastikerdar/vazir-font@v30.1.0/dist/Vazir-Bold.eot');
    src: url('https://cdn.jsdelivr.net/gh/rastikerdar/vazir-font@v30.1.0/dist/Vazir-Bold.eot?#iefix') format('embedded-opentype'),
    url('https://cdn.jsdelivr.net/gh/rastikerdar/vazir-font@v30.1.0/dist/Vazir-Bold.woff2') format('woff2'),
    url('https://cdn.jsdelivr.net/gh/rastikerdar/vazir-font@v30.1.0/dist/Vazir-Bold.woff') format('woff'),
    url('https://cdn.jsdelivr.net/gh/rastikerdar/vazir-font@v30.1.0/dist/Vazir-Bold.ttf') format('truetype');
    font-weight: bold;
    font-style: normal;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overflow: hidden; font-size: 16px; padding-bottom: env(safe-area-inset-bottom); transition: background-color 0.4s ease, color 0.4s ease; }
body { font-family: 'Vazir', Tahoma, sans-serif; direction: rtl; display: flex; justify-content: center; align-items: center; padding: 0; margin: 0; height: 100dvh; width: 100vw; }

html.dark {
    --bg-primary: #1a1a2e; --bg-secondary: #16213e; --bg-card: #1e2a4a; --bg-input: #2a3a5c;
    --bg-messages: #0f1a2e; --bg-header: linear-gradient(135deg, #1a1a3e, #2a1a4e); --bg-userlist: #1e2a4a;
    --bg-input-area: #16213e; --bg-msg-other: #2a3a5c; --bg-msg-me: linear-gradient(135deg, #4a6cf7, #6a3de8);
    --bg-voice-other: #1e2a4a; --bg-voice-me: linear-gradient(135deg, #5a7cf7, #7a4de8);
    --bg-video-other: #1e2a4a; --bg-video-me: linear-gradient(135deg, #5a7cf7, #7a4de8);
    --bg-file-other: #1e2a4a; --bg-file-me: linear-gradient(135deg, #5a7cf7, #7a4de8);
    --text-primary: #e8ecf1; --text-secondary: #a8b2c8; --text-muted: #6c7a9a; --border-color: #2a3a5c;
    --shadow-color: rgba(0,0,0,0.4); --scrollbar-track: #1e2a4a; --scrollbar-thumb: #3a4a6a;
    --btn-primary: #4a6cf7; --btn-primary-hover: #5a7cf7; --btn-danger: #dc3545; --btn-danger-hover: #c82333;
    --btn-success: #28a745; --btn-success-hover: #34ce57; --btn-warning: #ff6b00; --btn-warning-hover: #ff7a1a;
    --btn-video: #9b59b6; --btn-video-hover: #af7ac5; --btn-file: #17a2b8; --btn-file-hover: #138496;
    --btn-outline-border: rgba(255,255,255,0.2); --delete-btn-bg: #dc3545; --delete-btn-hover: #c82333;
    --play-btn-bg: #4a6cf7; --play-btn-hover: #5a7cf7;
}

html.light {
    --bg-primary: #f0f2f5; --bg-secondary: #ffffff; --bg-card: #ffffff; --bg-input: #e8ecf1;
    --bg-messages: #f5f7fa; --bg-header: linear-gradient(135deg, #4a6cf7, #6a3de8); --bg-userlist: #e8ecf1;
    --bg-input-area: #ffffff; --bg-msg-other: #ffffff; --bg-msg-me: linear-gradient(135deg, #4a6cf7, #6a3de8);
    --bg-voice-other: #eef3ff; --bg-voice-me: linear-gradient(135deg, #5a7cf7, #7a4de8);
    --bg-video-other: #eef3ff; --bg-video-me: linear-gradient(135deg, #5a7cf7, #7a4de8);
    --bg-file-other: #eef3ff; --bg-file-me: linear-gradient(135deg, #5a7cf7, #7a4de8);
    --text-primary: #1a1a2e; --text-secondary: #4a4a6a; --text-muted: #8a8aaa; --border-color: #dde1e6;
    --shadow-color: rgba(0,0,0,0.08); --scrollbar-track: #e9ecef; --scrollbar-thumb: #c4c9d4;
    --btn-primary: #4a6cf7; --btn-primary-hover: #5a7cf7; --btn-danger: #dc3545; --btn-danger-hover: #c82333;
    --btn-success: #28a745; --btn-success-hover: #34ce57; --btn-warning: #ff6b00; --btn-warning-hover: #ff7a1a;
    --btn-video: #9b59b6; --btn-video-hover: #af7ac5; --btn-file: #17a2b8; --btn-file-hover: #138496;
    --btn-outline-border: rgba(255,255,255,0.3); --delete-btn-bg: #dc3545; --delete-btn-hover: #c82333;
    --play-btn-bg: #4a6cf7; --play-btn-hover: #5a7cf7;
}

.chat-box { width: 100%; height: 100dvh; max-height: 100dvh; display: flex; flex-direction: column; background: var(--bg-primary); overflow: hidden; position: relative; transition: background-color 0.4s ease; }

/* ===== Header & Hamburger Menu (Right Aligned) ===== */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: var(--bg-header);
    color: white;
    flex-wrap: wrap;
    gap: 6px;
    flex-shrink: 0;
    min-height: 56px;
    padding-top: max(10px, env(safe-area-inset-top));
    position: relative;
    z-index: 100;
}

.username-section {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 160px;
    justify-content: flex-start;
}

.header-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
    order: 2;
}

.btn-hamburger {
    background: transparent;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 8px;
    transition: background 0.3s;
}

.btn-hamburger:hover { background: rgba(255,255,255,0.1); }

.btn { padding: 6px 14px; border: none; border-radius: 8px; font-size: 14px; font-family: 'Vazir', Tahoma, sans-serif; font-weight: bold; cursor: pointer; transition: all 0.2s ease; display: inline-flex; align-items: center; justify-content: center; gap: 4px; white-space: nowrap; min-height: 36px; min-width: 44px; touch-action: manipulation; }
.btn:hover { opacity: 0.85; }
.btn:active { transform: scale(0.92); }
.btn-primary { background: var(--btn-primary); color: white; }
.btn-success { background: var(--btn-success); color: white; }
.btn-danger { background: var(--btn-danger); color: white; }
.btn-warning { background: var(--btn-warning); color: white; }
.btn-video { background: var(--btn-video); color: white; }
.btn-file { background: var(--btn-file); color: white; }
.btn-outline { background: transparent; color: white; border: 1px solid var(--btn-outline-border); font-size: 13px; }
.btn-send { background: var(--btn-primary); color: white; }
.btn-theme { background: rgba(255,255,255,0.15); color: white; border: 1px solid rgba(255,255,255,0.2); font-size: 13px; min-width: 40px; padding: 6px 10px; }
.btn-theme:hover { background: rgba(255,255,255,0.25); }

/* User List in Menu */
.users-menu-container {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 10px 20px var(--shadow-color);
    z-index: 99;
    max-height: 60vh;
    overflow-y: auto;
    padding: 10px;
    animation: slideDown 0.3s ease;
}

.users-menu-container.active { display: block; }

@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

.menu-users-list { display: flex; flex-direction: column; gap: 8px; }

.menu-user-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-input);
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.menu-user-info { display: flex; align-items: center; gap: 8px; flex: 1; }
.menu-user-name { font-size: 14px; color: var(--text-primary); font-weight: bold; }
.online-dot { width: 8px; height: 8px; background: #28a745; border-radius: 50%; display: inline-block; animation: pulse-dot 1.5s infinite; }

@keyframes pulse-dot { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

.menu-user-actions { display: flex; align-items: center; gap: 8px; }
.user-checkbox { width: 18px; height: 18px; accent-color: #4a6cf7; cursor: pointer; }
.kick-btn-small { background: none; border: none; color: #dc3545; cursor: pointer; font-size: 16px; padding: 4px; opacity: 0.7; transition: opacity 0.2s; }
.kick-btn-small:hover { opacity: 1; transform: scale(1.1); }

.menu-call-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
}

.menu-call-buttons .btn { flex: 1; font-size: 13px; padding: 8px; }

.messages { flex: 1; overflow-y: auto; padding: 10px 14px; background: var(--bg-messages); display: flex; flex-direction: column; gap: 4px; min-height: 0; scroll-behavior: smooth; overscroll-behavior: contain; transition: background-color 0.4s ease; }
.messages::-webkit-scrollbar { width: 4px; }
.messages::-webkit-scrollbar-track { background: var(--scrollbar-track); border-radius: 10px; }
.messages::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 10px; }

.msg { padding: 8px 14px; border-radius: 14px; max-width: 85%; word-wrap: break-word; animation: slideIn 0.25s ease; position: relative; font-size: 14px; line-height: 1.6; box-shadow: 0 1px 3px var(--shadow-color); transition: background-color 0.4s ease, color 0.4s ease, border-color 0.4s ease; }

@keyframes slideIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }

.me { background: var(--bg-msg-me); color: white; align-self: flex-end; border-bottom-left-radius: 4px; padding-right: 40px; }
.other { background: var(--bg-msg-other); color: var(--text-primary); align-self: flex-start; border-bottom-right-radius: 4px; padding-left: 40px; border: 1px solid var(--border-color); }

.voice-msg { background: var(--bg-voice-other); border-right: 3px solid #4a6cf7; cursor: default; padding: 8px 14px; }
.voice-msg.me { background: var(--bg-voice-me); border-right: 3px solid #a8c0ff; color: white; }

.video-msg { background: var(--bg-video-other); border-right: 3px solid #9b59b6; cursor: default; padding: 8px 14px; }
.video-msg.me { background: var(--bg-video-me); border-right: 3px solid #c39bd3; color: white; align-self: flex-end !important; padding-right: 40px !important; padding-left: 14px !important; border-bottom-left-radius: 4px !important; border-bottom-right-radius: 14px !important; margin-left: auto !important; margin-right: 0 !important; }

.file-msg { background: var(--bg-file-other); border-right: 3px solid #17a2b8; cursor: default; padding: 8px 14px; }
.file-msg.me { background: var(--bg-file-me); border-right: 3px solid #5bc0de; color: white; align-self: flex-end !important; padding-right: 40px !important; padding-left: 14px !important; border-bottom-left-radius: 4px !important; border-bottom-right-radius: 14px !important; margin-left: auto !important; margin-right: 0 !important; }

.msg-user { font-weight: bold; font-size: 14px; display: block; margin-bottom: 2px; opacity: 0.85; }
.me .msg-user { color: rgba(255,255,255,0.9); }
.other .msg-user { color: #4a6cf7; }

.msg-content { font-size: 14px; display: inline; margin-left: 8px; }
.msg-time { font-size: 13px; opacity: 0.6; display: block; margin-top: 12px; direction: ltr; text-align: left; }
.me .msg-time { color: rgba(255,255,255,0.7); }
.other .msg-time { color: var(--text-muted); }

.delete-btn { background: var(--delete-btn-bg); color: white; border: none; border-radius: 14px; cursor: pointer; font-size: 12px; padding: 0 10px; height: 28px; display: inline-flex !important; align-items: center; justify-content: center; gap: 4px; flex-shrink: 0; transition: all 0.2s ease; opacity: 0.75; position: relative !important; top: auto !important; left: auto !important; right: auto !important; float: left; line-height: 1; white-space: nowrap; min-width: 60px; font-family: 'Vazir', Tahoma, sans-serif; }
.delete-btn:hover { opacity: 1; transform: scale(0.95); background: var(--delete-btn-hover); }
.me .delete-btn { float: left; margin-left: 6px; margin-right: 0; }
.other .delete-btn { float: right; margin-right: 6px; margin-left: 0; }

.voice-controls, .video-controls, .file-controls { display: inline-flex; align-items: center; gap: 12px; margin-top: 4px; flex-wrap: wrap; }

.voice-play-btn, .video-play-btn, .file-download-btn { background: var(--play-btn-bg); color: white; border: none; padding: 4px 14px; border-radius: 6px; cursor: pointer; font-size: 14px; font-family: 'Vazir', Tahoma, sans-serif; transition: all 0.2s; min-height: 30px; min-width: 60px; }
.voice-play-btn:hover, .video-play-btn:hover, .file-download-btn:hover { opacity: 0.85; transform: scale(0.95); }
.me .voice-play-btn, .me .video-play-btn, .me .file-download-btn { background: rgba(255,255,255,0.25); color: white; }

.video-preview { width: 100%; max-width: 300px; border-radius: 8px; margin-top: 4px; background: #000; display: block; }
.file-preview-img { max-width: 200px; max-height: 200px; border-radius: 8px; margin-bottom: 8px; cursor: pointer; border: 1px solid rgba(255,255,255,0.2); display: block; }
.file-media-player { max-width: 280px; width: 100%; margin-bottom: 8px; border-radius: 8px; }

.upload-progress-container { width: 100%; height: 4px; background: var(--border-color); border-radius: 2px; margin-bottom: 6px; overflow: hidden; display: none; }
.upload-progress-bar { height: 100%; background: var(--btn-success); width: 0%; transition: width 0.2s ease; }
.upload-status-text { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; display: none; text-align: center; }

.voice-status, .video-status { text-align: center; padding: 8px; background: #dc3545; color: white; border-radius: 8px; margin: 4px 10px; font-size: 14px; font-weight: bold; display: none; flex-shrink: 0; }
.video-status { background: #9b59b6; }
.voice-status.active, .video-status.active { display: block; animation: blinkBg 1s infinite; }

@keyframes blinkBg { 0%, 100% { background: #dc3545; } 50% { background: #ff4444; } }
@keyframes blinkBgVideo { 0%, 100% { background: #9b59b6; } 50% { background: #c39bd3; } }
.video-status.active { animation-name: blinkBgVideo; }

.voice-indicator { display: inline-block; width: 12px; height: 12px; background: white; border-radius: 50%; margin-left: 8px; animation: dotBlink 1s infinite; }

@keyframes dotBlink { 0%, 100% { opacity: 1; } 50% { opacity: 0.2; } }

.recording-time { font-size: 14px; margin-right: 10px; background: rgba(255,255,255,0.2); padding: 0 10px; border-radius: 4px; }

.input-area { padding: 8px 12px 10px; background: var(--bg-input-area); border-top: 1px solid var(--border-color); flex-shrink: 0; padding-bottom: max(10px, env(safe-area-inset-bottom)); transition: background-color 0.4s ease, border-color 0.4s ease; }

.input-area textarea {
    width: 100%;
    resize: none;
    height: 56px;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 14px;
    font-family: 'Vazir', Tahoma, sans-serif;
    outline: none !important;
    -webkit-appearance: none;
    appearance: none;
    transition: border 0.3s, transform 0.15s, background-color 0.4s ease, color 0.4s ease;
    background: var(--bg-input);
    color: var(--text-primary);
}

.input-area textarea:focus {
    border-color: var(--border-color) !important;
    background: var(--bg-card);
    outline: none !important;
    box-shadow: none !important;
    -webkit-box-shadow: none !important;
    -moz-box-shadow: none !important;
}

.input-area textarea.shake { animation: shake 0.4s ease; border-color: #dc3545; }

@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-8px); } 40% { transform: translateX(8px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(5px); } }

.btn-row { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.btn-row .btn { flex: 1; justify-content: center; padding: 8px 10px; font-size: 14px; min-height: 38px; }

.debug-info { font-size: 13px; color: var(--text-muted); text-align: center; padding: 4px 10px; background: var(--bg-userlist); border-top: 1px solid var(--border-color); flex-shrink: 0; font-family: 'Vazir', Tahoma, sans-serif; min-height: 26px; display: flex; align-items: center; justify-content: center; padding-bottom: max(4px, env(safe-area-inset-bottom)); transition: background-color 0.4s ease, color 0.4s ease, border-color 0.4s ease; }

/* Login Styles */
.login-container { display: flex; justify-content: center; align-items: center; width: 100%; height: 100%; padding: 20px; background: var(--bg-primary); transition: background-color 0.4s ease; }
.login-card { background: var(--bg-card); padding: 36px 32px; border-radius: 24px; box-shadow: 0 20px 60px var(--shadow-color); max-width: 420px; width: 100%; text-align: center; transition: background-color 0.4s ease, box-shadow 0.4s ease; }
.login-card .logo { font-size: 48px; margin-bottom: 10px; }
.login-card h2 { color: var(--text-primary); font-size: 22px; margin-bottom: 6px; transition: color 0.4s ease; }
.login-card h3 { color: var(--text-secondary); font-size: 18px; margin-bottom: 4px; transition: color 0.4s ease; }
.login-card p { color: var(--text-muted); font-size: 14px; margin-bottom: 20px; }
.login-card input { width: 100%; padding: 12px 16px; border: 2px solid var(--border-color); border-radius: 12px; font-size: 15px; font-family: 'Vazir', Tahoma, sans-serif; transition: border 0.3s, background-color 0.4s ease, color 0.4s ease; text-align: center; margin-bottom: 12px; background: var(--bg-input); color: var(--text-primary); }
.login-card input:focus { border-color: #4a6cf7; outline: none; }
.login-btn-row { display: flex; gap: 8px; width: 100%; }
.login-btn-row .btn-login { flex: 3; justify-content: center; padding: 12px; font-size: 15px; background: linear-gradient(135deg, #4a6cf7, #6a3de8); color: white; min-height: 44px; }
.login-btn-row .btn-login:hover { transform: scale(0.97); }
.login-btn-row .btn-theme-login { flex: 2; justify-content: center; padding: 12px; font-size: 14px; background: var(--bg-input); color: var(--text-primary); border: 2px solid var(--border-color); min-height: 44px; border-radius: 12px; font-family: 'Vazir', Tahoma, sans-serif; font-weight: bold; cursor: pointer; transition: all 0.3s ease; }
.login-btn-row .btn-theme-login:hover { transform: scale(0.97); border-color: #4a6cf7; }
html.dark .login-btn-row .btn-theme-login { color: white; }

/* Call System Styles */
.call-status {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 320px;
    max-width: 90vw;
    background: rgba(30, 42, 74, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0;
    border-radius: 16px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.4);
    z-index: 9999;
    display: none;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    transform-origin: bottom right;
}

html.light .call-status {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 15px 40px rgba(0,0,0,0.15);
}

.call-status.active { display: flex; animation: slideUpFade 0.4s ease forwards; }
.call-status.minimized { height: 60px !important; width: 200px; bottom: 20px; right: 20px; overflow: hidden; }

@keyframes slideUpFade {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.call-window-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: rgba(0,0,0,0.2);
    border-bottom: 1px solid rgba(255,255,255,0.05);
    cursor: move;
}

.call-window-title {
    font-size: 14px;
    font-weight: bold;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.call-window-controls { display: flex; gap: 8px; }
.win-btn { background: none; border: none; color: rgba(255,255,255,0.7); cursor: pointer; font-size: 16px; padding: 2px; transition: color 0.2s; }
.win-btn:hover { color: white; }
.win-btn.close:hover { color: #ff4444; }

.call-body {
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    transition: opacity 0.3s;
}

.call-status.minimized .call-body { display: none; }

.call-timer {
    font-size: 28px;
    font-family: 'Courier New', monospace;
    color: var(--btn-primary);
    direction: ltr;
    letter-spacing: 2px;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(74, 108, 247, 0.3);
}

.conference-participants {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    width: 100%;
    max-height: 100px;
    overflow-y: auto;
    padding: 5px 0;
}

.participant-badge {
    background: rgba(255,255,255,0.1);
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 11px;
    color: var(--text-primary);
    border: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 5px;
}

.participant-badge.speaking { border-color: #28a745; background: rgba(40, 167, 69, 0.2); box-shadow: 0 0 8px rgba(40, 167, 69, 0.3); }

.video-call-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 8px;
    width: 100%;
    max-height: 200px;
    overflow-y: auto;
    margin-top: 5px;
}

.video-item {
    position: relative;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 3/4;
    border: 1px solid rgba(255,255,255,0.1);
}

.video-item video { width: 100%; height: 100%; object-fit: cover; }

.call-actions {
    display: flex;
    gap: 10px;
    width: 100%;
    margin-top: 10px;
    flex-wrap: wrap;
    justify-content: center;
    padding-top: 10px;
    border-top: 1px solid rgba(255,255,255,0.05);
}

.call-actions .btn {
    flex: 1;
    min-width: 80px;
    padding: 8px;
    font-size: 13px;
    border-radius: 10px;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

#recordCallContainer {
    display: flex;
    justify-content: center;
    margin-top: 5px;
}

#recordCallContainer label {
    font-size: 12px;
    color: var(--text-muted);
    background: rgba(0,0,0,0.2);
    padding: 4px 10px;
    border-radius: 12px;
    cursor: pointer;
}

@media (max-width: 480px) {
    .call-status { width: 95%; right: 2.5%; left: 2.5%; bottom: 10px; }
    .call-status.minimized { width: 160px; right: 10px; bottom: 10px; }
}

.btn-hangup { background: #dc3545; color: white; }
.btn-hangup:hover { background: #c82333; }
.btn-accept { background: #28a745; color: white; }
.btn-reject { background: #dc3545; color: white; }
.btn-cancel { background: #ff6b00; color: white; }

.conference-participants { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 10px; width: 100%; }
.participant-badge { background: var(--bg-input); padding: 4px 10px; border-radius: 12px; font-size: 12px; color: var(--text-primary); border: 1px solid var(--border-color); display: flex; align-items: center; gap: 5px; }
.participant-badge.speaking { border-color: #28a745; background: rgba(40, 167, 69, 0.1); }
.participant-mute-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 12px; padding: 0; }
.participant-kick-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 12px; padding: 0; transition: color 0.2s; }
.participant-kick-btn:hover { color: #dc3545 !important; transform: scale(1.1); }

#callAudioRemote, #callAudioLocal { display: none; }

.video-call-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; width: 100%; margin-top: 10px; max-height: 300px; overflow-y: auto; }
.video-item { position: relative; background: #000; border-radius: 8px; overflow: hidden; aspect-ratio: 3/4; border: 2px solid var(--border-color); }
.video-item video { width: 100%; height: 100%; object-fit: cover; }
.video-item-label { position: absolute; bottom: 5px; left: 5px; background: rgba(0,0,0,0.6); color: white; padding: 2px 6px; border-radius: 4px; font-size: 10px; }
.video-toggle-btn { background: rgba(255,255,255,0.2); border: none; color: white; border-radius: 50%; width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; cursor: pointer; position: absolute; top: 5px; right: 5px; z-index: 10; }

@media (max-width: 768px) {
    .header { padding: 8px 10px; min-height: 48px; gap: 4px; }
    .username-section { min-width: 120px; }
    .username-section input { max-width: 130px; font-size: 14px; padding: 4px 8px; }
    .btn { font-size: 13px; padding: 4px 10px; min-height: 32px; min-width: 36px; }
    .msg { font-size: 14px; padding: 6px 12px; max-width: 90%; }
    .messages { padding: 8px 10px; }
    .input-area { padding: 6px 10px 8px; }
    .input-area textarea { height: 48px; font-size: 14px; padding: 6px 10px; }
    .call-status { bottom: 90px; padding: 14px 18px; min-width: 180px; }
    .call-timer { font-size: 26px; }
}

.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); z-index: 10000; justify-content: center; align-items: center; backdrop-filter: blur(5px); }
.modal-content { background: var(--bg-card); padding: 20px; border-radius: 16px; width: 90%; max-width: 400px; max-height: 80vh; overflow-y: auto; box-shadow: 0 10px 30px rgba(0,0,0,0.5); border: 1px solid var(--border-color); text-align: right; direction: rtl; }
.modal-header { font-size: 18px; font-weight: bold; margin-bottom: 15px; color: var(--text-primary); border-bottom: 1px solid var(--border-color); padding-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 24px; cursor: pointer; }
.modal-body input { width: 100%; padding: 10px; margin-bottom: 10px; border: 1px solid var(--border-color); border-radius: 8px; background: var(--bg-input); color: var(--text-primary); font-family: 'Vazir'; box-sizing: border-box; }
.modal-body label { display: block; margin-bottom: 5px; color: var(--text-secondary); font-size: 13px; }
.modal-footer { margin-top: 20px; display: flex; gap: 10px; flex-direction: column; }
.btn-save { background: #28a745; color: white; width: 100%; padding: 10px; border-radius: 8px; border: none; cursor: pointer; font-family: 'Vazir'; font-weight: bold; }
.btn-delete { background: #dc3545; color: white; width: 100%; padding: 10px; border-radius: 8px; border: none; cursor: pointer; font-family: 'Vazir'; font-weight: bold; margin-top: 10px; }
.readonly-field { background: var(--bg-secondary) !important; color: var(--text-muted) !important; cursor: not-allowed; }

.tools-menu-overlay {
    position: absolute;
    bottom: calc(100% + 15px);
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    padding: 10px 14px;
    z-index: 15;
    direction: rtl;
    gap: 4px;
    width: 0;
    opacity: 0;
    visibility: hidden;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-origin: bottom right;
    transform: scale(0.8) translateY(10px);
}

.tools-menu-overlay.active {
    width: fit-content;
    max-width: calc(100% - 10px);
    opacity: 1;
    visibility: visible;
    white-space: nowrap;
    transform: scale(1) translateY(0);
}

.tools-menu-overlay .toolbar-btn {
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
    max-width: 42px !important;
    min-height: 42px !important;
    max-height: 42px !important;
    margin: 0 3px !important;
    border-radius: 12px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

.tools-menu-overlay .toolbar-btn svg {
    width: 20px !important;
    height: 20px !important;
    display: block !important;
    flex-shrink: 0 !important;
}

.tools-menu-overlay .toolbar-btn:hover {
    transform: translateY(-3px) scale(1.08) !important;
    box-shadow: 0 6px 20px rgba(0,0,0,0.2) !important;
}

@keyframes toolsMenuSlideUp {
    from { opacity: 0; transform: scale(0.85) translateY(15px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.tools-menu-overlay.active {
    animation: toolsMenuSlideUp 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.modern-toolbar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    margin-top: 20px;
    padding: 10px;
    background: var(--bg-input);
    border-radius: 16px;
    border: 1px solid var(--border-color);
}

.toolbar-btn {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    color: white;
    position: relative;
    overflow: hidden;
    margin: 0 4px;
}

.toolbar-btn svg {
    width: 22px;
    height: 22px;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.1));
    transition: transform 0.3s ease;
}

.toolbar-btn:hover {
    transform: translateY(-4px) scale(1.08);
    box-shadow: 0 8px 20px rgba(0,0,0,0.25);
}

.toolbar-btn:hover svg {
    transform: scale(1.15);
}

.toolbar-btn:active {
    transform: translateY(-1px) scale(0.98);
}

.btn-audio { background: linear-gradient(135deg, #10b981, #059669); }
.btn-video { background: linear-gradient(135deg, #38bdf8, #0ea5e9); }
.btn-logout { background: linear-gradient(135deg, #ef4444, #dc2626); }
.btn-admin { background: linear-gradient(135deg, #f59e0b, #d97706); }

.toolbar-btn {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    max-width: 40px !important;
    min-height: 40px !important;
    max-height: 40px !important;
    padding: 0 !important;
    margin: 0 4px !important;
    line-height: 1 !important;
    border: none !important;
    outline: none !important;
    box-sizing: border-box !important;
    border-radius: 12px !important;
    background: var(--bg-input);
    color: white;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: relative !important;
    overflow: hidden !important;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.3s ease;
}

.toolbar-btn svg {
    width: 22px !important;
    height: 22px !important;
    display: block !important;
    flex-shrink: 0 !important;
    z-index: 2 !important;
    position: relative !important;
}

.toolbar-btn.recording {
    background: linear-gradient(135deg, #ef4444, #dc2626) !important;
}

.toolbar-btn.recording::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    border-radius: 12px;
    animation: pulse-ring 1.5s infinite;
    pointer-events: none;
    z-index: 1;
}

@keyframes pulse-ring {
    0% { box-shadow: inset 0 0 0 0 rgba(255,255,255,0.4); }
    50% { box-shadow: inset 0 0 0 4px rgba(255,255,255,0); }
    100% { box-shadow: inset 0 0 0 0 rgba(255,255,255,0); }
}

.btn-audio { background: linear-gradient(135deg, #10b981, #059669) !important; }
.btn-video { background: linear-gradient(135deg, #38bdf8, #0ea5e9) !important; }
.btn-logout { background: linear-gradient(135deg, #ef4444, #dc2626) !important; }
.btn-admin { background: linear-gradient(135deg, #f59e0b, #d97706) !important; }

.toolbar-divider {
    width: 1px;
    height: 30px;
    background: var(--border-color);
    margin: 0 4px;
    opacity: 0.5;
}

.toolbar-btn::after {
    content: attr(title);
    position: absolute;
    bottom: -35px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    border: 1px solid var(--border-color);
    pointer-events: none;
    z-index: 10;
}

.toolbar-btn:hover::after {
    opacity: 1;
    visibility: visible;
    bottom: -40px;
}

.btn-theme-modern {
    background: var(--btn-primary) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.btn-theme-modern:hover {
    background: var(--btn-primary) !important;
    color: white !important;
    border-color: var(--btn-primary) !important;
    transition: transform 0.3s ease;
}

.btn-theme-modern svg {
    width: 20px;
    height: 20px;
    stroke-width: 2;
}

.btn-screen-share { background: linear-gradient(135deg, #f093fb, #f5576c) !important; }

.btn-screen-mute { background: #f39c12 !important; color: white; }
.btn-screen-record { background: #e74c3c !important; color: white; }
.btn-screen-full { background: #3498db !important; color: white; }

.video-fullscreen-mode {
    position: fixed !important;
    top: 0 !important; left: 0 !important;
    width: 100vw !important; height: 100vh !important;
    z-index: 100000 !important;
    background: black;
    object-fit: contain;
}

.input-area .input-row {
    display: flex;
    align-items: stretch;
    gap: 0;
    position: relative;
    direction: rtl;
}

#toolsMenuToggle {
    border-radius: 0 10px 10px 0 !important;
    border: 1px solid var(--border-color);
    border-right: none !important;
    background: var(--bg-input);
    min-width: 46px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
    margin-top: 10px;
    margin-left: 8px;
    order: 0;
    padding: 0 !important;
}

#toolsMenuToggle:hover {
    background: var(--bg-card);
    border-color: #4a6cf7;
}

#toolsMenuToggle svg {
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#toolsMenuToggle.active svg {
    transform: rotate(90deg);
}

#msgForm {
    flex: 1;
    order: 1;
}

#message {
    flex: 1;
    border-radius: 0 !important;
    border-left: none !important;
    border-right: none !important;
}

.btn-tab {
    border-bottom-color: transparent !important;
    transition: all 0.3s ease;
}

.btn-tab.active {
    border-bottom-color: var(--btn-primary) !important;
    color: var(--btn-primary) !important;
}

.forum-stats-container {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 10px;
    margin: 10px 15px;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-row {
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin-bottom: 8px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: Auto;
}

.stat-icon {
    font-size: 1.4rem;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.stat-value {
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--text-primary, #fff);
    background: rgba(0, 0, 0, 0.2);
    padding: 2px 8px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

.stat-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    margin: 8px 0;
}

.sub-stats {
    gap: 5px;
}

.stat-item-small {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.stat-icon-sm {
    font-size: 1rem;
    opacity: 0.9;
}

.stat-value-sm {
    font-size: 0.75rem;
    color: var(--text-secondary, #ccc);
    font-weight: 600;
}

.stat-value, .stat-value-sm {
    transition: all 0.3s ease;
}

.stat-updated {
    transform: scale(1.2);
    color: #4ade80 !important;
}

.hamburger-icon {
    width: 24px;
    height: 18px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.bar {
    width: 100%;
    height: 3px;
    background-color: white;
    border-radius: 2px;
    transition: all 0.3s ease-in-out;
    transform-origin: center;
}

#menuToggle.active .top {
    transform: translateY(7.5px) rotate(45deg);
}

#menuToggle.active .middle {
    opacity: 0;
    transform: scaleX(0);
}

#menuToggle.active .bottom {
    transform: translateY(-7.5px) rotate(-45deg);
}