@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@600;700&family=JetBrains+Mono:wght@500&display=swap');

/* ===== Sidebar: NAS Apps as an icon-only rail ===== */
#services > .services-group:has(li[data-name="Sonarr"]) h2,
#layout-groups > .services-group:has(li[data-name="Sonarr"]) h2 {
  display: none;
}

#services > .services-group:has(li[data-name="Sonarr"]),
#layout-groups > .services-group:has(li[data-name="Sonarr"]) {
  position: fixed;
  top: 90px;
  left: 8px;
  width: 56px;
  z-index: 30;
}

#services > .services-group:has(li[data-name="Sonarr"]) .services-list,
#layout-groups > .services-group:has(li[data-name="Sonarr"]) .services-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#services > .services-group:has(li[data-name="Sonarr"]) .service-title-text,
#layout-groups > .services-group:has(li[data-name="Sonarr"]) .service-title-text {
  display: none;
}

#services > .services-group:has(li[data-name="Sonarr"]) .service-icon,
#layout-groups > .services-group:has(li[data-name="Sonarr"]) .service-icon {
  width: 40px;
  height: 40px;
}

body {
  padding-left: 64px;
  padding-right: 175px;
}

/* Force every OTHER top-level group full width (exclude the sidebar) */
#services > .services-group:not(:has(li[data-name="Sonarr"])),
#layout-groups > .services-group:not(:has(li[data-name="Sonarr"])) {
  flex: 1 1 100%;
  width: 100%;
}

/* ===== TrueNAS card: strip it down, move to top ===== */
li[data-name="TrueNAS"] .service-name,
li[data-name="TrueNAS"] .service-title {
  display: none;
}

li[data-name="TrueNAS"] .service-card,
li[data-name="TrueNAS"] .service-block {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
}

li[data-name="TrueNAS"] .font-thin {
  font-size: 0.95rem;
}

li[data-name="TrueNAS"] .font-bold.text-xs.uppercase {
  font-size: 0.65rem;
  opacity: 0.7;
}

#services > .services-group:has(li[data-name="TrueNAS"]) > button,
#layout-groups > .services-group:has(li[data-name="TrueNAS"]) > button {
  display: none;
}

#services > .services-group:has(li[data-name="TrueNAS"]),
#layout-groups > .services-group:has(li[data-name="TrueNAS"]) {
  position: absolute;
  top: 0;
  left: 64px;
  right: 64px;
  z-index: 25;
  margin-top: 0;
}

#information-widgets {
  margin-top: 100px;
  margin-bottom: 0;
}

/* ===== Center the CPU/RAM widgets ===== */
.widget-container {
  flex: 1 1 100%;
  display: flex;
  justify-content: center;
}


/* ===== Welcome banner (inserted by custom.js) ===== */
#welcome-banner {
  flex: 1 1 100%;
  order: -1;
  text-align: center;
  font-size: 2.75rem;
  font-weight: 600;
  margin: 1rem 0 0.5rem 0;
  font-family: 'Poppins', sans-serif;
  letter-spacing: 0.02em;
}

/* ===== Search bar: hidden (using new-tab extension's own search) ===== */


/* ===== Hide every group heading (Downloads, Media, etc.) ===== */
#services .services-group > button,
#layout-groups .services-group > button {
  display: none;
}

/* ===== Hide the manual refresh button ===== */
#revalidate {
  display: none;
}

/* ===== Hide Jellyfin widget entirely ===== */
.services-group:not(:has(li[data-name="Sonarr"])) li[data-name="Jellyfin"] {
  display: none;
}

/* ===== Background image layer ===== */
#custom-bg-layer {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-size: cover;
  background-position: center;
  transition: background-image 0.6s ease-in-out;
}

/* ===== Settings gear icon ===== */
#custom-settings-gear {
  position: fixed;
  bottom: 1rem;
  left: 1rem;
  width: 40px;
  height: 40px;
  border-radius: 9999px;
  background: rgba(30, 41, 59, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 40;
  font-size: 1.25rem;
  color: white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  user-select: none;
}
#custom-settings-gear:hover {
  background: rgba(51, 65, 85, 0.95);
}

