/* ==========================================================
   260 IT Knowledge Portal — Branding v2 (Clean Modern)
   Purpose: modern UI without fighting Material theme
   ========================================================== */

/* ---------------------------
   Global rhythm & typography
   --------------------------- */

.md-content {
  padding-top: 1.25rem;
  line-height: 1.7;
}

.md-typeset h1,
.md-typeset h2,
.md-typeset h3 {
  font-weight: 800;
  letter-spacing: -0.01em;
}

/* ---------------------------
   Layout width polish
   --------------------------- */

@media (min-width: 1024px) {
  .md-grid {
    max-width: 84rem;
  }
}

/* ---------------------------
   Card system (dashboard)
   --------------------------- */

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

.kb-card {
  background: var(--md-default-bg-color);
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 10px 30px rgba(2, 6, 23, 0.08);
  transition:
    transform 160ms cubic-bezier(.2,.9,.3,1),
    box-shadow 160ms ease,
    border-color 160ms ease;
}

.kb-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 44px rgba(2, 6, 23, 0.14);
  border-color: rgba(0, 200, 242, 0.25);
}

[data-md-color-scheme="slate"] .kb-card {
  border-color: rgba(255,255,255,0.05);
  box-shadow: 0 18px 44px rgba(0,0,0,0.6);
}


/* ---------------------------
   Card inner spacing
   --------------------------- */

.kb-card__block {
  padding: 1.25rem;
}

.kb-card__title {
  font-size: 1.05rem;
  font-weight: 800;
  margin-bottom: 0.35rem;
}

.kb-card__desc {
  font-size: 0.95rem;
  opacity: 0.8;
}

/* ---------------------------
   Buttons (modern SaaS style)
   --------------------------- */

.kb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 0.95rem;
  border-radius: 0.75rem;
  font-weight: 600;
  background: var(--md-primary-fg-color);
  color: #fff;
  border: 0;
  transition:
    transform 120ms ease,
    box-shadow 120ms ease,
    filter 120ms ease;
}

.kb-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.05);
  box-shadow: 0 10px 26px rgba(2,6,23,0.25);
}

/* ---------------------------
   Accessibility
   --------------------------- */

.kb-card:focus-within,
.kb-btn:focus {
  outline: 3px solid rgba(0, 200, 242, 0.25);
  outline-offset: 4px;
}

/* ==========================================================
   Page Tools — Modern Floating Control + Print Cleanup
   Branding v2 (Drop-in, non-destructive)
   ========================================================== */

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

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

/* ---------- Toggle button ---------- */
.page-tools__toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;

  background: linear-gradient(
    180deg,
    var(--md-primary-fg-color),
    color-mix(in srgb, var(--md-primary-fg-color) 85%, black)
  );

  color: #ffffff;
  border: 0;
  border-radius: 999px;
  padding: 0.45rem 0.95rem;

  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.01em;

  cursor: pointer;

  box-shadow:
    0 6px 18px rgba(2, 6, 23, 0.28),
    inset 0 1px 0 rgba(255,255,255,0.15);

  transition:
    transform 120ms ease,
    box-shadow 120ms ease,
    filter 120ms ease;
}

.page-tools__toggle:hover {
  transform: translateY(-2px);
  filter: brightness(1.05);
  box-shadow:
    0 10px 28px rgba(2, 6, 23, 0.35),
    inset 0 1px 0 rgba(255,255,255,0.18);
}

.page-tools__toggle:active {
  transform: translateY(0);
}

/* ---------- Dropdown menu ---------- */
.page-tools__menu {
  position: absolute;
  right: 0;
  margin-top: 0.4rem;
  min-width: 210px;

  background: color-mix(
    in srgb,
    var(--md-default-bg-color) 92%,
    transparent
  );

  backdrop-filter: blur(10px) saturate(120%);
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.12);

  box-shadow:
    0 20px 40px rgba(2, 6, 23, 0.45),
    inset 0 1px 0 rgba(255,255,255,0.06);

  padding: 0.35rem 0;
  display: none;
}

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

