/**
 * BrandProtector plugin overrides for JBS Productions - Dark.
 * Loaded after the theme styles and the plugin frontend styles.
 */

/* Slightly wider canvases so the dashboard tables fit without clipping. */
.jb-wrap {
  max-width: 1280px;
}

.jb-wrap--full {
  max-width: 1500px;
}

/* =========================================================
   Dashboard left navigation
   ========================================================= */
.jb-layout.jb-layout--left {
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 28px;
}

.jb-left-nav,
.jb-left-nav__menu,
.jb-left-nav__widgets {
  width: 100%;
}

.jb-left-nav {
  position: sticky;
  top: calc(var(--jbsp-banner-h, 0px) + var(--jb-adminbar, 0px) + 88px);
  align-self: start;
  display: grid;
  gap: 18px;
}

.jb-left-menu,
.jb-left-menu ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.jb-left-menu {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  width: 100%;
}

.jb-left-menu > li {
  margin: 0;
  width: 100%;
}

.jb-left-menu > li > a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  box-sizing: border-box;
  padding: 10px 14px;
  background: var(--jb-surface-2);
  border: 1px solid var(--jb-border);
  border-radius: 8px;
  color: var(--jb-text);
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  transition: background var(--jb-transition), border-color var(--jb-transition), color var(--jb-transition);
}

.jb-left-menu > li > a:hover {
  background: var(--jb-surface-3);
  border-color: var(--jb-border-strong);
  color: #fff;
}

.jb-left-menu > li.current-menu-item > a,
.jb-left-menu > li.current_page_item > a,
.jb-left-menu > li > a.is-current {
  background: #4ade80;
  border-color: #4ade80;
  color: #052e16;
}

/* Custom Menu widgets in the left column get the same pill treatment. */
.jb-left-nav .widget {
  width: 100%;
}

.jb-left-nav .widget-title {
  display: none;
}

.jb-left-nav .widget .menu,
.jb-left-nav .widget ul.menu {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

.jb-left-nav .widget .menu li {
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
}

.jb-left-nav .widget .menu a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  box-sizing: border-box;
  padding: 10px 14px;
  background: var(--jb-surface-2);
  border: 1px solid var(--jb-border);
  border-radius: 8px;
  color: var(--jb-text) !important;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
}

.jb-left-nav .widget .menu a:hover {
  background: var(--jb-surface-3);
  border-color: var(--jb-border-strong);
  color: #fff !important;
}

.jb-left-nav .widget .menu .current-menu-item > a,
.jb-left-nav .widget .menu .current_page_item > a {
  background: #4ade80 !important;
  border-color: #4ade80 !important;
  color: #052e16 !important;
}

/* Dashboard widgets often use theme .button / block navigation instead of a menu. */
.jb-left-nav .widget .button,
.jb-left-nav .widget .bp-button,
.jb-left-nav .widget .wp-block-button__link,
.jb-left-nav .widget .wp-block-navigation-item,
.jb-left-nav .widget .wp-block-navigation-item__content {
  width: 100%;
  box-sizing: border-box;
}

.jb-left-nav .widget .button,
.jb-left-nav .widget .bp-button,
.jb-left-nav .widget .wp-block-button__link,
.jb-left-nav .widget .wp-block-navigation-item__content {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
}

.jb-left-nav .widget .wp-block-navigation__container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

.jb-left-nav .widget a[aria-current="page"],
.jb-left-nav .widget a.is-current,
.jb-left-nav .widget .bp-button.is-current,
.jb-left-nav .widget .button.is-current,
.jb-left-nav .widget .menu a.is-current {
  background: #4ade80 !important;
  border-color: #4ade80 !important;
  color: #052e16 !important;
}

.jb-left-menu .sub-menu {
  margin: 6px 0 0 10px;
  display: grid;
  gap: 4px;
}

.jb-left-menu .sub-menu a {
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--jb-text-muted);
  font-size: 0.78rem;
}

.jb-left-menu .sub-menu a:hover {
  color: #fff;
  background: var(--jb-surface-3);
}

.jb-left-nav .widget {
  padding: 14px;
}

