/* ============================================================
   Jihad Mail — workspace shell (RTL)
   Dark violet rail + white mail window, inspired by the supplied
   reference layout, mirrored for Persian/RTL.
   Loaded after jihad-theme.css.
   ============================================================ */

:root {
  --shell-1: #10071e;
  --shell-2: #21103b;
  --shell-3: #3b1b62;
  --shell-line: rgba(255,255,255,.12);
  --shell-text: #f5efff;
  --shell-muted: #bdaed4;
}
html[data-jihad-theme="navy"] { --shell-1:#061426; --shell-2:#0b2340; --shell-3:#123a5c; }
html[data-jihad-theme="emerald"] { --shell-1:#041b16; --shell-2:#063b32; --shell-3:#0d5b4b; }
html[data-jihad-theme="wine"] { --shell-1:#1a0710; --shell-2:#3d1424; --shell-3:#64213a; }
html[data-jihad-theme="violet"] { --shell-1:#10071e; --shell-2:#21103b; --shell-3:#3b1b62; }
html[data-jihad-theme="sand"] { --shell-1:#1c150d; --shell-2:#3f3325; --shell-3:#665138; }
html[data-jihad-theme="sky"] { --shell-1:#031521; --shell-2:#08324b; --shell-3:#0f5273; }

body:not(.task-login) {
  background:
    radial-gradient(1000px 620px at 92% -10%, color-mix(in srgb, var(--shell-3) 82%, #fff), transparent 62%),
    radial-gradient(900px 600px at 0% 110%, color-mix(in srgb, var(--shell-3) 58%, transparent), transparent 68%),
    linear-gradient(145deg, var(--shell-1), var(--shell-2) 58%, var(--shell-1));
}

/* ---------- Right application rail ---------- */
#jihad-rail {
  position: fixed;
  z-index: 250;
  top: 12px;
  right: 12px;
  bottom: 12px;
  width: 62px;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--shell-line);
  border-radius: 21px;
  background: rgba(10, 5, 22, .48);
  box-shadow: 0 16px 42px rgba(0,0,0,.24);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}
#jihad-rail .rail-logo {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: #fff;
  padding: 4px;
  box-shadow: 0 8px 18px rgba(0,0,0,.2);
  margin-bottom: 8px;
}
#jihad-rail .rail-logo img { width: 100%; height: 100%; object-fit: contain; }
#jihad-rail .rail-app {
  position: relative;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: #cec0e4 !important;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}
#jihad-rail .rail-app svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#jihad-rail .rail-app span {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
#jihad-rail .rail-app:hover {
  background: rgba(255,255,255,.12);
  color: #fff !important;
  transform: translateY(-1px);
}
#jihad-rail .rail-app.active {
  background: color-mix(in srgb, var(--j-teal) 32%, rgba(255,255,255,.14));
  color: #fff !important;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.15), 0 8px 18px color-mix(in srgb, var(--j-teal) 20%, transparent);
}
body.task-mail #jihad-rail .rail-app[data-task="mail"],
body.task-addressbook #jihad-rail .rail-app[data-task="addressbook"],
body.task-settings #jihad-rail .rail-app[data-task="settings"] {
  background: color-mix(in srgb, var(--j-teal) 32%, rgba(255,255,255,.14));
  color: #fff !important;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.15), 0 8px 18px color-mix(in srgb, var(--j-teal) 20%, transparent);
}
#jihad-rail .rail-spacer { flex: 1 1 auto; }
#jihad-rail .rail-admin {
  color: #bdaed4 !important;
  border-top: 1px solid var(--shell-line);
  padding-top: 11px;
  border-radius: 0 0 13px 13px;
}

/* ---------- Dark top bar ---------- */
#jihad-appbar {
  flex: 0 0 56px;
  height: 56px;
  padding: 0 104px 0 16px;
  gap: 14px;
  background: transparent;
  border: 0;
  box-shadow: none;
  color: var(--shell-text);
}
#jihad-appbar .jihad-brand {
  min-width: 174px;
  color: var(--shell-text) !important;
}
#jihad-appbar .jihad-brand img {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: #fff;
  padding: 3px;
  box-shadow: 0 6px 16px rgba(0,0,0,.18);
}
#jihad-appbar .jihad-brand-text strong { color: #fff; font-size: 14px; }
#jihad-appbar .jihad-brand-text small { color: var(--shell-muted); }
#jihad-appbar .jihad-nav { display: none; }
#jihad-appbar .jihad-actions { gap: 9px; }
#jihad-appbar .jihad-compose {
  background: color-mix(in srgb, var(--j-teal) 84%, #fff);
  color: #fff !important;
  box-shadow: 0 7px 18px color-mix(in srgb, var(--j-teal) 26%, transparent);
}
#jihad-appbar .jihad-compose:hover { background: var(--j-teal-dark); }
#jihad-appbar .jihad-theme-toggle {
  color: var(--shell-text);
  background: rgba(255,255,255,.08);
  border-color: var(--shell-line);
}
#jihad-appbar .jihad-theme-toggle:hover {
  background: rgba(255,255,255,.15);
  color: #fff;
  border-color: rgba(255,255,255,.26);
}
#jihad-appbar .jihad-user { color: var(--shell-text); }
#jihad-appbar .jihad-avatar {
  background: rgba(255,255,255,.14);
  color: #fff;
}
#jihad-appbar .jihad-email { color: var(--shell-muted); }
#jihad-appbar .jihad-logout { color: var(--shell-muted) !important; }
#jihad-appbar .jihad-logout:hover { background: rgba(255,255,255,.1); color: #fff !important; }

