Spaces:
Running
Running
| <html lang="fa" dir="rtl"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover"> | |
| <title>پیام رسان مینیمال | MinimalChat</title> | |
| <link href="https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;700&display=swap" rel="stylesheet"> | |
| <style> | |
| :root { | |
| --primary: #3b82f6; | |
| --primary-dark: #2563eb; | |
| --bg-dark: #0f172a; | |
| --bg-card: rgba(30, 41, 59, 0.8); | |
| --glass: rgba(255, 255, 255, 0.08); | |
| --glass-border: rgba(255, 255, 255, 0.1); | |
| --text-primary: #f8fafc; | |
| --text-secondary: rgba(248, 250, 252, 0.6); | |
| --text-muted: rgba(248, 250, 252, 0.4); | |
| --success: #22c55e; | |
| --error: #ef4444; | |
| --warning: #f59e0b; | |
| } | |
| * { | |
| margin: 0; | |
| padding: 0; | |
| box-sizing: border-box; | |
| } | |
| body { | |
| font-family: 'Vazirmatn', sans-serif; | |
| background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #1e1b4b 100%); | |
| background-attachment: fixed; | |
| color: var(--text-primary); | |
| height: 100vh; | |
| height: 100dvh; | |
| overflow: hidden; | |
| -webkit-tap-highlight-color: transparent; | |
| } | |
| /* Utility Classes */ | |
| .glass-panel { | |
| background: var(--glass); | |
| backdrop-filter: blur(12px); | |
| -webkit-backdrop-filter: blur(12px); | |
| border: 1px solid var(--glass-border); | |
| } | |
| .hidden { display: none ; } | |
| .flex { display: flex; } | |
| .flex-col { flex-direction: column; } | |
| .flex-1 { flex: 1; } | |
| .items-center { align-items: center; } | |
| .justify-center { justify-content: center; } | |
| .justify-between { justify-content: space-between; } | |
| .gap-2 { gap: 0.5rem; } | |
| .gap-3 { gap: 0.75rem; } | |
| .gap-4 { gap: 1rem; } | |
| .w-full { width: 100%; } | |
| .h-full { height: 100%; } | |
| .min-w-0 { min-width: 0; } | |
| .p-2 { padding: 0.5rem; } | |
| .p-3 { padding: 0.75rem; } | |
| .p-4 { padding: 1rem; } | |
| .p-6 { padding: 1.5rem; } | |
| .px-4 { padding-left: 1rem; padding-right: 1rem; } | |
| .py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; } | |
| .py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; } | |
| .m-0 { margin: 0; } | |
| .mb-1 { margin-bottom: 0.25rem; } | |
| .mb-2 { margin-bottom: 0.5rem; } | |
| .mb-3 { margin-bottom: 0.75rem; } | |
| .mb-4 { margin-bottom: 1rem; } | |
| .mb-6 { margin-bottom: 1.5rem; } | |
| .mb-8 { margin-bottom: 2rem; } | |
| .mt-1 { margin-top: 0.25rem; } | |
| .mt-2 { margin-top: 0.5rem; } | |
| .mt-4 { margin-top: 1rem; } | |
| .mt-6 { margin-top: 1.5rem; } | |
| .mt-8 { margin-top: 2rem; } | |
| .mt-10 { margin-top: 2.5rem; } | |
| .mr-1 { margin-right: 0.25rem; } | |
| .mr-2 { margin-right: 0.5rem; } | |
| .ml-1 { margin-left: 0.25rem; } | |
| .ml-2 { margin-left: 0.5rem; } | |
| .mx-auto { margin-left: auto; margin-right: auto; } | |
| .text-center { text-align: center; } | |
| .text-xs { font-size: 0.75rem; } | |
| .text-sm { font-size: 0.875rem; } | |
| .text-base { font-size: 1rem; } | |
| .text-lg { font-size: 1.125rem; } | |
| .text-xl { font-size: 1.25rem; } | |
| .text-2xl { font-size: 1.5rem; } | |
| .text-3xl { font-size: 1.875rem; } | |
| .font-light { font-weight: 300; } | |
| .font-medium { font-weight: 500; } | |
| .font-bold { font-weight: 700; } | |
| .truncate { | |
| overflow: hidden; | |
| text-overflow: ellipsis; | |
| white-space: nowrap; | |
| } | |
| .rounded-full { border-radius: 9999px; } | |
| .rounded-lg { border-radius: 0.5rem; } | |
| .rounded-xl { border-radius: 0.75rem; } | |
| .rounded-2xl { border-radius: 1rem; } | |
| .border-b { border-bottom: 1px solid; } | |
| .border-t { border-top: 1px solid; } | |
| .border { border: 1px solid; } | |
| .border-dashed { border-style: dashed; } | |
| .border-white\/10 { border-color: rgba(255,255,255,0.1); } | |
| .border-white\/20 { border-color: rgba(255,255,255,0.2); } | |
| .bg-white { background-color: #fff; } | |
| .bg-white\/5 { background-color: rgba(255,255,255,0.05); } | |
| .bg-white\/10 { background-color: rgba(255,255,255,0.1); } | |
| .bg-blue-600 { background-color: var(--primary); } | |
| .bg-green-500\/20 { background-color: rgba(34,197,94,0.2); } | |
| .bg-red-500\/20 { background-color: rgba(239,68,68,0.2); } | |
| .bg-slate-900 { background-color: #0f172a; } | |
| .bg-slate-900\/20 { background-color: rgba(15,23,42,0.2); } | |
| .bg-slate-900\/90 { background-color: rgba(15,23,42,0.9); } | |
| .bg-slate-900\/95 { background-color: rgba(15,23,42,0.95); } | |
| .text-white { color: #fff; } | |
| .text-white\/30 { color: rgba(255,255,255,0.3); } | |
| .text-white\/40 { color: rgba(255,255,255,0.4); } | |
| .text-white\/50 { color: rgba(255,255,255,0.5); } | |
| .text-white\/60 { color: rgba(255,255,255,0.6); } | |
| .text-white\/70 { color: rgba(255,255,255,0.7); } | |
| .text-white\/80 { color: rgba(255,255,255,0.8); } | |
| .text-slate-900 { color: #0f172a; } | |
| .text-blue-300 { color: #93c5fd; } | |
| .text-indigo-300 { color: #a5b4fc; } | |
| .text-green-200 { color: #bbf7d0; } | |
| .text-green-500 { color: #22c55e; } | |
| .text-red-200 { color: #fecaca; } | |
| .text-red-400 { color: #f87171; } | |
| .shadow-lg { box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1); } | |
| .cursor-pointer { cursor: pointer; } | |
| .pointer-events-none { pointer-events: none; } | |
| .pointer-events-auto { pointer-events: auto; } | |
| .overflow-hidden { overflow: hidden; } | |
| .overflow-y-auto { overflow-y: auto; } | |
| .overflow-x-hidden { overflow-x: hidden; } | |
| .relative { position: relative; } | |
| .absolute { position: absolute; } | |
| .fixed { position: fixed; } | |
| .inset-0 { top: 0; right: 0; bottom: 0; left: 0; } | |
| .top-0 { top: 0; } | |
| .top-4 { top: 1rem; } | |
| .right-0 { right: 0; } | |
| .bottom-0 { bottom: 0; } | |
| .left-0 { left: 0; } | |
| .left-1\/2 { left: 50%; } | |
| .z-20 { z-index: 20; } | |
| .z-30 { z-index: 30; } | |
| .z-35 { z-index: 35; } | |
| .z-40 { z-index: 40; } | |
| .z-50 { z-index: 50; } | |
| .transform { transform: translateX(-50%); } | |
| /* Custom Styles */ | |
| .input-minimal { | |
| background: transparent; | |
| border: none; | |
| border-bottom: 1px solid rgba(255,255,255,0.2); | |
| transition: all 0.3s; | |
| width: 100%; | |
| color: #fff; | |
| padding: 0.75rem 0; | |
| } | |
| .input-minimal:focus { | |
| border-color: rgba(255,255,255,0.6); | |
| outline: none; | |
| } | |
| .input-minimal::placeholder { | |
| color: rgba(255,255,255,0.3); | |
| } | |
| .message-bubble-me { | |
| background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%); | |
| border-radius: 16px 16px 4px 16px; | |
| } | |
| .message-bubble-other { | |
| background: rgba(255,255,255,0.12); | |
| border-radius: 16px 16px 16px 4px; | |
| } | |
| .fade-in { | |
| animation: fadeIn 0.3s ease-out; | |
| } | |
| @keyframes fadeIn { | |
| from { opacity: 0; transform: translateY(10px); } | |
| to { opacity: 1; transform: translateY(0); } | |
| } | |
| .message-enter { | |
| animation: messagePop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); | |
| } | |
| @keyframes messagePop { | |
| 0% { opacity: 0; transform: scale(0.8) translateY(20px); } | |
| 100% { opacity: 1; transform: scale(1) translateY(0); } | |
| } | |
| .slide-in { | |
| animation: slideIn 0.3s ease-out; | |
| } | |
| @keyframes slideIn { | |
| from { transform: translateX(100%); } | |
| to { transform: translateX(0); } | |
| } | |
| /* Scrollbar */ | |
| ::-webkit-scrollbar { | |
| width: 4px; | |
| height: 4px; | |
| } | |
| ::-webkit-scrollbar-track { | |
| background: transparent; | |
| } | |
| ::-webkit-scrollbar-thumb { | |
| background: rgba(255,255,255,0.2); | |
| border-radius: 4px; | |
| } | |
| ::-webkit-scrollbar-thumb:hover { | |
| background: rgba(255,255,255,0.3); | |
| } | |
| /* Touch targets */ | |
| .touch-target { | |
| min-height: 44px; | |
| min-width: 44px; | |
| } | |
| /* Mobile optimizations */ | |
| @media (max-width: 768px) { | |
| .mobile-sidebar { | |
| position: fixed; | |
| top: 0; | |
| right: 0; | |
| height: 100vh; | |
| height: 100dvh; | |
| width: 85%; | |
| max-width: 300px; | |
| z-index: 40; | |
| transform: translateX(100%); | |
| transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); | |
| } | |
| .mobile-sidebar.open { | |
| transform: translateX(0); | |
| } | |
| .sidebar-overlay { | |
| position: fixed; | |
| inset: 0; | |
| background: rgba(0,0,0,0.5); | |
| backdrop-filter: blur(4px); | |
| z-index: 35; | |
| opacity: 0; | |
| pointer-events: none; | |
| transition: opacity 0.3s; | |
| } | |
| .sidebar-overlay.active { | |
| opacity: 1; | |
| pointer-events: auto; | |
| } | |
| .chat-container { | |
| position: fixed; | |
| inset: 0; | |
| z-index: 30; | |
| } | |
| .safe-bottom { | |
| padding-bottom: env(safe-area-inset-bottom, 20px); | |
| } | |
| input, textarea, select { | |
| font-size: 16px; | |
| } | |
| } | |
| /* Sticker Picker */ | |
| .sticker-picker { | |
| position: absolute; | |
| bottom: 100%; | |
| left: 0; | |
| right: 0; | |
| background: rgba(15, 23, 42, 0.95); | |
| backdrop-filter: blur(12px); | |
| border-top: 1px solid rgba(255,255,255,0.1); | |
| border-radius: 16px 16px 0 0; | |
| max-height: 280px; | |
| overflow-y: auto; | |
| transform: translateY(100%); | |
| transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); | |
| } | |
| .sticker-picker.open { | |
| transform: translateY(0); | |
| } | |
| .sticker-item { | |
| width: 64px; | |
| height: 64px; | |
| display: flex; | |
| align-items: center; | |
| justify-content: center; | |
| cursor: pointer; | |
| border-radius: 8px; | |
| transition: all 0.2s; | |
| font-size: 32px; | |
| } | |
| .sticker-item:hover { | |
| background: rgba(255,255,255,0.1); | |
| transform: scale(1.1); | |
| } | |
| /* Avatar colors */ | |
| .avatar-red { background: #ef444420; color: #fca5a5; } | |
| .avatar-blue { background: #3b82f620; color: #93c5fd; } | |
| .avatar-green { background: #22c55e20; color: #86efac; } | |
| .avatar-yellow { background: #eab30820; color: #fde047; } | |
| .avatar-purple { background: #a855f720; color: #d8b4fe; } | |
| .avatar-pink { background: #ec489920; color: #f9a8d4; } | |
| .avatar-orange { background: #f9731620; color: #fdba74; } | |
| .avatar-cyan { background: #06b6d420; color: #67e8f9; } | |
| /* Room avatar */ | |
| .room-avatar { | |
| width: 80px; | |
| height: 80px; | |
| border-radius: 50%; | |
| display: flex; | |
| align-items: center; | |
| justify-content: center; | |
| font-size: 2rem; | |
| font-weight: bold; | |
| border: 3px solid rgba(255,255,255,0.2); | |
| } | |
| /* Button hover effects */ | |
| .btn-hover:hover { | |
| background: rgba(255,255,255,0.1); | |
| } | |
| .btn-active:active { | |
| transform: scale(0.95); | |
| } | |
| /* Loading shimmer */ | |
| .shimmer { | |
| background: linear-gradient(90deg, rgba(255,255,255,0.05) 25%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.05) 75%); | |
| background-size: 200% 100%; | |
| animation: shimmer 1.5s infinite; | |
| } | |
| @keyframes shimmer { | |
| 0% { background-position: 200% 0; } | |
| 100% { background-position: -200% 0; } | |
| } | |
| /* Menu dropdown */ | |
| .menu-dropdown { | |
| position: absolute; | |
| top: 100%; | |
| left: 0; | |
| background: rgba(15, 23, 42, 0.95); | |
| backdrop-filter: blur(12px); | |
| border: 1px solid rgba(255,255,255,0.1); | |
| border-radius: 12px; | |
| min-width: 160px; | |
| padding: 0.5rem; | |
| opacity: 0; | |
| visibility: hidden; | |
| transform: translateY(-10px); | |
| transition: all 0.2s; | |
| z-index: 100; | |
| } | |
| .menu-dropdown.open { | |
| opacity: 1; | |
| visibility: visible; | |
| transform: translateY(0); | |
| } | |
| .menu-item { | |
| padding: 0.75rem 1rem; | |
| border-radius: 8px; | |
| cursor: pointer; | |
| display: flex; | |
| align-items: center; | |
| gap: 0.75rem; | |
| transition: all 0.2s; | |
| } | |
| .menu-item:hover { | |
| background: rgba(255,255,255,0.1); | |
| } | |
| .menu-item.danger { | |
| color: #f87171; | |
| } | |
| .menu-item.danger:hover { | |
| background: rgba(239,68,68,0.2); | |
| } | |
| /* Color picker */ | |
| .color-option { | |
| width: 40px; | |
| height: 40px; | |
| border-radius: 50%; | |
| cursor: pointer; | |
| border: 3px solid transparent; | |
| transition: all 0.2s; | |
| } | |
| .color-option:hover { | |
| transform: scale(1.1); | |
| } | |
| .color-option.selected { | |
| border-color: #fff; | |
| box-shadow: 0 0 0 2px rgba(255,255,255,0.3); | |
| } | |
| /* Built with badge */ | |
| .built-with { | |
| position: fixed; | |
| top: 12px; | |
| left: 12px; | |
| z-index: 1000; | |
| background: rgba(255,255,255,0.1); | |
| backdrop-filter: blur(8px); | |
| padding: 6px 12px; | |
| border-radius: 20px; | |
| font-size: 11px; | |
| color: rgba(255,255,255,0.7); | |
| text-decoration: none; | |
| border: 1px solid rgba(255,255,255,0.1); | |
| transition: all 0.2s; | |
| } | |
| .built-with:hover { | |
| background: rgba(255,255,255,0.15); | |
| color: #fff; | |
| } | |
| /* Sticker display in chat */ | |
| .sticker-message { | |
| font-size: 48px; | |
| line-height: 1; | |
| padding: 8px; | |
| } | |
| /* Profile avatar options */ | |
| .avatar-option { | |
| width: 56px; | |
| height: 56px; | |
| border-radius: 50%; | |
| display: flex; | |
| align-items: center; | |
| justify-content: center; | |
| font-size: 24px; | |
| cursor: pointer; | |
| border: 3px solid transparent; | |
| transition: all 0.2s; | |
| } | |
| .avatar-option:hover { | |
| transform: scale(1.05); | |
| } | |
| .avatar-option.selected { | |
| border-color: #3b82f6; | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <!-- Built with badge --> | |
| <a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank" class="built-with">Built with anycoder</a> | |
| <!-- Toast Container --> | |
| <div id="toast-container" class="fixed top-4 left-1/2 z-50 flex flex-col gap-2 w-full max-w-sm px-4 pointer-events-none" style="transform: translateX(-50%);"> | |
| </div> | |
| <!-- Auth View --> | |
| <div id="auth-view" class="h-full w-full flex items-center justify-center p-4 overflow-y-auto"> | |
| <div class="glass-panel p-6 rounded-2xl w-full max-w-md fade-in my-auto"> | |
| <div class="text-center mb-8"> | |
| <div class="w-16 h-16 bg-white/10 rounded-full mx-auto flex items-center justify-center mb-4"> | |
| <svg width="28" height="28" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> | |
| <path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"></path> | |
| </svg> | |
| </div> | |
| <h1 class="text-2xl font-bold">پیام رسان مینیمال</h1> | |
| <p class="text-white/50 text-sm mt-1">پیام رسان مینیمال با JavaScript</p> | |
| </div> | |
| <!-- Tabs --> | |
| <div class="flex gap-4 mb-6 border-b border-white/10 pb-1"> | |
| <button onclick="switchAuthTab('login')" id="tab-login" class="flex-1 pb-2 text-sm font-medium border-b-2 border-white text-white transition-colors touch-target flex items-center justify-center">ورود</button> | |
| <button onclick="switchAuthTab('register')" id="tab-register" class="flex-1 pb-2 text-sm font-medium border-b-2 border-transparent text-white/50 hover:text-white transition-colors touch-target flex items-center justify-center">ثبت نام</button> | |
| </div> | |
| <!-- Login Form --> | |
| <form id="login-form" class="space-y-5" onsubmit="handleLogin(event)"> | |
| <div> | |
| <label class="block text-xs text-white/60 mb-2">شماره موبایل</label> | |
| <input type="tel" id="login-phone" placeholder="09XXXXXXXXX" inputmode="tel" class="input-minimal touch-target" required> | |
| </div> | |
| <div> | |
| <label class="block text-xs text-white/60 mb-2">رمز عبور</label> | |
| <input type="password" id="login-password" placeholder="••••••••" class="input-minimal touch-target" required> | |
| </div> | |
| <button type="submit" class="w-full bg-white text-slate-900 font-bold py-3 rounded-lg hover:bg-white/90 transition-colors mt-4 touch-target btn-active"> | |
| ورود | |
| </button> | |
| </form> | |
| <!-- Register Form --> | |
| <form id="register-form" class="space-y-5 hidden" onsubmit="handleRegister(event)"> | |
| <div> | |
| <label class="block text-xs text-white/60 mb-2">نام کامل</label> | |
| <input type="text" id="reg-name" placeholder="نام شما" class="input-minimal touch-target" required> | |
| </div> | |
| <div> | |
| <label class="block text-xs text-white/60 mb-2">شماره موبایل</label> | |
| <input type="tel" id="reg-phone" placeholder="09XXXXXXXXX" inputmode="tel" class="input-minimal touch-target" required> | |
| </div> | |
| <div> | |
| <label class="block text-xs text-white/60 mb-2">رمز عبور</label> | |
| <input type="password" id="reg-password" placeholder="حداقل ۴ کاراکتر" class="input-minimal touch-target" required> | |
| </div> | |
| <button type="submit" class="w-full bg-white text-slate-900 font-bold py-3 rounded-lg hover:bg-white/90 transition-colors mt-4 touch-target btn-active"> | |
| ثبت نام | |
| </button> | |
| </form> | |
| <div class="mt-6 text-center"> | |
| <p class="text-xs text-white/40"> | |
| ساخته شده با JavaScript و LocalStorage | |
| </p> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Dashboard View --> | |
| <div id="dashboard-view" class="hidden h-full w-full flex flex-col md:flex-row relative"> | |
| <!-- Mobile Sidebar Overlay --> | |
| <div id="sidebar-overlay" class="sidebar-overlay md:hidden" onclick="toggleSidebar()"></div> | |
| <!-- Sidebar --> | |
| <aside id="sidebar" class="mobile-sidebar md:relative md:transform-none md:w-72 md:h-full glass-panel border-l border-white/10 flex flex-col bg-slate-900/95 md:bg-transparent"> | |
| <!-- Profile --> | |
| <div class="p-4 md:p-6 border-b border-white/10 flex items-center justify-between"> | |
| <div class="flex items-center gap-3 flex-1"> | |
| <div id="user-avatar" class="w-10 h-10 md:w-12 md:h-12 rounded-full flex items-center justify-center text-lg font-bold avatar-blue"> | |
| <span id="user-avatar-initial">U</span> | |
| </div> | |
| <div class="flex-1 min-w-0"> | |
| <h2 id="user-name-display" class="font-bold text-sm truncate">کاربر</h2> | |
| <p id="user-phone-display" class="text-xs text-white/50 font-mono">09XXXXXXXXX</p> | |
| </div> | |
| </div> | |
| <div class="relative"> | |
| <button onclick="toggleUserMenu(event)" class="text-white/40 hover:text-white transition-colors p-2 touch-target mr-2"> | |
| <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> | |
| <circle cx="12" cy="12" r="1"></circle> | |
| <circle cx="12" cy="5" r="1"></circle> | |
| <circle cx="12" cy="19" r="1"></circle> | |
| </svg> | |
| </button> | |
| <!-- User Menu --> | |
| <div id="user-menu" class="menu-dropdown"> | |
| <div class="menu-item" onclick="openEditProfileModal()"> | |
| <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> | |
| <path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"></path> | |
| <circle cx="12" cy="7" r="4"></circle> | |
| </svg> | |
| ویرایش پروفایل | |
| </div> | |
| <div class="menu-item danger" onclick="logout()"> | |
| <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> | |
| <path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"></path> | |
| <polyline points="16,17 21,12 16,7"></polyline> | |
| <line x1="21" y1="12" x2="9" y2="12"></line> | |
| </svg> | |
| خروج | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Create Room --> | |
| <div class="p-4 border-b border-white/10"> | |
| <div class="flex justify-between items-center mb-3"> | |
| <span class="text-xs font-medium text-white/60">اتاقهای من</span> | |
| <span id="room-count-badge" class="text-xs bg-white/10 px-2 py-0.5 rounded-full">۰/۳</span> | |
| </div> | |
| <button onclick="openCreateRoomModal()" id="btn-create-room" class="w-full py-3 border border-dashed border-white/20 rounded-lg text-sm text-white/70 hover:border-white/40 hover:text-white transition-colors touch-target"> | |
| <span class="ml-1">+</span> اتاق جدید | |
| </button> | |
| <p id="room-limit-msg" class="text-xs text-red-400 mt-2 hidden">حداکثر ۳ اتاق مجاز است</p> | |
| </div> | |
| <!-- Room List --> | |
| <div class="flex-1 overflow-y-auto p-2 space-y-1" id="room-list-container"> | |
| <div class="text-center mt-8 text-white/30 text-sm"> | |
| <p>اتاقی وجود ندارد</p> | |
| </div> | |
| </div> | |
| <!-- Mobile Safe Area --> | |
| <div class="h-safe-bottom md:hidden"></div> | |
| </aside> | |
| <!-- Main Content --> | |
| <main class="flex-1 flex flex-col h-full relative bg-slate-900/20 w-full"> | |
| <!-- Mobile Header --> | |
| <header class="h-14 glass-panel border-b border-white/10 flex items-center justify-between px-4 md:hidden"> | |
| <button onclick="toggleSidebar()" class="touch-target flex items-center justify-center w-10 h-10 -mr-2 text-white/80"> | |
| <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> | |
| <line x1="3" y1="12" x2="21" y2="12"></line> | |
| <line x1="3" y1="6" x2="21" y2="6"></line> | |
| <line x1="3" y1="18" x2="21" y2="18"></line> | |
| </svg> | |
| </button> | |
| <span class="text-sm font-medium text-white/60">پیام رسان مینیمال</span> | |
| <div class="w-10"></div> | |
| </header> | |
| <!-- Desktop Header --> | |
| <header class="hidden md:flex h-14 glass-panel border-b border-white/10 items-center justify-between px-6"> | |
| <span class="text-sm font-medium text-white/60">داشبورد</span> | |
| <div class="flex items-center gap-2 text-xs text-white/40"> | |
| <span class="w-2 h-2 bg-green-500 rounded-full animate-pulse"></span> | |
| آنلاین | |
| </div> | |
| </header> | |
| <!-- Welcome Screen --> | |
| <div id="welcome-screen" class="flex-1 flex flex-col items-center justify-center p-8 text-center"> | |
| <div class="w-20 h-20 bg-white/5 rounded-full flex items-center justify-center mb-4"> | |
| <svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" class="text-white/40"> | |
| <path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"></path> | |
| </svg> | |
| </div> | |
| <h2 class="text-xl font-bold mb-2">به پیام رسان خوش آمدید</h2> | |
| <p class="text-white/50 text-sm max-w-md">اتاق جدید بسازید یا یکی را انتخاب کنید</p> | |
| <button onclick="openCreateRoomModal()" class="mt-6 md:hidden bg-white/10 px-6 py-3 rounded-full text-sm font-medium touch-target"> | |
| <span class="ml-2">+</span>ساخت اتاق جدید | |
| </button> | |
| </div> | |
| <!-- Chat Interface --> | |
| <div id="chat-interface" class="hidden absolute inset-0 bg-slate-900 flex flex-col fade-in z-20"> | |
| <!-- Chat Header --> | |
| <div class="h-14 glass-panel border-b border-white/10 flex items-center justify-between px-4" style="padding-top: env(safe-area-inset-top, 0);"> | |
| <div class="flex items-center gap-3 flex-1 min-w-0"> | |
| <button onclick="closeChat()" class="md:hidden text-white/60 hover:text-white touch-target w-10 h-10 flex items-center justify-center -mr-2"> | |
| <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> | |
| <line x1="19" y1="12" x2="5" y2="12"></line> | |
| <polyline points="12,19 5,12 12,5"></polyline> | |
| </svg> | |
| </button> | |
| <div id="chat-room-avatar" class="w-10 h-10 rounded-full flex items-center justify-center shrink-0 avatar-purple"> | |
| <span id="chat-room-initial">#</span> | |
| </div> | |
| <div class="min-w-0 flex-1"> | |
| <h3 id="chat-room-name" class="font-bold text-sm truncate">اتاق</h3> | |
| <span id="chat-user-count" class="text-xs text-white/50">۲ عضو</span> | |
| </div> | |
| </div> | |
| <div class="flex items-center gap-1"> | |
| <button onclick="copyRoomLink()" class="text-white/40 hover:text-white text-sm touch-target w-10 h-10 flex items-center justify-center" title="کپی لینک"> | |
| <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> | |
| <circle cx="18" cy="5" r="3"></circle> | |
| <circle cx="6" cy="12" r="3"></circle> | |
| <circle cx="18" cy="19" r="3"></circle> | |
| <line x1="8.59" y1="13.51" x2="15.42" y2="17.49"></line> | |
| <line x1="15.41" y1="6.51" x2="8.59" y2="10.49"></line> | |
| </svg> | |
| </button> | |
| <div class="relative"> | |
| <button onclick="toggleRoomMenu(event)" class="text-white/40 hover:text-white text-sm touch-target w-10 h-10 flex items-center justify-center"> | |
| <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> | |
| <circle cx="12" cy="12" r="1"></circle> | |
| <circle cx="12" cy="5" r="1"></circle> | |
| <circle cx="12" cy="19" r="1"></circle> | |
| </svg> | |
| </button> | |
| <!-- Room Menu --> | |
| <div id="room-menu" class="menu-dropdown"> | |
| <div class="menu-item" onclick="openEditRoomModal()"> | |
| <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> | |
| <path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"></path> | |
| <path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"></path> | |
| </svg> | |
| ویرایش گروه | |
| </div> | |
| <div class="menu-item danger" onclick="deleteCurrentRoom()"> | |
| <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> | |
| <polyline points="3,6 5,6 21,6"></polyline> | |
| <path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"></path> | |
| </svg> | |
| حذف گروه | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Messages --> | |
| <div id="messages-container" class="flex-1 overflow-y-auto p-4 space-y-3 pb-32 md:pb-4"> | |
| <!-- Messages injected here --> | |
| </div> | |
| <!-- Sticker Picker --> | |
| <div id="sticker-picker" class="sticker-picker"> | |
| <div class="p-3 border-b border-white/10 flex justify-between items-center"> | |
| <span class="text-sm font-medium">استیکرها</span> | |
| <button onclick="toggleStickerPicker()" class="text-white/50 hover:text-white"> | |
| <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> | |
| <line x1="18" y1="6" x2="6" y2="18"></line> | |
| <line x1="6" y1="6" x2="18" y2="18"></line> | |
| </svg> | |
| </button> | |
| </div> | |
| <div class="p-3 grid grid-cols-5 gap-2" id="sticker-grid"> | |
| <!-- Stickers injected here --> | |
| </div> | |
| </div> | |
| <!-- Input --> | |
| <div class="absolute bottom-0 left-0 right-0 p-3 md:p-4 glass-panel border-t border-white/10 safe-bottom bg-slate-900/90" style="backdrop-filter: blur(20px);"> | |
| <form onsubmit="sendMessage(event)" class="flex gap-2 max-w-4xl mx-auto items-end"> | |
| <button type="button" onclick="toggleStickerPicker()" class="text-white/40 hover:text-white w-11 h-11 rounded-full flex items-center justify-center transition-colors touch-target shrink-0" title="استیکر"> | |
| <svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> | |
| <circle cx="12" cy="12" r="10"></circle> | |
| <path d="M8 14s1.5 2 4 2 4-2 4-2"></path> | |
| <line x1="9" y1="9" x2="9.01" y2="9"></line> | |
| <line x1="15" y1="9" x2="15.01" y2="9"></line> | |
| </svg> | |
| </button> | |
| <input type="text" id="message-input" placeholder="پیام خود را بنویسید..." class="flex-1 bg-white/10 border border-white/10 rounded-full px-4 py-3 text-sm text-white placeholder-white/30 focus:outline-none focus:border-white/30 focus:bg-white/15 transition-all touch-target" autocomplete="off"> | |
| <button type="submit" class="bg-blue-600 hover:bg-blue-500 text-white w-11 h-11 rounded-full flex items-center justify-center transition-colors touch-target btn-active shadow-lg shrink-0"> | |
| <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> | |
| <line x1="22" y1="2" x2="11" y2="13"></line> | |
| <polygon points="22,2 15,22 11,13 2,9 22,2"></polygon> | |
| </svg> | |
| </button> | |
| </form> | |
| </div> | |
| </div> | |
| </main> | |
| </div> | |
| <!-- Create Room Modal --> | |
| <div id="create-room-modal" class="fixed inset-0 z-50 hidden flex items-end md:items-center justify-center p-0 md:p-4 bg-black/60 backdrop-blur-sm transition-opacity"> | |
| <div class="glass-panel w-full md:max-w-sm rounded-t-2xl md:rounded-2xl p-6 fade-in bg-slate-900 border-t md:border border-white/10"> | |
| <div class="flex justify-between items-center mb-4"> | |
| <h3 class="font-bold text-lg">اتاق جدید</h3> | |
| <button onclick="closeCreateRoomModal()" class="text-white/40 hover:text-white touch-target w-10 h-10 flex items-center justify-center"> | |
| <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> | |
| <line x1="18" y1="6" x2="6" y2="18"></line> | |
| <line x1="6" y1="6" x2="18" y2="18"></line> | |
| </svg> | |
| </button> | |
| </div> | |
| <form onsubmit="handleCreateRoom(event)" class="space-y-4"> | |
| <div> | |
| <label class="block text-xs text-white/60 mb-2">نام اتاق</label> | |
| <input type="text" id="new-room-name" placeholder="مثلاً: گروه دوستان" class="w-full bg-white/5 border border-white/10 rounded-xl px-4 py-3 text-white placeholder-white/30 focus:outline-none focus:border-white/30 touch-target" required> | |
| </div> | |
| <div class="flex gap-3 pt-2"> | |
| <button type="button" onclick="closeCreateRoomModal()" class="flex-1 py-3 rounded-xl border border-white/10 text-sm hover:bg-white/5 transition-colors touch-target"> | |
| انصراف | |
| </button> | |
| <button type="submit" class="flex-1 py-3 rounded-xl bg-white text-slate-900 text-sm font-bold hover:bg-white/90 transition-colors touch-target btn-active"> | |
| ساختن | |
| </button> | |
| </div> | |
| </form> | |
| </div> | |
| </div> | |
| <!-- Edit Room Modal --> | |
| <div id="edit-room-modal" class="fixed inset-0 z-50 hidden flex items-end md:items-center justify-center p-0 md:p-4 bg-black/60 backdrop-blur-sm"> | |
| <div class="glass-panel w-full md:max-w-sm rounded-t-2xl md:rounded-2xl p-6 fade-in bg-slate-900 border-t md:border border-white/10"> | |
| <div class="flex justify-between items-center mb-4"> | |
| <h3 class="font-bold text-lg">ویرایش گروه</h3> | |
| <button onclick="closeEditRoomModal()" class="text-white/40 hover:text-white touch-target w-10 h-10 flex items-center justify-center"> | |
| <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> | |
| <line x1="18" y1="6" x2="6" y2="18"></line> | |
| <line x1="6" y1="6" x2="18" y2="18"></line> | |
| </svg> | |
| </button> | |
| </div> | |
| <form onsubmit="handleEditRoom(event)" class="space-y-4"> | |
| <div class="flex justify-center mb-4"> | |
| <div id="edit-room-avatar-preview" class="room-avatar avatar-purple"> | |
| <span id="edit-room-initial-preview">G</span> | |
| </div> | |
| </div> | |
| <div> | |
| <label class="block text-xs text-white/60 mb-2">نام گروه</label> | |
| <input type="text" id="edit-room-name" class="w-full bg-white/5 border border-white/10 rounded-xl px-4 py-3 text-white placeholder-white/30 focus:outline-none focus:border-white/30 touch-target" required> | |
| </div> | |
| <div> | |
| <label class="block text-xs text-white/60 mb-2">رنگ آ |