@media (max-width: 960px) {
  .jb-layout.jb-layout--left {
    grid-template-columns: minmax(0, 1fr);
  }

  .jb-left-nav {
    position: static;
  }

  .jb-left-menu {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .jb-left-menu > li > a {
    padding: 8px 12px;
  }
}

/* =========================================================
   BP cards
   ========================================================= */
.bp-wallet-balance,
.bp-brands-list,
.bp-brand-form,
.bp-run-scan,
.bp-scan-runs-table,
.bp-findings-table,
.bp-packs-generator,
.bp-account-panel {
  max-width: 100%;
  box-sizing: border-box;
  padding: 1.5rem !important;
  background: #ffffff !important;
  border: 1px solid #e6ebe8;
  border-radius: 12px !important;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18) !important;
}

.bp-wallet-balance h1,
.bp-wallet-balance h2,
.bp-wallet-balance h3,
.bp-brands-list h1,
.bp-brands-list h2,
.bp-brands-list h3,
.bp-brand-form h1,
.bp-brand-form h2,
.bp-brand-form h3,
.bp-run-scan h1,
.bp-run-scan h2,
.bp-run-scan h3,
.bp-scan-runs-table h1,
.bp-scan-runs-table h2,
.bp-scan-runs-table h3,
.bp-findings-table h1,
.bp-findings-table h2,
.bp-findings-table h3,
.bp-packs-generator h1,
.bp-packs-generator h2,
.bp-packs-generator h3,
.bp-account-panel h1,
.bp-account-panel h2,
.bp-account-panel h3,
.bp-table-header h3,
.bp-scan-info h3 {
  color: #17201b !important;
}

/* =========================================================
   Buttons
   ========================================================= */
.bp-button,
.bp-button-primary {
  background: var(--jb-accent) !important;
  border: 1px solid var(--jb-accent) !important;
  color: #04170c !important;
  border-radius: 8px !important;
  box-shadow: 0 6px 16px rgba(10, 191, 83, 0.18);
  font-weight: 700;
  text-shadow: none;
}

.bp-button:hover,
.bp-button-primary:hover {
  background: var(--jb-accent-dark) !important;
  border-color: var(--jb-accent-dark) !important;
  color: #fff !important;
}

.bp-button:disabled,
.bp-button:disabled:hover {
  background: #d7ded9 !important;
  border-color: #d7ded9 !important;
  color: #6b7280 !important;
  box-shadow: none;
}

.bp-button-secondary {
  background: #2d3330 !important;
  border-color: #2d3330 !important;
  color: #fff !important;
}

.bp-button-secondary:hover {
  background: #1f2422 !important;
  border-color: #1f2422 !important;
  color: #fff !important;
}

.bp-button-small {
  background: var(--jb-accent) !important;
  border: 1px solid var(--jb-accent) !important;
  border-radius: 7px !important;
  color: #04170c !important;
  font-size: 0.8rem;
  font-weight: 700;
  height: auto !important;
  line-height: 1.2 !important;
  padding: 6px 10px !important;
}

.bp-button-small:hover {
  background: var(--jb-accent-dark) !important;
  border-color: var(--jb-accent-dark) !important;
  color: #fff !important;
}

.bp-button-delete {
  background: var(--jb-red) !important;
  border-color: var(--jb-red) !important;
  color: #fff !important;
}

/* =========================================================
   Inputs / selects
   ========================================================= */
.bp-run-scan select,
.bp-brand-form input[type="text"],
.bp-brand-form input[type="url"],
.bp-brand-form input[type="email"],
.bp-brand-form select,
.bp-brand-form textarea,
.bp-table-filters select,
.bp-bulk-controls select,
.bp-run-bulk select,
.bp-finding-action,
.bp-packs-generator select,
.bp-packs-generator input,
.bp-account-panel select,
.bp-account-panel input,
.bp-topup-modal select,
.bp-topup-modal input {
  background: #ffffff !important;
  border: 1px solid #d6ded9 !important;
  border-radius: 7px !important;
  color: #111827 !important;
  box-sizing: border-box;
}

.bp-run-scan select option,
.bp-brand-form select option,
.bp-table-filters select option,
.bp-bulk-controls select option,
.bp-run-bulk select option,
.bp-finding-action option,
.bp-packs-generator select option {
  background: #fff;
  color: #111827;
}

