/* ════════════════════════════════════════════════════════════════
   The Automater — Library styles
   Builds on the existing dark slate / glass-effect / gradient-border
   conventions from index.html. Vanilla CSS, no preprocessor.
   ════════════════════════════════════════════════════════════════ */

/* ---- design tokens (mirror those in index.html :root) ---- */
:root {
  --bg-base: #0F172A;
  --bg-card: rgba(30, 41, 59, 0.45);
  --bg-card-hover: rgba(30, 41, 59, 0.7);
  --border-soft: rgba(148, 163, 184, 0.18);
  --border-bright: rgba(59, 130, 246, 0.45);
  --accent-blue: #3B82F6;
  --accent-violet: #8B5CF6;
  --accent-cyan: #06B6D4;
  --text-dim: #94A3B8;
  --shadow-card: 0 1px 0 rgba(255,255,255,0.04) inset, 0 8px 24px -10px rgba(0,0,0,0.45);
}

/* ---- gradient border (reused from index.html, matches existing logo treatment) ---- */
.gradient-border {
  background: linear-gradient(45deg, #3B82F6, #8B5CF6, #06B6D4);
  padding: 1px;
  border-radius: 12px;
}
.gradient-border-inner {
  background: var(--bg-base);
  border-radius: 11px;
}

/* ---- scroll utilities (reused from index.html) ---- */
.scroll-hide::-webkit-scrollbar { display: none; }
.scroll-hide { -ms-overflow-style: none; scrollbar-width: none; }

/* ════════════════════════════════════════════════════════════════
   AUTOMATION CARDS
   ════════════════════════════════════════════════════════════════ */
.lib-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  box-shadow: var(--shadow-card);
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
  cursor: pointer;
  text-align: left;
  width: 100%;
}
.lib-card:hover {
  transform: translateY(-2px);
  background: var(--bg-card-hover);
  border-color: var(--border-bright);
}
.lib-card:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

.lib-card-title {
  font-size: 15px;
  font-weight: 600;
  color: #E2E8F0;
  line-height: 1.25;
}

.lib-card-desc {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.lib-card-meta {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.lib-card-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.lib-card-cta {
  font-size: 12px;
  font-weight: 600;
  color: #93C5FD;
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.3);
  padding: 6px 12px;
  border-radius: 8px;
  transition: background 120ms ease, color 120ms ease;
  cursor: pointer;
  white-space: nowrap;
}
.lib-card-cta:hover {
  background: rgba(59, 130, 246, 0.25);
  color: #DBEAFE;
}

/* ---- skeleton cards (loading state) ---- */
.lib-card-skel {
  height: 180px;
  border-radius: 14px;
  background: linear-gradient(110deg, rgba(30,41,59,0.4) 30%, rgba(51,65,85,0.6) 50%, rgba(30,41,59,0.4) 70%);
  background-size: 200% 100%;
  animation: libShimmer 1.4s ease-in-out infinite;
  border: 1px solid var(--border-soft);
}
@keyframes libShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ════════════════════════════════════════════════════════════════
   BADGES
   ════════════════════════════════════════════════════════════════ */
.lib-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}

