@import url("/assets/pride-tokens.css");

/* ===================================================
   PRIDE SHELL — shared sidebar CSS
   Used by: crm.html, pm.html
   index.html has its own inline sidebar CSS

   Sidebar uses class .ps-side (injected via pride-shell.js)
   Layout hook: body.has-shell → flex row, sidebar left
   =================================================== */

/* ── Sidebar dimension variables ── */
:root {
  --sidebar-w: 240px;
  --sidebar-collapsed: 56px;
}

/* ── Body layout when shell is active ── */
body.has-shell {
  display: flex !important;
  height: 100vh;
  overflow: hidden;
}
body.has-shell .layout {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

/* ── Sidebar container ── */
.ps-side {
  background: var(--s1);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  transition: width .3s ease, min-width .3s ease;
  flex-shrink: 0;
  font-family: var(--font-sans);
}
.ps-side.collapsed {
  width: var(--sidebar-collapsed);
  min-width: var(--sidebar-collapsed);
}

/* ── Side top ── */
.ps-side .side-top {
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,.04);
}
.ps-side .side-logo {
  font-size: 15px;
  font-weight: 600;
  color: var(--w);
  letter-spacing: -.4px;
  white-space: nowrap;
  overflow: hidden;
}
.ps-side .side-logo span { color: var(--accent); }
.ps-side.collapsed .side-logo span:last-child { display: none; }

.ps-side .side-toggle {
  width: 28px; height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: none;
  color: var(--t3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
  flex-shrink: 0;
}
.ps-side .side-toggle:hover { color: var(--t1); border-color: var(--border2); }
.ps-side .side-toggle svg {
  width: 14px; height: 14px;
  transition: transform .3s;
}
.ps-side.collapsed .side-toggle svg { transform: rotate(180deg); }

/* ── Navigation ── */
.ps-side .side-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
}
.ps-side .side-nav::-webkit-scrollbar { width: 0; }
.ps-side .nav-section { padding: 0 12px; margin-bottom: 16px; }
.ps-side .nav-label {
  font-size: 8px;
  color: var(--t4);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  padding: 0 8px;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
}
.ps-side .nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all .15s;
  color: var(--t2);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-decoration: none;
  position: relative;
}
.ps-side .nav-item:hover { background: rgba(255,255,255,.04); color: var(--t1); }
.ps-side .nav-item.active { background: var(--glass); color: var(--accent); }
.ps-side .nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 5px; bottom: 5px;
  width: 2px;
  background: var(--accent);
  border-radius: 2px;
}
.ps-side .nav-icon {
  width: 18px; height: 18px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ps-side .nav-icon svg {
  width: 16px; height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ps-side .nav-text { overflow: hidden; text-overflow: ellipsis; }
.ps-side.collapsed .nav-text,
.ps-side.collapsed .nav-label { opacity: 0; width: 0; }
.ps-side .nav-badge {
  font-size: 9px;
  background: rgba(255,255,255,.06);
  color: var(--t2);
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: auto;
  flex-shrink: 0;
}
.ps-side.collapsed .nav-badge { display: none; }
.ps-side .nav-divider {
  height: 1px;
  background: rgba(255,255,255,.04);
  margin: 10px 12px;
}
.ps-side .nav-sub {
  margin-left: 20px;
  border-left: 1px solid rgba(255,255,255,.06);
  padding-left: 0;
}
.ps-side .nav-sub .nav-item {
  padding-left: 14px;
  font-size: 11px;
  color: var(--t3);
}
.ps-side .nav-sub .nav-item:hover { color: var(--t1); }
.ps-side.collapsed .nav-sub { display: none; }

/* ── Shared modal: warehouse robots ── */
.ps-modal {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0,0,0,.52);
}
.ps-modal.open { display: flex; }
.ps-modal-panel {
  width: min(820px, 100%);
  max-height: min(720px, calc(100vh - 48px));
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--s1);
  border: 1px solid var(--border2);
  border-radius: 12px;
  box-shadow: 0 24px 80px rgba(0,0,0,.45);
}
.ps-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.ps-modal-title { font-size: 15px; color: var(--w); font-weight: 600; }
.ps-modal-sub { font-size: 11px; color: var(--t3); margin-top: 4px; }
.ps-modal-close {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--t2);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}
.ps-modal-close:hover { color: var(--w); border-color: var(--border2); background: var(--glass2); }
.ps-warehouse-list { padding: 14px 18px 18px; overflow: auto; }
.ps-warehouse-row {
  display: grid;
  grid-template-columns: minmax(180px,1.1fr) minmax(130px,.72fr) minmax(220px,1.1fr);
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--t1);
}
.ps-warehouse-row:first-child { border-top: 0; }
.ps-warehouse-header {
  padding: 0 0 8px;
  color: var(--t3);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 600;
}
.ps-warehouse-name { color: var(--w); font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ps-warehouse-row a { color: var(--blue); text-decoration: none; }
.ps-warehouse-row a:hover { color: var(--w); }
.ps-warehouse-row span { color: var(--t4); }
.ps-wh-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--t1);
  white-space: nowrap;
}
.ps-wh-status::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.ps-wh-status.booked::before { background: var(--red); box-shadow: 0 0 8px rgba(224,84,84,.25); }
.ps-wh-status.repair::before { background: var(--yellow); box-shadow: 0 0 8px rgba(232,184,74,.2); }
.ps-wh-status.free::before { background: var(--green); box-shadow: 0 0 8px rgba(94,194,105,.2); }

