/* ===== Top Navigation ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid rgba(0, 0, 0, .08);
  background: rgba(245, 245, 247, .82);
  backdrop-filter: saturate(180%) blur(20px);
}
.nav {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 720;
  letter-spacing: 0;
  font-size: 15px;
}
.brand-mark {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: linear-gradient(180deg, #2d2d30, #101012);
  color: #fff;
  font-weight: 760;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.nav-link {
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  transition: .2s;
  cursor: pointer;
  border: none;
  background: none;
  white-space: nowrap;
}
.nav-link:hover { background: var(--soft); color: var(--ink); }
.nav-link.active { background: var(--ink); color: #fff; }
.nav-link.logout { color: #d32f2f; }
.nav-link.logout:hover { background: #fce8e6; }

/* ===== Gateway Overlay ===== */
.gate-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.gate-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  max-width: 400px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.gate-card h1 { font-size: 22px; margin: 0 0 8px; font-weight: 700; }
.gate-subtitle {
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 24px;
  line-height: 1.5;
}
.gate-form { display: flex; flex-direction: column; gap: 12px; }
.gate-form input {
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 15px;
  text-align: center;
  outline: none;
  transition: border-color .2s;
}
.gate-form input:focus { border-color: var(--accent); }
.gate-form button {
  padding: 12px;
  border: none;
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .2s;
}
.gate-form button:hover { opacity: .85; }
.gate-form button:disabled { opacity: .5; cursor: not-allowed; }
.gate-error {
  color: #d32f2f;
  font-size: 13px;
  margin: 0;
  min-height: 20px;
}

/* ===== Feed Filters ===== */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
}
.filter-bar input[type="search"] {
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  font-size: 14px;
  flex: 1;
  min-width: 180px;
  outline: none;
  background: var(--card);
  transition: border-color .2s;
}
.filter-bar input[type="search"]:focus { border-color: var(--accent); }
.filter-bar select {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 13px;
  background: var(--card);
  outline: none;
}
.results-count {
  font-size: 13px;
  color: var(--muted);
  padding: 0 0 8px;
}

/* ===== Tag Chips ===== */
.tag-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 8px 0 16px;
}
.tag-chip {
  padding: 4px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 12px;
  cursor: pointer;
  transition: .2s;
  color: var(--muted);
}
.tag-chip:hover { border-color: var(--accent); color: var(--accent); }
.tag-chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ===== Feed Cards ===== */
.feed { display: flex; flex-direction: column; gap: 12px; }
.feed-card {
  display: flex;
  gap: 16px;
  padding: 18px 20px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: .2s;
  align-items: flex-start;
}
.feed-card:hover {
  box-shadow: 0 1px 3px rgba(0, 0, 0, .06), 0 8px 20px rgba(0, 0, 0, .06);
}
.feed-card-thumb {
  width: 140px;
  height: 80px;
  border-radius: 6px;
  background: var(--soft);
  object-fit: cover;
  flex-shrink: 0;
}
.feed-card-body { flex: 1; min-width: 0; }
.feed-card-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  margin: 0 0 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.feed-card-title:hover { color: var(--accent); }
.feed-card-summary {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  margin: 0 0 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.feed-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
}
.feed-card-source {
  padding: 1px 7px;
  border-radius: 4px;
  background: var(--soft);
  font-weight: 500;
}
.feed-card-type {
  padding: 1px 7px;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 500;
}

/* ===== Side Filters Panel ===== */
.layout-main {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 28px;
  padding-top: 20px;
}
@media (max-width: 860px) {
  .layout-main { grid-template-columns: 1fr; }
  .side { display: none; }
}
.side { position: sticky; top: 80px; align-self: start; }
.panel { margin-bottom: 20px; }
.panel h3 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
  margin: 0 0 8px;
  font-weight: 600;
}
.category-nav, .filters {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.filter-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px;
  border-radius: var(--radius);
  border: none;
  background: none;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  color: var(--muted);
  transition: .15s;
  width: 100%;
}
.filter-btn:hover { background: var(--soft); color: var(--ink); }
.filter-btn.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.count-pill {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 10px;
  background: var(--soft);
  color: var(--muted);
}

