/**
 * PY Cookie Consent - стилове. Цветовете и радиусът идват от настройките
 * (CSS променливи --pycc-*); шрифтът е този на сайта.
 */
.pycc {
  --pycc-bg: #ffffff;
  --pycc-text: #1f2328;
  --pycc-primary: #1f2328;
  --pycc-on-primary: #ffffff;
  --pycc-accent: #2563eb;
  --pycc-on-accent: #ffffff;
  --pycc-radius: 4px;
  --pycc-muted: color-mix(in srgb, var(--pycc-text) 72%, var(--pycc-bg));
  --pycc-line: color-mix(in srgb, var(--pycc-text) 16%, var(--pycc-bg));
  --pycc-soft: color-mix(in srgb, var(--pycc-text) 5%, var(--pycc-bg));
  box-sizing: border-box;
  font: inherit;
  font-size: 15px;
  line-height: 1.5;
  color: var(--pycc-text);
  letter-spacing: normal;
  text-transform: none;
}

.pycc *,
.pycc *::before,
.pycc *::after {
  box-sizing: inherit;
}

.pycc[hidden],
.pycc [hidden] {
  display: none !important;
}

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

/* --- Бутони ------------------------------------------------------------- */

.pycc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin: 0;
  padding: 10px 18px;
  border: 2px solid var(--pycc-primary);
  border-radius: var(--pycc-radius);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
  transition: opacity 0.15s ease, background-color 0.15s ease;
}

.pycc-btn--primary {
  background: var(--pycc-primary);
  color: var(--pycc-on-primary);
}

.pycc-btn--primary:hover {
  opacity: 0.88;
}

.pycc-btn--outline {
  background: var(--pycc-bg);
  color: var(--pycc-primary);
}

/* Само „Приеми всички“: акцентен цвят, за да е очевидното действие. */
.pycc-btn--accept {
  border-color: var(--pycc-accent);
  background: var(--pycc-accent);
  color: var(--pycc-on-accent);
}

