/* Dark Chat — طراحی تاریک پیشرفته، Vazirmatn */
:root{
  --bg:#0a0e14;           /* سیاه‌تر */
  --panel:#111722;        /* تاریک‌تر */
  --panel2:#1a1f2d;       /* عمیق‌تر */
  --text:#e8edf9;         /* سفید مایل به آبی */
  --muted:#8a9bb2;        /* خاکستری آبی */
  --primary:#3b82f6;      /* آبی روشن‌تر */
  --secondary:#8b5cf6;    /* بنفش */
  --accent:#10b981;       /* سبز */
  --bubble:#1e2535;       /* حباب تاریک */
  --bubbleMe:#2d3b5a;     /* حباب خودم */
  --danger:#ef4444;       /* قرمز */
  --warning:#f59e0b;      /* نارنجی */
  --border:rgba(255,255,255,0.08); /* border نرم‌تر */
  --shadow:0 12px 32px rgba(0,0,0,0.45); /* سایه عمیق‌تر */
  --glow:0 0 20px rgba(59,130,246,0.15); /* درخشش آبی */
  --font:"Vazirmatn", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Tahoma, Arial;
}

*{
  box-sizing:border-box;
  -webkit-tap-highlight-color:transparent;
}

html,body{
  height:100%;
  scroll-behavior:smooth;
}

body{
  margin:0;
  font-family:var(--font);
  background:var(--bg);
  color:var(--text);
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
  overflow-x:hidden;
  background-image:
    radial-gradient(circle at 10% 20%, rgba(59,130,246,0.03) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(139,92,246,0.02) 0%, transparent 40%);
}

a{
  color:inherit;
  text-decoration:none;
  transition:color 0.2s;
}

a:hover{
  color:var(--primary);
}

.mono{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono","Courier New", monospace;
  letter-spacing:-0.02em;
}

/* پیل */
.pill{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  padding:10px 16px;
  border:1px solid var(--border);
  background:rgba(255,255,255,0.03);
  border-radius:12px;
  color:var(--text);
  font-weight:500;
  font-size:14px;
  transition:all 0.25s cubic-bezier(0.4,0,0.2,1);
  backdrop-filter:blur(10px);
  -webkit-backdrop-filter:blur(10px);
}

.pill:hover{
  background:rgba(255,255,255,0.07);
  border-color:rgba(255,255,255,0.15);
  transform:translateY(-1px);
  box-shadow:var(--shadow);
}

.pill.small{
  padding:8px 12px;
  font-size:12px;
  border-radius:10px;
}

.pill.primary{
  background:var(--primary);
  border-color:var(--primary);
  color:white;
  font-weight:600;
}

.pill.primary:hover{
  background:#2563eb;
  box-shadow:0 4px 16px rgba(59,130,246,0.3);
}

