/* ── Discovery hero ──────────────────────────────────────────────────────────── */

.tb-discovery-hero {
  background: linear-gradient(160deg, #1a2f1e 0%, #2d4a32 60%, #3a5a40 100%);
  color: #fff;
  padding: 2.25rem 0 2rem;
}

.tb-discovery-hero-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.tb-discovery-hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.tb-discovery-title {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: .2rem;
}

.tb-discovery-subtitle {
  font-size: .9rem;
  opacity: .75;
  margin: 0;
}

.tb-discovery-nav {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  align-items: center;
  flex-shrink: 0;
  padding-top: .35rem;
}

.tb-hero-btn {
  background: rgba(255,255,255,.15);
  color: #fff;
  border: 1px solid rgba(255,255,255,.3);
}
.tb-hero-btn:hover {
  background: rgba(255,255,255,.25);
  color: #fff;
  border-color: rgba(255,255,255,.5);
}

.tb-hero-btn-ghost {
  background: none;
  color: rgba(255,255,255,.7);
  border: 1px solid rgba(255,255,255,.2);
}
.tb-hero-btn-ghost:hover {
  color: #fff;
  border-color: rgba(255,255,255,.4);
  background: rgba(255,255,255,.08);
}

/* ── Search bar (inside hero) ─────────────────────────────────────────────────── */

.tb-search-form {
  display: flex;
  gap: .5rem;
  width: 100%;
  max-width: 620px;
}

.tb-search-icon {
  position: absolute;
  left: .75rem;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255,255,255,.5);
  pointer-events: none;
}

.tb-search-input {
  padding-left: 2.25rem;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.25);
  color: #fff;
}
.tb-search-input::placeholder { color: rgba(255,255,255,.5); }
.tb-search-input:focus {
  background: rgba(255,255,255,.18);
  border-color: rgba(255,255,255,.5);
  color: #fff;
  box-shadow: 0 0 0 .2rem rgba(255,255,255,.1);
}

/* ── Discovery grid — centred flex so few cards don't hug the left ────────────── */

.tb-discovery-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.25rem;
  padding-top: .25rem;
}

/* ── Buddy card ──────────────────────────────────────────────────────────────── */

.tb-buddy-card {
  background: var(--clr-card);
  border: 1px solid var(--clr-border);
  border-radius: var(--r-md);
  padding: 1.5rem 1.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: .6rem;
  width: 240px;
  flex: 0 1 240px;
  min-height: 220px;
  transition: box-shadow .15s, transform .15s;
}

.tb-buddy-card:hover {
  box-shadow: var(--sh-md);
  transform: translateY(-2px);
}

/* ── Avatar ──────────────────────────────────────────────────────────────────── */

.tb-buddy-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--clr-primary) 0%, #2d7a45 100%);
  color: #fff;
  font-size: 1.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(37,99,60,.25);
}

.tb-buddy-avatar-sm {
  width: 36px;
  height: 36px;
  font-size: .95rem;
}

.tb-buddy-name {
  font-weight: 700;
  font-size: .95rem;
}

.tb-buddy-bio {
  font-size: .82rem;
  color: var(--clr-muted);
  margin: 0;
  line-height: 1.5;
  flex: 1;
}

.tb-buddy-bio--empty {
  font-style: italic;
  opacity: .5;
}

.tb-buddy-actions {
  margin-top: auto;
  padding-top: .5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: .4rem;
}

/* ── Travel style tags ────────────────────────────────────────────────────────── */

.tb-style-tags {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  justify-content: center;
}

.tb-style-tag {
  background: var(--clr-primary-pale);
  color: var(--clr-primary);
  font-size: .72rem;
  font-weight: 600;
  padding: .15rem .55rem;
  border-radius: var(--r-pill);
}

/* ── Non-TB user fallback result ─────────────────────────────────────────────── */

.tb-non-tb-result {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--clr-card);
  border: 1px solid var(--clr-border);
  border-radius: var(--r-md);
  max-width: 420px;
  margin: 1rem auto 0;
}

/* ── Connection list ──────────────────────────────────────────────────────────── */

.tb-conn-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.tb-conn-item {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: .85rem 0;
  border-bottom: 1px solid var(--clr-border);
}

.tb-conn-item:last-child {
  border-bottom: none;
}

.tb-conn-info {
  flex: 1;
  min-width: 0;
}

.tb-conn-name {
  font-weight: 600;
  font-size: .95rem;
}

.tb-conn-actions {
  display: flex;
  align-items: center;
  gap: .4rem;
  flex-shrink: 0;
}

/* ── Recipient selector (share forms) ─────────────────────────────────────────── */

.tb-recipient-list {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.tb-recipient-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem .85rem;
  border: 1px solid var(--clr-border);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}

