/*
 * SW Barter Board – Frontend Styles
 * Designed to work cleanly inside HivePress / ExpertHive theme.
 * Color references use CSS custom properties where possible.
 */

/* ── Layout Wrappers ─────────────────────────────────────────────────── */
.swbb-archive-wrap,
.swbb-single-wrap,
.swbb-page-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 16px;
}

/* ── Hero ────────────────────────────────────────────────────────────── */
.swbb-archive-hero {
  text-align: center;
  padding: 48px 16px 32px;
}
.swbb-archive-hero h1 {
  font-size: 2.2rem;
  font-weight: 800;
  margin-bottom: 12px;
  color: #1a1a1a;
}
.swbb-hero-tagline {
  font-size: 1.1rem;
  color: #555;
  margin-bottom: 24px;
}

/* ── Buttons ─────────────────────────────────────────────────────────── */
.swbb-btn {
  display: inline-block;
  padding: 10px 20px;
  border: none;
  border-radius: 5px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: opacity .15s;
  line-height: 1.4;
}
.swbb-btn:hover { opacity: .88; }
.swbb-btn--primary   { background: #1a1a1a; color: #fff; }
.swbb-btn--secondary { background: #444; color: #fff; }
.swbb-btn--success   { background: #2d8a4e; color: #fff; }
.swbb-btn--danger    { background: #c0392b; color: #fff; }
.swbb-btn--ghost     { background: transparent; color: #555; border: 1px solid #ccc; }
.swbb-btn--lg        { padding: 14px 28px; font-size: 16px; }
.swbb-btn--sm        { padding: 6px 12px; font-size: 12px; }
.swbb-link-btn {
  background: none;
  border: none;
  color: #888;
  cursor: pointer;
  font-size: 13px;
  padding: 0;
  text-decoration: underline;
}

/* ── Filter Bar ──────────────────────────────────────────────────────── */
.swbb-filters {
  background: #f8f8f8;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 24px;
}
.swbb-filter-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}
.swbb-filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 160px;
}
.swbb-filter-group label {
  font-size: 12px;
  font-weight: 600;
  color: #555;
}
.swbb-filter-group input,
.swbb-filter-group select {
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
}

/* ── Grid ────────────────────────────────────────────────────────────── */
.swbb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin: 24px 0;
}
.swbb-result-count {
  font-size: 13px;
  color: #777;
  margin-bottom: 8px;
}

/* ── Barter Card ─────────────────────────────────────────────────────── */
.swbb-card {
  background: #fff;
  border: 1px solid #e2e2e2;
  border-radius: 8px;
  padding: 20px;
  transition: box-shadow .15s;
}
.swbb-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,.08);
}
.swbb-card-header {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.swbb-card-id {
  font-size: 11px;
  color: #aaa;
  font-family: monospace;
}
.swbb-card-title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 12px;
  line-height: 1.3;
}
.swbb-card-title a {
  color: #1a1a1a;
  text-decoration: none;
}
.swbb-card-title a:hover { color: #555; }

.swbb-card-exchange {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
}
.swbb-card-offering,
.swbb-card-seeking {
  flex: 1;
  background: #f9f9f9;
  border-radius: 6px;
  padding: 10px;
}
.swbb-card-arrow {
  font-size: 18px;
  color: #bbb;
  line-height: 2.5;
}
.swbb-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: #888;
  margin-bottom: 2px;
}
.swbb-hours {
  display: inline-block;
  background: #1a1a1a;
  color: #fff;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  margin-bottom: 4px;
}
.swbb-card-offering p,
.swbb-card-seeking p {
  margin: 0;
  font-size: 13px;
  color: #444;
}
.swbb-card-footer {
  font-size: 12px;
  color: #888;
  border-top: 1px solid #eee;
  padding-top: 8px;
}

