Spaces:
Running
Running
| <html lang="fa" dir="rtl"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Chat Room - Glassmorphism UI</title> | |
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> | |
| <style> | |
| :root { | |
| --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%); | |
| --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); | |
| --glass-bg: rgba(255, 255, 255, 0.15); | |
| --glass-bg-strong: rgba(255, 255, 255, 0.25); | |
| --glass-border: rgba(255, 255, 255, 0.3); | |
| --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37); | |
| --message-own-bg: linear-gradient(135deg, #667eea 0%, #764ba2 100%); | |
| --message-other-bg: rgba(255, 255, 255, 0.9); | |
| --message-own-color: #ffffff; | |
| --message-other-color: #2d3748; | |
| --text-primary: #1a202c; | |
| --text-secondary: #718096; | |
| --text-muted: #a0aec0; | |
| --online-color: #48bb78; | |
| --offline-color: #cbd5e0; | |
| --accent-color: #ed8936; | |
| --radius-sm: 0.5rem; | |
| --radius-md: 1rem; | |
| --radius-lg: 1.5rem; | |
| --radius-full: 9999px; | |
| } | |
| * { | |
| margin: 0; | |
| padding: 0; | |
| box-sizing: border-box; | |
| } | |
| body { | |
| font-family: 'Segoe UI', 'Vazirmatn', 'Tahoma', system-ui, -apple-system, sans-serif; | |
| background: var(--primary-gradient); | |
| background-attachment: fixed; | |
| height: 100vh; | |
| overflow: hidden; | |
| color: var(--text-primary); | |
| } | |
| /* Main Container */ | |
| .chat-page { | |
| height: 100vh; | |
| width: 100vw; | |
| overflow: hidden; | |
| } | |
| .chat-container { | |
| display: flex; | |
| height: 100vh; | |
| width: 100%; | |
| position: relative; | |
| background: rgba(0, 0, 0, 0.1); | |
| backdrop-filter: blur(20px); | |
| } | |
| /* Sidebar - Glassmorphism Panel */ | |
| .chat-sidebar { | |
| width: 320px; | |
| background: var(--glass-bg); | |
| backdrop-filter: blur(20px); | |
| -webkit-backdrop-filter: blur(20px); | |
| border-left: 1px solid var(--glass-border); | |
| display: flex; | |
| flex-direction: column; | |
| box-shadow: var(--glass-shadow); | |
| z-index: 10; | |
| transition: transform 0.3s ease; | |
| } | |
| .sidebar-header { | |
| padding: 1.5rem; | |
| background: var(--glass-bg-strong); | |
| backdrop-filter: blur(20px); | |
| border-bottom: 1px solid var(--glass-border); | |
| display: flex; | |
| flex-direction: column; | |
| gap: 0.5rem; | |
| } | |
| .sidebar-header h3 { | |
| color: white; | |
| font-size: 1.25rem; | |
| font-weight: 600; | |
| display: flex; | |
| align-items: center; | |
| gap: 0.75rem; | |
| text-shadow: 0 2px 4px rgba(0,0,0,0.1); | |
| } | |
| .sidebar-header h3 i { | |
| font-size: 1.1rem; | |
| opacity: 0.9; | |
| } | |
| .room-name { | |
| color: rgba(255, 255, 255, 0.8); | |
| font-size: 0.875rem; | |
| font-weight: 500; | |
| padding-right: 2rem; | |
| } | |
| .users-list { | |
| flex: 1; | |
| overflow-y: auto; | |
| padding: 1rem; | |
| display: flex; | |
| flex-direction: column; | |
| gap: 0.75rem; | |
| } | |
| .users-list::-webkit-scrollbar { | |
| width: 6px; | |
| } | |
| .users-list::-webkit-scrollbar-track { | |
| background: rgba(255,255,255,0.1); | |
| } | |
| .users-list::-webkit-scrollbar-thumb { | |
| background: rgba(255,255,255,0.3); | |
| border-radius: var(--radius-full); | |
| } | |
| .user-item { | |
| display: flex; | |
| align-items: center; | |
| gap: 0.875rem; | |
| padding: 0.875rem; | |
| background: rgba(255, 255, 255, 0.1); | |
| border-radius: var(--radius-md); | |
| border: 1px solid rgba(255, 255, 255, 0.1); | |
| transition: all 0.3s ease; | |
| cursor: pointer; | |
| } | |
| .user-item:hover { | |
| background: rgba(255, 255, 255, 0.2); | |
| transform: translateX(-4px); | |
| box-shadow: 0 4px 12px rgba(0,0,0,0.1); | |
| } | |
| .user-avatar { | |
| width: 40px; | |
| height: 40px; | |
| border-radius: 50%; | |
| background: var(--secondary-gradient); | |
| display: flex; | |
| align-items: center; | |
| justify-content: center; | |
| color: white; | |
| font-size: 1.25rem; | |
| flex-shrink: 0; | |
| box-shadow: 0 2px 8px rgba(0,0,0,0.2); | |
| } | |
| .user-info { | |
| display: flex; | |
| flex-direction: column; | |
| gap: 0.25rem; | |
| flex: 1; | |
| } | |
| .user-name { | |
| color: white; | |
| font-weight: 600; | |
| font-size: 0.9375rem; | |
| } | |
| .user-status { | |
| font-size: 0.75rem; | |
| display: flex; | |
| align-items: center; | |
| gap: 0.375rem; | |
| font-weight: 500; | |
| } | |
| .user-status.online { | |
| color: var(--online-color); | |
| } | |
| .user-status.offline { | |
| color: var(--text-muted); | |
| } | |
| .user-status i { | |
| font-size: 0.5rem; | |
| } | |
| .sidebar-footer { | |
| padding: 1.25rem; | |
| border-top: 1px solid var(--glass-border); | |
| background: rgba(0,0,0,0.1); | |
| } | |
| /* Main Chat Area */ | |
| .chat-main { | |
| flex: 1; | |
| display: flex; | |
| flex-direction: column; | |
| background: rgba(248, 249, 250, 0.85); | |
| backdrop-filter: blur(10px); | |
| position: relative; | |
| overflow: hidden; | |
| } | |
| .chat-header { | |
| background: var(--glass-bg); | |
| backdrop-filter: blur(20px); | |
| border-bottom: 1px solid var(--glass-border); | |
| padding: 1.25rem 1.5rem; | |
| display: flex; | |
| justify-content: space-between; | |
| align-items: center; | |
| box-shadow: 0 4px 20px rgba(0,0,0,0.05); | |
| z-index: 5; | |
| } | |
| .header-info h1 { | |
| font-size: 1.5rem; | |
| font-weight: 700; | |
| color: white; | |
| display: flex; | |
| align-items: center; | |
| gap: 0.75rem; | |
| margin-bottom: 0.25rem; | |
| text-shadow: 0 2px 4px rgba(0,0,0,0.1); | |
| } | |
| .header-info p { | |
| color: rgba(255,255,255,0.8); | |
| font-size: 0.875rem; | |
| font-weight: 500; | |
| } | |
| .header-actions { | |
| display: flex; | |
| gap: 0.75rem; | |
| } | |
| /* Buttons */ | |
| .btn { | |
| padding: 0.625rem 1.25rem; | |
| border: none; | |
| border-radius: var(--radius-md); | |
| font-family: inherit; | |
| font-size: 0.875rem; | |
| font-weight: 600; | |
| cursor: pointer; | |
| display: inline-flex; | |
| align-items: center; | |
| gap: 0.5rem; | |
| transition: all 0.3s ease; | |
| backdrop-filter: blur(10px); | |
| border: 1px solid rgba(255,255,255,0.2); | |
| box-shadow: 0 4px 6px rgba(0,0,0,0.1); | |
| } | |
| .btn-primary { | |
| background: rgba(255,255,255,0.9); | |
| color: #667eea; | |
| } | |
| .btn-primary:hover { | |
| transform: translateY(-2px); | |
| box-shadow: 0 6px 20px rgba(0,0,0,0.2); | |
| background: white; | |
| } | |
| .btn-secondary { | |
| background: rgba(255,255,255,0.1); | |
| color: white; | |
| } | |
| .btn-secondary:hover { | |
| background: rgba(255,255,255,0.2); | |
| transform: translateY(-2px); | |
| } | |
| .btn-icon { | |
| width: 36px; | |
| height: 36px; | |
| border-radius: 50%; | |
| border: none; | |
| background: rgba(255,255,255,0.2); | |
| color: white; | |
| font-size: 1.125rem; | |
| cursor: pointer; | |
| display: inline-flex; | |
| align-items: center; | |
| justify-content: center; | |
| transition: all 0.2s ease; | |
| backdrop-filter: blur(10px); | |
| } | |
| .btn-icon:hover { | |
| background: rgba(255,255,255,0.3); | |
| transform: scale(1.1); | |
| } | |
| /* Messages Area */ | |
| .chat-messages { | |
| flex: 1; | |
| overflow-y: auto; | |
| padding: 1.5rem; | |
| display: flex; | |
| flex-direction: column; | |
| gap: 1rem; | |
| background: rgba(255,255,255,0.05); | |
| } | |
| .chat-messages::-webkit-scrollbar { | |
| width: 8px; | |
| } | |
| .chat-messages::-webkit-scrollbar-track { | |
| background: rgba(0,0,0,0.05); | |
| border-radius: var(--radius-full); | |
| } | |
| .chat-messages::-webkit-scrollbar-thumb { | |
| background: rgba(102, 126, 234, 0.5); | |
| border-radius: var(--radius-full); | |
| } | |
| .chat-messages::-webkit-scrollbar-thumb:hover { | |
| background: rgba(102, 126, 234, 0.7); | |
| } | |
| /* Message Bubbles */ | |
| .message { | |
| max-width: 70%; | |
| min-width: 200px; | |
| padding: 0.875rem 1.125rem; | |
| border-radius: var(--radius-lg); | |
| position: relative; | |
| animation: messageSlide 0.3s cubic-bezier(0.4, 0, 0.2, 1); | |
| box-shadow: 0 4px 15px rgba(0,0,0,0.1); | |
| transition: transform 0.2s ease; | |
| } | |
| @keyframes messageSlide { | |
| from { | |
| opacity: 0; | |
| transform: translateY(20px) scale(0.95); | |
| } | |
| to { | |
| opacity: 1; | |
| transform: translateY(0) scale(1); | |
| } | |
| } | |
| .message:hover { | |
| transform: translateY(-2px); | |
| box-shadow: 0 6px 20px rgba(0,0,0,0.15); | |
| } | |
| /* Own Messages - Right Side (RTL: flex-start) */ | |
| .message.own { | |
| align-self: flex-start; | |
| background: var(--message-own-bg); | |
| color: var(--message-own-color); | |
| border-bottom-right-radius: 0.375rem; | |
| margin-left: 2rem; | |
| } | |
| /* Other Messages - Left Side (RTL: flex-end) */ | |
| .message:not(.own) { | |
| align-self: flex-end; | |
| background: var(--message-other-bg); | |
| color: var(--message-other-color); | |
| border-bottom-left-radius: 0.375rem; | |
| margin-right: 2rem; | |
| } | |
| .message-header { | |
| display: flex; | |
| align-items: center; | |
| gap: 0.75rem; | |
| margin-bottom: 0.5rem; | |
| font-size: 0.8125rem; | |
| opacity: 0.9; | |
| } | |
| .message-sender { | |
| font-weight: 700; | |
| } | |
| .message-time { | |
| font-size: 0.75rem; | |
| opacity: 0.8; | |
| font-weight: 500; | |
| } | |
| .message-content { | |
| font-size: 0.9375rem; | |
| line-height: 1.5; | |
| word-wrap: break-word; | |
| } | |
| .message-actions-admin { | |
| margin-right: auto; | |
| display: flex; | |
| gap: 0.5rem; | |
| } | |
| .message-actions-admin button { | |
| background: rgba(255,255,255,0.2); | |
| border: none; | |
| color: inherit; | |
| width: 24px; | |
| height: 24px; | |
| border-radius: 50%; | |
| cursor: pointer; | |
| display: flex; | |
| align-items: center; | |
| justify-content: center; | |
| font-size: 0.75rem; | |
| opacity: 0; | |
| transition: all 0.2s ease; | |
| } | |
| .message:hover .message-actions-admin button { | |
| opacity: 1; | |
| } | |
| .message-actions-admin button:hover { | |
| background: rgba(245, 87, 108, 0.9); | |
| color: white; | |
| transform: scale(1.1); | |
| } | |
| /* Temp Message */ | |
| .temp-message { | |
| opacity: 0.7; | |
| } | |
| .sending-status { | |
| font-size: 0.75rem; | |
| margin-right: auto; | |
| display: flex; | |
| align-items: center; | |
| gap: 0.25rem; | |
| } | |
| /* Input Area */ | |
| .chat-footer { | |
| background: var(--glass-bg); | |
| backdrop-filter: blur(20px); | |
| border-top: 1px solid var(--glass-border); | |
| padding: 1.25rem 1.5rem; | |
| box-shadow: 0 -4px 20px rgba(0,0,0,0.05); | |
| } | |
| #message-form { | |
| display: flex; | |
| flex-direction: column; | |
| gap: 0.75rem; | |
| } | |
| .message-input { | |
| display: flex; | |
| gap: 0.75rem; | |
| align-items: center; | |
| } | |
| #message-input { | |
| flex: 1; | |
| padding: 0.875rem 1.25rem; | |
| border: 2px solid rgba(255,255,255,0.2); | |
| border-radius: var(--radius-full); | |
| background: rgba(255,255,255,0.9); | |
| font-family: inherit; | |
| font-size: 0.9375rem; | |
| color: var(--text-primary); | |
| outline: none; | |
| transition: all 0.3s ease; | |
| box-shadow: 0 2px 8px rgba(0,0,0,0.05); | |
| } | |
| #message-input:focus { | |
| border-color: rgba(102, 126, 234, 0.5); | |
| box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1); | |
| background: white; | |
| } | |
| #message-input::placeholder { | |
| color: var(--text-muted); | |
| } | |
| .message-actions { | |
| display: flex; | |
| gap: 0.5rem; | |
| padding: 0 0.5rem; | |
| } | |
| /* Loading & Empty States */ | |
| .loading, .empty-state, .error-state { | |
| text-align: center; | |
| padding: 3rem; | |
| color: var(--text-secondary); | |
| display: flex; | |
| flex-direction: column; | |
| align-items: center; | |
| gap: 1rem; | |
| background: rgba(255,255,255,0.1); | |
| border-radius: var(--radius-lg); | |
| backdrop-filter: blur(10px); | |
| margin: 2rem; | |
| border: 1px solid var(--glass-border); | |
| } | |
| .loading::before { | |
| content: ''; | |
| width: 40px; | |
| height: 40px; | |
| border: 3px solid rgba(255,255,255,0.3); | |
| border-top-color: white; | |
| border-radius: 50%; | |
| animation: spin 1s linear infinite; | |
| } | |
| @keyframes spin { | |
| to { transform: rotate(360deg); } | |
| } | |
| .empty-state i, .error-state i { | |
| font-size: 3rem; | |
| color: rgba(255,255,255,0.5); | |
| margin-bottom: 0.5rem; | |
| } | |
| .error-state i { | |
| color: #f5576c; | |
| } | |
| .small-text { | |
| font-size: 0.875rem; | |
| opacity: 0.8; | |
| } | |
| /* Alerts */ | |
| .alert { | |
| padding: 1rem 1.5rem; | |
| border-radius: var(--radius-md); | |
| color: white; | |
| font-weight: 600; | |
| display: flex; | |
| align-items: center; | |
| gap: 0.75rem; | |
| box-shadow: 0 10px 25px rgba(0,0,0,0.2); | |
| backdrop-filter: blur(10px); | |
| border: 1px solid rgba(255,255,255,0.2); | |
| animation: slideDown 0.3s ease; | |
| } | |
| @keyframes slideDown { | |
| from { | |
| opacity: 0; | |
| transform: translateY(-20px); | |
| } | |
| to { | |
| opacity: 1; | |
| transform: translateY(0); | |
| } | |
| } | |
| .alert.success { | |
| background: rgba(72, 187, 120, 0.9); | |
| } | |
| .alert.error { | |
| background: rgba(245, 87, 108, 0.9); | |
| } | |
| /* Responsive Design */ | |
| @media (max-width: 968px) { | |
| .chat-sidebar { | |
| position: fixed; | |
| right: -320px; | |
| top: 0; | |
| height: 100vh; | |
| transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1); | |
| } | |
| .chat-sidebar.active { | |
| right: 0; | |
| } | |
| .message { | |
| max-width: 85%; | |
| } | |
| .header-actions { | |
| flex-wrap: wrap; | |
| gap: 0.5rem; | |
| } | |
| .btn { | |
| padding: 0.5rem 1rem; | |
| font-size: 0.8125rem; | |
| } | |
| } | |
| @media (max-width: 640px) { | |
| .chat-header { | |
| padding: 1rem; | |
| } | |
| .header-info h1 { | |
| font-size: 1.125rem; | |
| } | |
| .chat-messages { | |
| padding: 1rem; | |
| } | |
| .message { | |
| max-width: 90%; | |
| min-width: auto; | |
| margin-left: 0.5rem; | |
| margin-right: 0.5rem; | |
| } | |
| .chat-footer { | |
| padding: 1rem; | |
| } | |
| #message-input { | |
| padding: 0.75rem 1rem; | |
| } | |
| } | |
| /* Print Styles */ | |
| @media print { | |
| .chat-sidebar, .chat-footer, .header-actions { | |
| display: none; | |
| } | |
| .chat-main { | |
| background: white; | |
| } | |
| .message { | |
| break-inside: avoid; | |
| box-shadow: none; | |
| border: 1px solid #ddd; | |
| } | |
| } | |
| /* Reduced Motion */ | |
| @media (prefers-reduced-motion: reduce) { | |
| * { | |
| animation-duration: 0.01ms ; | |
| animation-iteration-count: 1 ; | |
| transition-duration: 0.01ms ; | |
| } | |
| } | |
| /* Dark Mode Support (System Preference) */ | |
| @media (prefers-color-scheme: dark) { | |
| :root { | |
| --message-other-bg: rgba(30, 41, 59, 0.9); | |
| --message-other-color: #e2e8f0; | |
| --text-primary: #f7fafc; | |
| } | |
| .chat-main { | |
| background: rgba(15, 23, 42, 0.85); | |
| } | |
| } | |
| </style> | |
| </head> | |
| <body class="chat-page"> | |
| <div style="position: fixed; top: 20px; left: 20px; z-index: 9999; background: rgba(255,255,255,0.2); backdrop-filter: blur(10px); padding: 8px 16px; border-radius: 20px; border: 1px solid rgba(255,255,255,0.3); font-size: 0.875rem; color: white; font-weight: 600;"> | |
| <a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank" style="color: white; text-decoration: none; display: flex; align-items: center; gap: 8px;"> | |
| <i class="fas fa-code"></i> Built with anycoder | |
| </a> | |
| </div> | |
| <div class="chat-container"> | |
| <aside class="chat-sidebar"> | |
| <div class="sidebar-header"> | |
| <h3><i class="fas fa-users"></i> کاربران آنلاین</h3> | |
| <span class="room-name">اتاق گفتگوی اصلی</span> | |
| </div> | |
| <div class="users-list" id="users-list"> | |
| <div class="loading">در حال بارگذاری...</div> | |
| </div> | |
| <div class="sidebar-footer"> | |
| <a href="dashboard.php" class="btn btn-secondary" style="width: 100%; justify-content: center;"> | |
| <i class="fas fa-arrow-right"></i> بازگشت | |
| </a> | |
| </div> | |
| </aside> | |
| <main class="chat-main"> | |
| <header class="chat-header"> | |
| <div class="header-info"> | |
| <h1><i class="fas fa-comments"></i> اتاق گفتگو</h1> | |
| <p>گفتگوی زنده با کاربران</p> | |
| </div> | |
| <div class="header-actions"> | |
| <button class="btn btn-primary" onclick="clearChat()"> | |
| <i class="fas fa-trash"></i> پاک کردن چت | |
| </button> | |
| <button class="btn btn-secondary" onclick="leaveRoom()"> | |
| <i class="fas fa-sign-out-alt"></i> ترک اتاق | |
| </button> | |
| </div> | |
| </header> | |
| <div class="chat-messages" id="chat-messages"> | |
| <div class="loading">در حال بارگذاری پیامها...</div> | |
| </div> | |
| <footer class="chat-footer"> | |
| <form id="message-form"> | |
| <div class="message-input"> | |
| <input type="text" id="message-input" placeholder="پیام خود را بنویسید..." autocomplete="off"> | |
| <button type="submit" class="btn btn-primary"> | |
| <i class="fas fa-paper-plane"></i> ارسال | |
| </button> | |
| </div> | |
| <div class="message-actions"> | |
| <button type="button" class="btn-icon" onclick="insertEmoji('😊')">😊</button> | |
| <button type="button" class="btn-icon" onclick="insertEmoji('😂')">😂</button> | |
| <button type="button" class="btn-icon" onclick="insertEmoji('❤️')">❤️</button> | |
| <button type="button" class="btn-icon" onclick="insertEmoji('👍')">👍</button> | |
| </div> | |
| </form> | |
| </footer> | |
| </main> | |
| </div> | |
| </body> | |
| </html> |