/* ── Kansleri Cookie Consent Admin ── */

.kncc-wrap {
  max-width: 900px;
}

.kncc-tabs {
  margin-bottom: 1.5rem;
}

/* Status label */

.kncc-status-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 1rem;
}

.kncc-status-label .dashicons {
  font-size: 18px;
  width: 18px;
  height: 18px;
}

.kncc-status-label--good {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.kncc-status-label--good .dashicons {
  color: #059669;
}

.kncc-status-label--error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.kncc-status-label--error .dashicons {
  color: #dc2626;
}

.kncc-status-label__sub {
  color: #6b7280;
  font-weight: 400;
}

.kncc-notice {
  padding: 10px 14px;
  border-radius: 4px;
  margin: 0 0 1rem;
  font-size: 14px;
}

.kncc-notice--success {
  background: #d1fae5;
  color: #065f46;
  border-left: 4px solid #10b981;
}

.kncc-notice--error {
  background: #fee2e2;
  color: #991b1b;
  border-left: 4px solid #ef4444;
}

.kncc-blocking-guide {
  margin-top: 12px;
  padding: 12px 14px;
  background: #f6f7f7;
  border: 1px solid #dcdcde;
  border-radius: 4px;
  max-width: 640px;
}

.kncc-blocking-guide ul {
  margin: 8px 0 8px 1.2em;
  list-style: disc;
}

.kncc-blocking-guide li {
  margin-bottom: 4px;
}

/* Cookies tab */

.kncc-cookies-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.kncc-cookie-table input[type="text"] {
  width: 100%;
  min-width: 60px;
}

.kncc-cookie-table select {
  width: 100%;
}

.kncc-remove-cookie {
  color: #dc2626 !important;
  font-size: 18px;
  font-weight: bold;
  border: none !important;
  background: none !important;
  cursor: pointer;
  padding: 4px 8px !important;
}

.kncc-remove-cookie:hover {
  color: #991b1b !important;
}

.kncc-no-cookies td {
  text-align: center;
  padding: 2rem;
  color: #6b7280;
  font-style: italic;
}

/* Scan results */

.kncc-scan-results {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.kncc-scan-results h4 {
  margin: 0 0 0.75rem;
}

.kncc-scan-results code {
  background: #e5e7eb;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 13px;
}

/* Scan result groups */

.kncc-scan-group {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  margin-bottom: 0.75rem;
  overflow: hidden;
}

.kncc-scan-group__header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #f3f4f6;
  border-bottom: 1px solid #e5e7eb;
}

.kncc-scan-group__header strong {
  font-size: 14px;
}

.kncc-scan-group__count {
  color: #6b7280;
  font-size: 13px;
}

.kncc-scan-group__header .button {
  margin-left: auto;
}

.kncc-scan-group__table {
  width: 100%;
  border-collapse: collapse;
}

.kncc-scan-group__table td {
  padding: 6px 14px;
  border-top: 1px solid #f3f4f6;
  font-size: 13px;
  vertical-align: middle;
}

.kncc-scan-group__table tr:first-child td {
  border-top: none;
}

.kncc-scan-cat {
  white-space: nowrap;
  text-transform: capitalize;
  font-weight: 500;
  font-size: 12px;
}

.kncc-scan-cat--analytics { color: #2563eb; }
.kncc-scan-cat--marketing { color: #dc2626; }
.kncc-scan-cat--necessary { color: #059669; }
.kncc-scan-cat--preferences { color: #7c3aed; }

.kncc-scan-desc {
  color: #6b7280;
}

.kncc-scan-group__table td:last-child {
  text-align: right;
  white-space: nowrap;
}

.kncc-scan-auto {
  margin-bottom: 1rem;
}

.kncc-scan-group--auto {
  opacity: 0.85;
}

.kncc-scan-group--auto .kncc-scan-group__header {
  background: #ecfdf5;
  border-bottom-color: #a7f3d0;
}

.kncc-scan-alldone {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 6px;
  padding: 12px 16px;
  color: #065f46;
  font-weight: 600;
  font-size: 14px;
  margin-top: 0.75rem;
}

.kncc-scan-unknown {
  margin-bottom: 0.5rem;
}

.kncc-scan-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid #d1d5db;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: kncc-spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

@keyframes kncc-spin {
  to { transform: rotate(360deg); }
}

/* Code preview */

.kncc-code-preview {
  margin-top: 1.5rem;
  background: #1e293b;
  border-radius: 8px;
  padding: 1.25rem;
}

.kncc-code-preview h3 {
  color: #94a3b8;
  font-size: 13px;
  margin: 0 0 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.kncc-code-preview pre {
  margin: 0;
  overflow-x: auto;
}

.kncc-code-preview code {
  color: #e2e8f0;
  font-size: 13px;
  line-height: 1.6;
  background: none;
}

/* Documentations tab */

.kncc-docs {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
}

.kncc-docs h2 {
  margin-top: 0;
}

.kncc-docs h3 {
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
}

.kncc-docs ul,
.kncc-docs ol {
  margin-top: 0.35rem;
}

/* AI helper panel */

.kncc-ai-helper {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin: 1rem 0;
}

.kncc-ai-helper h4 {
  margin: 0 0 0.5rem;
  color: #1e40af;
  font-size: 14px;
}

.kncc-ai-helper__steps {
  margin: 0 0 0.75rem;
  padding-left: 1.5rem;
  color: #1e3a5f;
  font-size: 13px;
  line-height: 1.7;
}

.kncc-ai-helper__steps li {
  margin-bottom: 0.15rem;
}

.kncc-import-json-area {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #bfdbfe;
}

.kncc-import-json-area label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 13px;
  color: #1e3a5f;
}

.kncc-import-json-area textarea {
  font-family: monospace;
  font-size: 12px;
  margin-bottom: 0.5rem;
}

/* Integration status badges */

.kncc-integrations-status {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 1rem;
}

.kncc-integration-badge {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 13px;
}

.kncc-integration-badge .dashicons {
  font-size: 20px;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  flex-shrink: 0;
}

.kncc-integration-badge strong {
  font-size: 14px;
}

.kncc-integration-badge--active {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
}

.kncc-integration-badge--active .dashicons {
  color: #059669;
}

.kncc-integration-badge--inactive {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
}

.kncc-integration-badge--inactive .dashicons {
  color: #9ca3af;
}

.kncc-integration-detail {
  color: #6b7280;
  font-size: 12px;
}

/* Statistics tab */

.kncc-stats {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
}

.kncc-stats__period {
  display: flex;
  gap: 6px;
  margin-bottom: 1.25rem;
}

.kncc-stats__cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 1.5rem;
}

.kncc-stats__card {
  border-radius: 8px;
  padding: 16px;
  text-align: center;
}

.kncc-stats__card--total {
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
}

.kncc-stats__card--accept {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
}

.kncc-stats__card--reject {
  background: #fef2f2;
  border: 1px solid #fecaca;
}

.kncc-stats__card--custom {
  background: #fffbeb;
  border: 1px solid #fde68a;
}

.kncc-stats__card-value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 4px;
}

.kncc-stats__card--total .kncc-stats__card-value { color: #374151; }
.kncc-stats__card--accept .kncc-stats__card-value { color: #059669; }
.kncc-stats__card--reject .kncc-stats__card-value { color: #dc2626; }
.kncc-stats__card--custom .kncc-stats__card-value { color: #d97706; }

.kncc-stats__card-label {
  font-size: 12px;
  color: #6b7280;
  font-weight: 500;
}

.kncc-stats__pct {
  font-weight: 600;
  color: #374151;
}

.kncc-stats__bar {
  display: flex;
  height: 32px;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 8px;
}

.kncc-stats__bar-seg {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  min-width: 28px;
  transition: width 0.3s ease;
}

.kncc-stats__bar-seg--accept { background: #10b981; }
.kncc-stats__bar-seg--reject { background: #ef4444; }
.kncc-stats__bar-seg--custom { background: #f59e0b; }

.kncc-stats__legend {
  display: flex;
  gap: 18px;
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 1.5rem;
}

.kncc-stats__legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.kncc-stats__dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.kncc-stats__dot--accept { background: #10b981; }
.kncc-stats__dot--reject { background: #ef4444; }
.kncc-stats__dot--custom { background: #f59e0b; }

.kncc-stats h3 {
  margin-top: 0;
  margin-bottom: 0.75rem;
}

.kncc-stats__empty {
  text-align: center;
  color: #9ca3af;
  font-style: italic;
  padding: 2rem 0;
}

/* Consent Log */

.kncc-consent-log-meta {
  flex-wrap: wrap;
}

@media (max-width: 782px) {
  .kncc-stats__cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ── Color picker grid (General tab) ── */

.kncc-color-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px 18px;
  max-width: 720px;
  margin-bottom: 6px;
}

.kncc-color-grid__item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.kncc-color-grid__label {
  display: block;
  font-size: 12px;
  color: #50575e;
  font-weight: 500;
  line-height: 1.4;
  margin-bottom: 2px;
}

/* ── Banner preview (in-place, non-blocking) ── */

.kncc-preview-toolbar {
  margin: 0 0 1.25rem;
  padding: 12px 14px;
  background: #f0f6fc;
  border-left: 4px solid #2563eb;
  border-radius: 2px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.kncc-preview-toolbar .description {
  margin: 0;
  flex: 1;
  min-width: 200px;
}

#kncc-preview-host {
  /* Host is a passthrough — the banner inside positions itself like the frontend. */
}

/* Per-variant positioning. The .kncc-banner--preview modifier scopes these to the admin
   preview only so the actual frontend banner is unaffected. z-index sits above admin
   content but below WordPress core admin notices/tooltips. */
.kncc-banner.kncc-banner--preview {
  z-index: 100000;
}

.kncc-banner--preview.kncc-banner--bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
}

.kncc-banner--preview.kncc-banner--modal {
  position: fixed;
  inset: auto;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: calc(100% - 48px);
  max-width: 560px;
  display: block;
  padding: 0;
}

.kncc-banner--preview.kncc-banner--modal .kncc-inner {
  margin: 0;
}

.kncc-banner--preview.kncc-banner--corner {
  position: fixed;
  bottom: 1rem;
  left: 1rem;
  max-width: 400px;
  width: calc(100% - 2rem);
}

/* Hide the native checkbox in the preview — WP admin's default input[type="checkbox"] styles
   would otherwise leak through and show a checkmark next to the custom toggle UI. */
.kncc-banner--preview .kncc-category__check {
  position: absolute !important;
  opacity: 0 !important;
  width: 0 !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  -webkit-appearance: none !important;
  appearance: none !important;
}

/* Small close button anchored to the banner's top-right corner. */
.kncc-preview-close {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  /* Track the body text color picker so the close icon stays visually consistent
     with the rest of the banner copy as the admin tunes their palette. */
  color: var(--kncc-body, #6b7280);
  border-radius: 4px;
  z-index: 2;
}

.kncc-preview-close:hover {
  background: rgba(0, 0, 0, 0.06);
  color: #1d2327;
}