/* دکمه‌ها */
.btn-primary{
  border:0;
  border-radius:14px;
  padding:14px 20px;
  background:linear-gradient(135deg, var(--primary), #2563eb);
  color:white;
  font-weight:700;
  font-size:15px;
  cursor:pointer;
  transition:all 0.3s cubic-bezier(0.4,0,0.2,1);
  position:relative;
  overflow:hidden;
  box-shadow:0 4px 20px rgba(59,130,246,0.25);
  letter-spacing:-0.01em;
}

.btn-primary:before{
  content:'';
  position:absolute;
  top:0;
  left:-100%;
  width:100%;
  height:100%;
  background:linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition:0.5s;
}

.btn-primary:hover:before{
  left:100%;
}

.btn-primary:hover{
  transform:translateY(-2px);
  box-shadow:0 8px 25px rgba(59,130,246,0.4);
}

.btn-primary:active{
  transform:translateY(0);
}

.btn-primary:disabled{
  opacity:0.5;
  cursor:not-allowed;
  transform:none !important;
}

.btn-ghost{
  border:1px solid var(--border);
  background:rgba(255,255,255,0.04);
  color:var(--text);
  border-radius:12px;
  padding:12px 18px;
  cursor:pointer;
  font-weight:500;
  font-size:14px;
  transition:all 0.25s;
  backdrop-filter:blur(8px);
}

.btn-ghost:hover{
  background:rgba(255,255,255,0.08);
  border-color:rgba(255,255,255,0.2);
  transform:translateY(-1px);
}

.btn-danger{
  border:1px solid rgba(239,68,68,0.3);
  background:linear-gradient(135deg, rgba(239,68,68,0.15), rgba(220,38,38,0.1));
  color:#fca5a5;
  border-radius:12px;
  padding:12px 18px;
  cursor:pointer;
  font-weight:500;
  font-size:14px;
  transition:all 0.25s;
  backdrop-filter:blur(8px);
}

.btn-danger:hover{
  background:linear-gradient(135deg, rgba(239,68,68,0.25), rgba(220,38,38,0.2));
  border-color:rgba(239,68,68,0.5);
  color:#f87171;
  transform:translateY(-1px);
  box-shadow:0 4px 16px rgba(239,68,68,0.15);
}

.link{
  color:var(--primary);
  font-weight:500;
  position:relative;
  padding-bottom:2px;
}

.link:after{
  content:'';
  position:absolute;
  bottom:0;
  left:0;
  width:0;
  height:1px;
  background:var(--primary);
  transition:width 0.3s;
}

.link:hover:after{
  width:100%;
}

/* آلرت */
.alert{
  padding:14px 18px;
  border-radius:14px;
  background:linear-gradient(135deg, rgba(239,68,68,0.15), rgba(220,38,38,0.1));
  border:1px solid rgba(239,68,68,0.3);
  margin:16px 0;
  color:#fca5a5;
  font-size:14px;
  backdrop-filter:blur(8px);
  animation:fadeIn 0.3s;
}

.hint{
  color:var(--muted);
  font-size:13px;
  margin-top:12px;
  line-height:1.5;
}

/* فرم‌ها */
label{
  display:block;
  color:var(--muted);
  margin-top:14px;
  margin-bottom:8px;
  font-size:14px;
  font-weight:500;
}

input,textarea,select{
  width:100%;
  padding:14px 16px;
  border-radius:14px;
  border:1px solid var(--border);
  background:var(--panel2);
  color:var(--text);
  outline:none;
  font-size:15px;
  font-family:var(--font);
  transition:all 0.25s;
  backdrop-filter:blur(8px);
}

input:focus,textarea:focus,select:focus{
  border-color:var(--primary);
  background:var(--panel);
  box-shadow:0 0 0 3px rgba(59,130,246,0.15), var(--shadow);
  transform:translateY(-1px);
}

textarea{
  resize:none;
  min-height:120px;
  line-height:1.6;
}

/* صفحه ورود */
.login-body{
  display:flex;
  align-items:center;
  justify-content:center;
  min-height:100vh;
  padding:24px;
  background:
    radial-gradient(ellipse at 20% 30%, rgba(59,130,246,0.05) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 70%, rgba(139,92,246,0.03) 0%, transparent 50%),
    var(--bg);
}

.login-card{
  width:min(440px,92vw);
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:24px;
  padding:32px;
  box-shadow:var(--shadow);
  backdrop-filter:blur(20px);
  -webkit-backdrop-filter:blur(20px);
  animation:slideUp 0.5s cubic-bezier(0.4,0,0.2,1);
  position:relative;
  overflow:hidden;
}

.login-card:before{
  content:'';
  position:absolute;
  top:0;
  left:0;
  right:0;
  height:4px;
  background:linear-gradient(90deg, var(--primary), var(--secondary));
}

.brand{
  font-weight:900;
  font-size:28px;
  background:linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip:text;
  -webkit-text-fill-color:transparent;
  background-clip:text;
  margin-bottom:8px;
  letter-spacing:-0.02em;
}

.subtitle{
  color:var(--muted);
  margin-top:4px;
  margin-bottom:28px;
  font-size:15px;
}

/* Layout اصلی */
.app-shell{
  height:100vh;
  display:grid;
  grid-template-columns:380px 1fr;
  position:relative;
}

/* سایدبار */
.sidebar{
  border-left:1px solid var(--border);
  background:linear-gradient(180deg, rgba(17,23,34,0.95), rgba(17,23,34,0.9));
  display:flex;
  flex-direction:column;
  min-width:280px;
  backdrop-filter:blur(20px);
  -webkit-backdrop-filter:blur(20px);
  position:relative;
  z-index:10;
}

.sidebar:before{
  content:'';
  position:absolute;
  top:0;
  right:0;
  bottom:0;
  width:1px;
  background:linear-gradient(to bottom, transparent, var(--border), transparent);
}

.sidebar-top{
  padding:20px;
  border-bottom:1px solid var(--border);
  position:relative;
}

.me{
  display:flex;
  gap:14px;
  align-items:center;
}

.avatar{
  width:48px;
  height:48px;
  border-radius:16px;
  background:linear-gradient(135deg, var(--primary), var(--secondary));
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:900;
  color:white;
  overflow:hidden;
  flex:0 0 48px;
  border:2px solid rgba(255,255,255,0.1);
  position:relative;
  transition:all 0.3s;
}

.avatar:hover{
  transform:scale(1.05);
  box-shadow:0 8px 25px rgba(59,130,246,0.3);
}

.avatar:before{
  content:'';
  position:absolute;
  inset:-2px;
  background:linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius:inherit;
  z-index:-1;
  opacity:0;
  transition:opacity 0.3s;
}

.avatar:hover:before{
  opacity:1;
}

.avatar img{
  width:100%;
  height:100%;
  object-fit:cover;
  border-radius:inherit;
}

.avatar.big{
  width:96px;
  height:96px;
  flex:0 0 96px;
  font-size:32px;
  border-radius:24px;
  border-width:3px;
}

.me-meta{
  display:flex;
  flex-direction:column;
  flex:1;
  min-width:0;
}

.me-name{
  font-weight:800;
  font-size:16px;
  letter-spacing:-0.01em;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.me-sub{
  color:var(--muted);
  font-size:13px;
  margin-top:4px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.top-actions{
  margin-top:16px;
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}

/* تب‌های سایدبار */
.sidebar-tabs{
  display:flex;
  gap:10px;
  padding:14px 20px;
  border-bottom:1px solid var(--border);
  background:rgba(0,0,0,0.2);
}

.tab-btn{
  flex:1;
  border:1px solid var(--border);
  background:rgba(255,255,255,0.03);
  color:var(--muted);
  border-radius:12px;
  padding:12px;
  cursor:pointer;
  font-weight:700;
  font-size:14px;
  transition:all 0.25s;
  position:relative;
  overflow:hidden;
}

.tab-btn:before{
  content:'';
  position:absolute;
  top:0;
  left:0;
  width:100%;
  height:100%;
  background:linear-gradient(135deg, var(--primary), var(--secondary));
  opacity:0;
  transition:opacity 0.3s;
  z-index:1;
}

.tab-btn.active{
  color:white;
  border-color:var(--primary);
  background:rgba(59,130,246,0.15);
  position:relative;
  z-index:2;
}

.tab-btn.active:before{
  opacity:1;
}

.tab-btn .content{
  position:relative;
  z-index:2;
}

.tab-btn:hover:not(.active){
  background:rgba(255,255,255,0.07);
  color:var(--text);
}

.sidebar-title{
  padding:16px 20px 8px;
  color:var(--muted);
  font-size:12px;
  font-weight:600;
  text-transform:uppercase;
  letter-spacing:0.05em;
}

.room-list{
  overflow:auto;
  flex:1;
  padding:8px 0;
}

.room-list.compact .room-item{
  padding:12px 20px;
}

.room-item{
  padding:16px 20px;
  border-top:1px solid rgba(255,255,255,0.03);
  display:flex;
  align-items:center;
  justify-content:space-between;
  cursor:pointer;
  transition:all 0.25s;
  position:relative;
  overflow:hidden;
}

.room-item:before{
  content:'';
  position:absolute;
  top:0;
  left:-100%;
  width:100%;
  height:100%;
  background:linear-gradient(90deg, transparent, rgba(59,130,246,0.1), transparent);
  transition:0.5s;
}

.room-item:hover:before{
  left:100%;
}

.room-item:hover{
  background:rgba(255,255,255,0.03);
}

.room-item.active{
  background:rgba(59,130,246,0.12);
  border-left:3px solid var(--primary);
}

.room-item.active:after{
  content:'';
  position:absolute;
  top:0;
  left:0;
  width:3px;
  height:100%;
  background:var(--primary);
}

.room-item .meta{
  color:var(--muted);
  font-size:12px;
  font-weight:500;
}

.room-item.muted{
  color:var(--muted);
  cursor:default;
}

.room-item.muted:hover{
  background:transparent;
}

/* ردیف کاربر */
.user-row{
  display:flex;
  align-items:center;
  gap:14px;
  width:100%;
}

.user-row .uavatar{
  width:40px;
  height:40px;
  border-radius:14px;
  background:linear-gradient(135deg, rgba(59,130,246,0.2), rgba(139,92,246,0.2));
  border:2px solid rgba(255,255,255,0.08);
  overflow:hidden;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:900;
  flex:0 0 40px;
  color:var(--primary);
  transition:all 0.25s;
}

.user-row:hover .uavatar{
  transform:scale(1.05);
  border-color:var(--primary);
}

.user-row .uavatar img{
  width:100%;
  height:100%;
  object-fit:cover;
  border-radius:inherit;
}

.user-row .uname{
  font-weight:800;
  font-size:15px;
  letter-spacing:-0.01em;
}

.user-row .ubio{
  color:var(--muted);
  font-size:13px;
  margin-top:2px;
  max-width:220px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

/* صفحه چت */
.chat{
  display:flex;
  flex-direction:column;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(59,130,246,0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 80%, rgba(139,92,246,0.05) 0%, transparent 50%),
    var(--bg);
  position:relative;
  overflow:hidden;
}

.chat:before{
  content:'';
  position:absolute;
  top:0;
  left:0;
  right:0;
  height:1px;
  background:linear-gradient(90deg, transparent, var(--border), transparent);
}

.chat-header{
  padding:18px 24px;
  border-bottom:1px solid var(--border);
  display:flex;
  align-items:center;
  justify-content:space-between;
  background:rgba(17,23,34,0.7);
  backdrop-filter:blur(20px);
  -webkit-backdrop-filter:blur(20px);
  position:relative;
  z-index:5;
}

.chat-header-left{
  display:flex;
  align-items:center;
  gap:14px;
  flex:1;
  min-width:0;
}

.chat-header-avatar{
  width:44px;
  height:44px;
  border-radius:14px;
  background:linear-gradient(135deg, rgba(59,130,246,0.15), rgba(139,92,246,0.1));
  border:2px solid rgba(255,255,255,0.08);
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:900;
  color:var(--muted);
  overflow:hidden;
  flex:0 0 44px;
}

.chat-header-avatar img{
  width:100%;
  height:100%;
  object-fit:cover;
  border-radius:inherit;
}

.chat-title{
  font-weight:800;
  font-size:18px;
  letter-spacing:-0.01em;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.chat-sub{
  color:var(--muted);
  font-size:13px;
  margin-top:4px;
  display:flex;
  align-items:center;
  gap:8px;
}

.dot{
  display:inline-block;
  width:10px;
  height:10px;
  border-radius:50%;
  position:relative;
}

.dot:before{
  content:'';
  position:absolute;
  inset:-3px;
  border-radius:inherit;
  opacity:0.5;
  animation:pulse 2s infinite;
}

.dot.offline{
  background:var(--danger);
}

.dot.offline:before{
  background:var(--danger);
}

.dot.online{
  background:var(--accent);
}

.dot.online:before{
  background:var(--accent);
}

/* پیام‌ها */
.messages{
  flex:1;
  overflow:auto;
  padding:24px;
  display:flex;
  flex-direction:column;
  gap:16px;
  position:relative;
}

.messages:before{
  content:'';
  position:absolute;
  top:0;
  left:0;
  right:0;
  height:1px;
  background:linear-gradient(90deg, transparent, rgba(255,255,255,0.03), transparent);
}

.msg-row{
  display:flex;
  gap:14px;
  align-items:flex-end;
  position:relative;
  animation:messageAppear 0.3s cubic-bezier(0.4,0,0.2,1);
}

.msg-row.me{
  flex-direction:row-reverse;
}

.msg-row .mavatar{
  width:40px;
  height:40px;
  border-radius:14px;
  background:linear-gradient(135deg, rgba(59,130,246,0.15), rgba(139,92,246,0.1));
  border:2px solid rgba(255,255,255,0.08);
  overflow:hidden;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:900;
  color:var(--muted);
  flex:0 0 40px;
  transition:all 0.25s;
}

.msg-row:hover .mavatar{
  transform:scale(1.05);
  border-color:var(--primary);
}

.msg-row .mavatar img{
  width:100%;
  height:100%;
  object-fit:cover;
  border-radius:inherit;
}

.msg{
  max-width:min(760px,85%);
  padding:16px 20px;
  border-radius:20px;
  background:var(--bubble);
  border:1px solid var(--border);
  box-shadow:0 4px 20px rgba(0,0,0,0.3);
  position:relative;
  backdrop-filter:blur(10px);
  -webkit-backdrop-filter:blur(10px);
  transition:all 0.25s;
}

.msg:hover{
  transform:translateY(-1px);
  box-shadow:0 8px 25px rgba(0,0,0,0.4);
}

.msg.me{
  background:var(--bubbleMe);
  border-color:rgba(59,130,246,0.3);
}

.msg.me:hover{
  box-shadow:0 8px 25px rgba(59,130,246,0.2);
}

.msg .top{
  display:flex;
  gap:12px;
  align-items:center;
  justify-content:space-between;
  margin-bottom:8px;
}

.msg .user{
  font-weight:800;
  font-size:15px;
  letter-spacing:-0.01em;
}

.msg .time{
  color:var(--muted);
  font-size:12px;
  font-weight:500;
}

.msg .body{
  white-space:pre-wrap;
  line-height:1.7;
  margin-top:8px;
  font-size:15px;
  word-break:break-word;
}

.msg .file{
  margin-top:12px;
  padding:14px 16px;
  border-radius:16px;
  background:rgba(255,255,255,0.03);
  border:1px solid var(--border);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  transition:all 0.25s;
}

.msg .file:hover{
  background:rgba(255,255,255,0.05);
  border-color:rgba(255,255,255,0.15);
}

.msg .file .name{
  font-weight:700;
  font-size:14px;
  letter-spacing:-0.01em;
}

.msg .file .meta{
  color:var(--muted);
  font-size:12px;
  margin-top:4px;
}

.msg .file img{
  max-width:280px;
  border-radius:14px;
  border:1px solid var(--border);
  transition:all 0.3s;
}

.msg .file img:hover{
  transform:scale(1.02);
}

/* پیام حذف شده */
.msg.deleted{
  opacity:0.7;
  background:rgba(239,68,68,0.05);
  border-color:rgba(239,68,68,0.15);
}

.msg.deleted .body{
  color:var(--muted);
  font-style:italic;
  font-size:14px;
}

.msg.deleted .deleted-label{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:8px 12px;
  background:linear-gradient(135deg, rgba(239,68,68,0.1), rgba(220,38,38,0.05));
  border:1px solid rgba(239,68,68,0.2);
  border-radius:10px;
  color:#fca5a5;
  font-size:12px;
  font-weight:600;
  margin-top:12px;
  backdrop-filter:blur(8px);
}

.msg.deleted .file{
  opacity:0.5;
}

/* دکمه حذف در پیام */
.msg-actions{
  position:absolute;
  top:12px;
  left:12px;
  opacity:0;
  transition:all 0.25s;
  display:flex;
  gap:6px;
  z-index:10;
}

.msg-row:hover .msg-actions{
  opacity:1;
  transform:translateY(0);
}

.msg-row.me .msg-actions{
  left:auto;
  right:12px;
}

.delete-btn{
  width:32px;
  height:32px;
  border-radius:50%;
  border:1px solid rgba(239,68,68,0.3);
  background:linear-gradient(135deg, rgba(239,68,68,0.15), rgba(220,38,38,0.1));
  color:#fca5a5;
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  font-size:14px;
  font-weight:700;
  transition:all 0.25s;
  backdrop-filter:blur(8px);
}

.delete-btn:hover{
  background:linear-gradient(135deg, rgba(239,68,68,0.25), rgba(220,38,38,0.2));
  border-color:rgba(239,68,68,0.5);
  color:#f87171;
  transform:scale(1.1) rotate(90deg);
  box-shadow:0 4px 16px rgba(239,68,68,0.2);
}

/* کامپوزر */
.composer{
  padding:20px 24px;
  border-top:1px solid var(--border);
  display:flex;
  gap:16px;
  align-items:flex-end;
  background:rgba(17,23,34,0.7);
  backdrop-filter:blur(20px);
  -webkit-backdrop-filter:blur(20px);
  position:relative;
  z-index:5;
}

.composer:before{
  content:'';
  position:absolute;
  top:0;
  left:0;
  right:0;
  height:1px;
  background:linear-gradient(90deg, transparent, rgba(255,255,255,0.05), transparent);
}

.composer textarea{
  min-height:52px;
  max-height:200px;
  line-height:1.6;
  padding:16px 20px;
  flex:1;
  border-radius:18px;
  font-size:15px;
  transition:all 0.25s;
}

.composer textarea:focus{
  min-height:80px;
}

.file-input{
  display:none;
}

.upload-preview{
  padding:16px 24px;
  border-top:1px solid var(--border);
  color:var(--muted);
  font-size:14px;
  background:rgba(17,23,34,0.5);
  backdrop-filter:blur(10px);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
}

/* مودال */
.modal{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,0.7);
  display:flex;
  align-items:center;
  justify-content:center;
  padding:20px;
  z-index:1000;
  animation:fadeIn 0.3s;
  backdrop-filter:blur(10px);
  -webkit-backdrop-filter:blur(10px);
}

.modal-card{
  width:min(560px,95vw);
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:24px;
  box-shadow:0 32px 64px rgba(0,0,0,0.5);
  overflow:hidden;
  animation:modalAppear 0.4s cubic-bezier(0.4,0,0.2,1);
  max-height:90vh;
  display:flex;
  flex-direction:column;
}

.modal-card:before{
  content:'';
  position:absolute;
  top:0;
  left:0;
  right:0;
  height:4px;
  background:linear-gradient(90deg, var(--primary), var(--secondary));
}

.modal-top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:20px 24px;
  border-bottom:1px solid var(--border);
  background:rgba(255,255,255,0.02);
}

.modal-title{
  font-weight:800;
  font-size:20px;
  letter-spacing:-0.01em;
}

.modal-body{
  padding:24px;
  overflow:auto;
  flex:1;
}

/* صفحه ادمین */
.admin-body{
  padding:24px;
  min-height:100vh;
  background:
    radial-gradient(ellipse at 20% 10%, rgba(59,130,246,0.05) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 90%, rgba(139,92,246,0.03) 0%, transparent 50%),
    var(--bg);
}

.admin-shell{
  max-width:1200px;
  margin:0 auto;
}

.admin-top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom:24px;
  padding-bottom:20px;
  border-bottom:1px solid var(--border);
}

.admin-top .brand{
  font-size:32px;
}

.grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:24px;
}

.card{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:24px;
  padding:24px;
  box-shadow:var(--shadow);
  backdrop-filter:blur(20px);
  -webkit-backdrop-filter:blur(20px);
  transition:all 0.3s;
}

.card:hover{
  transform:translateY(-2px);
  box-shadow:0 20px 40px rgba(0,0,0,0.4);
}

.card h3{
  margin:0 0 16px 0;
  font-size:20px;
  font-weight:800;
  letter-spacing:-0.01em;
  color:var(--text);
  position:relative;
  padding-bottom:12px;
}

.card h3:after{
  content:'';
  position:absolute;
  bottom:0;
  left:0;
  width:60px;
  height:3px;
  background:linear-gradient(90deg, var(--primary), transparent);
  border-radius:3px;
}

.row{
  display:flex;
  gap:16px;
  margin-top:16px;
  align-items:center;
}

.row > *{
  flex:1;
}

hr{
  border:0;
  height:1px;
  background:linear-gradient(90deg, transparent, var(--border), transparent);
  margin:24px 0;
}

.table{
  border:1px solid var(--border);
  border-radius:18px;
  overflow:hidden;
  background:var(--panel2);
}

.thead,.trow{
  display:grid;
  grid-template-columns:1.2fr .7fr .5fr 1fr;
}

.thead{
  background:rgba(255,255,255,0.04);
  color:var(--muted);
  font-size:13px;
  font-weight:600;
  text-transform:uppercase;
  letter-spacing:0.05em;
}

.thead>div,.trow>div{
  padding:16px 20px;
  border-bottom:1px solid var(--border);
  display:flex;
  align-items:center;
}

.trow{
  transition:all 0.25s;
}

.trow:hover{
  background:rgba(255,255,255,0.03);
}

.trow:last-child>div{
  border-bottom:0;
}

.check{
  display:flex;
  align-items:center;
  gap:12px;
  color:var(--muted);
  font-size:14px;
  cursor:pointer;
  user-select:none;
}

.thead.uploads,.trow.uploads{
  grid-template-columns:1.6fr .7fr .7fr .5fr .9fr .5fr;
}

.thead.rooms,.trow.rooms{
  grid-template-columns:1.5fr .7fr .6fr .9fr .5fr;
}

/* انیمیشن‌ها */
@keyframes fadeIn{
  from{ opacity:0; }
  to{ opacity:1; }
}

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

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

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

@keyframes pulse{
  0%,100%{ opacity:0.5; transform:scale(1); }
  50%{ opacity:0.2; transform:scale(1.2); }
}

/* اسکرول بار */
::-webkit-scrollbar{
  width:8px;
  height:8px;
}

::-webkit-scrollbar-track{
  background:rgba(255,255,255,0.02);
  border-radius:4px;
}

::-webkit-scrollbar-thumb{
  background:linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius:4px;
}

::-webkit-scrollbar-thumb:hover{
  background:linear-gradient(135deg, #2563eb, #7c3aed);
}

/* ریسپانسیو */
@media (max-width: 1100px){
  .app-shell{
    grid-template-columns:320px 1fr;
  }
  
  .grid{
    gap:20px;
  }
}

@media (max-width: 900px){
  .app-shell{
    grid-template-columns:1fr;
    height:100vh;
  }
  
  .sidebar{
    position:fixed;
    top:0;
    right:0;
    bottom:0;
    width:320px;
    z-index:100;
    transform:translateX(100%);
    transition:transform 0.3s cubic-bezier(0.4,0,0.2,1);
    box-shadow:-20px 0 40px rgba(0,0,0,0.3);
  }
  
  .sidebar.active{
    transform:translateX(0);
  }
  
  .grid{
    grid-template-columns:1fr;
  }
  
  .chat-header{
    padding:16px 20px;
  }
  
  .composer{
    padding:16px 20px;
  }
}

@media (max-width: 600px){
  .admin-body{
    padding:16px;
  }
  
  .card{
    padding:20px;
  }
  
  .row{
    flex-direction:column;
    gap:12px;
  }
  
  .modal-card{
    border-radius:20px;
  }
  
  .modal-body{
    padding:20px;
  }
}

/* افکت‌های ویژه */
.glow{
  position:relative;
}

.glow:after{
  content:'';
  position:absolute;
  inset:-2px;
  background:linear-gradient(135deg, var(--primary), var(--secondary), var(--accent));
  border-radius:inherit;
  z-index:-1;
  filter:blur(10px);
  opacity:0.3;
  animation:rotate 3s linear infinite;
}

@keyframes rotate{
  from{ transform:rotate(0deg); }
  to{ transform:rotate(360deg); }
}

/* حالت تاریک‌تر */
.dark-mode-toggle{
  position:fixed;
  bottom:24px;
  left:24px;
  width:52px;
  height:52px;
  border-radius:16px;
  background:var(--panel);
  border:1px solid var(--border);
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  z-index:100;
  transition:all 0.3s;
  backdrop-filter:blur(10px);
  box-shadow:var(--shadow);
}

.dark-mode-toggle:hover{
  transform:scale(1.1) rotate(30deg);
  background:var(--panel2);
}
/* ==================== */
/* بهبود‌های موبایل */
/* ==================== */

/* دکمه منوی موبایل */
.mobile-menu-toggle {
  display: none;
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 1000;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
}

.mobile-menu-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: 0.3s;
}

.mobile-back-btn {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 1000;
  padding: 12px 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-family: var(--font);
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(10px);
}

/* بهبود سایدبار در موبایل */
@media (max-width: 900px) {
  .mobile-menu-toggle {
    display: flex;
  }
  
  .mobile-back-btn {
    display: block;
  }
  
  .sidebar {
    width: 100%;
    max-width: 320px;
  }
  
  /* نمایش سایدبار وقتی کلاس active داره */
  .sidebar.active {
    transform: translateX(0);
  }
}

/* بهبود جدول‌ها در موبایل */
@media (max-width: 768px) {
  .grid {
    grid-template-columns: 1fr !important;
    gap: 16px;
  }
  
  /* تبدیل جدول به حالت اسکرول افقی */
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .table {
    min-width: 600px; /* حداقل عرض برای اسکرول */
  }
  
  /* بهبود سطرهای جدول */
  .thead, .trow {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    font-size: 13px;
  }
  
  .thead > div, .trow > div {
    padding: 12px 8px;
    word-break: break-word;
  }
}

/* بهبود فرم‌ها در موبایل */
@media (max-width: 600px) {
  .card {
    padding: 16px;
    border-radius: 20px;
  }
  
  input, textarea, select {
    padding: 16px;
    font-size: 16px; /* جلوگیری از زوم در iOS */
    border-radius: 14px;
  }
  
  .btn-primary, .btn-ghost, .btn-danger {
    padding: 16px;
    font-size: 16px;
    min-height: 52px;
  }
  
  .pill {
    padding: 12px 14px;
    font-size: 14px;
  }
  
  /* بهبود منوهای بالا */
  .admin-top, .chat-header {
    flex-direction: column;
    gap: 16px;
    padding: 16px;
  }
  
  .admin-top .top-actions, .chat-right {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }
  
  .row {
    flex-direction: column;
  }
  
  .row > * {
    width: 100%;
  }
}

/* بهبود پیام‌ها در موبایل */
@media (max-width: 900px) {
  .msg {
    max-width: 90%;
  }
  
  .composer {
    padding: 12px 16px;
    gap: 12px;
  }
  
  .composer textarea {
    font-size: 16px;
    min-height: 48px;
    padding: 14px;
  }
  
  .upload-preview {
    padding: 12px 16px;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

/* بهبود مودال در موبایل */
@media (max-width: 600px) {
  .modal-card {
    width: 95vw;
    max-height: 85vh;
    border-radius: 20px;
  }
  
  .modal-body {
    padding: 16px;
  }
}

/* جلوگیری از hover در تاچ دستگاه‌ها */
@media (hover: none) and (pointer: coarse) {
  .room-item:hover, .msg:hover, .btn-primary:hover, .btn-ghost:hover {
    transform: none;
  }
  
  .msg-actions {
    opacity: 1; /* همیشه نمایش داده بشه */
  }
}

/* بهبود اسکرول در iOS */
.room-list, .messages, .modal-body {
  -webkit-overflow-scrolling: touch;
}

/* بهبود آواتارها در موبایل */
@media (max-width: 480px) {
  .avatar {
    width: 40px;
    height: 40px;
  }
  
  .chat-header-avatar {
    width: 36px;
    height: 36px;
  }
  
  .mavatar {
    width: 32px;
    height: 32px;
  }
}