/* Header & Action Bar */
.module-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  gap: 12px;
}

.module-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.5px;
}

.btn-primary {
  background: linear-gradient(135deg, #d4af37 0%, #aa820a 100%);
  color: #000;
  border: none;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.8px;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 4px 15px rgba(212, 175, 55, 0.2);
}

.btn-primary:active {
  transform: scale(0.96);
}

/* Quick Search & Status Segment Control */
.aff-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
  background: rgba(14, 16, 23, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 12px;
  border-radius: 14px;
  backdrop-filter: blur(10px);
}

.search-box-wrap {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
}

.search-icon-left {
  position: absolute;
  left: 12px;
  color: var(--muted);
  pointer-events: none;
  display: flex;
  align-items: center;
}

.search-input {
  width: 100%;
  padding: 10px 38px 10px 38px;
  background: #090a0f;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  color: #fff;
  font-size: 0.82rem;
  outline: none;
  transition: all 0.2s ease;
}

.search-input:focus {
  border-color: rgba(212, 175, 55, 0.4);
  background: #0d0f17;
  box-shadow: 0 0 14px rgba(212, 175, 55, 0.12);
}

.search-input::placeholder {
  color: #555b6e;
  font-size: 0.8rem;
}

.btn-clear-search {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  display: none;
  align-items: center;
  justify-content: center;
}

.btn-clear-search:hover {
  color: #fff;
}

/* Status Segmented Tabs */
.filter-pills-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  background: #090a0f;
  padding: 4px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.filter-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px 4px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  letter-spacing: 0.3px;
  text-transform: capitalize;
}

.filter-pill .pill-count {
  font-size: 0.65rem;
  padding: 1px 5px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-weight: 800;
}

.filter-pill.active {
  background: #171a24;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.filter-pill[data-filter="all"].active {
  border-color: rgba(212, 175, 55, 0.35);
  color: var(--gold-glow);
}

.filter-pill[data-filter="all"].active .pill-count {
  background: rgba(212, 175, 55, 0.2);
  color: var(--gold-glow);
}

.filter-pill[data-filter="active"].active {
  border-color: rgba(16, 185, 129, 0.35);
  color: #34d399;
}

.filter-pill[data-filter="active"].active .pill-count {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.filter-pill[data-filter="pending"].active {
  border-color: rgba(245, 158, 11, 0.35);
  color: #fbbf24;
}

.filter-pill[data-filter="pending"].active .pill-count {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
}

.filter-pill[data-filter="inactive"].active {
  border-color: rgba(239, 68, 68, 0.35);
  color: #f87171;
}

.filter-pill[data-filter="inactive"].active .pill-count {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

/* Card List Layout */
.affiliate-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.aff-card {
  background: linear-gradient(145deg, #131620 0%, #0c0e14 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  position: relative;
  overflow: hidden;
  text-align: left;
}

.aff-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: var(--gold);
}

.aff-card.inactive::before {
  background: var(--muted);
}

.aff-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
}

.aff-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  gap: 4px;
  flex: 1;
}

.aff-name {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
  text-align: left;
  margin: 0;
}

.aff-tags {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}

.aff-code {
  font-family: monospace, monospace;
  font-size: 0.72rem;
  color: var(--gold-glow);
  background: rgba(212, 175, 55, 0.1);
  border: 1px solid rgba(212, 175, 55, 0.25);
  padding: 2px 7px;
  border-radius: 6px;
  letter-spacing: 0.5px;
}

.aff-rate-badge {
  font-size: 0.7rem;
  font-weight: 700;
  color: #34d399;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 2px 7px;
  border-radius: 6px;
}

/* Metadata Stack */
.aff-details-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(0, 0, 0, 0.35);
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.aff-detail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  gap: 12px;
}

.aff-detail-label {
  color: var(--muted);
  font-size: 0.7rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.aff-detail-val {
  color: #f3f4f6;
  font-weight: 500;
  text-align: right;
  word-break: break-all;
}

/* Actions Row */
.aff-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-action {
  flex: 1;
  min-width: 80px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text);
  border-radius: 8px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s ease;
}

.btn-action.stats {
  border-color: rgba(212, 175, 55, 0.3);
  color: var(--gold-glow);
  background: rgba(212, 175, 55, 0.05);
}

.btn-action.edit {
  border-color: rgba(59, 130, 246, 0.3);
  color: #60a5fa;
  background: rgba(59, 130, 246, 0.05);
}

.btn-action.invite {
  border-color: rgba(245, 158, 11, 0.3);
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.05);
}

.btn-action.toggle-inactive {
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.25);
  background: rgba(239, 68, 68, 0.04);
}

.btn-action.toggle-active {
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.25);
  background: rgba(16, 185, 129, 0.04);
}

.badge-status {
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.badge-active {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.badge-inactive {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.badge-pending {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.25);
}

/* Modals & Bottom Drawer */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(6px);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.open {
  display: flex;
}

.modal-box {
  background: #12141c;
  border: 1px solid var(--border-gold);
  border-radius: 16px;
  width: 100%;
  max-width: 440px;
  padding: 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.9);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--gold);
  letter-spacing: 0.5px;
  margin-bottom: 18px;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 0.68rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
  margin-bottom: 6px;
}

.form-group input {
  width: 100%;
  padding: 11px 12px;
  background: #090a0f;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: #fff;
  font-size: 0.85rem;
  outline: none;
}

.form-group input:focus {
  border-color: var(--gold);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

/* Drill-Down Statistics HUD inside Drawer */
.stats-hud-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.stat-metric-tile {
  background: #090a0f;
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 12px;
  border-radius: 10px;
}

.stat-metric-label {
  font-size: 0.65rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 700;
}

.stat-metric-val {
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
  margin-top: 4px;
}
