@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700;800&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100vh; font-family: 'Vazirmatn', Tahoma, sans-serif; background: #0f0f1a; color: #e2e8f0; direction: rtl; font-size: 14px; }
a { color: inherit; text-decoration: none; }
input, button, textarea, select { font-family: inherit; }
button { cursor: pointer; }
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-thumb { background: #2d2d4a; border-radius: 10px; }

/* ── Layout ── */
.page-auth {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #0f0f1a 0%, #1a1a2e 50%, #16213e 100%);
    position: relative; overflow: hidden;
}
.page-app { min-height: 100vh; display: flex; flex-direction: column; }

/* ── Auth blobs ── */
.blob1 { position: fixed; width: 400px; height: 400px; border-radius: 50%; background: radial-gradient(circle, rgba(108,99,255,.15) 0%, transparent 70%); top: -100px; right: -100px; pointer-events: none; z-index: 0; }
.blob2 { position: fixed; width: 280px; height: 280px; border-radius: 50%; background: radial-gradient(circle, rgba(67,217,173,.1) 0%, transparent 70%); bottom: -60px; left: -60px; pointer-events: none; z-index: 0; }

/* ── Auth box ── */
.auth-box {
    width: 420px; position: relative; z-index: 1;
    background: rgba(255,255,255,.04); backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,.08); border-radius: 24px;
    padding: 40px; box-shadow: 0 25px 50px rgba(0,0,0,.5);
}
.logo-wrap { text-align: center; margin-bottom: 28px; }
.logo-icon { width: 60px; height: 60px; border-radius: 18px; background: linear-gradient(135deg, #6C63FF, #43D9AD); display: flex; align-items: center; justify-content: center; margin: 0 auto 10px; font-size: 28px; }
.logo-title { font-size: 22px; font-weight: 800; background: linear-gradient(135deg,#6C63FF,#43D9AD); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.logo-sub { color: #64748b; font-size: 12px; margin-top: 4px; }

/* ── Tabs ── */
.tabs { display: flex; background: rgba(255,255,255,.05); border-radius: 12px; padding: 4px; margin-bottom: 22px; }
.tab-btn { flex: 1; padding: 9px 0; border-radius: 9px; border: none; font-weight: 600; font-size: 14px; background: transparent; color: #64748b; }
.tab-btn.active { background: linear-gradient(135deg,#6C63FF,#43D9AD); color: #fff; }

/* ── Fields ── */
.field { margin-bottom: 14px; }
.field label { font-size: 12px; color: #94a3b8; display: block; margin-bottom: 6px; }
.field input {
    width: 100%; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.1);
    border-radius: 10px; padding: 11px 14px; color: #e2e8f0; font-size: 14px; outline: none;
}
.field input:focus { border-color: #6C63FF; }

/* ── Buttons ── */
.btn-primary { width: 100%; padding: 13px 0; border-radius: 12px; border: none; background: linear-gradient(135deg,#6C63FF,#43D9AD); color: #fff; font-weight: 700; font-size: 15px; margin-top: 6px; box-shadow: 0 8px 25px rgba(108,99,255,.3); }
.btn-sm { padding: 7px 16px; border-radius: 9px; border: none; font-weight: 600; font-size: 13px; }
.btn-purple { background: linear-gradient(135deg,#6C63FF,#8B5CF6); color: #fff; }
.btn-green  { background: rgba(67,217,173,.15); color: #43D9AD; }
.btn-red    { background: rgba(239,83,80,.15);  color: #ef5350; }
.btn-gray   { background: rgba(255,255,255,.07); color: #94a3b8; }

/* ── Alerts ── */
.alert { border-radius: 10px; padding: 10px 14px; font-size: 13px; margin-bottom: 14px; }
.alert-err { background: rgba(239,83,80,.1);  border: 1px solid rgba(239,83,80,.3);  color: #ef5350; }
.alert-ok  { background: rgba(67,217,173,.1); border: 1px solid rgba(67,217,173,.3); color: #43D9AD; }

/* ── Header ── */
.header { height: 58px; background: rgba(255,255,255,.03); border-bottom: 1px solid rgba(255,255,255,.06); padding: 0 22px; display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; position: sticky; top: 0; z-index: 100; }
.h-logo { display: flex; align-items: center; gap: 10px; }
.h-logo-icon { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg,#6C63FF,#43D9AD); display: flex; align-items: center; justify-content: center; font-size: 16px; }
.h-logo-text { font-weight: 800; font-size: 18px; background: linear-gradient(135deg,#6C63FF,#43D9AD); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.nav { display: flex; gap: 3px; }
.nav-btn { padding: 7px 15px; border-radius: 9px; border: none; font-weight: 600; font-size: 13px; background: transparent; color: #64748b; }
.nav-btn:hover, .nav-btn.active { background: rgba(108,99,255,.15); color: #6C63FF; }
.h-user { display: flex; align-items: center; gap: 10px; }
.h-avatar { width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; color: #fff; }
.logout-btn { padding: 6px 12px; border-radius: 8px; border: 1px solid rgba(239,83,80,.3); background: rgba(239,83,80,.08); color: #ef5350; font-size: 12px; font-weight: 600; }

/* ── Avatar ── */
.avatar { border-radius: 12px; display: flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; flex-shrink: 0; position: relative; }
.dot { position: absolute; bottom: 1px; left: 1px; width: 11px; height: 11px; border-radius: 50%; border: 2px solid #0f0f1a; }
.dot-on  { background: #43D9AD; }
.dot-off { background: #374151; }

/* ── Content wrapper ── */
.content { flex: 1; max-width: 900px; margin: 0 auto; width: 100%; padding: 28px 20px; }
.page-title { font-size: 20px; font-weight: 800; margin-bottom: 4px; }
.page-sub   { color: #64748b; font-size: 13px; margin-bottom: 20px; }

/* ── Chat layout ── */
.chat-layout { display: flex; gap: 0; height: calc(100vh - 58px); overflow: hidden; }
.chat-sidebar { width: 290px; background: rgba(255,255,255,.02); border-left: 1px solid rgba(255,255,255,.05); display: flex; flex-direction: column; flex-shrink: 0; overflow-y: auto; }
.chat-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

/* ── Conversation list ── */
.sidebar-title { padding: 14px 16px 8px; font-size: 11px; color: #64748b; font-weight: 600; }
.conv-item { padding: 11px 14px; display: flex; align-items: center; gap: 11px; border-right: 3px solid transparent; }
.conv-item:hover { background: rgba(108,99,255,.07); }
.conv-item.active { background: rgba(108,99,255,.12); border-right-color: #6C63FF; }
.conv-name { font-weight: 600; font-size: 13px; }
.conv-last { font-size: 11px; color: #64748b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }

/* ── Chat messages ── */
.chat-header-bar { padding: 11px 18px; border-bottom: 1px solid rgba(255,255,255,.05); display: flex; align-items: center; gap: 12px; background: rgba(255,255,255,.02); flex-shrink: 0; }
.messages-wrap { flex: 1; overflow-y: auto; padding: 18px 14px; display: flex; flex-direction: column; gap: 7px; }
.msg-row { display: flex; }
.msg-row.mine   { justify-content: flex-start; }
.msg-row.theirs { justify-content: flex-end; }
.bubble { max-width: 68%; padding: 10px 14px; border-radius: 16px; font-size: 14px; line-height: 1.55; word-break: break-word; }
.bubble.mine   { background: linear-gradient(135deg,#6C63FF,#8B5CF6); border-radius: 16px 16px 16px 4px; box-shadow: 0 4px 14px rgba(108,99,255,.3); }
.bubble.theirs { background: rgba(255,255,255,.07); border-radius: 16px 16px 4px 16px; }
.msg-time { font-size: 10px; color: rgba(255,255,255,.5); margin-top: 4px; text-align: left; }
.msg-time.t { color: #475569; }

/* ── Chat input ── */
.chat-input-bar { padding: 11px 14px; border-top: 1px solid rgba(255,255,255,.05); display: flex; gap: 9px; flex-shrink: 0; }
.chat-input-bar input { flex: 1; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1); border-radius: 11px; padding: 11px 14px; color: #e2e8f0; font-size: 14px; outline: none; }
.send-btn { padding: 11px 20px; border-radius: 11px; border: none; background: linear-gradient(135deg,#6C63FF,#43D9AD); color: #fff; font-weight: 700; font-size: 14px; }

/* ── Cards ── */
.card { background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.06); border-radius: 14px; padding: 16px 18px; margin-bottom: 10px; }
.card-row { display: flex; align-items: center; gap: 13px; }

/* ── Stat grid ── */
.stat-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; margin-bottom: 24px; }
.stat-card { background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.06); border-radius: 14px; padding: 18px; text-align: center; }
.stat-icon  { font-size: 26px; margin-bottom: 8px; }
.stat-val   { font-size: 26px; font-weight: 800; }
.stat-label { font-size: 12px; color: #64748b; margin-top: 4px; }

/* ── Admin tabs ── */
.admin-layout { display: flex; gap: 0; min-height: calc(100vh - 58px); }
.admin-sidebar-nav { width: 200px; background: rgba(255,255,255,.02); border-left: 1px solid rgba(255,255,255,.05); padding: 14px 10px; flex-shrink: 0; }
.admin-sidebar-nav h3 { font-size: 11px; color: #475569; font-weight: 600; margin-bottom: 10px; padding: 0 8px; }
.asb-btn { display: flex; align-items: center; gap: 8px; width: 100%; padding: 9px 10px; border-radius: 9px; border: none; background: transparent; color: #64748b; font-weight: 600; font-size: 12px; text-align: right; margin-bottom: 3px; }
.asb-btn:hover, .asb-btn.active { background: rgba(108,99,255,.15); color: #6C63FF; }
.admin-content { flex: 1; padding: 26px 28px; overflow-y: auto; }

/* ── Badge ── */
.badge { font-size: 10px; padding: 2px 8px; border-radius: 5px; font-weight: 600; }
.badge-admin  { background: rgba(108,99,255,.2); color: #6C63FF; }
.badge-banned { background: rgba(239,83,80,.15); color: #ef5350; }

/* ── Misc ── */
.empty { text-align: center; color: #374151; padding: 40px; font-size: 14px; }
.section-title { font-size: 14px; color: #94a3b8; font-weight: 600; margin-bottom: 10px; }
.online-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.online-chip { display: flex; align-items: center; gap: 8px; background: rgba(67,217,173,.08); border: 1px solid rgba(67,217,173,.2); border-radius: 9px; padding: 7px 13px; font-size: 12px; font-weight: 600; }
textarea { width: 100%; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.1); border-radius: 10px; padding: 11px 14px; color: #e2e8f0; font-size: 14px; outline: none; resize: none; }
.search-input { width: 100%; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.1); border-radius: 11px; padding: 11px 14px; color: #e2e8f0; font-size: 14px; outline: none; margin-bottom: 16px; }

@media (max-width: 700px) {
    .auth-box { width: 95vw; padding: 24px 18px; }
    .stat-grid { grid-template-columns: repeat(2,1fr); }
    .chat-sidebar { width: 220px; }
    .admin-sidebar-nav { width: 48px; overflow: hidden; }
    .asb-btn span { display: none; }
}