/* ---------- White mail window ---------- */
#layout {
  flex: 1;
  min-height: 0;
  height: auto !important;
  width: calc(100% - 98px) !important;
  max-width: calc(100% - 98px) !important;
  min-width: 0 !important;
  align-self: stretch;
  margin: 0 86px 12px 12px;
  padding: 0;
  gap: 0;
  overflow: hidden;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(0,0,0,.34);
}
#layout-sidebar,
#layout-list,
#layout-content {
  height: 100%;
  background: #fff;
  border: 0 !important;
  border-radius: 0;
  box-shadow: none;
  overflow: hidden;
}
#layout-sidebar {
  flex: 0 0 238px;
  background: #f7f8fc;
  border-left: 1px solid #e9edf4 !important;
}
#layout-list {
  flex: 0 0 340px;
  border-left: 1px solid #e9edf4 !important;
}
#layout-content { background: #fff; }
#layout > div > .header {
  background: #fff !important;
  border-bottom: 1px solid #e9edf4 !important;
}
#layout-sidebar .jihad-sidebar-header { background: #f7f8fc !important; }
#layout-list .jihad-list-header { background: #fff !important; }
#layout-content .jihad-message-header { background: #fff !important; }
#layout-sidebar .header,
#layout-list .header,
#layout-content .header { height: 58px; min-height: 58px; }

/* subtle folder/sidebar treatment */
#layout-sidebar .jihad-folder-label { color: #9aa8ba; }
#mailboxlist li > a { border-radius: 10px; margin: 1px 7px; }
#mailboxlist li.selected > a { box-shadow: inset 3px 0 0 var(--j-teal); }
#layout-sidebar .footer { border-top: 1px solid #e9edf4; }

/* transparent iframe so the reading-pane effect remains part of the canvas */
#layout-content .iframe-wrapper { background: transparent; }
#layout-content iframe { background: transparent; }

/* ---------- Responsive ---------- */
@media (min-width: 981px) {
  /* the logo lives in the rail on desktop; keep the top bar quiet */
  #jihad-appbar .jihad-brand img { display: none; }
}
@media (max-width: 1180px) {
  #layout-sidebar { flex: 0 0 216px; }
  #layout-list { flex: 0 0 324px; }
}
@media (max-width: 980px) {
  #jihad-rail { display: none; }
  #jihad-appbar { padding: 0 14px; gap: 9px; }
  #jihad-appbar .jihad-nav { display: flex; }
  #jihad-appbar .jihad-brand { min-width: 0; }
  #layout {
    width: calc(100% - 20px) !important;
    max-width: calc(100% - 20px) !important;
    margin: 0 10px 10px;
    border-radius: 16px;
  }
  #layout-sidebar { flex: 0 0 66px; }
  #layout-list { flex: 0 0 300px; }
  #layout-sidebar .jihad-folder-label,
  #layout-sidebar .header-title,
  #layout-sidebar .footer { display: none; }
  #mailboxlist li > a { justify-content: center; padding: 10px 6px; font-size: 0; }
  #mailboxlist li > a:before { width: 20px; height: 20px; }
}
@media (max-width: 720px) {
  #jihad-appbar { padding: 0 10px; }
  #jihad-appbar .jihad-brand-text { display: none; }
  #jihad-appbar .jihad-compose span { display: none; }
  #jihad-appbar .jihad-email { display: none; }
  #layout {
    width: calc(100% - 16px) !important;
    max-width: calc(100% - 16px) !important;
    margin: 0 8px 8px;
    border-radius: 14px;
  }
  #layout-list { flex: 0 0 280px; }
}
