/* ==========================================================
  260 IT Knowledge Portal — Branding and Layout
  (Clean Professional + Pizazz)
  ========================================================== */

/* ---------------------------
  Header (Purple)
  --------------------------- */
.md-header {
  background-color: #3f51b5 !important;
  color: #ffffff !important;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25) !important;
  position: sticky;
  top: 0;
  z-index: 1000;
  border-radius: 0 0 8px 8px;
  border-bottom: 2px solid #00C8F2 !important;
}

/* Header search / buttons hover */
.md-header .md-search__form,
.md-header .md-header__button {
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}
.md-header .md-search__form:hover {
  background-color: #00C8F21A !important;
  box-shadow: 0 0 0 2px #00C8F2;
}
.md-header .md-header__button:hover {
  background-color: #00C8F21A !important;
}

.md-header__button.md-logo img {
  height: 3rem !important;
  width: auto !important;
  filter: none !important;
  mix-blend-mode: normal !important;
  background: transparent !important;
  display: inline-block;
}

.md-header .md-header__title,
.md-header .md-header__title a,
.md-header .md-header__topic,
.md-header a,
.md-header button,
.md-header svg {
  color: #ffffff !important;
  fill: #ffffff !important;
}

@media (max-width: 640px) {
  .md-header {
    background-color: #3647a8 !important;
  }
}

/* Subtle bottom line under header */
.md-header:after {
  content: "";
  display: block;
  height: 1px;
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  position: absolute;
  left: 0;
  bottom: -1px;
}

/* ==========================================================
  General Typography & Layout
  ========================================================== */

.md-content {
  line-height: 1.7;
  color: var(--md-typeset-color, #1e293b);
  padding-top: 1.5rem !important;
}

.md-typeset h1,
.md-typeset h2,
.md-typeset h3 {
  color: #00458C !important;
  font-weight: 800 !important;
  margin-bottom: 0.8rem;
  text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.05);
}

.md-typeset a {
  color: #00C8F2 !important;
  text-decoration: none;
}
.md-typeset a:hover {
  text-decoration: underline;
}

/* ==========================================================
  Dashboard Cards (Admin)
  ========================================================== */

.kb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)) !important;
  gap: 1.5rem !important;
  margin-top: 2rem;
}

.kb-card {
  background: #fff !important;
  border-radius: 10px !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
  transition: all 0.25s ease-out !important;
  overflow: hidden;
  border: 1px solid rgba(0, 69, 140, 0.08) !important;
}
.kb-card:hover {
  transform: translateY(-4px) !important;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15) !important;
  border-color: #00C8F2 !important;
}

/* Icon pop on hover */
.kb-card svg {
  transition: transform 0.2s ease-in-out, fill 0.2s ease-in-out;
}
.kb-card:hover svg {
  fill: #00C8F2 !important;
  transform: scale(1.1);
}

/* Dark mode fix for cards */
[data-md-color-scheme="slate"] .kb-card,
[data-md-color-scheme="slate"] .kb-card:hover,
[data-md-color-scheme="slate"] .kb-card__link-block,
[data-md-color-scheme="slate"] .kb-card__link-block * {
  background-color: var(--md-code-bg-color) !important;
  border-color: var(--md-default-fg-color--lightest) !important;
  color: var(--md-default-fg-color--light) !important;
}

[data-md-color-scheme="slate"] .kb-card__title,
[data-md-color-scheme="slate"] .kb-card__desc,
[data-md-color-scheme="slate"] .kb-card__link {
  color: var(--md-default-fg-color--light) !important;
  opacity: 1 !important;
}

[data-md-color-scheme="slate"] .kb-card a {
  color: var(--md-default-fg-color--light) !important;
}

.kb-card__link-block {
  padding: 1.5rem 1.75rem !important;
}
.kb-card__title {
  font-size: 1.3rem !important;
  color: #00458C !important;
}
.kb-card__desc {
  opacity: 0.8 !important;
}

/* Quick action buttons on dashboard */
.kb-btn {
  background: #00458C !important;
  color: #fff !important;
  padding: 0.6rem 1.1rem !important;
  border-radius: 8px !important;
  font-weight: 700 !important;
  box-shadow: 0 4px 12px rgba(0, 69, 140, 0.3) !important;
  transition: all 0.2s ease-in-out;
}
.kb-btn:hover {
  background: #00C8F2 !important;
  box-shadow: 0 6px 16px rgba(0, 200, 242, 0.5) !important;
  transform: translateY(-2px);
}

/* Subtle animation on quick buttons */
.kb-btn {
  animation: button-pulse 1.5s infinite alternate ease-in-out;
}
@keyframes button-pulse {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0.95;
    transform: scale(1.01);
  }
}

/* ==========================================================
  Footer
  ========================================================== */

.md-footer {
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  background: #f0f0f0 !important;
  padding: 1.5rem 0 !important;
  text-align: center;
  color: #334155;
  font-size: 0.9rem;
}
.md-footer a {
  color: #00458C;
  text-decoration: none;
}
.md-footer a:hover {
  color: #00C8F2;
  text-decoration: underline;
}

/* ==========================================================
  Page Tools menu (top right) + Print cleanup
  ========================================================== */

#kb-share-top {
  position: fixed;
  top: calc(var(--md-header-height, 3.2rem) + 0.3rem);
  right: max(0.6rem, env(safe-area-inset-right));
  z-index: 1400;
  pointer-events: none;
}

