/**
 * both-cards.css
 *
 * Single source of truth for the website-card UI used by:
 *   1. The public Directory (template-parts/cards/listing-card.php)
 *   2. The User Dashboard "My Websites".
 */

/* =============================================
   1. BASE GRID + CARD SHELL
   ============================================= */
.gpb-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-lg);
  min-height: 400px;
}

.gpb-card {
  background: var(--clr-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--clr-border);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.gpb-card:hover {
  box-shadow: var(--shadow-card-hover);
  border-color: var(--clr-primary-light);
}

/* =============================================
   2. LEGACY HEADER / METRIC / PRICING HELPERS
   (kept for backward compatibility with older templates)
   ============================================= */
.gpb-card-header {
  padding: 20px;
  border-bottom: 1px solid var(--clr-bg);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.gpb-card-site-info {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.site-favicon {
  border-radius: 6px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.site-name {
  font-size: 1.1rem;
  margin: 0 0 2px;
  line-height: 1.3;
}

.site-url {
  font-size: 0.85rem;
  color: var(--clr-text-light);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.site-url:hover { color: var(--clr-primary); }

.gpb-card-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 16px 20px;
  background: var(--clr-bg);
  border-bottom: 1px solid var(--clr-border);
}

.metric-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.metric-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--clr-text-light);
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.metric-value {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--clr-dark);
}

.metric-value.country-val {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60px;
}

.gpb-card-niche { padding: 12px 20px 0; }

.gpb-card-pricing {
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.price-item { display: flex; flex-direction: column; }
.price-label { font-size: 0.75rem; color: var(--clr-text-muted); font-weight: 500; }
.price-val { font-size: 1.1rem; font-weight: 800; color: var(--clr-dark); }
.price-na { font-size: 1.1rem; color: var(--clr-text-light); font-weight: 400; }
.price-divider { width: 1px; height: 30px; background: var(--clr-border); }

.gpb-card-actions {
  padding: 16px 20px;
  border-top: 1px solid var(--clr-bg);
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 10px;
  margin-top: auto;
}

/* No-results placeholder shown inside the grid when filters return zero hits */
.no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  background: var(--clr-elevated);
  border-radius: var(--radius-lg);
  border: 1px dashed var(--clr-border);
}
.no-results-icon { font-size: 3rem; margin-bottom: 16px; opacity: 0.5; }
.no-results h3 { margin-bottom: 8px; color: var(--clr-dark); }

/* =============================================
   3. VERIFIED BADGE + PUBLISHER ONLINE DOT
   ============================================= */
.verified-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: #10B981;
  background: rgba(16, 185, 129, .12);
  border: 1px solid rgba(16, 185, 129, .25);
  border-radius: var(--radius-full);
  padding: 2px 8px;
  margin-top: 4px;
  letter-spacing: .02em;
}
.verified-badge svg { flex-shrink: 0; }
.verified-badge--lg {
  font-size: 12.5px;
  padding: 4px 12px;
  margin-top: 6px;
}

.pub-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.pub-dot--online   { background: #10B981; box-shadow: 0 0 0 2px rgba(16,185,129,.3); animation: pulse-dot 1.8s infinite; }
.pub-dot--recent   { background: #F59E0B; }
.pub-dot--away     { background: #94A3B8; }
.pub-dot--inactive { background: #475569; }

@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 2px rgba(16,185,129,.3); }
  50%      { box-shadow: 0 0 0 5px rgba(16,185,129,.0); }
}

.card-pub-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--clr-text-muted);
  padding: 8px var(--space-md);
  border-top: 1px solid var(--clr-border);
  margin-top: 2px;
}
.pub-profile-link {
  color: var(--clr-primary);
  font-weight: 500;
  text-decoration: none;
}
.pub-profile-link:hover { text-decoration: underline; }

/* Late override block from the original main.css "redesigned card" section */
.verified-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--clr-success);
  background: #ECFDF5;
  border: 1px solid rgba(16,185,129,.2);
  border-radius: var(--radius-full);
  padding: 2px 8px;
  margin-top: 4px;
}

