/* ==========================================================================
   Kitgenix Document Manager – admin app styles
   Builds on top of the shared assets/css/kitgenix-admin-ui.css component
   library. Only plugin-specific layout and states live here.
   ========================================================================== */

/* ----------------------------------------------------------------
  Page app wrapper & generic layout helpers
----------------------------------------------------------------- */
#kitgenix-document-manager-admin-app {
  width: 100%;
  max-width: 1240px;
}

.kitgenix-grid {
  display: grid;
  gap: 24px;
  align-items: start;
}

.kitgenix-grid--2 {
  grid-template-columns: minmax(0, 380px) minmax(0, 1fr);
}

@media screen and (max-width: 960px) {
  .kitgenix-grid--2 {
    grid-template-columns: 1fr;
  }
}

.kitgenix-documents-sidebar {
  display: grid;
  gap: 16px;
  align-content: start;
  min-width: 0;
}

/* Small muted caption text used throughout (also created dynamically by
   admin.js, e.g. version-list empty state and bulk-upload file list). */
.kitgenix-muted {
  color: var(--kitgenix-text-muted);
  font-size: 12px;
  line-height: 1.6;
}

/* Inline code / placeholder token, e.g. the {slug} hint under the slug field. */
.kitgenix-code {
  display: inline-block;
  padding: 1px 6px;
  margin-left: 2px;
  border-radius: var(--kitgenix-radius-sm);
  background: var(--kitgenix-bg-light);
  border: 1px solid var(--kitgenix-border-subtle);
  font-family: monospace;
  font-size: 11px;
  color: var(--kitgenix-text-color);
}

/* ----------------------------------------------------------------
  Batch upload dropzone
----------------------------------------------------------------- */
.kitgenix-document-manager-bulk-upload-card .button {
  margin-bottom: 0;
}

.kitgenix-document-manager-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 140px;
  margin-bottom: 14px;
  padding: 18px;
  border: 2px dashed color-mix(in srgb, var(--kitgenix-brand) 28%, var(--kitgenix-border-color));
  border-radius: var(--kitgenix-radius-lg);
  background: color-mix(in srgb, var(--kitgenix-brand) 4%, var(--kitgenix-bg-light));
  text-align: center;
  cursor: pointer;
  transition: border-color var(--kitgenix-transition), background var(--kitgenix-transition), transform var(--kitgenix-transition);
}

.kitgenix-document-manager-dropzone:hover,
.kitgenix-document-manager-dropzone:focus {
  border-color: color-mix(in srgb, var(--kitgenix-brand) 55%, var(--kitgenix-border-color));
  background: color-mix(in srgb, var(--kitgenix-brand) 8%, var(--kitgenix-bg-light));
  transform: translateY(-1px);
}

.kitgenix-document-manager-dropzone:focus {
  outline: 2px solid color-mix(in srgb, var(--kitgenix-brand) 40%, transparent);
  outline-offset: 2px;
}

.kitgenix-document-manager-dropzone.is-dragover {
  border-color: var(--kitgenix-brand);
  background: var(--kitgenix-brand-light);
}

.kitgenix-document-manager-selected-files {
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid var(--kitgenix-border-color);
  border-radius: var(--kitgenix-radius-md);
  background: var(--kitgenix-bg-light);
}

.kitgenix-document-manager-selected-files__summary {
  margin: 0 0 8px;
  font-weight: 600;
  color: var(--kitgenix-text-color);
}

.kitgenix-document-manager-selected-files__list {
  margin: 0;
  padding-left: 18px;
}

.kitgenix-document-manager-selected-files__list li + li {
  margin-top: 4px;
}

/* ----------------------------------------------------------------
  Documents bulk-action toolbar
----------------------------------------------------------------- */
.kitgenix-document-manager-bulk-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.kitgenix-document-manager-bulk-toolbar__controls select,
.kitgenix-document-manager-bulk-toolbar__controls .button {
  margin: 0;
}

.kitgenix-document-manager-bulk-toolbar__status {
  min-height: 24px;
}

