/* custom.css of home.hx */
/* Scandi Dark Bento — viewport-fit dashboard
   Targets the real DOM:
     #inner_wrapper > div.container.flex.flex-col
       ├─ search overlay (hidden)
       ├─ #information-widgets
       ├─ #layout-groups
       │    ├─ .services-group  (Hero, Featured, Apps, Media, Tools)
       │    └─ .bookmark-group  (Quick Links)
       └─ #footer (hidden)
*/

:root {
  --bg-primary: #161615;
  --bg-card: #232221;
  --bg-card-hover: #2a2928;
  --border: #2f2e2d;
  --text-primary: #e7e5e4;
  --text-muted: #78716c;
}

html, body, #__next, #page_wrapper, #inner_wrapper {
  height: 100vh !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  background: var(--bg-primary) !important;
}

::-webkit-scrollbar { width: 0; height: 0; }

/* === SHELL: the unnamed div directly under #inner_wrapper ===
   Force full-width and column flex so widgets / layout-groups stack. */
#inner_wrapper > div {
  width: 100% !important;
  max-width: none !important;
  height: 100vh !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0.6rem !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 0.6rem !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
}

#footer { display: none !important; }

/* === TOP WIDGET STRIP === */
#information-widgets {
  flex: 0 0 auto !important;
  margin: 0 !important;
  padding: 0.5rem 0.75rem !important;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
}

#widgets-wrap {
  flex-wrap: nowrap !important;
  gap: 0.75rem;
}

.widget-container,
.information-widget-greeting,
.information-widget-datetime,
.information-widget-openmeteo {
  margin: 0 !important;
}

.information-widget-resource {
  padding: 0.25rem 0.5rem !important;
}

/* === BENTO GRID on #layout-groups === */
#layout-groups,
#services,
#bookmarks {
  flex: 1 1 auto !important;
  margin: 0 !important;
  min-height: 0 !important;
}

/* Bento grid was written for #layout-groups but never matched: without per-group layout
   entries homepage renders #services instead. Adding tabs (2026-11-05) switched the DOM to
   #layout-groups, so these rules are parked under an inert id to keep the live look. */
#bento-off {
  display: grid !important;
  grid-template-columns: repeat(12, 1fr);
  grid-template-rows: 1.4fr 1fr 1fr 0.7fr;
  gap: 0.6rem;
}

#bento-off > *:nth-child(1) { grid-column: 1 / 5  !important; grid-row: 1 / 4 !important; }  /* Hero    — Jellyfin */
#bento-off > *:nth-child(2) { grid-column: 5 / 13 !important; grid-row: 1     !important; }  /* Featured— Frigate */
#bento-off > *:nth-child(3) { grid-column: 5 / 13 !important; grid-row: 2     !important; }  /* Apps */
#bento-off > *:nth-child(4) { grid-column: 5 / 13 !important; grid-row: 3     !important; }  /* Media */
#bento-off > *:nth-child(5) { grid-column: 1 / 7  !important; grid-row: 4     !important; }  /* Tools */
#bento-off > *:nth-child(6) { grid-column: 7 / 13 !important; grid-row: 4     !important; }  /* Quick Links */

/* === GROUP wrapper fills its cell === */
.services-group,
.bookmark-group {
  height: 100% !important;
  margin: 0 !important;
  flex-basis: auto !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}

/* The headlessui disclosure panel inside each group */
.services-group > [id^="headlessui-disclosure-panel"],
.bookmark-group > [id^="headlessui-disclosure-panel"] {
  height: 100% !important;
  flex: 1 1 auto !important;
}

/* The inner <ul> — force columns per group */
.services-group ul,
.bookmark-group ul {
  height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  gap: 0.5rem !important;
  align-content: stretch !important;
}

