/* PIDON Publisher Pro 41.1 – panel publikacji (frontend). Korzysta z UIkit motywu YOOtheme. */

.pidon-dashboard,
.pidon-form-card {
  --pidon-accent: #e07a5f;
  --pidon-ink: #1f2937;
  --pidon-muted: #6b7280;
  --pidon-border: #e5e7eb;
  --pidon-soft: #f8fafc;
  --pidon-danger: #dc2626;
  color: var(--pidon-ink);
}

.pidon-card {
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 10px 30px -14px rgba(15, 23, 42, .18);
}

.pidon-sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.pidon-muted {
  color: var(--pidon-muted);
}

.pidon-alert {
  border-radius: 10px;
}

/* ===== Nagłówek panelu ===== */

.pidon-head {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.pidon-avatar {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
}

.pidon-head-text {
  flex: 1;
  min-width: 180px;
}

.pidon-title {
  margin: 0;
  font-size: 1.5rem;
  line-height: 1.25;
}

.pidon-subtitle {
  margin: 2px 0 0;
  color: var(--pidon-muted);
}

.pidon-head-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ===== Dane organizacji ===== */

.pidon-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px 24px;
  margin: 20px 0 0;
  padding: 16px 0 0;
  border-top: 1px solid var(--pidon-border);
}

.pidon-facts dt {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--pidon-muted);
}

.pidon-facts dd {
  margin: 2px 0 0;
  font-weight: 600;
  word-break: break-word;
}

/* ===== Liczniki i kategorie ===== */

.pidon-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 20px;
}

.pidon-stat {
  padding: 14px 16px;
  border: 1px solid var(--pidon-border);
  border-radius: 10px;
  background: var(--pidon-soft);
}

.pidon-stat strong {
  display: block;
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--pidon-ink);
}

.pidon-stat span {
  font-size: 13px;
  color: var(--pidon-muted);
}

.pidon-cats {
  margin-top: 14px;
}

.pidon-cats summary {
  cursor: pointer;
  font-size: 14px;
  color: var(--pidon-muted);
}

.pidon-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.pidon-chip {
  padding: 4px 10px;
  border: 1px solid var(--pidon-border);
  border-radius: 999px;
  background: #f1f5f9;
  color: #334155;
  font-size: 13px;
  font-weight: 500;
}

/* ===== Lista wpisów ===== */

.pidon-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.pidon-section-title {
  margin: 0;
  font-size: 1.25rem;
}

.pidon-count {
  display: inline-block;
  color: #334155;
  min-width: 22px;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  background: #f1f5f9;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  vertical-align: middle;
}

.pidon-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.pidon-filters .uk-input {
  flex: 1 1 220px;
  width: auto;
}

.pidon-filters .uk-select {
  flex: 0 1 240px;
  width: auto;
}

.pidon-link-muted {
  font-size: 14px;
  color: var(--pidon-muted);
}

.pidon-table .pidon-post-title {
  font-weight: 600;
}

.pidon-label {
  margin-left: 6px;
  font-size: 11px;
  vertical-align: middle;
}

.pidon-actions .uk-button + .uk-button {
  margin-left: 4px;
}

.pidon-btn-danger {
  color: var(--pidon-danger) !important;
  border: 1px solid #fecaca !important;
  background: #fff !important;
}

.pidon-btn-danger:hover {
  background: #fef2f2 !important;
}

.pidon-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
}

.pidon-empty {
  padding: 32px 16px;
  text-align: center;
  border: 1px dashed var(--pidon-border);
  border-radius: 10px;
  background: var(--pidon-soft);
}

.pidon-empty p {
  margin: 0 0 8px;
}

/* ===== Formularz ===== */

.pidon-editing {
  margin: 4px 0 0;
}

.pidon-req {
  color: var(--pidon-accent);
}

.pidon-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 20px;
}

.pidon-field {
  margin-bottom: 20px;
}

.pidon-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 6px;
  font-size: 13px;
  color: var(--pidon-muted);
}

.pidon-counter {
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.pidon-counter.is-over {
  color: var(--pidon-danger);
  font-weight: 600;
}

.pidon-error {
  margin-top: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--pidon-danger);
}

.pidon-error:empty {
  display: none;
}

.pidon-field.has-error .uk-input,
.pidon-field.has-error .uk-select {
  border-color: var(--pidon-danger);
}

.pidon-field.has-error .wp-editor-wrap {
  outline: 1px solid var(--pidon-danger);
}

.pidon-terms {
  padding: 14px 16px;
  border-radius: 10px;
  background: var(--pidon-soft);
}

.pidon-terms label {
  font-size: 14px;
}

.pidon-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

.pidon-submit[disabled] {
  opacity: .7;
  cursor: progress;
}