@media (max-width: 900px) {
  .kitgenix-document-manager-bulk-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .kitgenix-document-manager-bulk-toolbar__controls {
    flex-direction: column;
    align-items: stretch;
  }

  .kitgenix-document-manager-bulk-toolbar__controls select,
  .kitgenix-document-manager-bulk-toolbar__controls .button {
    width: 100%;
  }
}

/* ----------------------------------------------------------------
  Documents / categories / versions tables
----------------------------------------------------------------- */
.kitgenix-document-manager-table .kitgenix-col-select {
  width: 44px;
  text-align: center;
}

.kitgenix-document-manager-table td.kitgenix-col-select {
  vertical-align: middle;
}

.kitgenix-document-manager-table .kitgenix-col-actions {
  white-space: normal;
}

/* Row action links laid out as a wrapping, left-aligned inline group –
   used instead of .kitgenix-table-actions (which is icon-button, right
   aligned) because these rows use plain text action links. */
.kitgenix-table-actions-wrap {
  flex-wrap: wrap;
  justify-content: flex-start !important;
  gap: 4px 14px;
}

.kitgenix-table-actions-wrap a {
  white-space: nowrap;
}

/* ----------------------------------------------------------------
  Versions list (inside the document edit modal)
----------------------------------------------------------------- */
.kitgenix-versions-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.kitgenix-versions-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--kitgenix-border-color);
  border-radius: var(--kitgenix-radius-md);
  padding: 12px 16px;
  background: var(--kitgenix-bg-white);
  transition: background var(--kitgenix-transition), border-color var(--kitgenix-transition);
}

.kitgenix-versions-item:hover {
  background: var(--kitgenix-bg-light);
  border-color: color-mix(in srgb, var(--kitgenix-brand) 25%, var(--kitgenix-border-color));
}

.kitgenix-versions-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--kitgenix-text-color);
}

.kitgenix-versions-sub {
  margin-top: 2px;
}

.kitgenix-versions-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

/* ----------------------------------------------------------------
  Category badge / visibility pills (kept for any legacy output)
----------------------------------------------------------------- */
.kitgenix-doc-category {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--kitgenix-radius-pill);
  font-size: 11px;
  font-weight: 700;
  background: var(--kitgenix-brand-light);
  color: var(--kitgenix-brand);
  border: 1px solid color-mix(in srgb, var(--kitgenix-brand) 22%, transparent);
}

.kitgenix-visibility-public {
  background: var(--kitgenix-success-light);
  color: var(--kitgenix-success);
  border-color: var(--kitgenix-success-border);
}

.kitgenix-visibility-private {
  background: var(--kitgenix-warning-light);
  color: var(--kitgenix-warning);
  border-color: var(--kitgenix-warning-border);
}

/* ----------------------------------------------------------------
  Modal footer modifier: primary action on the right, a destructive
  "Delete" link pinned to the left – see the document/category modals.
----------------------------------------------------------------- */
.kitgenix-modal-footer-split {
  justify-content: space-between;
}

/* ----------------------------------------------------------------
  Frontend tab: button color grid & shortcode builder results
----------------------------------------------------------------- */
.kitgenix-document-manager-color-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  max-width: 480px;
}

.kitgenix-document-manager-sc-results {
  width: 100%;
  max-height: 220px;
  overflow: auto;
  padding: 10px 12px;
  border: 1px solid var(--kitgenix-border-color);
  border-radius: var(--kitgenix-radius-md);
  background: var(--kitgenix-bg-light);
}

/* ----------------------------------------------------------------
  Accessibility
----------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  #kitgenix-document-manager-admin-app * {
    transition: none !important;
  }
}

/* ----------------------------------------------------------------
  Document-edit screen metabox (post.php?post_type=kitgenix_document)
  Lives outside .kitgenix-admin-app – lightweight token-based polish only.
----------------------------------------------------------------- */
.kitgenix-metabox .kitgenix-field-row {
  margin: 0 0 10px;
}

.kitgenix-metabox .description {
  color: var(--kitgenix-text-muted, #64748B);
  font-size: 12px;
}

.kitgenix-document-manager-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.kitgenix-document-manager-stable-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