/* ── Status Badges ───────────────────────────────────────────────────── */
.swbb-status {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.swbb-status--open        { background: #e6f7ee; color: #1e7e45; }
.swbb-status--negotiating { background: #fff3cd; color: #856404; }
.swbb-status--agreed      { background: #d1ecf1; color: #0c5460; }
.swbb-status--completed   { background: #e9ecef; color: #495057; }
.swbb-status--expired     { background: #fce8e8; color: #b33; }
.swbb-status--pending     { background: #fff3cd; color: #856404; }
.swbb-status--accepted    { background: #d1ecf1; color: #0c5460; }
.swbb-status--declined    { background: #fce8e8; color: #b33; }
.swbb-status--withdrawn   { background: #e9ecef; color: #777; }

/* ── Single Post ─────────────────────────────────────────────────────── */
.swbb-single-post { max-width: 800px; }
.swbb-post-header { margin-bottom: 28px; }
.swbb-post-meta-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.swbb-listing-id {
  font-family: monospace;
  font-size: 12px;
  color: #aaa;
}
.swbb-location { font-size: 14px; color: #666; }
.swbb-post-title {
  font-size: 1.8rem;
  font-weight: 800;
  margin: 0 0 8px;
  color: #1a1a1a;
}
.swbb-poster { font-size: 14px; color: #777; margin: 0; }
.swbb-expired-label { color: #c00; font-weight: 600; }

/* ── Exchange Grid (single post) ─────────────────────────────────────── */
.swbb-exchange-grid {
  display: flex;
  gap: 16px;
  align-items: stretch;
  margin: 28px 0;
}
.swbb-exchange-card {
  flex: 1;
  border-radius: 10px;
  padding: 20px;
}
.swbb-exchange-card--offering { background: #f0f8f4; border: 1px solid #c8e6d4; }
.swbb-exchange-card--seeking  { background: #f3f4fb; border: 1px solid #cdd3f4; }
.swbb-exchange-card h3 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: #888;
  margin: 0 0 8px;
}
.swbb-hours-badge {
  display: inline-block;
  background: #1a1a1a;
  color: #fff;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  margin-bottom: 10px;
}
.swbb-exchange-card p { margin: 0; color: #333; line-height: 1.6; }
.swbb-exchange-arrow {
  font-size: 24px;
  color: #ccc;
  display: flex;
  align-items: center;
  padding-top: 40px;
}
.swbb-post-description {
  border-top: 1px solid #eee;
  padding-top: 20px;
  margin-top: 20px;
  color: #444;
  line-height: 1.7;
}

/* ── Forms ───────────────────────────────────────────────────────────── */
.swbb-form-wrap,
.swbb-offer-section { margin: 32px 0; }
.swbb-form-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 8px;
}
.swbb-form-intro,
.swbb-offer-intro {
  color: #666;
  margin-bottom: 24px;
  font-size: 14px;
}
.swbb-offer-section { border-top: 2px solid #eee; padding-top: 28px; }
.swbb-offer-section h3 { font-size: 1.2rem; margin-bottom: 8px; }

.swbb-form { max-width: 640px; }
.swbb-field-group {
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.swbb-field-group--inline { flex-direction: row; align-items: center; gap: 12px; }
.swbb-field-group--inline label { white-space: nowrap; min-width: 160px; }
.swbb-fieldset {
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
}
.swbb-fieldset legend {
  font-weight: 700;
  font-size: 14px;
  padding: 0 8px;
  color: #1a1a1a;
}
.swbb-field-group label {
  font-size: 13px;
  font-weight: 600;
  color: #333;
}
.swbb-required { color: #c00; }
.swbb-field-group input[type="text"],
.swbb-field-group input[type="number"],
.swbb-field-group input[type="date"],
.swbb-field-group select,
.swbb-field-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 5px;
  font-size: 14px;
  box-sizing: border-box;
  transition: border-color .15s;
}
.swbb-field-group input:focus,
.swbb-field-group select:focus,
.swbb-field-group textarea:focus {
  border-color: #1a1a1a;
  outline: none;
}
.swbb-form-footer { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.swbb-submit-msg,
.swbb-form-msg {
  font-size: 14px;
  padding: 8px 12px;
  border-radius: 4px;
}
.swbb-msg--success { background: #d4edda; color: #155724; }
.swbb-msg--error   { background: #f8d7da; color: #721c24; }

/* ── Poster Card (single post) ───────────────────────────────────────── */
.swbb-poster-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-top: 16px;
  padding: 16px;
  background: #f9f9f9;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
}
.swbb-poster-avatar img {
  border-radius: 50%;
  display: block;
}
.swbb-poster-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.swbb-poster-name {
  font-size: 15px;
  font-weight: 700;
  color: #1a1a1a;
}
.swbb-poster-link {
  color: #1a1a1a;
  text-decoration: none;
}
.swbb-poster-link:hover { text-decoration: underline; }
.swbb-poster-meta {
  font-size: 12px;
  color: #888;
}
.swbb-vendor-profile-btn {
  display: inline-block;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #555;
  text-decoration: none;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 4px 10px;
  transition: background .15s, border-color .15s;
}
.swbb-vendor-profile-btn:hover {
  background: #1a1a1a;
  color: #fff;
  border-color: #1a1a1a;
}

/* ── Card Footer (updated to hold poster + location) ─────────────────── */
.swbb-card-footer {
  font-size: 12px;
  color: #888;
  border-top: 1px solid #eee;
  padding-top: 10px;
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.swbb-card-poster {
  display: flex;
  align-items: center;
  gap: 6px;
}
.swbb-card-poster img {
  border-radius: 50%;
  vertical-align: middle;
}
.swbb-card-poster-link {
  color: #555;
  text-decoration: none;
  font-weight: 600;
}
.swbb-card-poster-link:hover { color: #1a1a1a; text-decoration: underline; }
.swbb-card-location { color: #888; }


.swbb-notice {
  padding: 12px 16px;
  border-radius: 6px;
  margin: 16px 0;
  font-size: 14px;
}
.swbb-notice--info  { background: #d1ecf1; color: #0c5460; }
.swbb-notice--warn  { background: #fff3cd; color: #856404; }
.swbb-notice--success { background: #d4edda; color: #155724; }
.swbb-no-results { text-align: center; padding: 48px; }
.swbb-no-results p { color: #888; margin-bottom: 16px; }

/* ── Offers Panel ────────────────────────────────────────────────────── */
.swbb-offers-panel {
  border-top: 2px solid #eee;
  padding-top: 28px;
  margin-top: 28px;
}
.swbb-offers-panel h3 { margin-bottom: 16px; }
.swbb-offer-card {
  border: 1px solid #e2e2e2;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
}
.swbb-offer-card--status-accepted { border-left: 4px solid #2d8a4e; }
.swbb-offer-card--status-declined { opacity: .6; }
.swbb-offer-card--status-withdrawn { opacity: .5; }
.swbb-offer-header {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.swbb-offer-user { font-weight: 700; font-size: 14px; }
.swbb-offer-date { font-size: 12px; color: #aaa; margin-left: auto; }
.swbb-offer-message { font-style: italic; color: #666; font-size: 14px; }
.swbb-offer-actions { margin-top: 12px; display: flex; gap: 8px; }

/* ── Trade Status Panel ──────────────────────────────────────────────── */
.swbb-trade-status {
  border: 2px solid #1a1a1a;
  border-radius: 10px;
  padding: 24px;
  margin-top: 28px;
}
.swbb-trade-status h3 { margin: 0 0 16px; }
.swbb-trade-confirmations { display: flex; gap: 24px; flex-wrap: wrap; }
.swbb-confirm-item {
  flex: 1;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
}
.swbb-confirm-item span:first-child { font-weight: 600; color: #555; }
.swbb-check { color: #2d8a4e; font-weight: 600; }
.swbb-pending { color: #888; }
.swbb-agreed-at { font-size: 13px; color: #888; margin-top: 16px; }

/* ── Existing Offer Notice ───────────────────────────────────────────── */
.swbb-existing-offer { padding: 12px 16px; }

/* ── Account Dashboard ───────────────────────────────────────────────── */
.swbb-account h2 { font-size: 1.5rem; margin-bottom: 20px; }
.swbb-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 2px solid #eee;
  margin-bottom: 24px;
}
.swbb-tab {
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  color: #666;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color .15s, border-color .15s;
}
.swbb-tab:hover { color: #1a1a1a; }
.swbb-tab.active { color: #1a1a1a; border-bottom-color: #1a1a1a; }
.swbb-tab-actions { margin-bottom: 20px; }
.swbb-list { display: flex; flex-direction: column; gap: 10px; }
.swbb-list-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid #e2e2e2;
  border-radius: 6px;
  flex-wrap: wrap;
  gap: 8px;
}
.swbb-list-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
.swbb-list-main a {
  font-weight: 600;
  color: #1a1a1a;
  text-decoration: none;
}
.swbb-list-main a:hover { color: #555; }
.swbb-offer-detail,
.swbb-trade-partner { font-size: 12px; color: #888; }
.swbb-list-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.swbb-date { font-size: 12px; color: #aaa; }
.swbb-id-badge {
  display: inline-block;
  font-size: 11px;
  font-family: monospace;
  color: #aaa;
  background: #f5f5f5;
  padding: 1px 6px;
  border-radius: 3px;
}
.swbb-badge-count { font-size: 12px; color: #856404; background: #fff3cd; padding: 2px 8px; border-radius: 10px; }
.swbb-link { font-size: 13px; color: #555; }

/* ── Vendor Profile Injection ────────────────────────────────────────── */
.swbb-vendor-barters { margin: 24px 0; padding: 16px; background: #f9f9f9; border-radius: 8px; }
.swbb-vendor-barters h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .5px; color: #888; margin: 0 0 12px; }
.swbb-vendor-barter-link {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 0;
  border-bottom: 1px solid #eee;
  text-decoration: none;
  color: #1a1a1a;
}
.swbb-vendor-barter-link:last-of-type { border-bottom: none; }
.swbb-vendor-barter-link strong { font-size: 14px; }
.swbb-vendor-barter-link small { font-size: 12px; color: #888; }
.swbb-see-all { display: block; margin-top: 10px; font-size: 13px; color: #555; }

/* ── Flag Section ────────────────────────────────────────────────────── */
.swbb-flag-section { margin-top: 40px; padding-top: 16px; border-top: 1px solid #eee; }
.swbb-flag-form { display: flex; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.swbb-flag-form select { padding: 6px 10px; border: 1px solid #ccc; border-radius: 4px; font-size: 13px; }
.swbb-flag-msg { font-size: 13px; }

/* ── Breadcrumb ──────────────────────────────────────────────────────── */
.swbb-breadcrumb {
  font-size: 13px;
  color: #aaa;
  margin-bottom: 20px;
  display: flex;
  gap: 8px;
  align-items: center;
}
.swbb-breadcrumb a { color: #888; text-decoration: none; }
.swbb-breadcrumb a:hover { color: #1a1a1a; }

/* ── Pagination ──────────────────────────────────────────────────────── */
.swbb-pagination { margin: 32px 0; text-align: center; }
.swbb-pagination .page-numbers {
  display: inline-block;
  padding: 6px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  margin: 0 2px;
  font-size: 13px;
  color: #555;
  text-decoration: none;
}
.swbb-pagination .page-numbers.current { background: #1a1a1a; color: #fff; border-color: #1a1a1a; }

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .swbb-exchange-grid { flex-direction: column; }
  .swbb-exchange-arrow { display: none; }
  .swbb-filter-form { flex-direction: column; }
  .swbb-list-row { flex-direction: column; align-items: flex-start; }
  .swbb-trade-confirmations { flex-direction: column; }
  .swbb-card-exchange { flex-direction: column; }
  .swbb-card-arrow { display: none; }
}
