/* Agri4All - Agri for All Uploads (read-only social view).
 * Scoped under .a4a-soc-page so it never collides with agri-for-all.css.
 * Responsive: cards reflow to a single column on narrow screens; long links
 * wrap rather than overflow (no content cutoff). */

.a4a-soc-page {
  display: block;
  width: 100%;
  box-sizing: border-box;
}

/* Let the social view (header + groups + cards) extend past the viewport
 * bottom and scroll the dashboard container instead of being clipped. The
 * global .dashboard-content rule sets `overflow: hidden`; override it only
 * when a .a4a-soc-page is mounted inside, so no content is cut off. Mirrors
 * the .vd-page / .workflow-page overrides; other pages keep their behaviour. */
.dashboard-content:has(.a4a-soc-page) {
  overflow-y: auto;
}

.a4a-soc-page * { box-sizing: border-box; }

/* -- header -- */
.a4a-soc-head {
  margin: 0 0 16px;
}
.a4a-soc-title {
  margin: 0 0 4px;
  font-size: 20px;
  font-weight: 800;
  color: #0f172a;
}
.a4a-soc-sub {
  font-size: 13px;
  color: #64748b;
  max-width: 60ch;
}

/* -- states -- */
.a4a-soc-loading,
.a4a-soc-empty {
  padding: 24px;
  text-align: center;
  color: #64748b;
  font-size: 14px;
}
.a4a-soc-error {
  padding: 16px;
  border: 1px solid #fecaca;
  background: #fef2f2;
  border-radius: 10px;
  color: #991b1b;
  font-size: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
}

/* -- groups -- */
.a4a-soc-group {
  margin: 0 0 24px;
}
.a4a-soc-group-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 2px 8px;
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 14px;
}
.a4a-soc-group-client {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
}
.a4a-soc-group-month {
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  background: #f1f5f9;
  border-radius: 999px;
  padding: 2px 9px;
}
.a4a-soc-group-count {
  font-size: 12px;
  color: #94a3b8;
  margin-left: auto;
}

/* -- card grid -- */
.a4a-soc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

.a4a-soc-card {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.a4a-soc-card-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}
.a4a-soc-card-titlewrap {
  min-width: 0;
  flex: 1 1 auto;
}
/* Client-rating badge above-and-left of the client name. */
.a4a-soc-card-rating { display: inline-flex; margin: 3px 0 1px; }
.a4a-soc-card-title {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  word-break: break-word;
}
.a4a-soc-card-meta {
  margin-top: 2px;
  font-size: 12px;
  color: #64748b;
  word-break: break-word;
}

/* -- per-country links -- */
.a4a-soc-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.a4a-soc-links-note {
  font-size: 12px;
  color: #94a3b8;
  font-style: italic;
}
.a4a-soc-links-err {
  font-size: 12px;
  color: #991b1b;
}

.a4a-soc-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid #f1f5f9;
  border-radius: 8px;
  background: #f8fafc;
  min-width: 0;
}
.a4a-soc-country {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
  min-width: 0;
}

/* -- agri4all_status badge -- */
.a4a-soc-badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: capitalize;
  border-radius: 999px;
  padding: 2px 9px;
  letter-spacing: 0.01em;
}
.a4a-soc-badge--pending {
  background: #f1f5f9;
  color: #475569;
}
.a4a-soc-badge--approved {
  background: #dcfce7;
  color: #166534;
}

.a4a-soc-link {
  margin-left: auto;
  font-size: 12px;
  font-weight: 600;
  color: #0f766e;
  text-decoration: none;
  word-break: break-all;
}
.a4a-soc-link:hover { text-decoration: underline; }
.a4a-soc-link-pending {
  margin-left: auto;
  font-size: 12px;
  color: #94a3b8;
  font-style: italic;
}

/* -- subtle archive button -- */
.a4a-soc-archive {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  background: transparent;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 3px 9px;
  cursor: pointer;
  transition: color 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}
.a4a-soc-archive:hover:not(:disabled) {
  color: #475569;
  border-color: #cbd5e1;
  background: #f8fafc;
}
.a4a-soc-archive:disabled { opacity: 0.6; cursor: default; }
.a4a-soc-archive--err {
  color: #991b1b;
  border-color: #fecaca;
}

/* -- generic small buttons (retry) -- */
.a4a-soc-btn {
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
  border: 1px solid transparent;
}
.a4a-soc-btn--ghost {
  background: #fff;
  border-color: #cbd5e1;
  color: #334155;
}
.a4a-soc-btn--ghost:hover { background: #f8fafc; }
.a4a-soc-btn--sm {
  font-size: 12px;
  padding: 4px 10px;
  align-self: flex-start;
}

/* -- mobile -- */
@media (max-width: 640px) {
  .a4a-soc-grid {
    grid-template-columns: 1fr;
  }
  .a4a-soc-group-count {
    margin-left: 0;
    flex-basis: 100%;
  }
  .a4a-soc-link,
  .a4a-soc-link-pending {
    margin-left: 0;
    flex-basis: 100%;
  }
}
