/* ═══════════════════════════════════════════════════════════════════════════════
   Kitgenix Hub – plugin discovery grid (admin.php?page=kitgenix)
   Keep this file identical between plugins to ensure consistent UI/UX.
   Consumes the same --kitgenix-* tokens as kitgenix-admin-ui.css (loaded
   alongside this file on every page that enqueues it) so the Hub reads as
   part of the same product as every plugin's own settings screen, not a
   bolted-on WordPress-default page. See kitgenix-admin-ui.css for the
   token definitions (Primary Blue #214BFF, Manrope/Inter, 8/12/16/20/28
   radius scale, 4/8/12/16/24/32/48/64 spacing scale).
═══════════════════════════════════════════════════════════════════════════════ */

/* Content-centering shell for everything below the header – same pattern
   as .kitgenix-settings-layout on every plugin's own settings screen (the
   outer .wrap.kitgenix-admin-app is the edge-to-edge canvas; this is just
   the readable-width column sitting inside it). */
.kitgenix-hub-wrap {
  width: 100%;
  margin: 0;
  padding: 0 24px 40px;
  box-sizing: border-box;
}

@media screen and (max-width: 782px) {
  .kitgenix-hub-wrap {
    padding: 0 16px 32px;
  }
}

.kitgenix-hub {
  color: var(--kitgenix-text-color);
  font-family: var(--kitgenix-font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Header – same sticky full-bleed topbar treatment as every plugin's own
   settings screen (.kitgenix-topbar in kitgenix-admin-ui.css): it sits
   outside .kitgenix-hub-wrap so it spans the full edge-to-edge canvas
   instead of being boxed in at the page-shell width. */
.kitgenix-hub-header {
  position: sticky;
  top: 32px;
  z-index: 1000;
  width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--kitgenix-space-4);
  margin: 0 0 var(--kitgenix-space-6) 0;
  padding: 8px 24px;
  background: var(--kitgenix-bg-white);
  border-bottom: 1px solid var(--kitgenix-border-color);
  box-shadow: var(--kitgenix-shadow-sm);
  color: var(--kitgenix-text-color);
  font-family: var(--kitgenix-font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: top 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

@media screen and (max-width: 782px) {
  .kitgenix-hub-header {
    top: 46px;
    padding: 8px 16px;
  }
}

.kitgenix-hub-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.kitgenix-hub-logo {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: var(--kitgenix-radius-sm);
  display: block;
}

.kitgenix-hub-brand-copy {
  min-width: 0;
}

.kitgenix-hub-title {
  margin: 0;
  font-family: var(--kitgenix-font-heading);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--kitgenix-text-color);
  white-space: nowrap;
}

.kitgenix-hub-description {
  margin: 0;
  color: var(--kitgenix-text-muted);
  font-size: 12px;
  line-height: 1.4;
}

.kitgenix-hub-social-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--kitgenix-space-2);
}

.kitgenix-hub-social-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--kitgenix-bg-light);
  border: 1px solid var(--kitgenix-border-color);
  border-radius: var(--kitgenix-radius-md);
  color: var(--kitgenix-text-color);
  text-decoration: none;
  transition: all var(--kitgenix-transition);
}

.kitgenix-hub-social-links a:hover,
.kitgenix-hub-social-links a:focus {
  border-color: var(--kitgenix-brand);
  background: var(--kitgenix-brand-light);
  outline: none;
}

.kitgenix-hub-social-links a:focus-visible {
  box-shadow: var(--kitgenix-focus-ring);
}

.kitgenix-hub-social-links img {
  width: 15px;
  height: 15px;
  opacity: 0.75;
}

.kitgenix-hub .kitgenix-hub-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--kitgenix-space-4);
  align-items: stretch;
}

/* Extends the shared .kitgenix-card (background/border/radius/shadow) –
   only the parts a media banner + footer actions row need change. */
.kitgenix-hub .kitgenix-card {
  display: flex;
  flex-direction: column;
  margin-bottom: 0;
  padding: 0;
  overflow: hidden;
  transition: border-color var(--kitgenix-transition), box-shadow var(--kitgenix-transition), transform var(--kitgenix-transition);
}