/* ===== Pagination ===== */
.pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 24px 0 40px;
  flex-wrap: wrap;
}
.page-btn {
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  font-size: 13px;
  cursor: pointer;
  transition: .2s;
}
.page-btn:hover:not(:disabled):not(.active) { border-color: var(--accent); color: var(--accent); }
.page-btn.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ===== Footer ===== */
.footer {
  padding: 32px 0;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  border-top: 1px solid var(--line);
  margin-top: 40px;
}

/* ===== Module Layout ===== */
.module-section { padding: 20px 0; }
.module-header { margin-bottom: 24px; }
.module-header h2 { font-size: 24px; font-weight: 700; margin: 0 0 8px; }
.module-header p { color: var(--muted); margin: 0; font-size: 15px; }

/* ===== Case Study Cards ===== */
.case-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: .2s;
}
.case-card:hover {
  box-shadow: 0 2px 4px rgba(0,0,0,.06), 0 12px 24px rgba(0,0,0,.08);
}
.case-card.featured { border-left: 4px solid var(--accent); }
.case-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.case-card-header h3 { margin: 0 0 6px; font-size: 17px; }
.case-card-body {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}
.case-card-body p { margin: 0 0 10px; font-size: 14px; line-height: 1.6; }
.case-card-body strong { font-weight: 600; }

/* ===== Insight Cards ===== */
.insight-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.insight-card .category-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 8px;
}
.badge-trend { background: #e8f0fe; color: #1967d2; }
.badge-opportunity { background: #e6f4ea; color: #137333; }
.badge-warning { background: #fce8e6; color: #c5221f; }
.badge-technique { background: #fef7e0; color: #b06000; }

/* ===== FAQ Accordion ===== */
.faq-item {
  border-bottom: 1px solid var(--line);
  padding: 16px 0;
}
.faq-question {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  border: none;
  background: none;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-align: left;
  color: var(--ink);
}
.faq-question:hover { color: var(--accent); }
.faq-icon { font-size: 20px; transition: transform .2s; }
.faq-question[aria-expanded="true"] .faq-icon { transform: rotate(45deg); }
.faq-answer { padding-top: 12px; font-size: 14px; line-height: 1.6; color: var(--muted); }

/* ===== Share Form ===== */
.share-form {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 32px;
}
.share-form h3 { margin: 0 0 16px; font-size: 17px; }
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--ink);
}
.form-group input,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 14px;
  outline: none;
  transition: border-color .2s;
}
.form-group input:focus,
.form-group textarea:focus { border-color: var(--accent); }
.form-group textarea { resize: vertical; min-height: 120px; }
.char-count { font-size: 12px; color: var(--muted); text-align: right; margin-top: 4px; }
.form-actions { display: flex; gap: 12px; align-items: center; }
.btn-primary {
  padding: 10px 24px;
  border: none;
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .2s;
}
.btn-primary:hover { opacity: .85; }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }

/* ===== Loading & Empty States ===== */
.skeleton {
  background: linear-gradient(90deg, var(--soft) 25%, #ececee 50%, var(--soft) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius);
  height: 80px;
  margin-bottom: 12px;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state p { font-size: 15px; margin: 0; }
.error-state { text-align: center; padding: 40px 20px; color: #d32f2f; }
.error-state button {
  margin-top: 12px;
  padding: 8px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  cursor: pointer;
}

/* ===== Step Guide ===== */
.step-item {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.step-header {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}
.step-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}
.step-title { font-size: 16px; font-weight: 600; margin: 0; flex: 1; }
.step-body { padding-top: 16px; border-top: 1px solid var(--line); margin-top: 16px; }
.step-body p { font-size: 14px; line-height: 1.6; margin: 0 0 12px; }
.step-body .tip {
  background: #fef7e0;
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 12px;
}
.step-body .tip strong { color: #b06000; }
.step-tools {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.step-tools span {
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--accent-soft);
  font-size: 12px;
  color: var(--accent);
}

/* ===== Share Cards List ===== */
.share-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.share-card h4 { margin: 0 0 6px; font-size: 15px; }
.share-card .share-meta {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}
.share-card .share-content {
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
}
.share-card .share-content .full { display: none; }
.share-card .share-content.expanded .preview { display: none; }
.share-card .share-content.expanded .full { display: inline; }
