/* ==========================================================================
   Roshdino account drawer (v1)
   Opens from the round "م" avatar in the top bar. The rest of the page is
   dimmed and softly blurred behind a single fixed scrim (no filter on the app
   itself, so layout and fixed bars are untouched). Only transform/opacity are
   animated to keep it light on phones.
   ========================================================================== */

.rd-mdr-scrim {
  position: fixed;
  inset: 0;
  z-index: 9990;
  background: rgba(10, 12, 16, .5);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .34s ease, visibility 0s linear .34s;
}
.rd-mdr-scrim.is-open {
  opacity: 1;
  visibility: visible;
  transition: opacity .34s ease, visibility 0s;
}

.rd-mdr {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 9991;
  box-sizing: border-box;
  width: min(86vw, 350px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: calc(env(safe-area-inset-top, 0px) + 24px) 18px calc(env(safe-area-inset-bottom, 0px) + 22px);
  direction: rtl;
  font-family: RoshdinoYekan, Tahoma, sans-serif;
  color: #1f2430;
  background: linear-gradient(180deg, #fffaf5 0%, #ffffff 60%);
  border-radius: 0 30px 30px 0;
  box-shadow: 0 30px 70px rgba(0, 0, 0, .35), inset -1px 0 0 rgba(249, 115, 22, .18);
  overflow: hidden;
  touch-action: pan-y;
  transform: translate3d(-106%, 0, 0);
  visibility: hidden;
  transition: transform .42s cubic-bezier(.22, 1, .36, 1), visibility 0s linear .42s;
  will-change: transform;
}
.rd-mdr.is-open {
  transform: translate3d(0, 0, 0);
  visibility: visible;
  transition: transform .42s cubic-bezier(.22, 1, .36, 1), visibility 0s;
}
.rd-mdr.is-dragging { transition: none; }

/* warm glow in the corner, drawn once when the drawer opens */
.rd-mdr::before {
  content: "";
  position: absolute;
  width: 240px;
  height: 240px;
  top: -110px;
  left: -90px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(249, 115, 22, .32), rgba(249, 115, 22, 0) 70%);
  pointer-events: none;
  opacity: 0;
}
.rd-mdr.is-open::before { animation: rd-mdr-glow 1.1s ease .15s forwards; }
@keyframes rd-mdr-glow {
  from { opacity: 0; transform: scale(.7); }
  to { opacity: 1; transform: scale(1); }
}

.rd-mdr-head {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
}
.rd-mdr-avatar {
  flex: 0 0 auto;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 900;
  color: #fff;
  background: linear-gradient(145deg, #fdba74, #f97316 55%, #ea580c);
  box-shadow: 0 12px 26px rgba(249, 115, 22, .38), inset 0 1px 0 rgba(255, 255, 255, .45);
  transform: scale(.4) rotate(-40deg);
  opacity: 0;
}
.rd-mdr.is-open .rd-mdr-avatar {
  animation: rd-mdr-pop .6s cubic-bezier(.34, 1.56, .64, 1) .1s forwards;
}
@keyframes rd-mdr-pop {
  to { transform: scale(1) rotate(0); opacity: 1; }
}
.rd-mdr-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.rd-mdr-title b { font-size: 17px; font-weight: 900; letter-spacing: .2px; }
.rd-mdr-title small { font-size: 12px; color: #7b8190; }

.rd-mdr-x {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(249, 115, 22, .22);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(249, 115, 22, .08);
  color: #c2410c;
  cursor: pointer;
  padding: 0;
  transition: transform .2s ease, background .2s ease;
}
.rd-mdr-x:active { transform: scale(.9); }
.rd-mdr-x svg { width: 18px; height: 18px; }

.rd-mdr-rule {
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, #f97316, transparent);
  transform: scaleX(0);
  transform-origin: center;
  margin: 2px 0 4px;
}
.rd-mdr.is-open .rd-mdr-rule { animation: rd-mdr-line .7s cubic-bezier(.22, 1, .36, 1) .2s forwards; }
@keyframes rd-mdr-line { to { transform: scaleX(1); } }

.rd-mdr-list { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; list-style: none; }

.rd-mdr-item {
  position: relative;
  box-sizing: border-box;
  width: 100%;
  display: grid;
  grid-template-columns: 46px 1fr 16px;
  align-items: center;
  gap: 12px;
  padding: 14px 14px;
  border: 1px solid rgba(249, 115, 22, .16);
  border-radius: 22px;
  background: rgba(249, 115, 22, .06);
  color: inherit;
  font: inherit;
  text-align: right;
  cursor: pointer;
  opacity: 0;
  transform: translate3d(-22px, 0, 0);
  transition: background .2s ease, border-color .2s ease, transform .2s ease;
  -webkit-tap-highlight-color: transparent;
}
.rd-mdr.is-open .rd-mdr-item {
  animation: rd-mdr-in .55s cubic-bezier(.22, 1, .36, 1) forwards;
  animation-delay: calc(.12s + var(--i, 0) * 70ms);
}
@keyframes rd-mdr-in {
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}
.rd-mdr-item:hover { background: rgba(249, 115, 22, .11); border-color: rgba(249, 115, 22, .3); }
.rd-mdr-item:active { transform: scale(.98) !important; }
.rd-mdr-item:focus-visible { outline: 2px solid #f97316; outline-offset: 2px; }

.rd-mdr-ico {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #ffedd5, #fed7aa);
  color: #ea580c;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6);
}
.rd-mdr-ico svg { width: 22px; height: 22px; }
.rd-mdr-txt { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.rd-mdr-txt b { font-size: 15px; font-weight: 800; }
.rd-mdr-txt small { font-size: 12px; color: #7b8190; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rd-mdr-chev { color: #f97316; opacity: .75; }
.rd-mdr-chev svg { width: 16px; height: 16px; display: block; transform: scaleX(-1); }

.rd-mdr-foot {
  margin-top: auto;
  padding-top: 12px;
  font-size: 12px;
  color: #9aa0ad;
  text-align: center;
  letter-spacing: .3px;
}

/* ---- dark theme ----------------------------------------------------------- */
html.dark .rd-mdr {
  color: #eef0f4;
  background: linear-gradient(180deg, #1c2029 0%, #13161c 65%);
  box-shadow: 0 30px 70px rgba(0, 0, 0, .6), inset -1px 0 0 rgba(249, 115, 22, .2);
}
html.dark .rd-mdr-title small,
html.dark .rd-mdr-txt small,
html.dark .rd-mdr-foot { color: #8b93a3; }
html.dark .rd-mdr-x { color: #fdba74; background: rgba(249, 115, 22, .12); }
html.dark .rd-mdr-item { background: rgba(249, 115, 22, .09); border-color: rgba(249, 115, 22, .2); }
html.dark .rd-mdr-item:hover { background: rgba(249, 115, 22, .16); }
html.dark .rd-mdr-ico { background: linear-gradient(145deg, rgba(249, 115, 22, .3), rgba(249, 115, 22, .14)); color: #fdba74; }

html.rd-mdr-open { overflow: hidden; }

/* ---- reduced motion: keep the state change, drop the movement ----------- */
@media (prefers-reduced-motion: reduce) {
  .rd-mdr, .rd-mdr-scrim, .rd-mdr-item, .rd-mdr-avatar, .rd-mdr-rule { transition: none !important; animation: none !important; }
  .rd-mdr-item, .rd-mdr-avatar { opacity: 1; transform: none; }
  .rd-mdr-rule { transform: none; }
  .rd-mdr::before { display: none; }
}

/* section flash used when the drawer jumps to a section on home */
.rd-flash { animation: rd-flash 1.3s ease; }
@keyframes rd-flash {
  0%, 100% { box-shadow: none; }
  30% { box-shadow: 0 0 0 10px rgba(249, 115, 22, .18); }
}
