/* ─── Social Aggregator – NSBC theme match ───────────────────────── */
#sa-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
  font-family: 'Open Sans', sans-serif;
}

/* Tabs */
#sa-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  justify-content: center;
  text-align: center;
}

#sa-tabs button {
  padding: 0.45rem 1rem;
  border: 2px solid var(--primary-color);
  background: var(--light-bg);
  color: var(--primary-color);
  font-weight: 600;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.25s, color 0.25s;
}

#sa-tabs button:hover {
  background: var(--highlight-color);
}

#sa-tabs button.active {
  background: var(--primary-color);
  color: #fff;
}

/* Grid */
#sa-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.sa-item {
  aspect-ratio: 1/1;
  background: #e0e0e0;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  transition: transform 0.25s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sa-item:hover {
  transform: translateY(-4px);
}

/* Thumbnail Placeholder */
.sa-thumb {
  width: 100%;
  height: 100%;
  position: relative;
  background: #d8d8d8;
  overflow: hidden;
}

.sa-thumb-inner {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #d8d8d8;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.sa-thumb-inner.loaded {
  opacity: 1;
}

/* Show More Button */
#sa-more {
  display: block;
  margin: 2rem auto 0;
  padding: 0.75rem 2rem;
  border: none;
  background: var(--accent-color);
  color: #fff;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.25s;
}

#sa-more:hover {
  background: #000;
}

/* Modal */
.sa-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem;
}

.sa-modal-content {
  background: #fff;
  max-width: 960px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  border-radius: 10px;
  position: relative;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.sa-modal-close {
  position: absolute;
  top: 8px;
  right: 12px;
  font-size: 26px;
  font-weight: 700;
  cursor: pointer;
  color: #888;
  transition: color 0.2s;
}

.sa-modal-close:hover {
  color: #000;
}

/* Modal Post */
.sa-post {
  display: flex;
  gap: 1rem;
  flex: 1 1 auto;
  overflow: hidden;
}

.sa-left {
  flex: 1 1 60%;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: 60vh;
  overflow-y: auto;
}

.sa-media {
  width: 100%;
}

.sa-embed {
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
}

.sa-embed iframe,
.sa-embed video,
.sa-embed img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border: none;
  display: block;
}

/* Right Column */
.sa-right {
  flex: 1 1 40%;
  overflow-y: auto;
  padding: 0.3rem 0;
}

.sa-caption p {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
}

.sa-caption small {
  color: #666;
  font-size: 0.85rem;
}

.sa-caption a {
  color: var(--accent-color);
  text-decoration: none;
  font-weight: 600;
}

.sa-caption a:hover {
  text-decoration: underline;
}

/* Thumbnails */
.sa-thumbs {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}

.sa-thumbpick {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 6px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border 0.2s, transform 0.2s;
}

.sa-thumbpick:hover {
  transform: scale(1.05);
}

.sa-thumbpick.active {
  border-color: var(--accent-color);
}

/* ─── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 768px) {
  #sa-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .sa-post {
    flex-direction: column;
  }
  .sa-left,
  .sa-right {
    max-height: none;
    width: 100%;
  }
  #sa-tabs button {
    flex: 1 1 48%;
  }
}

@media (max-width: 500px) {
  #sa-grid {
    grid-template-columns: 1fr;
  }
}