/* ── Side bottom (user + theme) ── */
.ps-side .side-bottom {
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,.04);
}
.ps-side .side-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s;
  overflow: hidden;
}
.ps-side .side-user:hover { background: rgba(255,255,255,.04); }
.ps-side .avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(255,107,90,.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  color: var(--accent);
  flex-shrink: 0;
}
.ps-side .user-info { overflow: hidden; white-space: nowrap; }
.ps-side .user-name { font-size: 12px; color: var(--t1); font-weight: 500; }
.ps-side .user-role { font-size: 10px; color: var(--t3); }
.ps-side.collapsed .user-info { opacity: 0; width: 0; }
.ps-side .theme-toggle {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  color: var(--t3);
  display: flex;
  align-items: center;
  transition: color .15s, background .15s;
  flex-shrink: 0;
}
.ps-side .theme-toggle:hover { color: var(--accent); background: var(--glass2); }
.ps-side .theme-toggle svg { width: 14px; height: 14px; }
.ps-side.collapsed .theme-toggle { display: none; }

/* ── Light theme overrides ── */
:root.light .ps-side { border-right-color: var(--border); }
:root.light .ps-side .side-top { border-bottom-color: var(--border); }
:root.light .ps-side .side-bottom { border-top-color: var(--border); }
:root.light .ps-side .nav-divider { background: var(--border); }
:root.light .ps-side .nav-item:hover { background: rgba(0,0,0,.05); }
:root.light .ps-side .nav-item.active,
[data-theme="light"] .ps-side .nav-item.active { background: var(--accent-tint); color: var(--accent); }
:root.light .ps-side .nav-label { color: var(--t3); }
:root.light .ps-side .side-user:hover { background: rgba(0,0,0,.04); }
:root.light .ps-side .nav-badge { background: rgba(0,0,0,.06); color: var(--t2); }

/* ── Mobile: hide sidebar, show bottom nav ── */
@media (max-width: 767px) {
  body.has-shell .ps-side { display: none; }
  /* Hide module's own mobile nav if any */
  body.has-shell .mobile-nav { display: none !important; }

  .ps-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 64px;
    background: var(--s1);
    border-top: 1px solid var(--border);
    z-index: 250;
    align-items: stretch;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .ps-bnav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: none;
    border: none;
    color: var(--t3);
    font-size: 9px;
    font-family: inherit;
    cursor: pointer;
    transition: color .15s;
    padding: 4px 0;
    letter-spacing: .3px;
    text-transform: uppercase;
    text-decoration: none;
  }
  .ps-bnav-btn svg {
    width: 20px; height: 20px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.6;
  }
  .ps-bnav-btn.active { color: var(--accent); }
  .ps-modal { padding: 14px; }
  .ps-warehouse-row { grid-template-columns: 1fr; gap: 4px; padding: 11px 0; }
  .ps-warehouse-header { display: none; }
}

@media (min-width: 768px) {
  .ps-bottom-nav { display: none !important; }
}