.card-pub-status {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  font-size: 0.78rem;
  color: var(--clr-text-muted);
  border-top: 1px solid var(--clr-border);
}

.pub-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--clr-text-light);
}
.pub-dot--online  { background: var(--clr-success); box-shadow: 0 0 0 2px rgba(16,185,129,.2); }
.pub-dot--away    { background: var(--clr-warning); box-shadow: 0 0 0 2px rgba(245,158,11,.2); }
.pub-dot--offline { background: #94A3B8; }

/* =============================================
   4. REDESIGNED CARD PRIMITIVES
   ============================================= */
/* Top strip: niche chip + dofollow badge + favourite/status slot */
.card-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px 0;
  gap: 8px;
}
.card-strip-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 0;
}

.card-niche-chip {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--clr-primary);
  background: var(--clr-primary-light);
  padding: 3px 10px;
  border-radius: var(--radius-full);
}

/* Favourite (heart) toggle — directory cards only */
.gpb-fav-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--clr-text-light);
  border-radius: 50%;
  transition: color 0.2s;
  flex-shrink: 0;
  line-height: 1;
}
.gpb-fav-btn:hover { color: #FBBF24; }
.gpb-fav-btn.active { color: #FBBF24; }
.gpb-fav-btn.active svg { fill: #FBBF24; }

/* Site identity row: favicon + name + domain */
.card-identity {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px 12px;
}

.card-favicon-wrap {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  background: var(--clr-bg);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--clr-border);
  overflow: hidden;
}

.card-favicon {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  object-fit: contain;
}

.card-id-body {
  min-width: 0;
  flex: 1;
}

.card-site-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--clr-dark);
  margin: 0 0 3px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-domain {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  color: var(--clr-text-light);
  text-decoration: none;
  transition: color var(--transition-fast);
}
.card-domain:hover { color: var(--clr-primary); }

/* Metrics grid (DA / DR / Semrush / Ahrefs) */
.card-metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 12px 16px;
  background: var(--clr-bg);
  border-top: 1px solid var(--clr-border);
  border-bottom: 1px solid var(--clr-border);
}

.card-metric {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 2px;
}

.cm-value {
  font-size: 1rem;
  font-weight: 800;
  color: var(--clr-dark);
  font-family: var(--font-heading);
  line-height: 1;
}

.cm-key {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--clr-text-light);
}

.country-val {
  font-size: 0.8rem;
  max-width: 56px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Pricing row (Guest Post | Link Insert) */
.card-pricing-row {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  gap: 12px;
  border-bottom: 1px solid var(--clr-border);
}

.cp-slot {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cp-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--clr-text-muted);
}

.cp-val {
  font-size: 1.05rem;
  color: var(--clr-dark);
}
.cp-val strong { font-weight: 800; color: var(--clr-success); }
.cp-val em     { font-style: normal; color: var(--clr-text-light); }

.cp-divider {
  width: 1px;
  height: 32px;
  background: var(--clr-border);
  flex-shrink: 0;
}

/* =============================================
   5. NICHE DROPDOWN + COUNTRY CHIP
   ============================================= */
.niche-more-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.card-niche-more {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font: inherit;
  transition: opacity 0.15s ease;
}

.card-niche-more:hover { opacity: 0.8; }

.card-niche-more .card-niche-chip { pointer-events: none; }