.tb-recipient-row:has(input:checked) {
  border-color: var(--clr-primary);
  background: var(--clr-primary-pale);
}

.tb-recipient-row input[type="radio"] {
  margin: 0;
}

/* ── Shared-with-me list ──────────────────────────────────────────────────────── */

.tb-share-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.tb-share-item {
  display: flex;
  align-items: flex-start;
  gap: .85rem;
  padding: .9rem 0;
  border-bottom: 1px solid var(--clr-border);
}

.tb-share-item:last-child {
  border-bottom: none;
}

.tb-share-info {
  flex: 1;
  min-width: 0;
}

.tb-share-title {
  font-weight: 600;
  color: var(--clr-primary);
  text-decoration: none;
}

.tb-share-title:hover {
  text-decoration: underline;
}

.tb-share-message {
  font-size: .83rem;
  color: var(--clr-muted);
  margin: .3rem 0 .2rem;
  font-style: italic;
}

/* ── Not-discoverable banner ─────────────────────────────────────────────────── */

.tb-undiscoverable-banner {
  background: #fff3cd;
  border-bottom: 1px solid #ffc107;
  color: #664d03;
  padding: .65rem 0;
  font-size: .875rem;
}

/* ── Two-column discovery layout ─────────────────────────────────────────────── */

.tb-discovery-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 1.75rem;
  align-items: start;
}

.tb-discovery-main {
  min-width: 0;
}

/* ── Your Travel Buddies sidebar panel ───────────────────────────────────────── */

.tb-buddies-panel {
  background: var(--clr-card);
  border: 1px solid var(--clr-border);
  border-radius: var(--r-md);
  overflow: hidden;
  position: sticky;
  top: 1.5rem;
}

.tb-buddies-panel-header {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-weight: 700;
  font-size: .9rem;
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--clr-border);
  background: var(--clr-primary-pale);
  color: var(--clr-primary);
}

.tb-buddies-count {
  margin-left: auto;
  background: var(--clr-primary);
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  border-radius: var(--r-pill);
  padding: .1rem .45rem;
}

.tb-buddies-list {
  display: flex;
  flex-direction: column;
}

.tb-buddy-row {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .65rem 1rem;
  border-bottom: 1px solid var(--clr-border);
  text-decoration: none;
  color: inherit;
  transition: background .12s;
}

.tb-buddy-row:last-child {
  border-bottom: none;
}

.tb-buddy-row:hover {
  background: var(--clr-primary-pale);
  text-decoration: none;
  color: inherit;
}

.tb-buddy-row-info {
  flex: 1;
  min-width: 0;
}

.tb-buddy-row-name {
  font-weight: 600;
  font-size: .875rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tb-buddy-row-styles {
  font-size: .75rem;
  color: var(--clr-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tb-buddy-row-msg {
  flex-shrink: 0;
  color: var(--clr-muted);
  font-size: 1rem;
  padding: .2rem .35rem;
  border-radius: var(--r-sm);
  transition: color .12s, background .12s;
}

.tb-buddy-row-msg:hover {
  color: var(--clr-primary);
  background: rgba(0,0,0,.06);
}

.tb-buddies-panel-footer {
  padding: .75rem 1rem;
  border-top: 1px solid var(--clr-border);
}

.tb-buddies-empty {
  padding: 1.5rem 1rem;
  text-align: center;
  color: var(--clr-muted);
}

.tb-buddies-empty i {
  font-size: 1.75rem;
  display: block;
  margin-bottom: .5rem;
  opacity: .4;
}

.tb-buddies-empty p {
  font-size: .82rem;
  margin: 0;
}

/* ── Responsive ──────────────────────────────────────────────────────────────── */

@media (max-width: 900px) {
  .tb-discovery-layout {
    grid-template-columns: 1fr;
  }
  .tb-buddies-panel {
    position: static;
    /* Move panel above the grid on smaller screens */
    order: -1;
  }
  .tb-buddies-list {
    /* Horizontal scroll row on tablet */
    flex-direction: row;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .tb-buddies-list::-webkit-scrollbar { display: none; }
  .tb-buddy-row {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: .3rem;
    min-width: 90px;
    padding: .65rem .75rem;
    border-bottom: none;
    border-right: 1px solid var(--clr-border);
  }
  .tb-buddy-row:last-child { border-right: none; }
  .tb-buddy-row-styles { display: none; }
  .tb-buddy-row-msg { display: none; }
}

@media (max-width: 576px) {
  .tb-discovery-hero { padding: 1.5rem 0 1.25rem; }
  .tb-discovery-title { font-size: 1.55rem; }
  .tb-discovery-hero-top { flex-direction: column; gap: .75rem; }
  .tb-discovery-nav { padding-top: 0; }
  .tb-search-form { max-width: 100%; }
  .tb-buddy-card { width: 100%; flex: 1 1 100%; }
}