#bento-off > *:nth-child(1) ul { grid-template-columns: 1fr !important; }                /* Hero */
#bento-off > *:nth-child(2) ul { grid-template-columns: 1fr !important; }                /* Featured */
#bento-off > *:nth-child(3) ul { grid-template-columns: repeat(5, 1fr) !important; }     /* Apps */
#bento-off > *:nth-child(4) ul { grid-template-columns: repeat(4, 1fr) !important; }     /* Media */
#bento-off > *:nth-child(5) ul { grid-template-columns: repeat(5, 1fr) !important; }     /* Tools */
#bento-off > *:nth-child(6) ul { grid-template-columns: repeat(6, 1fr) !important; }     /* Quick Links */

/* Hide collapse/disclosure buttons & group headers */
.group-header,
button[id^="headlessui-disclosure-button"] { display: none !important; }

/* === CARDS === */
li.service, li.bookmark {
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
  height: 100% !important;
}

li.service > *, li.bookmark > * {
  height: 100% !important;
  margin-bottom: 0 !important;
}

li.service > div,
li.bookmark > a,
li.bookmark > div {
  background: var(--bg-card) !important;
  border: 1px solid var(--border) !important;
  border-radius: 18px !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  box-shadow: none !important;
  transition: background 0.15s ease !important;
  height: 100% !important;
  margin: 0 !important;
  box-sizing: border-box !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  position: relative !important;
  overflow: hidden !important;
}

/* The icon-and-text row inside a service card */
li.service > div > div {
  width: 100% !important;
}

li.service > div:hover,
li.bookmark > a:hover,
li.bookmark > div:hover {
  background: var(--bg-card-hover) !important;
}

/* === HERO (Jellyfin) — vertical, large, centered === */
#bento-off > *:nth-child(1) li.service > div {
  align-items: center !important;
  text-align: center !important;
  padding: 2.5rem 1.5rem !important;
  gap: 1.5rem !important;
}
#bento-off > *:nth-child(1) li.service > div > div {
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  gap: 1rem !important;
  margin: 0 !important;
}
#bento-off > *:nth-child(1) .service-icon,
#bento-off > *:nth-child(1) img,
#bento-off > *:nth-child(1) svg {
  width: 8rem !important;
  height: 8rem !important;
  margin: 0 !important;
}
#bento-off > *:nth-child(1) .service-name {
  font-size: 2rem !important;
  font-weight: 600 !important;
}
#bento-off > *:nth-child(1) .service-description {
  font-size: 1rem !important;
}

/* === FEATURED (Frigate) — horizontal centered === */
#bento-off > *:nth-child(2) li.service > div {
  padding: 1.5rem 2rem !important;
  align-items: center !important;
}
#bento-off > *:nth-child(2) li.service > div > div {
  align-items: center !important;
  justify-content: center !important;
  gap: 1rem !important;
}
#bento-off > *:nth-child(2) .service-icon,
#bento-off > *:nth-child(2) li.service img,
#bento-off > *:nth-child(2) li.service svg {
  width: 4rem !important;
  height: 4rem !important;
  margin: 0 !important;
}
#bento-off > *:nth-child(2) .service-name {
  font-size: 1.5rem !important;
  font-weight: 600 !important;
}
#bento-off > *:nth-child(2) .service-description {
  font-size: 1rem !important;
}

/* === APPS + MEDIA — equal medium tiles, vertically centered === */
#bento-off > *:nth-child(3) li.service > div,
#bento-off > *:nth-child(4) li.service > div {
  padding: 1rem 1.1rem !important;
  align-items: center !important;
}
#bento-off > *:nth-child(3) li.service > div > div,
#bento-off > *:nth-child(4) li.service > div > div {
  align-items: center !important;
  gap: 0.75rem !important;
}
#bento-off > *:nth-child(3) .service-icon,
#bento-off > *:nth-child(4) .service-icon,
#bento-off > *:nth-child(3) li.service img,
#bento-off > *:nth-child(4) li.service img,
#bento-off > *:nth-child(3) li.service svg,
#bento-off > *:nth-child(4) li.service svg {
  width: 2rem !important;
  height: 2rem !important;
}
#bento-off > *:nth-child(3) .service-name,
#bento-off > *:nth-child(4) .service-name {
  font-size: 0.95rem !important;
  font-weight: 500 !important;
}
#bento-off > *:nth-child(3) .service-description,
#bento-off > *:nth-child(4) .service-description {
  font-size: 0.78rem !important;
}