.kitgenix-hub .kitgenix-card:hover {
  border-color: var(--kitgenix-brand);
  box-shadow: var(--kitgenix-shadow-md);
  transform: translateY(-1px);
}

.kitgenix-hub .kitgenix-card-media {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--kitgenix-bg-light);
  border-bottom: 1px solid var(--kitgenix-border-color);
}

.kitgenix-hub .kitgenix-card-media-banner {
  aspect-ratio: 772 / 250;
}

.kitgenix-hub .kitgenix-card-media-icon {
  min-height: 132px;
  padding: var(--kitgenix-space-4);
}

.kitgenix-hub .kitgenix-card-media-image {
  display: block;
  max-width: 100%;
}

.kitgenix-hub .kitgenix-card-media-banner .kitgenix-card-media-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.kitgenix-hub .kitgenix-card-media-icon .kitgenix-card-media-image {
  width: 96px;
  height: 96px;
  object-fit: contain;
  border-radius: var(--kitgenix-radius-md);
}

.kitgenix-hub .kitgenix-card-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: var(--kitgenix-space-3);
  padding: var(--kitgenix-space-4);
}

.kitgenix-hub .kitgenix-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--kitgenix-space-2);
}

.kitgenix-hub .kitgenix-card-title {
  margin: 0;
  font-family: var(--kitgenix-font-heading);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--kitgenix-text-color);
}

.kitgenix-hub .kitgenix-card-desc {
  margin: 0;
  color: var(--kitgenix-text-muted);
  font-size: 13px;
  line-height: 1.6;
}

/* Status badges – same tokens as .kitgenix-badge.success/.warning
   elsewhere in the app (see kitgenix-admin-ui.css), just named for what
   they mean on this page (an installed-and-active vs. inactive plugin). */
.kitgenix-hub .kitgenix-badge.ok {
  background: var(--kitgenix-success-light);
  color: var(--kitgenix-success);
}

.kitgenix-hub .kitgenix-badge.warn {
  background: var(--kitgenix-warning-light);
  color: var(--kitgenix-warning);
}

.kitgenix-hub .kitgenix-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--kitgenix-space-2);
  align-items: center;
  margin-top: auto;
  padding: var(--kitgenix-space-4);
  border-top: 1px solid var(--kitgenix-border-subtle);
}

/* The shared .kitgenix-admin-app button component (kitgenix-admin-ui.css)
   already covers sizing/shape here since this page carries that class too;
   brand colors are reapplied with the same values so this still renders
   correctly if that component's rules ever change independently. */
.kitgenix-hub .kitgenix-card-actions .button {
  min-width: 112px;
  text-align: center;
  border-radius: var(--kitgenix-radius-md);
  font-family: var(--kitgenix-font-body);
  font-weight: 600;
  transition: all var(--kitgenix-transition);
}

.kitgenix-hub .kitgenix-card-actions .button.button-primary,
.kitgenix-hub .kitgenix-card-actions a.button.button-primary {
  border-color: var(--kitgenix-brand);
  background: var(--kitgenix-brand);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(33, 75, 255, 0.25);
}

.kitgenix-hub .kitgenix-card-actions .button.button-primary:hover,
.kitgenix-hub .kitgenix-card-actions a.button.button-primary:hover,
.kitgenix-hub .kitgenix-card-actions .button.button-primary:focus-visible,
.kitgenix-hub .kitgenix-card-actions a.button.button-primary:focus-visible {
  border-color: var(--kitgenix-brand-dark);
  background: var(--kitgenix-brand-dark);
  color: #ffffff;
}

.kitgenix-hub .kitgenix-card-actions .button.button-secondary,
.kitgenix-hub .kitgenix-card-actions a.button.button-secondary {
  border-color: var(--kitgenix-border-color);
  color: var(--kitgenix-text-color);
  background: var(--kitgenix-bg-white);
}

.kitgenix-hub .kitgenix-card-actions .button.button-secondary:hover,
.kitgenix-hub .kitgenix-card-actions a.button.button-secondary:hover,
.kitgenix-hub .kitgenix-card-actions .button.button-secondary:focus-visible,
.kitgenix-hub .kitgenix-card-actions a.button.button-secondary:focus-visible {
  border-color: var(--kitgenix-brand);
  color: var(--kitgenix-brand);
  background: var(--kitgenix-bg-light);
}

