/* Yara Messenger — style | استایل اصلی */
@font-face{font-family:Vazirmatn;src:url(../fonts/Vazirmatn.woff2) format("woff2");font-weight:100 900;font-display:swap}
:root{--accent:#7c5cff;--accent2:color-mix(in srgb,var(--accent) 65%,#ff5fa2);
--bg:#f2f1f8;--panel:rgba(255,255,255,.72);--solid:#fff;--text:#17152b;--muted:#6d6a85;--line:rgba(23,21,43,.09);--in:#fff;--shadow:0 10px 40px -12px rgba(40,30,90,.25);--ease:cubic-bezier(.22,1,.36,1);--ok:#22c55e}
:root[data-theme=dark]{--bg:#0d0c16;--panel:rgba(30,28,48,.66);--solid:#1a1829;--text:#ecebf7;--muted:#9390ad;--line:rgba(255,255,255,.08);--in:#232038;--shadow:0 10px 40px -12px rgba(0,0,0,.6)}
@media(prefers-color-scheme:dark){:root[data-theme=auto]{--bg:#0d0c16;--panel:rgba(30,28,48,.66);--solid:#1a1829;--text:#ecebf7;--muted:#9390ad;--line:rgba(255,255,255,.08);--in:#232038;--shadow:0 10px 40px -12px rgba(0,0,0,.6)}}
*{box-sizing:border-box;margin:0;-webkit-tap-highlight-color:transparent}
html{font-size:16px}
body{font-family:Vazirmatn,Tahoma,system-ui,sans-serif;background:var(--bg);color:var(--text);min-height:100dvh;line-height:1.7;
background-image:radial-gradient(60rem 40rem at 90% -10%,color-mix(in srgb,var(--accent) 22%,transparent),transparent),radial-gradient(50rem 40rem at -10% 110%,color-mix(in srgb,var(--accent2) 18%,transparent),transparent);background-attachment:fixed}
a{color:var(--accent);text-decoration:none}
button,input,textarea{font:inherit;color:inherit}
button{cursor:pointer;border:0;background:none}
:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.ic{display:inline-flex;width:1.25rem;height:1.25rem}.ic svg{width:100%;height:100%}
/* ---------- Auth ---------- */
.aurora{position:fixed;inset:0;overflow:hidden;background:#12102a;z-index:-1}
.aurora i{position:absolute;width:55vmax;height:55vmax;border-radius:50%;filter:blur(90px);opacity:.75;animation:drift 18s ease-in-out infinite alternate}
.aurora i:nth-child(1){background:var(--accent);top:-20vmax;right:-10vmax}
.aurora i:nth-child(2){background:#ff5fa2;bottom:-25vmax;left:-15vmax;animation-duration:23s}
.aurora i:nth-child(3){background:#22d3ee;top:30%;left:35%;width:30vmax;height:30vmax;opacity:.4;animation-duration:29s}
@keyframes drift{to{transform:translate(-12vmax,10vmax) scale(1.2) rotate(40deg)}}
.auth-wrap{min-height:100dvh;display:grid;place-items:center;padding:1.2rem}
.glass{background:rgba(255,255,255,.12);backdrop-filter:blur(28px) saturate(1.4);-webkit-backdrop-filter:blur(28px) saturate(1.4);border:1px solid rgba(255,255,255,.25);box-shadow:0 30px 80px -20px rgba(0,0,0,.5)}
.auth-card{width:min(26rem,100%);border-radius:28px;padding:2rem 1.6rem;display:flex;flex-direction:column;gap:.9rem;color:#fff;animation:rise .8s var(--ease) both}
@keyframes rise{from{opacity:0;transform:translateY(24px) scale(.97)}}
.auth-logo{width:4.2rem;height:4.2rem;border-radius:20px;align-self:center;box-shadow:0 12px 30px -8px rgba(0,0,0,.5);background:#fff2}
.auth-card h1{text-align:center;font-size:1.8rem;font-weight:800;letter-spacing:-.01em}
.auth-card .sub{text-align:center;opacity:.8;margin-top:-.5rem;font-size:.9rem}
.auth-card .field span{color:#fff;opacity:.85}
.auth-card input{background:rgba(255,255,255,.14);border-color:rgba(255,255,255,.25);color:#fff}
.auth-card input:focus{background:rgba(255,255,255,.22)}
.auth-card .alt{text-align:center;font-size:.9rem;opacity:.9}.auth-card .alt a{color:#fff;font-weight:700;text-decoration:underline}
.form-error{color:#ffd1d9;font-size:.85rem;min-height:1.2em;text-align:center}
.panel .form-error{color:#e11d48;text-align:start}
.avatar-pick{display:flex;align-items:center;gap:.8rem;cursor:pointer;align-self:center;font-size:.85rem}
.avatar-pick>span{width:3.6rem;height:3.6rem;border-radius:50%;background:rgba(255,255,255,.18);display:grid;place-items:center;overflow:hidden;border:1px dashed rgba(255,255,255,.5)}
.avatar-pick img{width:100%;height:100%;object-fit:cover}
/* ---------- Controls ---------- */
.field{display:flex;flex-direction:column;gap:.3rem;font-size:.85rem}
.field span{color:var(--muted)}
.field.inline{flex-direction:row;align-items:center;justify-content:space-between}
input,textarea{width:100%;padding:.7rem .9rem;border-radius:14px;border:1px solid var(--line);background:var(--solid);outline:0;transition:border-color .2s,box-shadow .2s}
input:focus,textarea:focus{border-color:var(--accent);box-shadow:0 0 0 4px color-mix(in srgb,var(--accent) 20%,transparent)}
input[type=color]{width:3rem;height:2.2rem;padding:2px;cursor:pointer}
input[type=range]{padding:0;accent-color:var(--accent)}
.btn{padding:.75rem 1.2rem;border-radius:14px;font-weight:700;transition:transform .2s var(--ease),filter .2s;display:inline-flex;gap:.5rem;align-items:center;justify-content:center}
.btn:active{transform:scale(.97)}.btn:disabled{opacity:.6}
.btn.primary{background:linear-gradient(135deg,var(--accent),var(--accent2));color:#fff;box-shadow:0 8px 24px -8px var(--accent)}
.btn.primary:hover{filter:brightness(1.08)}
.btn.danger{background:color-mix(in srgb,#ef4444 14%,transparent);color:#ef4444}
.btn.wide{width:100%}
.icon-btn{width:2.5rem;height:2.5rem;border-radius:50%;display:grid;place-items:center;color:var(--muted);transition:background .2s,color .2s,transform .2s var(--ease);flex:none}
.icon-btn:hover{background:var(--line);color:var(--text)}.icon-btn:active{transform:scale(.9)}
.av{width:var(--s,2.9rem);height:var(--s,2.9rem);border-radius:50%;display:inline-grid;place-items:center;color:#fff;font-weight:700;overflow:hidden;flex:none;position:relative;font-size:calc(var(--s,2.9rem)*.4)}
.av img{width:100%;height:100%;object-fit:cover}
.dot{position:absolute;inset-inline-end:0;bottom:0;width:.8rem;height:.8rem;border-radius:50%;background:var(--ok);border:2px solid var(--solid)}
/* ---------- Chat layout ---------- */
.app{display:grid;grid-template-columns:23rem 1fr;height:100dvh;max-width:1500px;margin:auto;padding:.8rem;gap:.8rem}
.side,.chat{background:var(--panel);backdrop-filter:blur(24px);-webkit-backdrop-filter:blur(24px);border:1px solid var(--line);border-radius:26px;box-shadow:var(--shadow);overflow:hidden;display:flex;flex-direction:column;min-height:0}
.side-top{display:flex;align-items:center;gap:.3rem;padding:.8rem;border-bottom:1px solid var(--line)}
.search{position:relative;flex:1;min-width:0}
.search>.ic{position:absolute;inset-inline-start:.8rem;top:50%;transform:translateY(-50%);color:var(--muted);pointer-events:none}
.search input{padding-inline-start:2.5rem;border-radius:999px}
.results{position:absolute;inset-inline:0;top:calc(100% + .4rem);background:var(--solid);border:1px solid var(--line);border-radius:18px;box-shadow:var(--shadow);z-index:20;padding:.3rem;max-height:60vh;overflow:auto;animation:pop .25s var(--ease)}
@keyframes pop{from{opacity:0;transform:translateY(-6px) scale(.98)}}
.row{display:flex;align-items:center;gap:.75rem;padding:.65rem .75rem;border-radius:16px;cursor:pointer;transition:background .15s;width:100%;text-align:start}
.row:hover{background:var(--line)}.row.active{background:color-mix(in srgb,var(--accent) 16%,transparent)}
.row .mid{flex:1;min-width:0;display:flex;flex-direction:column}
.row .mid b{font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.row .mid small{color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.row .end{display:flex;flex-direction:column;align-items:flex-end;gap:.2rem;font-size:.72rem;color:var(--muted)}
.badge{background:linear-gradient(135deg,var(--accent),var(--accent2));color:#fff;min-width:1.35rem;height:1.35rem;border-radius:999px;display:grid;place-items:center;font-size:.72rem;padding:0 .4rem;font-weight:700;animation:pop .3s var(--ease)}
.contacts{overflow:auto;padding:.5rem;flex:1}
.hint{color:var(--muted);text-align:center;padding:2rem 1rem;font-size:.9rem}
.empty{margin:auto;text-align:center;color:var(--muted);display:grid;gap:1rem;justify-items:center;padding:1rem}
.empty img{width:5rem;opacity:.9;border-radius:22px;filter:drop-shadow(0 10px 24px var(--accent))}
.room{display:flex;flex-direction:column;min-height:0;flex:1;position:relative}
.room[hidden]{display:none}
.room-top{display:flex;align-items:center;gap:.7rem;padding:.7rem 1rem;border-bottom:1px solid var(--line)}
.room-top .back{display:none}
.who{display:flex;flex-direction:column;line-height:1.35}.who small{color:var(--muted);font-size:.78rem}.who small.on{color:var(--ok)}
.msgs{flex:1;overflow:auto;padding:1rem;display:flex;flex-direction:column;gap:.25rem;overscroll-behavior:contain;scroll-behavior:smooth}
.day{align-self:center;background:var(--line);color:var(--muted);font-size:.75rem;padding:.1rem .8rem;border-radius:999px;margin:.6rem 0}
.msg{max-width:min(34rem,82%);animation:msgIn .35s var(--ease)}
@keyframes msgIn{from{opacity:0;transform:translateY(10px) scale(.97)}}
.msg.out{align-self:flex-start}.msg.in{align-self:flex-end}
.bubble{padding:.5rem .8rem .35rem;border-radius:18px;background:var(--in);box-shadow:0 1px 2px rgba(0,0,0,.08);overflow-wrap:anywhere;white-space:pre-wrap}
.out .bubble{background:linear-gradient(135deg,var(--accent),var(--accent2));color:#fff;border-bottom-right-radius:6px}
.in .bubble{border-bottom-left-radius:6px}
.msg.pending{opacity:.6}
.meta{display:flex;gap:.3rem;justify-content:flex-end;align-items:center;font-size:.68rem;opacity:.7;margin-top:.1rem}
.meta .ic{width:1rem;height:1rem}.meta .rd{color:#b9f6ff;opacity:1}
.bubble img.media,.bubble video.media{display:block;max-width:100%;max-height:22rem;border-radius:12px;margin:.1rem 0 .3rem;cursor:zoom-in}
.bubble audio{max-width:100%;margin:.2rem 0}
.filecard{display:flex;align-items:center;gap:.7rem;color:inherit;margin:.1rem 0 .3rem}
.filecard .ic{width:2.4rem;height:2.4rem;padding:.55rem;border-radius:12px;background:rgba(127,127,127,.2)}
.filecard div{display:flex;flex-direction:column;min-width:0;white-space:normal}.filecard small{opacity:.75}
.composer{display:flex;align-items:flex-end;gap:.3rem;padding:.7rem;border-top:1px solid var(--line);position:relative;padding-bottom:max(.7rem,env(safe-area-inset-bottom))}
.composer textarea{resize:none;max-height:9rem;border-radius:20px;flex:1}
.send{width:2.8rem;height:2.8rem;border-radius:50%;background:linear-gradient(135deg,var(--accent),var(--accent2));color:#fff;display:grid;place-items:center;flex:none;box-shadow:0 6px 18px -6px var(--accent);transition:transform .25s var(--ease)}
.send:hover{transform:scale(1.08) rotate(-8deg)}.send:active{transform:scale(.92)}.send svg{transform:scaleX(-1)}
.emoji-pop{position:absolute;bottom:calc(100% + .3rem);inset-inline-start:.7rem;background:var(--solid);border:1px solid var(--line);border-radius:18px;padding:.5rem;display:grid;grid-template-columns:repeat(8,1fr);gap:.1rem;box-shadow:var(--shadow);z-index:10;animation:pop .25s var(--ease);max-width:20rem}
.emoji-pop[hidden]{display:none}
.emoji-pop button{font-size:1.35rem;padding:.2rem;border-radius:8px}.emoji-pop button:hover{background:var(--line)}
.preview{display:flex;align-items:center;gap:.8rem;padding:.6rem 1rem;border-top:1px solid var(--line);position:relative;animation:pop .25s var(--ease)}
.preview[hidden]{display:none}
.preview img{width:3.4rem;height:3.4rem;object-fit:cover;border-radius:12px}
.preview .info{flex:1;min-width:0;display:flex;flex-direction:column;font-size:.85rem}.preview .info span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.progress{height:.3rem;border-radius:9px;background:var(--line);overflow:hidden;margin-top:.3rem}.progress i{display:block;height:100%;width:0;background:linear-gradient(90deg,var(--accent),var(--accent2));transition:width .15s}
.lightbox{position:fixed;inset:0;background:rgba(0,0,0,.88);display:grid;place-items:center;z-index:100;cursor:zoom-out;animation:pop .25s}.lightbox img{max-width:94vw;max-height:92vh;border-radius:12px}
.toasts{position:fixed;bottom:1.2rem;inset-inline:0;display:flex;flex-direction:column;align-items:center;gap:.5rem;pointer-events:none;z-index:200}
.toast{background:var(--text);color:var(--bg);padding:.6rem 1.1rem;border-radius:14px;font-size:.9rem;box-shadow:var(--shadow);animation:pop .3s var(--ease)}.toast.err{background:#e11d48;color:#fff}
/* ---------- Profile / Settings ---------- */
.page{max-width:40rem;margin:auto;padding:1rem 1rem 4rem;display:flex;flex-direction:column;gap:1rem}
.page-top{display:flex;align-items:center;gap:.5rem;padding:.4rem 0}.page-top h1{font-size:1.4rem}
.panel{background:var(--panel);backdrop-filter:blur(24px);-webkit-backdrop-filter:blur(24px);border:1px solid var(--line);border-radius:22px;padding:1.1rem;display:flex;flex-direction:column;gap:.8rem;box-shadow:var(--shadow)}
.panel h2{font-size:1rem}
.profile-head{flex-direction:row;align-items:center;gap:1rem}.profile-head div{display:flex;flex-direction:column}.profile-head small{color:var(--muted)}
.big-av{position:relative;border-radius:50%}.big-av .av{--s:5.5rem}
.big-av em{position:absolute;inset-block-end:0;inset-inline-end:0;width:2rem;height:2rem;border-radius:50%;background:var(--accent);color:#fff;display:grid;place-items:center;border:3px solid var(--solid)}
.big-av em .ic{width:.9rem;height:.9rem}
.stats{flex-direction:row;justify-content:space-around;text-align:center}.stats div{display:flex;flex-direction:column}.stats b{font-size:1.3rem}.stats small{color:var(--muted)}
.seg{display:grid;grid-template-columns:repeat(3,1fr);background:var(--line);border-radius:14px;padding:.25rem}
.seg button{padding:.5rem;border-radius:11px;transition:background .25s var(--ease),color .25s}.seg button.on{background:var(--solid);box-shadow:0 2px 8px rgba(0,0,0,.12);font-weight:700}
.swatches{display:flex;gap:.6rem;flex-wrap:wrap}
.sw{width:2.2rem;height:2.2rem;border-radius:50%;border:3px solid var(--solid);box-shadow:0 0 0 2px transparent;transition:transform .2s var(--ease),box-shadow .2s}.sw:hover{transform:scale(1.12)}.sw.on{box-shadow:0 0 0 2px var(--text)}
.range-labels{display:flex;justify-content:space-between;font-size:.75rem;color:var(--muted)}
.sample{color:var(--muted)}
.total{font-size:1.5rem;font-weight:800}
.stack{display:flex;height:.8rem;border-radius:99px;overflow:hidden;background:var(--line)}.stack i{transition:width .5s var(--ease)}
.legend{display:flex;flex-wrap:wrap;gap:.4rem 1rem;font-size:.8rem;color:var(--muted)}.legend b{display:inline-block;width:.7rem;height:.7rem;border-radius:50%;margin-inline-end:.3rem}
.file-list{display:flex;flex-direction:column;max-height:20rem;overflow:auto}
.frow{display:flex;align-items:center;gap:.7rem;padding:.5rem 0;border-bottom:1px solid var(--line)}
.frow .mid{flex:1;min-width:0;display:flex;flex-direction:column}.frow .mid span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.frow small{color:var(--muted)}
/* ---------- Mobile ---------- */
@media(max-width:760px){
.app{display:block;padding:0;height:100dvh}
.side{border-radius:0;height:100dvh;border:0}
.chat{position:fixed;inset:0;border-radius:0;border:0;background:var(--bg);transform:translateX(-100%);transition:transform .38s var(--ease);z-index:30}
.app.in-chat .chat{transform:none}
.room-top .back{display:grid}.empty{display:none}
.msg{max-width:88%}
}
@media(prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important}}
