/* ─── Directory Layout ──────────────────────────────────────── */
body { padding-top: 68px; }

.dir-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: calc(100vh - 68px);
  max-width: 1400px;
  margin: 0 auto;
  gap: 0;
}

/* ─── Filters Sidebar ───────────────────────────────────────── */
.dir-filters {
  border-right: 1px solid var(--border);
  background: var(--white);
  position: sticky;
  top: 68px;
  height: calc(100vh - 68px);
  overflow-y: auto;
}
.dir-filters-inner { padding: 24px 16px; }

.filter-section { margin-bottom: 24px; }
.filter-section h4 {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 10px;
}
.filter-chips { display: flex; flex-direction: column; gap: 4px; }
.filter-chip { display: flex; align-items: center; gap: 0; cursor: pointer; }
.filter-chip input { display: none; }
.filter-chip span {
  font-size: 13px;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 6px;
  color: var(--text-2);
  transition: background .12s, color .12s;
  width: 100%;
}
.filter-chip:hover span { background: var(--slate-pale); }
.filter-chip input:checked + span {
  background: var(--blue-pale);
  color: var(--blue);
  font-weight: 600;
}

/* ─── Main Area ─────────────────────────────────────────────── */
.dir-main { padding: 28px 32px; background: var(--slate-pale); }

.dir-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}
.dir-header-left h1 {
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 2px;
}
.dir-header-left p { font-size: 13px; color: var(--text-3); }

.dir-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.dir-search-wrap { position: relative; }
.dir-search-wrap input {
  padding: 9px 36px 9px 14px;
  border: 1.5px solid var(--border-2);
  border-radius: 8px;
  font-size: 14px;
  font-family: var(--font);
  outline: none;
  width: 220px;
  transition: border-color .15s, box-shadow .15s;
  background: var(--white);
}
.dir-search-wrap input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(26,79,214,.1); }
.dir-search-icon {
  position: absolute;
  right: 10px; top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  pointer-events: none;
}

.dir-view-toggle { display: flex; gap: 2px; }
.view-btn {
  width: 34px; height: 34px;
  border: 1.5px solid var(--border-2);
  border-radius: 7px;
  background: var(--white);
  font-size: 15px;
  cursor: pointer;
  color: var(--text-3);
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.view-btn.active { background: var(--blue); border-color: var(--blue); color: #fff; }
.view-btn:hover:not(.active) { background: var(--slate-pale); }

/* ─── List View ─────────────────────────────────────────────── */
.dir-list-view { display: flex; flex-direction: column; gap: 12px; }

.dir-entity-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  display: flex;
  align-items: flex-start;
  gap: 18px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: box-shadow .2s, transform .2s;
}
.dir-entity-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }

.dec-icon {
  width: 52px; height: 52px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
  background: var(--slate-pale);
}
.dec-body { flex: 1; min-width: 0; }
.dec-name {
  font-size: 16px; font-weight: 700; color: var(--text);
  margin-bottom: 4px;
}
.dec-meta {
  font-size: 13px; color: var(--text-3);
  display: flex; gap: 14px; flex-wrap: wrap;
  margin-bottom: 8px;
}
.dec-meta span { display: flex; align-items: center; gap: 4px; }
.dec-description {
  font-size: 13px; color: var(--text-2);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 10px;
}
.dec-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.dec-badges { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex-shrink: 0; }
.dec-seek-badge {
  font-size: 11px; font-weight: 600;
  padding: 3px 9px; border-radius: 20px;
}
.dec-seek-badge.seeking  { background: var(--blue-pale); color: var(--blue); }
.dec-seek-badge.offering { background: var(--emerald-pale); color: var(--emerald); }

/* ─── Grid View ─────────────────────────────────────────────── */
.dir-grid-view {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.dir-entity-grid-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex; flex-direction: column; gap: 12px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: box-shadow .2s, transform .2s;
}
.dir-entity-grid-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.degc-top { display: flex; align-items: center; gap: 12px; }
.degc-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  background: var(--slate-pale);
  flex-shrink: 0;
}
.degc-name { font-size: 15px; font-weight: 700; color: var(--text); line-height: 1.3; }
.degc-type { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.degc-desc {
  font-size: 13px; color: var(--text-2); line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.degc-tags { display: flex; gap: 5px; flex-wrap: wrap; }
.degc-footer {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: auto; padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 12px; color: var(--text-3);
}

/* ─── States ─────────────────────────────────────────────────── */
.dir-loading, .dir-empty {
  text-align: center; padding: 80px 24px;
  color: var(--text-3); font-size: 15px;
}
.dir-empty-icon { font-size: 40px; margin-bottom: 12px; }
.dir-empty h3 { font-size: 18px; font-weight: 700; color: var(--text-2); margin-bottom: 8px; }

/* ─── Entity Drawer ─────────────────────────────────────────── */
.drawer-backdrop {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.35);
  z-index: 200;
  backdrop-filter: blur(2px);
}
.entity-drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 100%; max-width: 520px;
  background: var(--white);
  z-index: 201;
  display: flex; flex-direction: column;
  box-shadow: -8px 0 40px rgba(0,0,0,.12);
  overflow: hidden;
}
.entity-drawer.hidden { display: none; }
.drawer-backdrop.hidden { display: none; }

.drawer-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.drawer-title-row { display: flex; gap: 14px; align-items: flex-start; }
.drawer-icon {
  width: 52px; height: 52px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; background: var(--slate-pale); flex-shrink: 0;
}
.drawer-header h2 {
  font-size: 20px; font-weight: 800; color: var(--text);
  margin-bottom: 5px; line-height: 1.2;
}
#drawer-meta { font-size: 13px; color: var(--text-3); display: flex; gap: 10px; flex-wrap: wrap; }
.drawer-close {
  background: none; border: none; font-size: 18px;
  cursor: pointer; color: var(--text-3); padding: 4px 8px;
  border-radius: 6px; flex-shrink: 0;
}
.drawer-close:hover { background: var(--slate-pale); }

.drawer-body {
  overflow-y: auto; flex: 1;
  padding: 20px 24px;
  display: flex; flex-direction: column; gap: 20px;
}
.drawer-section {}
.drawer-section-title {
  font-size: 11px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--blue);
  margin-bottom: 10px; padding-bottom: 6px;
  border-bottom: 1px solid var(--blue-mid);
}
.drawer-row { font-size: 14px; color: var(--text-2); line-height: 1.65; }
.drawer-row strong { color: var(--text); display: block; font-size: 12px; font-weight: 600; color: var(--text-3); margin-bottom: 2px; }
.drawer-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }

.drawer-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex; gap: 10px; flex-shrink: 0;
  background: var(--slate-pale);
}

/* ─── Responsive ─────────────────────────────────────────────── */
@media (max-width: 900px) {
  .dir-layout { grid-template-columns: 1fr; }
  .dir-filters { position: static; height: auto; }
  .dir-main { padding: 20px 16px; }
}
@media (max-width: 600px) {
  .dir-header { flex-direction: column; align-items: flex-start; }
  .dir-search-wrap input { width: 100%; }
  .entity-drawer { max-width: 100%; }
}
