/* css/layout.css */

/* ━━━━━━━━━━━━━━━━━━━━━━━━
   APP SHELL & SCREENS
━━━━━━━━━━━━━━━━━━━━━━━━ */
.SCR { display: none !important; }
#LS.ON { display: flex !important; }
#AS.ON { display: flex !important; }
#AS { min-height: 100vh; background: #0d1117; }

.main { 
    margin-right: 240px; 
    margin-top: 60px;
    flex: 1; 
    display: flex; 
    flex-direction: column; 
    min-height: calc(100vh - 60px);
    padding: 28px;
}

.content {
    flex: 1;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━
   SIDEBAR
━━━━━━━━━━━━━━━━━━━━━━━━ */
.sidebar {
  width: 240px; background: #161b22;
  border-left: 1px solid #30363d;
  display: flex; flex-direction: column;
  position: fixed; top: 0; right: 0; height: 100vh;
  z-index: 200; transition: transform .3s cubic-bezier(.16,1,.3,1);
}

.sb-top {
  padding: 24px 20px 16px;
  border-bottom: 1px solid #30363d;
}

.sb-brand { display: flex; align-items: center; gap: 10px; }

.sb-icon {
  width: 36px; height: 36px; border-radius: 8px; flex-shrink: 0;
  background: linear-gradient(135deg, #f0b429 0%, #e09800 100%);
  display: flex; align-items: center; justify-content: center;
  box-shadow: none; font-size: 18px; color: #ffffff;
}

.sb-bname { font-size: 20px; font-weight: 900; color: #e6edf3; letter-spacing: -.2px; }
.sb-bsub { font-size: 11px; color: #6e7681; font-weight: 500; letter-spacing: .5px; margin-top: 4px; }

.sb-user {
  margin: 12px 12px 4px;
  padding: 10px 12px; border-radius: 12px;
  background: #21262d; border: 1px solid #30363d;
  display: flex; align-items: center; gap: 10px;
}

.sb-av {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #ffffff;
  flex-shrink: 0;
}

.sb-uname { font-size: 13px; font-weight: 600; color: #e6edf3; line-height: 1.2; }
.sb-urole { font-size: 11px; color: #8b949e; font-weight: 400; margin-top: 2px; }

.sb-pulse {
  width: 7px; height: 7px; border-radius: 50%; background: #1aab78;
  margin-right: auto; flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(26,171,120,.2);
  animation: pulse-live 2s ease infinite;
}

@keyframes pulse-live { 0%,100% { box-shadow: 0 0 0 2px rgba(26,171,120,.2); transform: scale(1); } 50% { box-shadow: 0 0 0 5px rgba(26,171,120,.05); transform: scale(1.3); } }

.sb-nav { flex: 1; padding: 8px 0; overflow-y: auto; }
.sb-group { font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: #6e7681; padding: 12px 20px 4px; margin-top: 8px; }

.sb-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px;
  cursor: pointer; transition: all .2s;
  margin: 2px 12px; position: relative;
}

.sb-item:hover { background: #21262d; }
.sb-item.ACT { background: rgba(56,139,253,.15); border: none; }
.sb-item.ACT .sb-lbl { color: #388bfd; font-weight: 600; }
.sb-item.ACT .sb-iico { color: #388bfd; opacity: 1; }
.sb-item.ACT::before { display: none; }

.sb-iico { width: 17px; height: 17px; flex-shrink: 0; color: #8b949e; opacity: 1; transition: all .2s; }
.sb-item:hover .sb-iico { color: #e6edf3; }
.sb-item.ACT:hover .sb-iico { color: #388bfd; }

.sb-lbl { font-size: 13px; font-weight: 500; color: #8b949e; transition: color .2s; }
.sb-item:hover .sb-lbl { color: #e6edf3; }
.sb-item.ACT:hover .sb-lbl { color: #388bfd; }

.sb-ct {
  margin-right: auto; font-size: 10px; font-weight: 600;
  background: #2d0f0e; color: #f85149;
  border-radius: 20px; padding: 2px 8px; min-width: 16px; text-align: center;
}
.sb-ct.zt { display: none; }

.sb-btm { padding: 16px; border-top: 1px solid #30363d; display: flex; align-items: center; }

.sb-out {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px;
  cursor: pointer; background: none; border: none; width: 100%; transition: all .2s;
}

.sb-out:hover { background: rgba(248,81,73,.1); }
.sb-out-l { font-size: 13px; font-weight: 600; color: #8b949e; transition: color .2s; }
.sb-out:hover .sb-out-l { color: #f85149; }
.sb-out svg { color: #8b949e; transition: color .2s; width: 17px; height: 17px; }
.sb-out:hover svg { color: #f85149; }

.sb-ov { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 190; backdrop-filter: blur(4px); }
.sb-ov.on { display: block; }

/* ━━━━━━━━━━━━━━━━━━━━━━━━
   TOPBAR
━━━━━━━━━━━━━━━━━━━━━━━━ */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 240px;
  height: 60px;
  background: rgba(13,17,23,.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid #30363d;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; z-index: 100;
}

.tb-l { display: flex; align-items: center; gap: 12px; }
.tb-bc { display: flex; align-items: center; gap: 6px; font-size: 15px; font-weight: 600; color: #e6edf3; }
.tb-bc-a { color: #e6edf3; }
.tb-bc-sep { font-size: 13px; color: #6e7681; margin: 0 4px; }
.tb-bc-b { font-size: 13px; font-weight: 400; color: #6e7681; }

.tb-r { display: flex; align-items: center; gap: 12px; }
.ham { display: none; background: none; border: none; cursor: pointer; padding: 6px; border-radius: 8px; color: #8b949e; }

/* ━━━━━━━━━━━━━━━━━━━━━━━━
   BOTTOM NAVIGATION (Mobile)
━━━━━━━━━━━━━━━━━━━━━━━━ */
.bot-nav { display: none; }

/* ━━━━━━━━━━━━━━━━━━━━━━━━
   LAYOUT LIGHT MODE OVERRIDES
━━━━━━━━━━━━━━━━━━━━━━━━ */
html[data-theme="light"] #AS { background: #f6f8fa; }
html[data-theme="light"] .sidebar { background: #ffffff; border-color: #d0d7de; }
html[data-theme="light"] .sb-top { border-color: #d0d7de; }
html[data-theme="light"] .sb-bname { color: #1F2328; }
html[data-theme="light"] .sb-bsub { color: #656d76; }
html[data-theme="light"] .sb-user { background: #f6f8fa; border-color: #d0d7de; }
html[data-theme="light"] .sb-uname { color: #1F2328; }
html[data-theme="light"] .sb-urole { color: #656d76; }
html[data-theme="light"] .sb-group { color: #8c959f; }
html[data-theme="light"] .sb-item:hover { background: #f6f8fa; }
html[data-theme="light"] .sb-item.ACT { background: rgba(9,105,218,.1); }
html[data-theme="light"] .sb-item.ACT .sb-lbl { color: #0969da; }
html[data-theme="light"] .sb-item.ACT .sb-iico { color: #0969da; }
html[data-theme="light"] .sb-iico { color: #656d76; }
html[data-theme="light"] .sb-item:hover .sb-iico { color: #1F2328; }
html[data-theme="light"] .sb-lbl { color: #656d76; }
html[data-theme="light"] .sb-item:hover .sb-lbl { color: #1F2328; }
html[data-theme="light"] .sb-ct { background: #ffebe9; color: #cf222e; }
html[data-theme="light"] .sb-btm { border-color: #d0d7de; }
html[data-theme="light"] .sb-out-l { color: #656d76; }
html[data-theme="light"] .sb-out:hover { background: #ffebe9; }
html[data-theme="light"] .sb-out:hover .sb-out-l { color: #cf222e; }
html[data-theme="light"] .sb-out svg { color: #656d76; }
html[data-theme="light"] .sb-out:hover svg { color: #cf222e; }

html[data-theme="light"] .topbar { background: rgba(255,255,255,.85); border-color: #d0d7de; }
html[data-theme="light"] .tb-bc { color: #1F2328; }
html[data-theme="light"] .tb-bc-a { color: #1F2328; }
html[data-theme="light"] .tb-bc-sep { color: #8c959f; }
html[data-theme="light"] .tb-bc-b { color: #656d76; }

/* ━━━━━━━━━━━━━━━━━━━━━━━━
   RESPONSIVE LAYOUT
━━━━━━━━━━━━━━━━━━━━━━━━ */
@media(max-width:900px) {
  .sidebar { transform: translateX(100%); } 
  .sidebar.open { transform: translateX(0); } 
  .sb-ov { display: block; }
  
  .main { margin-right: 0; padding: 20px 16px; margin-top: 60px; } 
  .topbar { right: 0; padding: 0 16px; }
  .ham { display: flex; } 
  
  .bot-nav { 
    display: block; 
    position: fixed; bottom: 0; left: 0; right: 0; 
    background: #161b22; border-top: 1px solid #30363d; 
    z-index: 100; padding: 6px 0; padding-bottom: env(safe-area-inset-bottom);
  }
  html[data-theme="light"] .bot-nav { background: #ffffff; border-color: #d0d7de; }
  
  .bn-inner { display: flex; justify-content: space-around; }
  
  .bn-i { 
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; 
    padding: 8px 4px; cursor: pointer; border: none; background: none; 
    color: #8b949e; font-size: 10px; font-weight: 600; position: relative; 
    transition: color .2s; font-family: 'Tajawal', sans-serif; 
  }
  html[data-theme="light"] .bn-i { color: #656d76; }
  
  .bn-i.ACT { color: #388bfd; }
  html[data-theme="light"] .bn-i.ACT { color: #0969da; }
  
  .bn-i svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; }
  
  .bn-pip { 
    position: absolute; top: 6px; left: calc(50% + 4px); width: 8px; height: 8px; 
    background: #f85149; border-radius: 50%; border: 2px solid #161b22; 
  }
  html[data-theme="light"] .bn-pip { background: #cf222e; border-color: #ffffff; }
}