@media screen and (max-width: 782px) {
  .kitgenix-hub .kitgenix-hub-grid {
    grid-template-columns: 1fr;
  }

  .kitgenix-hub .kitgenix-card-actions .button {
    width: 100%;
  }
}

/* ═══════════════════════════════════════
   DARK MODE
   The Hub page carries .kitgenix-admin-app for the shared full-bleed canvas
   and background (see kitgenix-admin-ui.css), but not the in-app theme
   toggle (no data-kitgenix-tabs on this page, so kitgenix-admin-tabs.js
   never sets [data-kitgenix-theme]). It follows the OS-level preference
   instead, using the exact same Midnight-based dark palette as every other
   page's dark theme so the two never look like different products.
═══════════════════════════════════════ */

@media (prefers-color-scheme: dark) {
  .wrap.kitgenix-admin-app:has(.kitgenix-hub) {
    background: #071B3A;
  }

  .kitgenix-hub {
    color: #EAF0FB;
  }

  .kitgenix-hub-header {
    background: #0F2242;
    border-color: #1E3358;
  }

  .kitgenix-hub-title {
    color: #EAF0FB;
  }

  .kitgenix-hub-description,
  .kitgenix-hub .kitgenix-card-desc {
    color: #93A2C2;
  }

  .kitgenix-hub-social-links a {
    background: #0A1830;
    border-color: #1E3358;
    color: #EAF0FB;
  }

  .kitgenix-hub-social-links a:hover,
  .kitgenix-hub-social-links a:focus {
    border-color: #42B3FF;
    background: #132A4D;
  }

  .kitgenix-hub-social-links img {
    filter: invert(1);
  }

  .kitgenix-hub .kitgenix-card {
    background: #0F2242;
    border-color: #1E3358;
  }

  .kitgenix-hub .kitgenix-card:hover {
    border-color: #42B3FF;
  }

  .kitgenix-hub .kitgenix-card-media {
    background: #0A1830;
    border-color: #1E3358;
  }

  .kitgenix-hub .kitgenix-card-title {
    color: #EAF0FB;
  }

  .kitgenix-hub .kitgenix-card-actions {
    border-color: #162743;
  }

  .kitgenix-hub .kitgenix-badge.muted {
    background: #0A1830;
    color: #93A2C2;
  }

  .kitgenix-hub .kitgenix-badge.ok {
    background: #0F2B1D;
    color: #22C55E;
  }

  .kitgenix-hub .kitgenix-badge.warn {
    background: #2B2010;
    color: #F59E0B;
  }

  .kitgenix-hub .kitgenix-card-actions .button.button-primary,
  .kitgenix-hub .kitgenix-card-actions a.button.button-primary {
    border-color: #42B3FF;
    background: #42B3FF;
    color: #071B3A;
  }

  .kitgenix-hub .kitgenix-card-actions .button.button-primary:hover,
  .kitgenix-hub .kitgenix-card-actions a.button.button-primary:hover,
  .kitgenix-hub .kitgenix-card-actions .button.button-primary:focus-visible,
  .kitgenix-hub .kitgenix-card-actions a.button.button-primary:focus-visible {
    border-color: #6EC6FF;
    background: #6EC6FF;
    color: #071B3A;
  }

  .kitgenix-hub .kitgenix-card-actions .button.button-secondary,
  .kitgenix-hub .kitgenix-card-actions a.button.button-secondary {
    border-color: #1E3358;
    color: #EAF0FB;
    background: #0F2242;
  }

  .kitgenix-hub .kitgenix-card-actions .button.button-secondary:hover,
  .kitgenix-hub .kitgenix-card-actions a.button.button-secondary:hover,
  .kitgenix-hub .kitgenix-card-actions .button.button-secondary:focus-visible,
  .kitgenix-hub .kitgenix-card-actions a.button.button-secondary:focus-visible {
    border-color: #42B3FF;
    color: #42B3FF;
    background: #132A4D;
  }
}