.page-tools {
  pointer-events: auto;
  position: relative;
}

.page-tools__toggle {
  background: #00458C;
  color: #ffffff;
  border: 0;
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 69, 140, 0.3);
}

.page-tools__toggle:hover {
  background: #00C8F2;
  color: #0f172a;
}

.page-tools__menu {
  position: absolute;
  right: 0;
  margin-top: 0.25rem;
  min-width: 200px;
  background: var(--md-default-bg-color);
  border-radius: 8px;
  border: 1px solid rgba(15, 23, 42, 0.15);
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.45);
  padding: 0.25rem 0;
  display: none;
}

.page-tools__menu.is-open {
  display: block;
}

.page-tools__item {
  width: 100%;
  padding: 0.4rem 0.8rem;
  text-align: left;
  background: transparent;
  border: 0;
  font-size: 0.8rem;
  cursor: pointer;
}

.page-tools__item:hover {
  background: rgba(148, 163, 184, 0.2);
}

/* Hide floating UI when printing so PDFs are clean */
@media print {
  #kb-share-top,
  .admin-dashboard-button,
  .download-all-button {
    display: none !important;
  }

  /* Each expanded article prints on its own page */
  .article-expand.is-open {
    break-before: page;          /* modern property */
    page-break-before: always;   /* older browsers */
    page-break-inside: avoid;
  }

  /* Let the very first expanded article stay on page 1 */
  .article-expand.is-open:first-of-type {
    break-before: auto;
    page-break-before: auto;
  }
}

/* ==========================================================
  Inline article preview + Expand all (client pages)
  ========================================================== */

.article-expand {
  margin: 0.35rem 0 0.75rem 1.5rem; /* indent under bullet */
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: rgba(0, 0, 0, 0.02);
  display: none;
}

.article-expand.is-open {
  display: block;
}

/* Hide top H1 in expanded article preview */
.article-expand h1 {
  display: none;
}

[data-md-color-scheme="slate"] .article-expand {
  background: #121a2e !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
}

.client-articles-toolbar {
  margin: 0.25rem 0 0.5rem 0;
  display: flex;
  justify-content: flex-end;
}

#expandAllClientArticles {
  padding: 0.3rem 0.7rem;
  font-size: 0.8rem;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.2);
  background: var(--md-default-bg-color);
  cursor: pointer;
  white-space: nowrap;
}

#expandAllClientArticles:hover {
  background: rgba(0, 0, 0, 0.06);
}

[data-md-color-scheme="slate"] #expandAllClientArticles {
  background: #121a2e !important;
  color: #e6eef7 !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
}

/* ==========================================================
   Clients Directory Page (/clients) – Pill Card Layout
   ========================================================== */

.clients-directory {
  margin: 2rem auto 0;
  max-width: 72rem;
}

.clients-directory__heading {
  text-align: center;
  margin-bottom: 0.75rem;
  color: #0f172a;
}

[data-md-color-scheme="slate"] .clients-directory__heading {
  color: #e5e7eb;
}

.clients-directory__search {
  display: flex;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.clients-directory__search input {
  width: 100%;
  max-width: 420px;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  background: rgba(255, 255, 255, 0.9);
  font-size: 0.9rem;
  color: #0f172a;
}

.clients-directory__search input::placeholder {
  color: #94a3b8;
}

/* Dark-mode search input */
[data-md-color-scheme="slate"] .clients-directory__search input {
  background: #020617;
  border-color: rgba(148, 163, 184, 0.6);
  color: #e5e7eb;
}

[data-md-color-scheme="slate"] .clients-directory__search input::placeholder {
  color: #64748b;
}

/* Grid of pills – up to ~5–6 per row on wide screens */
#clientDirectoryList {
  list-style: none;
  padding: 0;
  margin: 0 auto;
  max-width: 1200px;

  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)) !important;
  gap: 1rem;
  justify-items: center;
}

/* each <li> centers its pill */
#clientDirectoryList > li {
  display: flex !important;
  justify-content: center;
  width: 100%;
}

/* BIGGER skinny pill buttons (all same size, names wrap) */
#clientDirectoryList a {
  display: flex;
  align-items: center;
  justify-content: center;

  width: 100%;
  max-width: 280px;          /* controls pill width */
  padding: 0.65rem 1.6rem;   /* taller + wider */
  border-radius: 999px;

  background: linear-gradient(135deg, #00c8f2, #00458c);
  color: #f9fafb;
  font-weight: 700;
  font-size: 0.9rem;
  text-align: center;
  text-decoration: none;
  line-height: 1.25;

  /* allow names to wrap over multiple lines */
  white-space: normal;
  overflow: visible;
  -webkit-line-clamp: unset;
  -webkit-box-orient: unset;

  box-shadow:
    0 8px 18px rgba(15, 23, 42, 0.6),
    0 0 0 1px rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.5);

  transition:
    transform 0.08s ease,
    filter 0.1s ease;
}

#clientDirectoryList a:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
}

/* Mobile tweaks */

@media (max-width: 640px) {
  .clients-directory {
    margin-top: 1.25rem;
  }

  #clientDirectoryList {
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)) !important;
  }
}

/* Hide any client row that JS marks as .is-hidden */
#clientDirectoryList > li.is-hidden {
  display: none !important;
}