/* Edytor WordPressa – motyw potrafi ukrywać pasek narzędzi */
.pidon-form .mce-toolbar-grp { display: block !important; visibility: visible !important; background: #f0f0f0 !important; border-bottom: 1px solid #ccc !important; }
.pidon-form .mce-container-body { display: block !important; }
.pidon-form .wp-editor-wrap { border-radius: 8px; }
.pidon-form .wp-editor-area { background: #fff !important; color: #1f2937 !important; }

@media (max-width: 640px) {
  .pidon-stats {
    grid-template-columns: 1fr 1fr;
  }
  .pidon-grid {
    grid-template-columns: 1fr;
  }
  .pidon-head-actions {
    width: 100%;
  }
  .pidon-head-actions .uk-button {
    flex: 1;
  }
  .pidon-form-actions {
    flex-direction: column-reverse;
  }
  .pidon-form-actions .uk-button {
    width: 100%;
  }
  .pidon-table.uk-table-responsive td.uk-text-right {
    text-align: left !important;
  }
  .pidon-table.uk-table-responsive td.pidon-muted {
    padding-top: 0;
    font-size: 14px;
  }
}


/* ===== Czytelność niezależnie od ustawień motywu =====
   Motyw (np. sekcja lub karta YOOtheme z jasnym tekstem) potrafi nadać tekstowi w kartach
   biały kolor – wtedy liczby, kategorie i treść tabeli znikały na białym tle.
   Karty panelu mają zawsze jasne tło, więc ustawiamy im ciemny tekst jawnie. */
.pidon-dashboard .pidon-card,
.pidon-card.pidon-form-card {
  background: #fff !important;
  color: var(--pidon-ink) !important;
}

.pidon-dashboard .pidon-card :is(h1, h2, h3, h4, .pidon-title, .pidon-section-title),
.pidon-card.pidon-form-card :is(h1, h2, h3, h4, .pidon-section-title) {
  color: #111827 !important;
}

.pidon-dashboard .pidon-card :is(p, li, dd, td, strong, summary, label, .uk-form-label),
.pidon-card.pidon-form-card :is(p, li, dd, td, strong, label, .uk-form-label) {
  color: inherit;
}

.pidon-dashboard .pidon-card .pidon-muted,
.pidon-dashboard .pidon-card .pidon-stat span,
.pidon-dashboard .pidon-card .pidon-cats summary,
.pidon-dashboard .pidon-card .pidon-facts dt,
.pidon-dashboard .pidon-card .pidon-subtitle,
.pidon-dashboard .pidon-card .pidon-link-muted,
.pidon-card.pidon-form-card .pidon-meta,
.pidon-card.pidon-form-card .pidon-muted {
  color: var(--pidon-muted) !important;
}

.pidon-dashboard .pidon-card .pidon-stat strong {
  color: var(--pidon-ink) !important;
}

.pidon-dashboard .pidon-card .pidon-chip,
.pidon-dashboard .pidon-card .pidon-count {
  color: #334155 !important;
}

.pidon-dashboard .pidon-table th {
  color: var(--pidon-muted) !important;
}

.pidon-dashboard .pidon-table td,
.pidon-dashboard .pidon-table .pidon-post-title {
  color: var(--pidon-ink) !important;
}

.pidon-dashboard .pidon-table .pidon-post-title:hover {
  color: var(--pidon-accent) !important;
}

.pidon-dashboard .pidon-card :is(.uk-input, .uk-select),
.pidon-card.pidon-form-card :is(.uk-input, .uk-select, .uk-textarea) {
  background-color: #fff !important;
  color: var(--pidon-ink) !important;
  border-color: #cbd5e1 !important;
}

.pidon-dashboard .pidon-card :is(.uk-input, .uk-textarea)::placeholder,
.pidon-card.pidon-form-card :is(.uk-input, .uk-textarea)::placeholder {
  color: #94a3b8 !important;
}

.pidon-dashboard .pidon-card .uk-button-default,
.pidon-card.pidon-form-card .uk-button-default {
  background: #fff !important;
  color: var(--pidon-ink) !important;
  border-color: #cbd5e1 !important;
}

.pidon-dashboard .pidon-card .uk-button-default:hover,
.pidon-card.pidon-form-card .uk-button-default:hover {
  border-color: var(--pidon-ink) !important;
}

.pidon-dashboard .pidon-card .pidon-empty {
  color: var(--pidon-ink) !important;
}

/* Sekcja z jasnym tekstem (.uk-light) odwraca też przyciski UIkit – w białych kartach przywracamy zwykłe. */
.uk-light .pidon-card .uk-button-primary {
  background: #d9480f !important;
  color: #fff !important;
  border-color: transparent !important;
}

.uk-light .pidon-card .uk-button-secondary {
  background: #1f2937 !important;
  color: #fff !important;
  border-color: transparent !important;
}

.uk-light .pidon-card .uk-alert-primary {
  color: #1e40af !important;
}

/* ===== Lightbox zdjęć (galeria pod wpisem) ===== */

.pidon-lightbox-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(8px); z-index: 99999; display: flex; justify-content: center; align-items: center; opacity: 0; visibility: hidden; transition: opacity 0.3s ease; }
.pidon-lightbox-overlay.active { opacity: 1; visibility: visible; }
.pidon-lightbox-window { position: relative; width: 85vw; height: 85vh; background: rgba(255, 255, 255, 0.05); border-radius: 8px; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5); display: flex; justify-content: center; align-items: center; overflow: hidden; }
.pidon-lightbox-img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; cursor: zoom-in; transition: transform 0.2s ease; user-select: none; }
.pidon-lightbox-img.zoomed { max-width: none !important; max-height: none !important; width: auto; height: auto; cursor: grab; position: absolute; transition: none; }
.pidon-lightbox-img.zoomed:active { cursor: grabbing; }
.pidon-close-btn { position: absolute; top: 20px; right: 20px; width: 40px; height: 40px; background: rgba(0,0,0,0.5); border-radius: 50%; color: white; border: none; font-size: 24px; line-height: 40px; cursor: pointer; z-index: 100000; display: flex; justify-content: center; align-items: center; transition: background 0.2s; }
.pidon-close-btn:hover { background: #f0506e; }