/* ===== Settings panel ===== */
#custom-settings-panel {
  position: fixed;
  bottom: 4.5rem;
  left: 1rem;
  width: 260px;
  background: rgba(15, 23, 42, 0.97);
  border-radius: 0.75rem;
  padding: 1rem;
  z-index: 40;
  color: white;
  font-size: 0.85rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
  display: none;
}
#custom-settings-panel.open {
  display: block;
}
#custom-settings-panel h3 {
  margin: 0 0 0.75rem 0;
  font-size: 0.95rem;
  font-weight: 600;
}
#custom-settings-panel .setting-group {
  margin-bottom: 1rem;
}
#custom-settings-panel label {
  display: block;
  margin-bottom: 0.25rem;
  opacity: 0.8;
}
#custom-settings-panel select,
#custom-settings-panel button.theme-toggle {
  width: 100%;
  padding: 0.4rem;
  border-radius: 0.4rem;
  background: rgba(255,255,255,0.1);
  color: white;
  border: 1px solid rgba(255,255,255,0.15);
  cursor: pointer;
}

/* ===== Light theme overrides ===== */
html.custom-light-theme {
  background: #e2e8f0 !important;
}
html.custom-light-theme body,
html.custom-light-theme #inner_wrapper {
  color: #1e293b !important;
}

/* ===== Search bar: fully hidden, zero layout footprint ===== */
.information-widget-search {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* ===== qBittorrent (Downloads widget): hide title/link, keep stats visible ===== */
#services > .services-group:has(li[data-name="qBittorrent"]):not(:has(li[data-name="Sonarr"])) .service-title,
#layout-groups > .services-group:has(li[data-name="qBittorrent"]):not(:has(li[data-name="Sonarr"])) .service-title {
  display: none;
}

/* ================================================================
   POLISH LAYER
   ================================================================ */

/* --- Sidebar rail: scrolls instead of running under the gear --- */
#services > .services-group:has(li[data-name="Sonarr"]),
#layout-groups > .services-group:has(li[data-name="Sonarr"]) {
  max-height: calc(100vh - 160px);
  overflow-y: auto;
  scrollbar-width: none;
  padding: 4px 0;
}
#services > .services-group:has(li[data-name="Sonarr"])::-webkit-scrollbar,
#layout-groups > .services-group:has(li[data-name="Sonarr"])::-webkit-scrollbar { display: none; }

/* --- Rail tiles: rounded glass + hover lift --- */
.services-group:has(li[data-name="Sonarr"]) .service-card {
  border-radius: 12px !important;
  background: rgba(30, 41, 59, 0.7) !important;
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
}
.services-group:has(li[data-name="Sonarr"]) .service-card:hover {
  transform: translateX(3px);
  background: rgba(51, 65, 85, 0.9) !important;
  border-color: rgba(91, 140, 255, 0.45);
}

/* --- Welcome banner: bigger, gradient text --- */
#welcome-banner {
  font-size: clamp(2.2rem, 4.5vw, 3.4rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  background: linear-gradient(90deg, #ffffff 30%, #9db8ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* --- TrueNAS stat strip + qBit stats: monospace numbers, spaced labels --- */
li[data-name="TrueNAS"] .font-thin,
.services-group:has(li[data-name="qBittorrent"]):not(:has(li[data-name="Sonarr"])) .font-thin {
  font-family: 'JetBrains Mono', monospace;
}
.font-bold.text-xs.uppercase { letter-spacing: 0.12em; }

/* --- qBit stat tiles: rounded panels with hover --- */
.services-group:has(li[data-name="qBittorrent"]):not(:has(li[data-name="Sonarr"])) .service-block {
  border-radius: 12px !important;
  background: rgba(30, 41, 59, 0.65) !important;
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: background .15s ease;
}
.services-group:has(li[data-name="qBittorrent"]):not(:has(li[data-name="Sonarr"])) .service-block:hover {
  background: rgba(51, 65, 85, 0.8) !important;
}
.services-group:has(li[data-name="qBittorrent"]):not(:has(li[data-name="Sonarr"])) .service-card {
  background: transparent !important;
  box-shadow: none !important;
}

/* --- Pool bar: thicker with an accent fill --- */
li[data-name="TrueNAS"] [class*="bg-theme-800"] { border-radius: 9999px; }

/* --- Settings gear: glass + subtle hover --- */
#custom-settings-gear {
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: transform .2s ease, background .15s ease;
}
#custom-settings-gear:hover { transform: rotate(45deg); }
#custom-settings-panel {
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* --- Keep the TrueNAS strip inside the screen (no sideways scroll) --- */
html, body { overflow-x: hidden; }
#services > .services-group:has(li[data-name="TrueNAS"]),
#layout-groups > .services-group:has(li[data-name="TrueNAS"]) {
  left: 72px !important;
  right: 24px !important;
  width: auto !important;
  max-width: calc(100vw - 96px);
  box-sizing: border-box;
}
li[data-name="TrueNAS"], li[data-name="TrueNAS"] .service-card { min-width: 0; overflow: hidden; }

