/* ============================================================================
   Mailyte Email Server Handbook — Custom Theme
   Modern, clean, developer-friendly design
   ============================================================================ */

/* --------------------------------------------------------------------------
   Color Palette
   -------------------------------------------------------------------------- */
:root {
  /* Brand colors */
  --ml-brand: #4f46e5;
  --ml-brand-light: #818cf8;
  --ml-brand-dark: #3730a3;
  --ml-accent: #06b6d4;
  --ml-accent-light: #22d3ee;
  --ml-success: #10b981;
  --ml-warning: #f59e0b;
  --ml-danger: #ef4444;

  /* Material overrides — light mode */
  --md-primary-fg-color: var(--ml-brand);
  --md-primary-fg-color--light: var(--ml-brand-light);
  --md-primary-fg-color--dark: var(--ml-brand-dark);
  --md-accent-fg-color: var(--ml-accent);
}

/* Dark mode accent tweaks */
[data-md-color-scheme="slate"] {
  --md-accent-fg-color: var(--ml-accent-light);
}

/* --------------------------------------------------------------------------
   Typography
   -------------------------------------------------------------------------- */
.md-typeset {
  font-size: 0.82rem;
  line-height: 1.7;
}

.md-typeset h1 {
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.6em;
}

.md-typeset h2 {
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-top: 1.8em;
  padding-bottom: 0.3em;
  border-bottom: 1px solid var(--md-default-fg-color--lightest);
}

