/* ── The applications panel (issue #185, F0) ───────────────────────────────────────────────
   A dockable from its first day (#188), so nothing here positions it from an ancestor: the
   element is re-parented into a dock zone and has to look the same wherever it lands. The
   default — not docked — is the same overlay shape the chat uses, between the two bars. */

.lf-apps {
  position: fixed;
  top: var(--lf-top-edge, var(--lf-header-height));
  bottom: var(--lf-footer-height, 0px);
  right: 0;
  width: min(380px, 100vw);
  z-index: 1074;
  background: #fff;
  box-shadow: -8px 0 28px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.lf-apps[hidden] { display: none !important; }

/* Docked: the zone decides where it is and how big, so the overlay geometry goes away. */
.lf-apps.lf-docked {
  position: static;
  width: auto;
  box-shadow: none;
  border-inline-start: 1px solid #ced4da;
}

.lf-apps-titlebar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #dee2e6;
  background: #f8f9fa;
  flex: 0 0 auto;
}

.lf-apps-title {
  font-size: 1rem;
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
}

.lf-apps-close {
  border: 0;
  background: transparent;
  color: #6c757d;
  padding: 0.15rem 0.35rem;
  border-radius: 0.25rem;
  cursor: pointer;
}
.lf-apps-close:hover { background: #e9ecef; color: #343a40; }

.lf-apps-search-wrap { padding: 0.5rem 0.75rem; flex: 0 0 auto; }

.lf-apps-body {
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 0;
  padding: 0 0.5rem 0.5rem;
}
.lf-apps-body:focus-visible { outline: 2px solid #0d6efd; outline-offset: -2px; }

.lf-apps-card {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.6rem;
  border-radius: 0.375rem;
  cursor: pointer;
  /* The publisher's accent, when they chose one; the theme's otherwise. */
  border-inline-start: 3px solid var(--lf-app-accent, transparent);
}
.lf-apps-card:hover { background: #f1f3f5; }
.lf-apps-card:focus-visible { outline: 2px solid #0d6efd; outline-offset: -2px; background: #f1f3f5; }

.lf-apps-card-icon {
  flex: 0 0 auto;
  width: 2rem;
  text-align: center;
  font-size: 1.15rem;
  color: var(--lf-app-accent, #495057);
}

.lf-apps-card-text { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.lf-apps-card-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lf-apps-card-desc {
  font-size: 0.8rem;
  color: #6c757d;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lf-apps-star {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: #adb5bd;
  padding: 0.2rem 0.3rem;
  border-radius: 0.25rem;
  cursor: pointer;
}
.lf-apps-star:hover { color: #6c757d; background: #e9ecef; }
.lf-apps-star.is-on { color: #f59f00; }

.lf-apps-empty { padding: 0.75rem; color: #6c757d; margin: 0; }

/* ── What a feed offers and this host does not have (issue #185, F1) ─────────────────────── */

.lf-apps-group {
  padding: 0.6rem 0.6rem 0.25rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #868e96;
}

/* Dimmer than an installed card, because it is not a door yet: pressing it opens the Catalogue
   to read about it, and the difference has to be visible before the click. */
.lf-apps-card-available .lf-apps-card-icon { color: #adb5bd; }

.lf-apps-card-version { font-size: 0.75rem; color: #868e96; flex: 0 0 auto; }

.lf-apps-install {
  flex: 0 0 auto;
  font-size: 0.75rem;
  font-weight: 600;
  color: #0d6efd;
  border: 1px solid #0d6efd;
  border-radius: 0.25rem;
  padding: 0.1rem 0.4rem;
}

/* The count of installed applications with something newer on offer. */
.lf-apps-toggle { position: relative; }
.lf-apps-badge {
  position: absolute;
  top: -0.25rem;
  inset-inline-end: -0.25rem;
  min-width: 1.1rem;
  padding: 0 0.2rem;
  border-radius: 0.55rem;
  background: #fd7e14;
  color: #fff;
  font-size: 0.65rem;
  line-height: 1.1rem;
  text-align: center;
  font-weight: 700;
}

@media (max-width: 720px) {
  .lf-apps { width: 100vw; }
}

/* The application this page is mounted inside (issue #208, F12). */
.lf-apps-card.is-current { box-shadow: inset 3px 0 0 var(--lf-app-accent, #0d6efd); }