/* --- Rail hover: no sideways shift, room for the highlight border --- */
#services > .services-group:has(li[data-name="Sonarr"]),
#layout-groups > .services-group:has(li[data-name="Sonarr"]) {
  left: 2px !important;
  width: 68px !important;
  padding: 6px !important;
  box-sizing: border-box;
}
.services-group:has(li[data-name="Sonarr"]) .service-card:hover {
  transform: none !important;
  box-shadow: 0 0 0 1px rgba(91, 140, 255, 0.45), 0 0 12px rgba(91, 140, 255, 0.25);
}

/* --- Rail hover: inner highlight only (can't be clipped by the scroll area) --- */
.services-group:has(li[data-name="Sonarr"]) .service-card:hover {
  box-shadow: inset 0 0 0 1.5px rgba(91, 140, 255, 0.7), inset 0 0 14px rgba(91, 140, 255, 0.25) !important;
  border-color: transparent !important;
}

/* ================================================================
   NEW WIDGET ROWS (Status / Media Queue / Now Playing / Upcoming)
   ================================================================ */
.services-group:has(li[data-name="VPN"]),
.services-group:has(li[data-name="Requests"]),
.services-group:has(li[data-name="Now Playing"]),
.services-group:has(li[data-name="Calendar"]) {
  margin-top: 0.75rem;
}

/* glass cards for the new rows */
.services-group:has(li[data-name="VPN"]) .service-card,
.services-group:has(li[data-name="Requests"]) .service-card,
.services-group:has(li[data-name="Now Playing"]) .service-card,
.services-group:has(li[data-name="Calendar"]) .service-card {
  background: rgba(30, 41, 59, 0.55) !important;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px !important;
}
.services-group:has(li[data-name="VPN"]) .service-block,
.services-group:has(li[data-name="Requests"]) .service-block {
  border-radius: 10px !important;
  background: rgba(255, 255, 255, 0.04) !important;
}
.services-group:has(li[data-name="VPN"]) .font-thin,
.services-group:has(li[data-name="Requests"]) .font-thin {
  font-family: 'JetBrains Mono', monospace;
}

/* weather + clock sit beside CPU/RAM */
.information-widget-openmeteo,
.information-widget-datetime {
  opacity: 0.9;
}

/* --- Weather + clock: float top-right beside CPU/RAM instead of taking their own rows --- */
#information-widgets { position: relative; }
#information-widgets .information-widget-openmeteo,
#information-widgets .information-widget-datetime {
  position: absolute !important;
  right: 1.25rem;
  width: auto !important;
  flex: none !important;
  z-index: 26;
}
#information-widgets .information-widget-openmeteo { top: 0; }
#information-widgets .information-widget-datetime  { top: 2.6rem; }
#information-widgets .information-widget-datetime > div { font-size: 0.9rem; opacity: 0.85; }

/* tighter banner spacing */
#welcome-banner { margin: 0.5rem 0 0 0 !important; line-height: 1.1; }
#information-widgets { margin-bottom: 0 !important; }

/* --- Even gutters: clear gap from the sidebar, content stays centered --- */
body {
  padding-left: 104px !important;
  padding-right: 104px !important;
}
#services > .services-group:has(li[data-name="TrueNAS"]),
#layout-groups > .services-group:has(li[data-name="TrueNAS"]) {
  left: 104px !important;
  right: 104px !important;
  max-width: none;
}

/* ================================================================
   SCROLLBAR FIX: pad the real scroll container, not <body>
   ================================================================ */
body { padding-left: 0 !important; padding-right: 0 !important; }
#inner_wrapper { padding-left: 96px; padding-right: 96px; box-sizing: border-box; }
#services > .services-group:has(li[data-name="TrueNAS"]),
#layout-groups > .services-group:has(li[data-name="TrueNAS"]) {
  left: 2rem !important;
  right: 2rem !important;
}