.pycc-btn--accept:hover {
  border-color: color-mix(in srgb, var(--pycc-accent) 85%, #000);
  background: color-mix(in srgb, var(--pycc-accent) 85%, #000);
}

.pycc-btn--outline:hover {
  background: var(--pycc-soft);
}

.pycc-btn--link {
  border-color: transparent;
  background: transparent;
  color: var(--pycc-text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.pycc-btn:focus-visible,
.pycc-prefs__close:focus-visible,
.pycc-reopen:focus-visible,
.pycc-link:focus-visible,
.pycc-cat__cookies summary:focus-visible,
.pycc-switch input:focus-visible + .pycc-switch__track {
  outline: 3px solid var(--pycc-primary);
  outline-offset: 2px;
}

.pycc-link {
  color: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* --- Банер -------------------------------------------------------------- */

.pycc-banner {
  position: fixed;
  z-index: 2147483000;
  margin: 0;
  padding: 24px;
  background: var(--pycc-bg);
  border: 1px solid var(--pycc-line);
  border-radius: var(--pycc-radius);
  box-shadow: 0 16px 48px rgb(0 0 0 / 0.2);
  color: var(--pycc-text);
  animation: pycc-in 0.3s ease-out;
}

.pycc-banner__title {
  margin: 0 0 12px;
  font-size: 19px;
  font-weight: 700;
  line-height: 1.3;
}

.pycc-banner__text {
  margin: 0;
  max-width: 60ch;
  color: var(--pycc-muted);
  line-height: 1.6;
}

.pycc-banner__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

/* „Откажи“ и „Приеми“ - една до друга, еднакво широки („Приеми“ вдясно); „Настройки“ отдолу. */
.pycc-banner__actions :is(.pycc-btn--outline, .pycc-btn--accept) {
  flex: 1 1 140px;
}

.pycc-banner__actions .pycc-btn--link {
  flex: 1 1 100%;
  min-height: 40px;
}

/* Прозорец в средата (по подразбиране): не може да бъде подминат. */
.pycc-banner--modal {
  inset: 0;
  width: min(520px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  margin: auto;
  overflow-y: auto;
  padding: 28px;
}

.pycc-banner--modal[open] {
  display: block;
}

.pycc-banner--modal::backdrop {
  background: rgb(0 0 0 / 0.5);
}

.pycc-banner--modal .pycc-banner__title {
  font-size: 22px;
}

/* Плаваща кутия в ъгъл. */
.pycc-banner--box {
  width: min(420px, calc(100% - 32px));
}

.pycc-banner--left-top,
.pycc-banner--left-bottom {
  left: 16px;
}

.pycc-banner--right-top,
.pycc-banner--right-bottom {
  right: 16px;
}

.pycc-banner--left-top,
.pycc-banner--right-top {
  top: 16px;
}

.pycc-banner--left-bottom,
.pycc-banner--right-bottom {
  bottom: 16px;
}

/* Лента по цялата ширина. */
.pycc-banner--bar {
  left: 0;
  right: 0;
  border-radius: 0;
  padding: 20px 16px;
}

.pycc-banner--bar.pycc-banner--bottom {
  bottom: 0;
  border-width: 1px 0 0;
}

.pycc-banner--bar.pycc-banner--top {
  top: 0;
  border-width: 0 0 1px;
}

.pycc-banner--bar .pycc-banner__inner {
  max-width: 1280px;
  margin: 0 auto;
}

@media (min-width: 960px) {
  .pycc-banner--bar .pycc-banner__inner {
    display: flex;
    align-items: center;
    gap: 40px;
  }

  .pycc-banner--bar .pycc-banner__content {
    flex: 1;
  }

  .pycc-banner--bar .pycc-banner__actions {
    flex-shrink: 0;
    flex-wrap: nowrap;
    margin-top: 0;
  }

  .pycc-banner--bar .pycc-banner__actions .pycc-btn {
    flex: 0 0 auto;
  }

  .pycc-banner--bar .pycc-banner__actions .pycc-btn--link {
    order: -1;
  }
}

/* Телефони: всеки вариант става лист в долната част (до палеца, не закрива заглавието). */
@media (max-width: 560px) {
  .pycc-banner {
    padding: 20px 16px calc(16px + env(safe-area-inset-bottom));
  }

  .pycc-banner--box,
  .pycc-banner--modal {
    inset: auto 0 0;
    width: 100%;
    max-width: none;
    max-height: 85dvh;
    margin: 0;
    border-width: 1px 0 0;
    border-radius: var(--pycc-radius) var(--pycc-radius) 0 0;
  }

  .pycc-banner--modal .pycc-banner__title {
    font-size: 19px;
  }

  /* Един под друг: „Приеми“ най-отгоре, до палеца; „Откажи“ веднага под него. */
  .pycc-banner__actions :is(.pycc-btn--outline, .pycc-btn--accept) {
    flex: 1 1 100%;
  }

  .pycc-banner__actions .pycc-btn--accept,
  .pycc-prefs__actions .pycc-btn--accept {
    order: -1;
  }
}

/* Докато прозорецът е отворен, страницата отзад не се скролва. */
html:has(.pycc-banner--modal[open]),
html:has(.pycc-prefs[open]) {
  overflow: hidden;
}

@keyframes pycc-in {
  from {
    opacity: 0;
    translate: 0 12px;
  }
}

/* --- Панел с настройките ----------------------------------------------- */

.pycc-prefs {
  width: min(640px, calc(100% - 24px));
  max-height: min(88vh, 900px);
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: var(--pycc-radius);
  background: var(--pycc-bg);
  box-shadow: 0 24px 64px rgb(0 0 0 / 0.3);
  overflow: hidden;
}

.pycc-prefs[open] {
  display: flex;
}

.pycc-prefs::backdrop {
  background: rgb(0 0 0 / 0.55);
}

.pycc-prefs__form {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: inherit;
  margin: 0;
}

.pycc-prefs__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--pycc-line);
}

.pycc-prefs__title {
  margin: 0;
  font: inherit;
  font-size: 19px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--pycc-text);
}

.pycc-prefs__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: -8px -10px -8px 0;
  padding: 0;
  border: 0;
  border-radius: var(--pycc-radius);
  background: transparent;
  color: var(--pycc-text);
  cursor: pointer;
}

.pycc-prefs__close:hover {
  background: var(--pycc-soft);
}

.pycc-prefs__body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  overscroll-behavior: contain;
}

.pycc-prefs__intro {
  margin: 0 0 12px;
  color: var(--pycc-muted);
}

.pycc-prefs__note {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-left: 3px solid var(--pycc-primary);
  background: var(--pycc-soft);
  font-size: 14px;
}

.pycc-prefs__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px 20px;
  border-top: 1px solid var(--pycc-line);
  background: var(--pycc-bg);
}

.pycc-prefs__actions .pycc-btn {
  flex: 1 1 160px;
}