.bp-run-scan select:focus,
.bp-brand-form input:focus,
.bp-brand-form select:focus,
.bp-brand-form textarea:focus,
.bp-table-filters select:focus,
.bp-bulk-controls select:focus,
.bp-run-bulk select:focus,
.bp-finding-action:focus,
.bp-packs-generator select:focus {
  border-color: var(--jb-accent) !important;
  box-shadow: 0 0 0 3px rgba(10, 191, 83, 0.14) !important;
  outline: none !important;
}

.bp-run-scan input[type="checkbox"],
.bp-findings-table input[type="checkbox"] {
  accent-color: var(--jb-accent);
}

/* =========================================================
   Tables
   ========================================================= */
.bp-table-content {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.bp-table {
  width: 100%;
  min-width: 0;
  background: #fff !important;
  border-collapse: collapse;
}

.bp-finding-url {
  display: inline-block;
  max-width: 340px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.bp-finding-action {
  width: 100%;
  min-width: 110px;
}

.bp-table th:last-child,
.bp-table td:last-child {
  min-width: 150px;
  white-space: nowrap;
}

.bp-table th {
  background: #f4f7f5 !important;
  border-bottom: 1px solid #dfe7e2 !important;
  color: #1f2937 !important;
  font-weight: 600;
  white-space: nowrap;
}

.bp-table td {
  background: #fff !important;
  border-bottom: 1px solid #eef1ef !important;
  color: #374151 !important;
}

.bp-table tr:hover td {
  background: #f8fbf9 !important;
}

.bp-findings-table a,
.bp-scan-results a {
  color: var(--jb-accent-dark) !important;
}

.bp-findings-table a:hover,
.bp-scan-results a:hover {
  color: var(--jb-accent) !important;
}

/* =========================================================
   Filters, badges and selected states
   ========================================================= */
.bp-table-header {
  flex-wrap: wrap;
  gap: 12px;
}

.bp-table-filters {
  flex-wrap: wrap;
}

.bp-table-filters select {
  min-width: 160px;
}

.bp-status {
  border-radius: 5px;
  font-size: 0.8rem;
  font-weight: 600;
}

.bp-status-new {
  background: #fff4e5 !important;
  color: #a85f00 !important;
}

.bp-status-completed,
.bp-status-google_delisted {
  background: var(--jb-accent-soft) !important;
  color: var(--jb-accent-dark) !important;
}

.bp-status-running {
  background: #e8f5e9 !important;
  color: var(--jb-accent-dark) !important;
}

.bp-brand-item a {
  background: #fff !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 8px !important;
  color: #17201b !important;
  padding: 12px 14px !important;
}

.bp-brand-item a:hover {
  background: #f8fbf9 !important;
  border-color: var(--jb-accent) !important;
}

.bp-brand-item.bp-current a {
  background: var(--jb-accent-soft) !important;
  border-color: var(--jb-accent) !important;
  border-left: 4px solid var(--jb-accent) !important;
  color: #17201b !important;
}

.bp-brand-item.bp-current a .bp-brand-name {
  color: #17201b !important;
}

.bp-brand-selected {
  background: var(--jb-accent) !important;
  color: #04170c !important;
}

.bp-approval-approved {
  background: var(--jb-accent-soft) !important;
  color: var(--jb-accent-dark) !important;
}

.bp-stat-value {
  color: var(--jb-accent-dark) !important;
}

.bp-nav-link {
  background: #fff !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 8px !important;
  color: #17201b !important;
}

.bp-nav-link:hover {
  background: var(--jb-accent-soft) !important;
  border-color: var(--jb-accent) !important;
}

.bp-scan-result-title {
  color: #17201b !important;
}

.bp-scan-result-meta {
  color: #6b7280 !important;
}

.bp-scan-results-hidden {
  margin-left: 10px;
  color: #6b7280;
  font-size: 0.78rem;
  font-weight: 500;
}

.bp-scan-result-url a {
  display: block;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* =========================================================
   Scan history inline run details
   ========================================================= */
.bp-run-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.bp-run-details > td {
  background: #f8fbf9 !important;
  padding: 0 !important;
}

.bp-run-details-inner {
  max-width: 100%;
  overflow-x: hidden;
  padding: 14px 16px 16px;
}

.bp-run-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-bottom: 10px;
  color: #4b5563;
  font-size: 0.85rem;
}

.bp-run-summary strong {
  color: #111827;
}

.bp-run-findings {
  list-style: none;
  min-width: 0;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.bp-run-finding {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 8px 10px;
}

.bp-run-finding a {
  color: var(--jb-accent-dark) !important;
  overflow-wrap: anywhere;
}

.bp-run-finding-meta {
  margin-top: 4px;
  color: #6b7280;
  font-size: 0.8rem;
}

.bp-run-empty {
  margin: 0;
  color: #6b7280;
  font-size: 0.85rem;
}

.bp-run-actions .bp-button-small {
  white-space: nowrap;
}

/* =========================================================
   Findings pagination and bulk selection
   ========================================================= */
.bp-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 14px;
}

.bp-page-info {
  color: #4b5563;
  font-size: 0.85rem;
}

.bp-pagination .bp-button-small:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.bp-bulk-controls select[data-bulk-platform] {
  min-width: 150px;
}

.bp-run-bulk {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.bp-run-bulk select {
  width: auto;
  min-width: 140px;
}

.bp-run-select-all {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #374151;
  font-size: 0.82rem;
}

.bp-run-finding {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  min-width: 0;
  max-width: 100%;
}

.bp-run-finding-checkbox {
  margin-top: 5px;
}

.bp-run-finding-body {
  flex: 1;
  min-width: 0;
  max-width: 100%;
}

.bp-run-finding-body > a {
  display: block;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.bp-run-finding-meta {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.bp-run-finding-body .bp-finding-actions {
  margin-top: 6px;
}

.bp-finding-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.bp-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: #f3f4f6;
  color: #374151;
  cursor: pointer;
  line-height: 1;
  transition: filter var(--jb-transition), transform var(--jb-transition);
}

.bp-icon-btn svg {
  display: block;
  width: 16px;
  height: 16px;
}

.bp-icon-btn:hover {
  filter: brightness(0.96);
  transform: translateY(-1px);
}

.bp-icon-btn:disabled {
  opacity: 0.5;
  cursor: wait;
  transform: none;
}

.bp-icon-confirm {
  background: #dcfce7;
  border-color: #bbf7d0;
  color: #15803d;
}

.bp-icon-reject {
  background: #fee2e2;
  border-color: #fecaca;
  color: #b91c1c;
}

.bp-icon-delist {
  background: #dbeafe;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

.bp-icon-takedown {
  background: #fef3c7;
  border-color: #fde68a;
  color: #92400e;
}

.bp-icon-removed {
  background: #e5e7eb;
  border-color: #d1d5db;
  color: #374151;
}

/* =========================================================
   Takedown pack modal
   ========================================================= */
.bp-pack-modal {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.7);
}

.bp-pack-modal.is-open {
  display: flex;
}

.bp-pack-modal-dialog {
  display: flex;
  flex-direction: column;
  width: min(760px, 100%);
  max-height: 85vh;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
}

.bp-pack-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
}

.bp-pack-modal-header h3 {
  margin: 0;
  color: #111827;
}

.bp-pack-modal-close {
  padding: 0 4px;
  background: transparent !important;
  border: 0 !important;
  color: #6b7280 !important;
  font-size: 1.5rem;
  line-height: 1;
}

.bp-pack-modal .bp-pack-content {
  flex: 1;
  overflow: auto;
  margin: 0;
  padding: 16px 20px;
  background: #f8faf9;
  color: #111827;
  font-size: 0.82rem;
  white-space: pre-wrap;
}

.bp-pack-modal .bp-pack-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid #e5e7eb;
}

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 782px) {
  .bp-wallet-balance,
  .bp-brands-list,
  .bp-brand-form,
  .bp-run-scan,
  .bp-scan-runs-table,
  .bp-findings-table,
  .bp-packs-generator,
  .bp-account-panel {
    border-radius: 10px !important;
    padding: 1.25rem !important;
  }

  .bp-table {
    min-width: 680px;
  }

  .bp-table-filters {
    width: 100%;
  }

  .bp-table-filters select {
    min-width: 0;
    width: 100%;
  }
}