/* ================================================================
   RIGHT SIDEBAR: School
   ================================================================ */
#layout-groups > .services-group:has(li[data-name="Brightspace"]),
#services > .services-group:has(li[data-name="Brightspace"]) {
  position: fixed;
  top: 90px;
  right: 2px;
  left: auto;
  width: 68px !important;
  padding: 6px !important;
  box-sizing: border-box;
  z-index: 30;
  flex: none !important;
  max-height: calc(100vh - 160px);
  overflow-y: auto;
  scrollbar-width: none;
}
.services-group:has(li[data-name="Brightspace"]) .services-list {
  display: flex; flex-direction: column; gap: 8px;
}
.services-group:has(li[data-name="Brightspace"]) .service-title-text,
.services-group:has(li[data-name="Brightspace"]) > button { display: none; }
.services-group:has(li[data-name="Brightspace"]) .service-icon { width: 40px; height: 40px; }
.services-group:has(li[data-name="Brightspace"]) .service-icon img { border-radius: 8px; }
.services-group:has(li[data-name="Brightspace"]) .service-card {
  border-radius: 12px !important;
  background: rgba(30, 41, 59, 0.7) !important;
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: background .15s ease;
}
.services-group:has(li[data-name="Brightspace"]) .service-card:hover {
  background: rgba(51, 65, 85, 0.9) !important;
  box-shadow: inset 0 0 0 1.5px rgba(91, 140, 255, 0.7), inset 0 0 14px rgba(91, 140, 255, 0.25) !important;
}

/* School icons: round the Brightspace image's square background */
li[data-name="Brightspace"] .service-icon img { border-radius: 9999px; object-fit: cover; }
li[data-name="myWIT"] .service-icon img { object-fit: contain; }

/* --- Center icons inside every sidebar tile (left + right rails) --- */
.services-group:is(:has(li[data-name="Sonarr"]), :has(li[data-name="Brightspace"])) li.service,
.services-group:is(:has(li[data-name="Sonarr"]), :has(li[data-name="Brightspace"])) .service-card {
  width: 56px !important;
  height: 56px !important;
  margin: 0 !important;
  padding: 0 !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
}
.services-group:is(:has(li[data-name="Sonarr"]), :has(li[data-name="Brightspace"])) .service-title {
  width: 100% !important;
  height: 100%;
  justify-content: center;
  align-items: center;
}
.services-group:is(:has(li[data-name="Sonarr"]), :has(li[data-name="Brightspace"])) .service-title > :not(.service-icon) {
  display: none !important;
}
.services-group:is(:has(li[data-name="Sonarr"]), :has(li[data-name="Brightspace"])) .service-icon {
  width: 40px !important;
  height: 40px !important;
  margin: 0 !important;
  padding: 0 !important;
  flex: none;
}
.services-group:is(:has(li[data-name="Sonarr"]), :has(li[data-name="Brightspace"])) .service-icon img {
  width: 32px !important;
  height: 32px !important;
  object-fit: contain;
}

/* --- Weather + clock: one centered column --- */
#information-widgets .information-widget-openmeteo,
#information-widgets .information-widget-datetime {
  width: 230px !important;
  right: 1rem;
}
#information-widgets .information-widget-openmeteo .widget-inner,
#information-widgets .information-widget-openmeteo > div,
#information-widgets .information-widget-datetime > div {
  justify-content: center !important;
  text-align: center;
  width: 100%;
}

/* --- Weather + clock: vertically centered between TrueNAS strip and qBit row --- */
#information-widgets .information-widget-openmeteo { top: calc(50% - 2.1rem) !important; }
#information-widgets .information-widget-datetime  { top: calc(50% + 0.5rem) !important; }
#information-widgets .information-widget-openmeteo { top: calc(50% - 1.3rem) !important; }
#information-widgets .information-widget-datetime  { top: calc(50% + 1.3rem) !important; }

/* --- Right rail: clear of the page scrollbar --- */
#layout-groups > .services-group:has(li[data-name="Brightspace"]),
#services > .services-group:has(li[data-name="Brightspace"]) { right: 18px !important; }
#inner_wrapper { padding-right: 112px; }
.bookmark-group:has(li[data-name="YouTube"]) { display: none !important; }