/* ---------- Menu items ---------- */
.page-tools__item {
  width: 100%;
  padding: 0.45rem 0.9rem;

  display: flex;
  align-items: center;
  gap: 0.5rem;

  background: transparent;
  border: 0;
  text-align: left;

  font-size: 0.8rem;
  font-weight: 500;
  color: var(--md-typeset-color);

  cursor: pointer;
  transition: background-color 120ms ease, transform 120ms ease;
}

.page-tools__item:hover {
  background: rgba(148, 163, 184, 0.18);
  transform: translateX(2px);
}

/* ---------- Dark mode refinement ---------- */
[data-md-color-scheme="slate"] .page-tools__menu {
  border-color: rgba(255,255,255,0.06);
  box-shadow:
    0 24px 50px rgba(0,0,0,0.7),
    inset 0 1px 0 rgba(255,255,255,0.04);
}

[data-md-color-scheme="slate"] .page-tools__item:hover {
  background: rgba(255,255,255,0.08);
}

/* ==========================================================
   Print Cleanup — Clean PDFs, No Floating UI
   ========================================================== */

@media print {
  /* Hide floating and navigation UI */
  #kb-share-top,
  nav,
  .md-nav,
  .md-sidebar,
  .client-articles-toolbar,
  #clientDirectoryList {
    display: none !important;
  }

  /* Normalize main content containers */
  .md-content,
  .md-typeset,
  .md-main,
  main,
  article,
  section {
    width: 100% !important;
    overflow: visible !important;
    float: none !important;
  }

  /* Prevent layout fragmentation */
  .grid,
  .flex,
  ul,
  li {
    display: block !important;
  }

  /* Page setup */
  @page {
    size: A4;
    margin: 16mm;
  }
}

/* ============================
   END Page Tools Block
   ============================ */

/* ==========================================================
   Inline Article Preview — Modern v2
   Keeps JS behavior intact (.is-open)
   ========================================================== */

/* Collapsed by default */
.article-expand {
  margin: 0.45rem 0 0.85rem 1.5rem;
  padding: 0 1rem;

  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, 0.08);

  background: linear-gradient(
    180deg,
    rgba(255,255,255,0.85),
    rgba(255,255,255,0.75)
  );

  box-shadow:
    0 10px 28px rgba(15, 23, 42, 0.08),
    inset 0 1px 0 rgba(255,255,255,0.25);

  display: grid;
  grid-template-rows: 0fr;
  overflow: hidden;

  transition:
    grid-template-rows 260ms ease,
    padding 220ms ease,
    border-color 180ms ease,
    box-shadow 220ms ease;
}

/* Expanded state */
.article-expand.is-open {
  grid-template-rows: 1fr;
  padding: 0.85rem 1rem;
}

/* Inner content wrapper (prevents height jump) */
.article-expand > * {
  min-height: 0;
}

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

/* Dark mode variant */
[data-md-color-scheme="slate"] .article-expand {
  background: linear-gradient(
    180deg,
    rgba(8, 10, 18, 0.75),
    rgba(8, 10, 18, 0.65)
  );
  border-color: rgba(255,255,255,0.06);
  box-shadow:
    0 18px 40px rgba(0,0,0,0.55),
    inset 0 1px 0 rgba(255,255,255,0.04);
}

/* ---------- Toolbar ---------- */
.client-articles-toolbar {
  margin: 0.35rem 0 0.6rem;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.4rem;
}

/* Expand All button — modern pill */
#expandAllClientArticles {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;

  padding: 0.35rem 0.8rem;
  font-size: 0.75rem;
  font-weight: 600;

  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.18);

  background: linear-gradient(
    180deg,
    var(--md-default-bg-color),
    color-mix(in srgb, var(--md-default-bg-color) 88%, black)
  );

  color: var(--md-typeset-color);
  cursor: pointer;
  white-space: nowrap;

  box-shadow:
    0 3px 10px rgba(2,6,23,0.15),
    inset 0 1px 0 rgba(255,255,255,0.35);

  transition:
    transform 120ms ease,
    box-shadow 120ms ease,
    background-color 120ms ease;
}