/* --- Категории ---------------------------------------------------------- */

.pycc-cat {
  padding: 14px 0;
  border-top: 1px solid var(--pycc-line);
}

.pycc-cat__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.pycc-cat__title {
  margin: 0;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  color: var(--pycc-text);
}

.pycc-cat__always {
  font-size: 13px;
  font-weight: 600;
  color: var(--pycc-muted);
}

.pycc-cat__desc {
  margin: 4px 0 0;
  font-size: 14px;
  color: var(--pycc-muted);
}

.pycc-cat__cookies {
  margin-top: 8px;
  font-size: 14px;
}

.pycc-cat__cookies summary {
  display: inline-block;
  padding: 4px 0;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Превключвател: истински checkbox (role="switch") под визуалната писта. */
.pycc-switch {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
  width: 48px;
  height: 28px;
  cursor: pointer;
}

.pycc-switch input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.pycc-switch__track {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: color-mix(in srgb, var(--pycc-text) 30%, var(--pycc-bg));
  transition: background-color 0.15s ease;
  pointer-events: none;
}

.pycc-switch__track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.3);
  transition: transform 0.15s ease;
}

.pycc-switch input:checked + .pycc-switch__track {
  background: var(--pycc-primary);
}

.pycc-switch input:checked + .pycc-switch__track::after {
  transform: translateX(20px);
}

/* --- Таблица с бисквитки ------------------------------------------------- */

.pycc-table-wrap {
  margin-top: 8px;
  overflow-x: auto;
}

.pycc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.pycc-table th,
.pycc-table td {
  padding: 6px 8px;
  border: 1px solid var(--pycc-line);
  text-align: left;
  vertical-align: top;
}

.pycc-table th {
  background: var(--pycc-soft);
  font-weight: 600;
}

.pycc-table code {
  font-size: 12px;
  word-break: break-all;
}

@media (max-width: 560px) {
  .pycc-table thead {
    display: none;
  }

  .pycc-table tr {
    display: block;
    border-bottom: 1px solid var(--pycc-line);
  }

  .pycc-table td {
    display: grid;
    grid-template-columns: 7em 1fr;
    gap: 8px;
    border: 0;
  }

  .pycc-table td::before {
    content: attr(data-label);
    font-weight: 600;
  }
}

/* --- Плаващ бутон ------------------------------------------------------- */

/*
 * В покой: точен кръг 44×44 (10 + 22 икона + 10 + рамка 2 = 44), без gap.
 * При посочване/фокус етикетът се разгръща и бутонът става хапче.
 */
.pycc-reopen {
  position: fixed;
  z-index: 2147482999;
  bottom: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  min-width: 44px;
  padding: 0 10px;
  border: 1px solid var(--pycc-line);
  border-radius: 999px;
  transition: padding 0.25s ease;
  background: var(--pycc-bg);
  color: var(--pycc-text);
  box-shadow: 0 4px 16px rgb(0 0 0 / 0.15);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.pycc-reopen--left {
  left: 16px;
}

.pycc-reopen--right {
  right: 16px;
}

.pycc-reopen svg {
  flex-shrink: 0;
}

/* Само иконата, докато посетителят не посочи бутона; разстоянието е част от етикета. */
.pycc-reopen__label {
  max-width: 0;
  padding-left: 0;
  overflow: hidden;
  white-space: nowrap;
  transition: max-width 0.25s ease, padding-left 0.25s ease;
}

.pycc-reopen:hover,
.pycc-reopen:focus-visible {
  padding-right: 14px;
}

.pycc-reopen:hover .pycc-reopen__label,
.pycc-reopen:focus-visible .pycc-reopen__label {
  max-width: 12em;
  padding-left: 8px;
}

/* --- Блокирано вградено съдържание -------------------------------------- */

.pycc-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 200px;
  padding: 24px;
  border: 1px dashed var(--pycc-line);
  background: var(--pycc-soft);
  text-align: center;
}

.pycc-placeholder p {
  margin: 0;
  max-width: 36em;
}

/* --- Линк към настройките (shortcode) ---------------------------------- */

.pycc-settings-link {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
  .pycc-banner,
  .pycc-switch__track,
  .pycc-switch__track::after,
  .pycc-reopen,
  .pycc-reopen__label {
    animation: none;
    transition: none;
  }
}

@media print {
  .pycc-banner,
  .pycc-reopen,
  .pycc-prefs {
    display: none !important;
  }
}
