/* Sitewide chrome stylesheet — footer, back-to-top, legal modals, cookie
 * consent, and the AI-workflows nav dropdown.
 *
 * These six blocks were inline <style> inside partials that base.html includes
 * on EVERY page, so each one shipped ~22KB of CSS inside the HTML of every
 * response, uncacheable and re-sent on every navigation.
 *
 * Load order matters: base.html links this AFTER block css_app (project.css and
 * any page stylesheet). That reproduces the old document order, where these
 * blocks sat at the end of <body> and therefore won ties against everything
 * declared before them. Moving the link earlier would silently flip those ties.
 */

/* ═══ from partials/footer.html ═══════════════════════ */
.footer-social li a svg { width: 16px; height: 16px; fill: currentColor; vertical-align: -3px; }
              .footer-social li a { color: rgba(255,255,255,.85); transition: color .18s, background .18s, border-color .18s; }
              .footer-social li a:hover { color: #fff; }

/* ═══ from partials/footer.html ═══════════════════════ */
/* Overlay */
  .lm-overlay {
    display: none;
    position: fixed; inset: 0; z-index: 99990;
    background: rgba(8, 14, 30, .72);
    align-items: center; justify-content: center;
    padding: 20px;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
  }
  .lm-overlay.lm-active { display: flex; animation: lmFadeIn .18s ease; }
  @keyframes lmFadeIn { from { opacity: 0; } to { opacity: 1; } }

  /* Dialog */
  .lm-dialog {
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    width: 100%; max-width: 520px;
    max-height: 88vh;
    display: flex; flex-direction: column;
    box-shadow: 0 28px 90px rgba(0,0,0,.5), 0 0 0 1px rgba(255,255,255,.08);
    animation: lmSlideUp .22s cubic-bezier(.22,.68,0,1.15);
  }
  @keyframes lmSlideUp {
    from { opacity: 0; transform: translateY(22px) scale(.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
  }

  /* Header */
  .lm-header {
    background: linear-gradient(135deg, #0d1b2a 0%, #0e2340 100%);
    padding: 20px 24px 16px;
    display: flex; align-items: center; justify-content: space-between;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255,255,255,.08);
  }
  .lm-title {
    display: flex; align-items: center; gap: 10px;
    color: #fff; font-size: 1rem; font-weight: 700; margin: 0;
  }
  .lm-icon {
    width: 32px; height: 32px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: .88rem; flex-shrink: 0;
  }
  .lm-close {
    background: none; border: none; cursor: pointer;
    color: rgba(255,255,255,.55); font-size: 1.3rem; line-height: 1;
    padding: 2px 6px; border-radius: 6px;
    transition: color .15s, background .15s;
  }
  .lm-close:hover { color: #fff; background: rgba(255,255,255,.1); }

  /* Body — scrollable */
  .lm-body {
    padding: 26px 28px;
    overflow-y: auto;
    flex: 1;
    font-size: .9rem; line-height: 1.78; color: #374151;
    scrollbar-width: thin; scrollbar-color: #d1d5db transparent;
  }
  .lm-body::-webkit-scrollbar { width: 5px; }
  .lm-body::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }

  .lm-body h5 {
    font-size: .76rem; font-weight: 800; text-transform: uppercase;
    letter-spacing: .1em; color: #0d1b2a;
    margin: 22px 0 8px; padding-bottom: 6px;
    border-bottom: 2px solid #e5e7eb;
  }
  .lm-body h5:first-child { margin-top: 0; }
  .lm-body p { margin-bottom: .75em; color: #4b5563; }
  .lm-body ul { padding-left: 1.3em; margin-bottom: .75em; color: #4b5563; }
  .lm-body ul li { margin-bottom: .3em; }
  .lm-body a { color: #0c5adb; }
  .lm-body strong { color: #1f2937; }

  /* Footer */
  .lm-footer {
    display: flex; align-items: center; justify-content: space-between;
    padding: 13px 24px; background: #f9fafb;
    border-top: 1px solid #e5e7eb; flex-shrink: 0;
  }
  .lm-note { font-size: .73rem; color: #9ca3af; }
  .lm-btn-close {
    background: #0d1b2a; color: #fff; border: none;
    border-radius: 8px; padding: 8px 20px;
    font-size: .8rem; font-weight: 700; letter-spacing: .04em;
    cursor: pointer; transition: background .18s;
  }
  .lm-btn-close:hover { background: #1a3550; }

/* ═══ from partials/back_to_top.html ═══════════════════════ */
.back-to-top {
    position: fixed;
    top: 50%;
    right: 24px;
    width: 48px;
    height: 48px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #ffffff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow:
      0 10px 24px rgba(37, 99, 235, 0.35),
      0 2px 6px rgba(37, 99, 235, 0.20),
      inset 0 1px 0 rgba(255, 255, 255, 0.25);
    opacity: 0;
    pointer-events: none;
    transform: translate(72px, -50%);
    transition:
      opacity 0.28s ease,
      transform 0.32s cubic-bezier(0.2, 0.8, 0.2, 1),
      box-shadow 0.25s ease,
      background 0.25s ease;
    z-index: 1080; /* above Bootstrap modals' backdrop layer */
    -webkit-tap-highlight-color: transparent;
  }

  .back-to-top.is-visible {
    opacity: 1;
    pointer-events: auto;
    transform: translate(0, -50%);
  }

  .back-to-top:hover {
    transform: translate(0, -50%) scale(1.08);
    background: linear-gradient(135deg, #4f94f8 0%, #2563eb 100%);
    box-shadow:
      0 14px 32px rgba(37, 99, 235, 0.45),
      0 4px 10px rgba(37, 99, 235, 0.30),
      inset 0 1px 0 rgba(255, 255, 255, 0.35);
  }

  .back-to-top:focus-visible {
    outline: 3px solid rgba(59, 130, 246, 0.45);
    outline-offset: 3px;
  }

  .back-to-top:active {
    transform: translate(0, -50%) scale(0.94);
    box-shadow:
      0 6px 14px rgba(37, 99, 235, 0.30),
      inset 0 2px 6px rgba(0, 0, 0, 0.18);
  }

  .back-to-top svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  @media (max-width: 576px) {
    .back-to-top {
      right: 16px;
      width: 44px;
      height: 44px;
    }
  }

  @media (prefers-reduced-motion: reduce) {
    .back-to-top {
      transition: opacity 0.2s ease;
    }
    .back-to-top:hover { transform: translate(0, -50%); }
    .back-to-top:active { transform: translate(0, -50%); }
  }

/* ═══ from components/legal_modals.html ═══════════════════════ */
/* ===== Legal Modal Styles ===== */
.legal-modal-content {
  background: #0d1b2e;
  color: #d1d9e6;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
}

.legal-modal-header {
  background: linear-gradient(135deg, #0f2547 0%, #1a3a6e 100%);
  border-bottom: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px 12px 0 0;
  padding: 1.25rem 1.5rem;
}

.legal-modal-header .modal-title {
  color: #ffffff;
  font-size: 1.05rem;
  font-weight: 600;
  display: flex;
  align-items: center;
}

.legal-modal-body {
  padding: 1.75rem;
  font-size: 0.88rem;
  line-height: 1.7;
}

.legal-modal-body h6 {
  color: #60a5fa;
  font-weight: 600;
  margin-top: 1.4rem;
  margin-bottom: 0.5rem;
  font-size: 0.88rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.legal-modal-body p,
.legal-modal-body li {
  color: #b0bec5;
}

/* The shared body partials link to sibling documents and to account settings.
   Without this the links inherit the dark modal body colour and read as plain
   text — the reader never discovers the Refund Policy exists. */
.legal-modal-body a {
  color: #60a5fa;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.legal-modal-body a:hover { color: #93c5fd; }

.legal-modal-body code {
  background: rgba(255,255,255,0.08);
  padding: .1rem .35rem;
  border-radius: 4px;
  font-size: .85em;
  color: #d1d9e6;
}

.legal-modal-body ul {
  padding-left: 1.4rem;
}

.legal-modal-body ul li {
  margin-bottom: 0.35rem;
}

.legal-effective-date {
  font-size: 0.78rem;
  color: #6b7a8d;
  font-style: italic;
  margin-bottom: 1rem;
}

/* Cookie table */
.legal-cookie-table {
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 1.25rem;
  font-size: 0.82rem;
}

.legal-cookie-row {
  display: grid;
  grid-template-columns: 160px 1fr 180px;
  gap: 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.legal-cookie-row:last-child {
  border-bottom: none;
}

.legal-cookie-row > div {
  padding: 0.65rem 0.9rem;
  border-right: 1px solid rgba(255,255,255,0.06);
  color: #b0bec5;
}

.legal-cookie-row > div:last-child {
  border-right: none;
}

.legal-cookie-header {
  background: rgba(255,255,255,0.05);
}

.legal-cookie-header > div {
  font-weight: 600;
  color: #d1d9e6;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.legal-modal-footer {
  background: #0d1b2e;
  border-top: 1px solid rgba(255,255,255,0.08);
  border-radius: 0 0 12px 12px;
  padding: 0.9rem 1.5rem;
}

.legal-close-btn {
  background: rgba(255,255,255,0.08);
  color: #d1d9e6;
  border: 1px solid rgba(255,255,255,0.12);
  padding: 0.4rem 1.2rem;
  border-radius: 6px;
  font-size: 0.82rem;
  transition: background 0.2s;
}

.legal-close-btn:hover {
  background: rgba(255,255,255,0.15);
  color: #fff;
}

.legal-permalink-btn {
  background: transparent;
  color: #60a5fa;
  border: 1px solid rgba(96,165,250,0.4);
  padding: 0.4rem 1.2rem;
  border-radius: 6px;
  font-size: 0.82rem;
  text-decoration: none;
  transition: background 0.2s;
}

.legal-permalink-btn:hover {
  background: rgba(96,165,250,0.12);
  color: #93c5fd;
}

@media (max-width: 576px) {
  .legal-cookie-row {
    grid-template-columns: 1fr;
  }
  .legal-cookie-header {
    display: none;
  }
  .legal-cookie-row > div {
    border-right: none;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    padding: 0.5rem 0.8rem;
  }
  .legal-cookie-row > div:last-child {
    border-bottom: none;
  }
}

/* Cookie-consent rules moved to cookie-consent.css (linked by components/cookie_consent.html). */

/* ═══ from ai_workflows/partials/nav_dropdown.html ═══════════════════════ */
/* ═══════════════════════════════════════════
   FIX: Pages Mega-Menu .content hidden
   The theme hides .content on desktop (min-width 1024px)
   and only shows it when .on class is added by JS.
   Override to always show on dropdown hover/open.
   ═══════════════════════════════════════════ */
@media (min-width: 1024px) {
  nav.navbar.validnavs ul.dropdown-menu.megamenu-content .content {
    display: block !important;
    height: auto !important;
  }
}

/* ═══════════════════════════════════════════
   AI Workflows Mega-Menu
   ═══════════════════════════════════════════ */

/* Trigger link */
#aiWorkflowsDropdown {
  font-size: 1.05rem;
  font-weight: 500;
  transition: color 0.2s ease;
}
#aiWorkflowsDropdown:hover,
.aiw-dropdown:hover > #aiWorkflowsDropdown {
  color: #667eea !important;
}

/* ── Container ── */
.aiw-mega-menu {
  min-width: 480px;
  max-width: 540px;
  padding: 0 !important;
  border: none !important;
  border-radius: 16px;
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.04);
  max-height: 82vh;
  display: flex;
  flex-direction: column;
}

/* ── Top Bar ── */
.aiw-mega-top {
  display: flex;
  gap: 0;
  background: linear-gradient(135deg, #0f0c29, #302b63);
  padding: 0;
  flex-shrink: 0;
}

.aiw-mega-top-link {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.7rem 0.5rem;
  color: rgba(255, 255, 255, 0.75) !important;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none !important;
  transition: all 0.2s ease;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.aiw-mega-top-link:last-child {
  border-right: none;
}

.aiw-mega-top-link:hover {
  color: #ffffff !important;
  background: rgba(255, 255, 255, 0.08);
}

.aiw-mega-top-link i {
  font-size: 0.95rem;
}

.aiw-mega-top-cta {
  color: #a5b4fc !important;
}

.aiw-mega-top-cta:hover {
  color: #ffffff !important;
  background: rgba(102, 126, 234, 0.25) !important;
}

/* ── Body ── */
.aiw-mega-body {
  padding: 0.5rem 0;
  overflow-y: auto;
  flex: 1;
}

/* ── Category Blocks with Color Bands ── */
.aiw-mega-category {
  padding: 0;
  margin: 0 0.5rem 0.35rem;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #f0f0f5;
}

.aiw-mega-category + .aiw-mega-category {
  margin-top: 0.35rem;
}

/* Color bands per category index */
.aiw-mega-category[data-cat-index="0"] .aiw-mega-cat-header {
  background: linear-gradient(135deg, #eef2ff, #e0e7ff);
  border-left: 4px solid #667eea;
}
.aiw-mega-category[data-cat-index="0"] .aiw-cat-icon-wrap {
  background: #667eea;
}

.aiw-mega-category[data-cat-index="1"] .aiw-mega-cat-header {
  background: linear-gradient(135deg, #ecfdf5, #d1fae5);
  border-left: 4px solid #10b981;
}
.aiw-mega-category[data-cat-index="1"] .aiw-cat-icon-wrap {
  background: #10b981;
}
.aiw-mega-category[data-cat-index="1"] .aiw-mega-cat-header .aiw-cat-name {
  color: #047857;
}
.aiw-mega-category[data-cat-index="1"] .aiw-cat-count {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
}

.aiw-mega-category[data-cat-index="2"] .aiw-mega-cat-header {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border-left: 4px solid #f59e0b;
}
.aiw-mega-category[data-cat-index="2"] .aiw-cat-icon-wrap {
  background: #f59e0b;
}
.aiw-mega-category[data-cat-index="2"] .aiw-mega-cat-header .aiw-cat-name {
  color: #b45309;
}
.aiw-mega-category[data-cat-index="2"] .aiw-cat-count {
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
}

.aiw-mega-category[data-cat-index="3"] .aiw-mega-cat-header {
  background: linear-gradient(135deg, #fce7f3, #fbcfe8);
  border-left: 4px solid #ec4899;
}
.aiw-mega-category[data-cat-index="3"] .aiw-cat-icon-wrap {
  background: #ec4899;
}
.aiw-mega-category[data-cat-index="3"] .aiw-mega-cat-header .aiw-cat-name {
  color: #be185d;
}
.aiw-mega-category[data-cat-index="3"] .aiw-cat-count {
  background: rgba(236, 72, 153, 0.12);
  color: #db2777;
}

.aiw-mega-category[data-cat-index="4"] .aiw-mega-cat-header {
  background: linear-gradient(135deg, #ede9fe, #ddd6fe);
  border-left: 4px solid #8b5cf6;
}
.aiw-mega-category[data-cat-index="4"] .aiw-cat-icon-wrap {
  background: #8b5cf6;
}
.aiw-mega-category[data-cat-index="4"] .aiw-mega-cat-header .aiw-cat-name {
  color: #6d28d9;
}
.aiw-mega-category[data-cat-index="4"] .aiw-cat-count {
  background: rgba(139, 92, 246, 0.12);
  color: #7c3aed;
}

.aiw-mega-category[data-cat-index="5"] .aiw-mega-cat-header {
  background: linear-gradient(135deg, #e0f2fe, #bae6fd);
  border-left: 4px solid #0ea5e9;
}
.aiw-mega-category[data-cat-index="5"] .aiw-cat-icon-wrap {
  background: #0ea5e9;
}
.aiw-mega-category[data-cat-index="5"] .aiw-mega-cat-header .aiw-cat-name {
  color: #0369a1;
}
.aiw-mega-category[data-cat-index="5"] .aiw-cat-count {
  background: rgba(14, 165, 233, 0.12);
  color: #0284c7;
}

.aiw-mega-category[data-cat-index="6"] .aiw-mega-cat-header {
  background: linear-gradient(135deg, #fee2e2, #fecaca);
  border-left: 4px solid #ef4444;
}
.aiw-mega-category[data-cat-index="6"] .aiw-cat-icon-wrap {
  background: #ef4444;
}
.aiw-mega-category[data-cat-index="6"] .aiw-mega-cat-header .aiw-cat-name {
  color: #b91c1c;
}
.aiw-mega-category[data-cat-index="6"] .aiw-cat-count {
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
}

/* Category header */
.aiw-mega-cat-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.9rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: #667eea;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-decoration: none !important;
  transition: all 0.2s ease;
  border-left: 4px solid #667eea;
  background: linear-gradient(135deg, #eef2ff, #e0e7ff);
}

.aiw-mega-cat-header:hover {
  filter: brightness(0.96);
}

/* Category icon circle */
.aiw-cat-icon-wrap {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: #667eea;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.aiw-cat-icon-wrap i {
  font-size: 0.75rem;
  color: #ffffff;
}

.aiw-cat-name {
  flex: 1;
  font-size: 0.82rem;
  color: #4338ca;
}

/* Product count pill */
.aiw-cat-count {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.1rem 0.5rem;
  background: rgba(102, 126, 234, 0.12);
  color: #667eea;
  border-radius: 20px;
}

.aiw-mega-cat-arrow {
  font-size: 0.65rem;
  color: inherit;
  opacity: 0.4;
  transition: all 0.2s ease;
}

.aiw-mega-cat-header:hover .aiw-mega-cat-arrow {
  opacity: 1;
  transform: translateX(2px);
}

/* ── Product List ── */
.aiw-mega-products {
  list-style: none;
  margin: 0;
  padding: 0.35rem 0.5rem 0.5rem;
  background: #ffffff;
}

.aiw-mega-product {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 0.65rem;
  margin: 0.1rem 0;
  border-radius: 8px;
  color: #334155 !important;
  text-decoration: none !important;
  font-size: 0.92rem;
  font-weight: 500;
  transition: all 0.2s ease;
  line-height: 1.3;
}

.aiw-mega-product:hover {
  background: #f0f4ff;
  color: #4f46e5 !important;
  padding-left: 0.9rem;
}

.aiw-product-icon {
  font-size: 0.8rem;
  color: #94a3b8;
  width: 16px;
  text-align: center;
  flex-shrink: 0;
  transition: color 0.2s ease;
}

.aiw-mega-product:hover .aiw-product-icon {
  color: #667eea;
}

.aiw-product-name {
  flex: 1;
  min-width: 0;
}

/* Badges */
.aiw-badge-pro {
  font-size: 0.6rem;
  font-weight: 700;
  padding: 0.12rem 0.4rem;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #ffffff;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.aiw-badge-credits {
  font-size: 0.72rem;
  font-weight: 600;
  color: #94a3b8;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.15rem;
  transition: color 0.2s ease;
}

.aiw-badge-credits i {
  font-size: 0.65rem;
}

.aiw-mega-product:hover .aiw-badge-credits {
  color: #667eea;
}

/* Empty state */
.aiw-mega-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: #94a3b8;
}

.aiw-mega-empty i {
  font-size: 2rem;
  display: block;
  margin-bottom: 0.5rem;
}

.aiw-mega-empty p {
  font-size: 0.9rem;
  margin: 0;
}

/* ── Footer ── */
.aiw-mega-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 1rem;
  background: #f8f9fb;
  border-top: 1px solid #eef0f4;
  flex-shrink: 0;
}

.aiw-mega-footer-hint {
  font-size: 0.75rem;
  color: #94a3b8;
  font-weight: 500;
}

.aiw-mega-footer-hint i {
  color: #667eea;
}

.aiw-mega-footer-link {
  font-size: 0.8rem;
  font-weight: 600;
  color: #667eea !important;
  text-decoration: none !important;
  transition: color 0.2s ease;
}

.aiw-mega-footer-link:hover {
  color: #4f46e5 !important;
}

/* ── Scrollbar ── */
.aiw-mega-body::-webkit-scrollbar {
  width: 5px;
}

.aiw-mega-body::-webkit-scrollbar-track {
  background: transparent;
}

.aiw-mega-body::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.aiw-mega-body::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .aiw-mega-menu {
    min-width: 100vw;
    max-width: 100vw;
    border-radius: 0;
    max-height: 70vh;
  }

  .aiw-mega-top-link span {
    font-size: 0.78rem;
  }

  .aiw-mega-footer {
    flex-direction: column;
    gap: 0.4rem;
    text-align: center;
  }
}