/* Audience badges */
.lib-aud-consumer  { background: rgba(34,197,94,0.12);  color: #86EFAC; border-color: rgba(34,197,94,0.3); }
.lib-aud-ub        { background: rgba(59,130,246,0.12); color: #93C5FD; border-color: rgba(59,130,246,0.3); }
.lib-aud-vertical  { background: rgba(168,85,247,0.12); color: #D8B4FE; border-color: rgba(168,85,247,0.3); }
.lib-aud-developer { background: rgba(100,116,139,0.18); color: #CBD5E1; border-color: rgba(100,116,139,0.4); }

/* Tier chips (the 🟢 / 🟡 / 🟠 / 🔴 colored chips) */
.lib-tier-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
}
.lib-tier-ready   { background: rgba(34,197,94,0.10);  color: #86EFAC; border-color: rgba(34,197,94,0.28); }
.lib-tier-byo     { background: rgba(234,179,8,0.10);  color: #FDE68A; border-color: rgba(234,179,8,0.30); }
.lib-tier-oauth   { background: rgba(249,115,22,0.10); color: #FDBA74; border-color: rgba(249,115,22,0.30); }
.lib-tier-special { background: rgba(239,68,68,0.10);  color: #FCA5A5; border-color: rgba(239,68,68,0.30); }

/* ════════════════════════════════════════════════════════════════
   FEATURED CAROUSEL
   ════════════════════════════════════════════════════════════════ */
.lib-feat-card {
  scroll-snap-align: start;
  flex-shrink: 0;
  width: 288px;
  min-height: 176px;
  padding: 18px;
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(59,130,246,0.12), rgba(139,92,246,0.08));
  border: 1px solid rgba(148,163,184,0.18);
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease;
}
.lib-feat-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-bright);
}
.lib-feat-card .lib-card-title { font-size: 14px; }
.lib-feat-card .lib-card-desc { font-size: 12px; -webkit-line-clamp: 2; }

/* ════════════════════════════════════════════════════════════════
   CHAT (Librarian)
   ════════════════════════════════════════════════════════════════ */
.lib-chat-msg {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.lib-chat-msg.user { justify-content: flex-end; }
.lib-chat-bubble {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.lib-chat-msg.user .lib-chat-bubble {
  background: linear-gradient(135deg, #3B82F6, #6366F1);
  color: white;
  border-bottom-right-radius: 4px;
}
.lib-chat-msg.librarian .lib-chat-bubble {
  background: rgba(30, 41, 59, 0.7);
  color: #E2E8F0;
  border: 1px solid var(--border-soft);
  border-bottom-left-radius: 4px;
}
.lib-chat-empty {
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  padding: 24px 12px;
}

/* ════════════════════════════════════════════════════════════════
   SEARCH RESULT ROWS
   ════════════════════════════════════════════════════════════════ */
.lib-search-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease;
}
.lib-search-row:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-bright);
}
.lib-search-row-main { flex: 1; min-width: 0; }
.lib-search-row-title {
  font-size: 14px;
  font-weight: 600;
  color: #E2E8F0;
  margin-bottom: 2px;
}
.lib-search-row-desc {
  font-size: 12px;
  color: var(--text-dim);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ════════════════════════════════════════════════════════════════
   PREVIEW MODAL
   ════════════════════════════════════════════════════════════════ */
.lib-modal-header {
  padding: 22px 24px 16px;
  border-bottom: 1px solid var(--border-soft);
}
.lib-modal-body {
  padding: 20px 24px;
  max-height: 60vh;
  overflow-y: auto;
}
.lib-modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.lib-modal-section { margin-bottom: 18px; }
.lib-modal-section:last-child { margin-bottom: 0; }
.lib-modal-section h4 {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}
.lib-modal-section p, .lib-modal-section li {
  font-size: 14px;
  color: #E2E8F0;
  line-height: 1.55;
}
.lib-modal-section ul {
  list-style: none;
  padding-left: 0;
}
.lib-modal-section ul li {
  padding-left: 20px;
  position: relative;
  margin-bottom: 6px;
}
.lib-modal-section ul li::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 9px;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--accent-blue);
}

.lib-modal-sample {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  color: #CBD5E1;
  line-height: 1.5;
  font-style: italic;
}

/* Primary install button used in the preview modal + Featured cards */
.lib-btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(90deg, #3B82F6, #6366F1);
  color: white;
  font-weight: 600;
  font-size: 14px;
  padding: 10px 18px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: filter 140ms ease, transform 140ms ease;
  box-shadow: 0 8px 24px -10px rgba(59,130,246,0.6);
}
.lib-btn-primary:hover { filter: brightness(1.08); transform: translateY(-1px); }
.lib-btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  color: #CBD5E1;
  font-weight: 500;
  font-size: 14px;
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid var(--border-soft);
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease;
}
.lib-btn-secondary:hover { background: rgba(148,163,184,0.08); color: white; }

/* ════════════════════════════════════════════════════════════════
   FILTER PANEL — category links
   ════════════════════════════════════════════════════════════════ */
.lib-cat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: #CBD5E1;
}
.lib-cat-row:hover { background: rgba(148,163,184,0.08); color: white; }
.lib-cat-row .lib-cat-count {
  font-size: 11px;
  color: var(--text-dim);
}

/* ════════════════════════════════════════════════════════════════
   AUTOMATION DETAIL PAGE specifics
   ════════════════════════════════════════════════════════════════ */
.lib-detail-hero {
  background: linear-gradient(160deg, rgba(59,130,246,0.10), rgba(139,92,246,0.05));
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  padding: 28px;
}
.lib-detail-title {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.15;
  color: white;
  margin-bottom: 8px;
}
.lib-detail-sub {
  font-size: 15px;
  color: var(--text-dim);
  line-height: 1.55;
}

/* ════════════════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .lib-detail-title { font-size: 22px; }
  .lib-modal-body { max-height: 50vh; }
}

/* ════════════════════════════════════════════════════════════════
   TOAST (simple stacking notifications)
   ════════════════════════════════════════════════════════════════ */
#libToastWrap {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: calc(100vw - 40px);
}
.lib-toast {
  background: rgba(30,41,59,0.95);
  border: 1px solid var(--border-soft);
  color: #E2E8F0;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  box-shadow: 0 12px 28px -10px rgba(0,0,0,0.6);
  animation: libToastIn 200ms ease;
}
.lib-toast.success { border-color: rgba(34,197,94,0.4); }
.lib-toast.error   { border-color: rgba(239,68,68,0.4); }
@keyframes libToastIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