.card-niche-more svg {
  width: 10px;
  height: 10px;
  transition: transform 0.15s ease;
  color: var(--clr-muted, #6B7280);
}

.card-niche-more[aria-expanded="true"] svg { transform: rotate(180deg); }

.niche-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  display: none;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
  padding: 8px;
  background: var(--clr-surface, #fff);
  border: 1px solid var(--clr-border, #E5E7EB);
  border-radius: 8px;
  z-index: 50;
  min-width: 120px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.niche-dropdown.open { display: flex; }

.niche-dropdown .card-niche-chip {
  font-size: 0.82rem;
  padding: 3px 8px;
}

.card-country-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--clr-bg, #F9FAFB);
  border: 1px solid var(--clr-border, #E5E7EB);
  padding: 3px 8px;
  border-radius: 999px;
  color: var(--clr-muted, #6B7280);
}
.card-country-chip svg { width: 10px; height: 10px; }

/* =============================================
   6. PREMIUM "FLOATING" OVERRIDES
   These rules come last in cascade order and refine the visual tone.
   The original main.css used !important on a few of them — preserved here.
   ============================================= */
.gpb-cards-grid { gap: 20px; }
.gpb-card {
  background: #FAFAFE;
  border-radius: 20px !important;
  border: 1px solid rgba(0,0,0,0.055) !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.03) !important;
  transition: border-color 0.22s, background 0.22s !important;
}
.gpb-card:hover {
  box-shadow: 0 28px 70px rgba(99,102,241,0.15),
              0 8px 28px rgba(0,0,0,0.07),
              0 0 0 1.5px rgba(99,102,241,0.2) !important;
  border-color: rgba(99,102,241,0.12) !important;
  background: #FFFFFF !important;
}

.card-strip {
  padding: 14px 18px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-niche-chip {
  background: rgba(99,102,241,0.08);
  color: var(--clr-primary-dark);
  font-size: 0.67rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 99px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.gpb-fav-btn {
  background: rgba(0,0,0,0.04);
  border: none;
  border-radius: 50%;
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 0.12s cubic-bezier(0.4,0,0.2,1);
  padding: 0; flex-shrink: 0;
}
.gpb-fav-btn:hover  { background: rgba(251,191,36,0.14); }
.gpb-fav-btn.active { background: rgba(251,191,36,0.12); }

.card-identity {
  padding: 4px 18px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.card-favicon-wrap {
  flex-shrink: 0;
  width: 40px; height: 40px;
  border-radius: 10px;
  overflow: hidden;
  background: #F5F5F9;
  border: 1px solid rgba(0,0,0,0.06);
  display: flex; align-items: center; justify-content: center;
}
.card-favicon { width: 32px; height: 32px; border-radius: 6px; }
.card-site-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: #09090B;
  margin: 0 0 2px;
  line-height: 1.3;
  letter-spacing: -0.01em;
}
.card-domain {
  font-size: 0.77rem;
  color: #71717A;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  text-decoration: none !important;
  font-weight: 500;
  transition: color 0.12s;
}
.card-domain:hover { color: var(--clr-primary); }
.verified-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.67rem;
  font-weight: 700;
  color: var(--clr-success);
  background: rgba(16,185,129,0.08);
  border: 1px solid rgba(16,185,129,0.18);
  border-radius: 99px;
  padding: 2px 8px;
  margin-top: 3px;
  letter-spacing: 0.02em;
}

.card-metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid rgba(0,0,0,0.055);
  border-bottom: 1px solid rgba(0,0,0,0.055);
  background: rgba(245,245,249,0.65);
  gap: 0;
}
.card-metric {
  display: flex; flex-direction: column; align-items: center;
  padding: 10px 4px;
  text-align: center;
  background: transparent;
  border-right: 1px solid rgba(0,0,0,0.04);
}
.card-metric:last-child { border-right: none; }
.cm-value {
  font-size: 0.88rem; font-weight: 800;
  color: #09090B;
  font-family: var(--font-heading);
  letter-spacing: -0.02em; line-height: 1;
}
.cm-key {
  font-size: 0.61rem; font-weight: 700;
  color: #71717A;
  text-transform: uppercase; letter-spacing: 0.05em;
  margin-top: 3px;
}

.card-pricing-row {
  display: flex; align-items: center;
  padding: 12px 18px;
}
.cp-slot { flex: 1; }
.cp-label {
  font-size: 0.63rem; text-transform: uppercase;
  letter-spacing: 0.06em; font-weight: 700;
  color: #A1A1AA; margin-bottom: 2px;
}
.cp-val { font-size: 0.98rem; font-weight: 800; color: #09090B; letter-spacing: -0.02em; }
.cp-val strong { font-weight: 800; }
.cp-val em { font-style: normal; color: #A1A1AA; font-size: 0.83rem; font-weight: 400; }
.cp-divider { width: 1px; height: 26px; background: rgba(0,0,0,0.07); margin: 0 16px; flex-shrink: 0; }

.card-pub-status {
  padding: 6px 18px;
  font-size: 0.73rem;
  color: #71717A;
  border-top: 1px solid rgba(0,0,0,0.04);
}
.pub-dot { width: 7px; height: 7px; }
.pub-dot--online  { background: #10B981; box-shadow: 0 0 5px rgba(16,185,129,0.5); }
.pub-dot--away    { background: #F59E0B; box-shadow: 0 0 5px rgba(245,158,11,0.5); }
.pub-dot--offline { background: #D1D5DB; box-shadow: none; }

.gpb-card-actions {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 8px;
  padding: 11px 14px 15px;
  border-top: 1px solid rgba(0,0,0,0.05);
  margin-top: auto;
}
.gpb-card-actions .btn-sm {
  border-radius: 10px;
  font-size: 0.77rem;
  padding: 8px 10px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.gpb-card-actions .btn-primary { box-shadow: 0 4px 12px rgba(99,102,241,0.3); }
.gpb-card-actions .btn-outline {
  border-color: rgba(0,0,0,0.1);
  color: #3F3F46;
}
.gpb-card-actions .btn-outline:hover {
  background: #F4F4F6;
  color: #09090B;
  border-color: rgba(0,0,0,0.15);
  box-shadow: none;
  transform: none;
}

/* =============================================
   7. DASHBOARD OWNER-CARD EXTENSIONS
   .gpb-card--owner replaces the favourite slot with a status badge and adds
   an inline rejection-reason banner. Visuals otherwise inherit from above.
   ============================================= */
.gpb-card--owner .gpb-card-status-slot {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.gpb-card-reject {
  margin: 0 16px 12px;
  padding: 10px 12px;
  background: #FEF2F2;
  border-left: 3px solid var(--clr-danger);
  color: #991B1B;
  font-size: 0.85rem;
  border-radius: 6px;
  line-height: 1.45;
}
.gpb-card-reject strong { color: #7F1D1D; }

/* =============================================
   8. RESPONSIVE BREAKPOINTS
   ============================================= */
@media (min-width: 769px) and (max-width: 1024px) {
  .gpb-cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
}

@media (max-width: 768px) {
  .gpb-cards-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  /* Better spacing for mobile cards */
  .gpb-card {
    margin-bottom: 16px;
  }

  .gpb-card-actions {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .gpb-card-actions .btn {
    width: 100%;
    margin: 2px 0;
  }

  /* Mobile pricing display */
  .gpb-card-pricing {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }
}

@media (max-width: 600px) {
  .gpb-cards-grid {
    grid-template-columns: 1fr;
  }
  .gpb-card-metrics {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .niche-dropdown {
    min-width: 100px;
  }
  .niche-dropdown .card-niche-chip {
    font-size: 0.8rem;
    padding: 3px 8px;
  }
}

/* Very narrow phones (Galaxy A, iPhone SE) */
@media (max-width: 380px) {
  .gpb-card-metrics { grid-template-columns: repeat(2, 1fr); }
}

/* Accessibility: reduced motion */
@media (prefers-reduced-motion: reduce) {
  .gpb-card:hover {
    transform: none;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .gpb-card {
    border: 2px solid #000;
  }
}

/* Print styles */
@media print {
  .gpb-card-actions {
    display: none !important;
  }

  .gpb-card {
    break-inside: avoid;
    border: 1px solid #ccc;
    box-shadow: none;
  }
}