#expandAllClientArticles:hover {
  transform: translateY(-1px);
  box-shadow:
    0 6px 18px rgba(2,6,23,0.25),
    inset 0 1px 0 rgba(255,255,255,0.4);
}

/* Dark mode button */
[data-md-color-scheme="slate"] #expandAllClientArticles {
  background: linear-gradient(
    180deg,
    rgba(10, 14, 28, 0.85),
    rgba(10, 14, 28, 0.75)
  );
  color: #e6eef7;
  border-color: rgba(255,255,255,0.12);
  box-shadow:
    0 6px 20px rgba(0,0,0,0.6),
    inset 0 1px 0 rgba(255,255,255,0.05);
}

/* Clickable article titles */
.client-article-link {
  display: block;
  cursor: pointer;
  font-weight: 600;
  color: var(--md-accent-fg-color);
  padding: 0.5rem 0;
  transition: color 0.2s ease;
}

.client-article-link:hover {
  color: var(--md-primary-fg-color);
  text-decoration: underline;
}


/* ==========================================================
  Daily Notes — Enhanced Styling with Flare
  ========================================================== */

.daily-notes {
  grid-column: 1 / -1;
  position: relative;
  background: linear-gradient(135deg, #fffde7, #fff9c4);
  border: 1px solid #e0c200;
  border-left: 6px solid transparent;
  border-radius: 12px;
  box-shadow:
    0 2px 8px rgba(6, 8, 15, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  padding: 0.85rem 1.25rem;
  margin-bottom: 1.25rem;
  color: #0f172a;
  font-size: 0.95rem;
  line-height: 1.5;
  overflow: hidden;
  animation: fadeInNote 0.4s ease-out;
}

/* Animated shimmer bar on the left */
.daily-notes::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 6px;
  height: 100%;
  background: linear-gradient(
    180deg,
    #facc15,
    #fcd34d,
    #facc15
  );
  animation: shimmerBar 3s linear infinite;
  border-radius: 12px 0 0 12px;
}

/* Content wrapper */
.daily-notes #dailyNotesContent {
  padding-top: 0.5rem;
  white-space: pre-wrap;
}

/* Header with optional icon */
.daily-notes-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.daily-notes-header h3 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.daily-notes-header h3::before {
  content: "📝";
  font-size: 1.1rem;
}

/* List styling */
.daily-notes ul {
  margin: 0;
  padding-left: 1.25rem;
}
.daily-notes li {
  margin-bottom: 0.4rem;
}

/* Toggle Button */
.daily-notes-toggle,
.core-toggle-btn {
  background-color: #fcd34d;
  border: 1px solid #d97706;
  padding: 0.45rem 1rem;
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: 8px;
  color: #1a202c;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition:
    background-color 0.2s ease,
    transform 0.2s ease;
}

.daily-notes-toggle:hover,
.core-toggle-btn:hover {
  background-color: #f59e0b;
  transform: translateY(-1px);
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
  .daily-notes {
    background: linear-gradient(135deg, #1f1f1f, #2a2a1f);
    color: #fefce8;
    border-color: #fcd34d;
    box-shadow:
      0 2px 10px rgba(0, 0, 0, 0.4),
      inset 0 1px 0 rgba(255, 255, 255, 0.05);
  }

  .daily-notes::before {
    background: linear-gradient(
      180deg,
      #facc15,
      #fcd34d,
      #facc15
    );
  }

  .daily-notes-toggle,
  .core-toggle-btn {
    background-color: #b45309;
    color: #fefce8;
    border-color: #fcd34d;
  }

  .daily-notes-toggle:hover,
  .core-toggle-btn:hover {
    background-color: #d97706;
  }
}

/* Animations */
@keyframes fadeInNote {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes shimmerBar {
  0% {
    background-position: 0% 0%;
  }
  100% {
    background-position: 0% 100%;
  }
}