/* ============================================================================
   sidebar.css — reusable slide-in navigation sidebar.
   Pair with js/sidebar.js. Include on any page:
     <link rel="stylesheet" href="/css/sidebar.css" />
     <script src="/js/sidebar.js" defer></script>
   ============================================================================ */

/* Keep the sidebar's own box model predictable regardless of page CSS */
#nav-open-btn,
#side-nav,
#side-nav * {
  box-sizing: border-box;
}

/* Menu open button — white icon on a black rounded-square background */
#nav-open-btn {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9990;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: #000;
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
}
#nav-open-btn svg { width: 26px; height: 26px; }

/* Drawer backdrop */
#side-nav {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.5);
}
#side-nav.open { display: block; }

/* Sliding panel — full height, from the right */
#side-nav-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  height: 100%;
  width: 100%;
  max-width: 380px;
  background: #111;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.28s ease;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.3);
}
#side-nav.open #side-nav-panel { transform: translateX(0); }

/* Panel header */
#side-nav-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 54px;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
#side-nav-title {
  font-family: "Baumans", system-ui;
  font-size: 17px;
  letter-spacing: 1px;
  color: #fff;
  text-decoration: none;
}
#side-nav-title:hover { text-decoration: none; }
#side-nav-close {
  /* width:auto + inline-flex guard against pages whose global `button {}`
     rule sets width:100%/display:block (e.g. the Password Keeper page),
     which would otherwise stretch this × and wrap the header title. */
  width: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: #fff;
  padding: 6px;
  line-height: 0;
  border-radius: 6px;
}
#side-nav-close svg { width: 20px; height: 20px; }

/* Search */
#side-nav-search-wrap {
  position: relative;
  padding: 14px 16px;
  flex-shrink: 0;
}
#side-nav-search-icon {
  position: absolute;
  left: 28px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  line-height: 0;
  color: rgba(255, 255, 255, 0.45);
  pointer-events: none;
}
#side-nav-search-icon svg { width: 16px; height: 16px; display: block; }
#side-nav-search {
  width: 100%;
  box-sizing: border-box;
  padding: 11px 12px 11px 38px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 9px;
  color: #fff;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}
#side-nav-search::placeholder { color: rgba(255, 255, 255, 0.4); }
#side-nav-search:focus {
  border-color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.12);
}

/* List */
#side-nav-links {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  flex: 1;
  padding-bottom: 10px;
}
.side-nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 20px;
  text-decoration: none;
  color: #fff;
  font-family: "Baumans", system-ui;
  font-size: 15px;
  letter-spacing: 0.4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  border-left: 3px solid transparent;
  transition: background 0.15s, border-color 0.15s;
}
.side-nav-item:hover { background: rgba(255, 255, 255, 0.07); }
.side-nav-item:active { background: rgba(255, 255, 255, 0.1); }
.side-nav-item.active {
  background: rgba(255, 255, 255, 0.12);
  border-left-color: #fff;
}
.side-nav-item img {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  object-fit: contain;
}
.side-nav-ico {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.side-nav-ico svg { width: 100%; height: 100%; display: block; }
#side-nav-empty {
  display: none;
  padding: 24px 20px;
  text-align: center;
  color: rgba(255, 255, 255, 0.5);
  font-size: 14px;
}

/* Footer: logged-in user + log out */
#side-nav-footer {
  flex-shrink: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding: 12px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#side-nav-user {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.55);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#side-nav-user:empty { display: none; }
#side-nav-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 11px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 9px;
  font-family: "Baumans", system-ui;
  font-size: 14px;
  letter-spacing: 0.4px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
#side-nav-logout svg { width: 16px; height: 16px; }
#side-nav-logout:hover {
  background: rgba(255, 80, 80, 0.2);
  border-color: rgba(255, 80, 80, 0.5);
}
#side-nav-logout:disabled { opacity: 0.6; cursor: default; }