.md-typeset h3 {
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   Navigation — modern feel
   -------------------------------------------------------------------------- */
.md-nav__title {
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  opacity: 0.7;
}

/* Active nav item highlight */
.md-nav__item--active > .md-nav__link {
  font-weight: 600;
}

/* Smooth sidebar scroll */
.md-sidebar__scrollwrap {
  scrollbar-width: thin;
  scrollbar-color: var(--md-default-fg-color--lightest) transparent;
}

/* --------------------------------------------------------------------------
   Cards — homepage feature grid
   -------------------------------------------------------------------------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.2rem;
  margin: 1.5rem 0;
}

.grid.cards > * {
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: 0.75rem;
  padding: 1.25rem 1.5rem;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--md-default-bg-color);
}

.grid.cards > *:hover {
  border-color: var(--md-primary-fg-color);
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.08),
    0 2px 4px -2px rgba(0, 0, 0, 0.05);
  transform: translateY(-3px);
}

/* Card icon size */
.grid.cards .lg {
  font-size: 2rem;
}

/* --------------------------------------------------------------------------
   Code blocks — polished look
   -------------------------------------------------------------------------- */
.md-typeset code {
  border-radius: 0.25rem;
  padding: 0.1em 0.35em;
  font-size: 0.82em;
}

.md-typeset pre {
  border-radius: 0.5rem;
  overflow: hidden;
}

.md-typeset pre > code {
  font-size: 0.78rem;
  line-height: 1.65;
}

/* Copy button styling */
.md-clipboard {
  border-radius: 0.35rem;
}

/* Code annotation pop-ups */
.md-annotation__index {
  border-radius: 50%;
}

/* --------------------------------------------------------------------------
   Admonitions — softer, rounder
   -------------------------------------------------------------------------- */
.md-typeset .admonition,
.md-typeset details {
  border-radius: 0.5rem;
  border-width: 0;
  border-left: 4px solid;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.md-typeset .admonition-title,
.md-typeset summary {
  border-radius: 0.5rem 0.5rem 0 0;
  font-weight: 600;
}

/* Custom "stable" admonition */
.md-typeset .admonition.stable,
.md-typeset details.stable {
  border-color: var(--ml-success);
}
.md-typeset .admonition.stable > .admonition-title,
.md-typeset details.stable > summary {
  background-color: rgba(16, 185, 129, 0.08);
}

/* Custom "beta" admonition */
.md-typeset .admonition.beta,
.md-typeset details.beta {
  border-color: var(--ml-warning);
}
.md-typeset .admonition.beta > .admonition-title,
.md-typeset details.beta > summary {
  background-color: rgba(245, 158, 11, 0.08);
}

/* --------------------------------------------------------------------------
   Tables — cleaner design
   -------------------------------------------------------------------------- */
.md-typeset table:not([class]) {
  font-size: 0.8rem;
  border-collapse: separate;
  border-spacing: 0;
  border-radius: 0.5rem;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.md-typeset table:not([class]) th {
  background-color: var(--md-primary-fg-color);
  color: var(--md-primary-bg-color);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  padding: 0.75rem 1rem;
}

.md-typeset table:not([class]) td {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--md-default-fg-color--lightest);
}

.md-typeset table:not([class]) tr:last-child td {
  border-bottom: none;
}

.md-typeset table:not([class]) tbody tr:hover {
  background-color: rgba(79, 70, 229, 0.03);
}

/* --------------------------------------------------------------------------
   Status badges — pill-shaped labels
   -------------------------------------------------------------------------- */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.6;
}

.status-badge.stable {
  background: linear-gradient(135deg, #d1fae5, #a7f3d0);
  color: #065f46;
}

.status-badge.beta {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  color: #92400e;
}

.status-badge.dev {
  background: linear-gradient(135deg, #e0e7ff, #c7d2fe);
  color: #3730a3;
}

.status-badge.deprecated {
  background: linear-gradient(135deg, #fee2e2, #fecaca);
  color: #991b1b;
}

/* --------------------------------------------------------------------------
   API endpoint blocks
   -------------------------------------------------------------------------- */
.api-endpoint {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--md-code-bg-color);
  border-left: 4px solid var(--md-primary-fg-color);
  padding: 0.6rem 1rem;
  margin: 1rem 0;
  border-radius: 0 0.4rem 0.4rem 0;
  font-family: var(--md-code-font);
  font-size: 0.85rem;
}

.api-method {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 0.25rem;
  font-weight: 700;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  min-width: 3.5rem;
  text-align: center;
}

.api-method.get    { background: #dbeafe; color: #1e40af; }
.api-method.post   { background: #d1fae5; color: #065f46; }
.api-method.put    { background: #fef3c7; color: #92400e; }
.api-method.patch  { background: #fef3c7; color: #92400e; }
.api-method.delete { background: #fee2e2; color: #991b1b; }

/* --------------------------------------------------------------------------
   Mermaid diagrams — improve readability
   -------------------------------------------------------------------------- */
.mermaid {
  margin: 1.5rem 0;
}

.mermaid svg {
  max-width: 100%;
  border-radius: 0.5rem;
}

/* --------------------------------------------------------------------------
   Header & search — clean look
   -------------------------------------------------------------------------- */
.md-header {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.md-search__input {
  border-radius: 0.5rem;
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.md-footer {
  border-top: 1px solid var(--md-default-fg-color--lightest);
}

/* --------------------------------------------------------------------------
   Content — breathing room
   -------------------------------------------------------------------------- */
.md-content__inner {
  padding-top: 1.5rem;
}

/* Paragraph spacing */
.md-typeset p {
  margin-bottom: 0.85em;
}

/* Lists — tighter */
.md-typeset li {
  margin-bottom: 0.3em;
}

/* --------------------------------------------------------------------------
   Tabs — rounded
   -------------------------------------------------------------------------- */
.md-typeset .tabbed-labels > label {
  border-radius: 0.4rem 0.4rem 0 0;
  font-weight: 600;
  font-size: 0.78rem;
}

/* --------------------------------------------------------------------------
   Task lists — better checkboxes
   -------------------------------------------------------------------------- */
.md-typeset .task-list-indicator::before {
  border-radius: 0.2rem;
}

/* --------------------------------------------------------------------------
   Version selector
   -------------------------------------------------------------------------- */
.md-version {
  font-weight: 600;
  opacity: 0.9;
}

.md-version:hover {
  opacity: 1;
}

/* --------------------------------------------------------------------------
   Announcement bar (if used)
   -------------------------------------------------------------------------- */
.md-banner {
  background: linear-gradient(135deg, var(--ml-brand), var(--ml-brand-dark));
  color: white;
  font-size: 0.78rem;
  font-weight: 500;
}

/* --------------------------------------------------------------------------
   Image lightbox (glightbox plugin)
   -------------------------------------------------------------------------- */
.glightbox img {
  border-radius: 0.5rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media screen and (max-width: 768px) {
  .grid {
    grid-template-columns: 1fr;
  }

  .md-typeset table:not([class]) {
    font-size: 0.72rem;
  }

  .md-typeset table:not([class]) th,
  .md-typeset table:not([class]) td {
    padding: 0.5rem 0.6rem;
  }
}

/* --------------------------------------------------------------------------
   Print
   -------------------------------------------------------------------------- */
@media print {
  .md-header,
  .md-sidebar,
  .md-footer,
  .md-tabs {
    display: none !important;
  }

  .md-content {
    margin: 0;
    max-width: 100%;
  }

  .md-typeset .admonition {
    break-inside: avoid;
  }
}

/* --------------------------------------------------------------------------
   Smooth scroll everywhere
   -------------------------------------------------------------------------- */
html {
  scroll-behavior: smooth;
}

/* --------------------------------------------------------------------------
   Selection color
   -------------------------------------------------------------------------- */
::selection {
  background: rgba(79, 70, 229, 0.2);
}