/* === TOOLS — compact icon-over-name === */
#bento-off > *:nth-child(5) li.service > div {
  padding: 0.5rem !important;
  flex-direction: column !important;
  justify-content: center !important;
  align-items: center !important;
  text-align: center !important;
  gap: 0.3rem !important;
}
#bento-off > *:nth-child(5) .service-icon,
#bento-off > *:nth-child(5) li.service img,
#bento-off > *:nth-child(5) li.service svg {
  width: 1.4rem !important;
  height: 1.4rem !important;
}
#bento-off > *:nth-child(5) .service-name {
  font-size: 0.75rem !important;
  font-weight: 500 !important;
}
#bento-off > *:nth-child(5) .service-description {
  display: none !important;
}

/* === BOOKMARKS — icon-only tiles === */
#bento-off > *:nth-child(6) li.bookmark a {
  flex-direction: column !important;
  justify-content: center !important;
  align-items: center !important;
  text-align: center !important;
  gap: 0.3rem !important;
  height: 100% !important;
  padding: 0.5rem !important;
}
#bento-off > *:nth-child(6) li.bookmark img,
#bento-off > *:nth-child(6) li.bookmark svg {
  width: 1.4rem !important;
  height: 1.4rem !important;
}
#bento-off > *:nth-child(6) .bookmark-text,
#bento-off > *:nth-child(6) .bookmark-description {
  display: none !important;
}
#bento-off > *:nth-child(6) .bookmark-name {
  font-size: 0.7rem !important;
}

/* === TYPOGRAPHY === */
.service-name, .bookmark-name { color: var(--text-primary) !important; }
.service-description, .bookmark-description { color: var(--text-muted) !important; }

/* Stop services-group default flex-grow shenanigans */
.services-group.flex-1, .bookmark-group.flex-1 { flex: 1 1 auto !important; }

/* Fleet tab: full-height iframe of https://home.hx/fleet/ (source /home/ale/srv/tools/fleet-map/) */
iframe.fleet-frame {
  width: 100%;
  height: calc(100vh - 175px);
  min-height: 600px;
  border: 0;
  border-radius: 0.5rem;
  background: #1c1917;
}

/* Tab bar (Home / Fleet) — docked into the top widget bar by custom.js (after the greeting) */
#tabs { margin: 0 !important; flex: 0 0 auto !important; }
#tabs.docked { align-self: center; margin: 0 0.5rem 0 0 !important; }
#myTab { display: flex !important; gap: 0.15rem; width: fit-content; padding: 0.15rem !important;
  background: var(--bg-primary) !important; border: 1px solid var(--border); border-radius: 10px !important; }
#myTab li { height: auto !important; width: auto !important; }
#myTab button { margin: 0 !important; padding: 0.15rem 0.7rem !important; font-size: 0.8rem; border-radius: 7px !important; color: var(--text-muted); white-space: nowrap; }
#myTab button[aria-selected="true"] { background: var(--bg-card-hover) !important; color: var(--text-primary); }

/* Fleet tab: one full-width card, the iframe fills it */
#layout-groups:has(iframe.fleet-frame) { display: block !important; margin: 0 !important; }
#layout-groups:has(iframe.fleet-frame) .services-group { padding: 0 !important; }
li.service:has(iframe.fleet-frame) > div { justify-content: flex-start !important; padding: 0.5rem !important; }

/* Keep the top bar on one line now that it also holds the tabs */
.information-widget-greeting span { white-space: nowrap; }
#widgets-wrap { flex-wrap: nowrap !important; }
#widgets-wrap > .widget-container > div { flex-wrap: nowrap !important; }
@media (max-width: 1700px) {
  .information-widget-greeting span { font-size: 1.1rem !important; margin-right: 0.5rem !important; }
  .information-widget-resource { margin-right: 0 !important; padding: 0.25rem 0.35rem !important; }
  .information-widget-datetime span, .information-widget-datetime div { font-size: 0.95rem !important; }
}
