/* Copella Header */
:root {
  --cp-header-h: 64px;
  --cp-header-bg: #111;
  --cp-header-fg: #f8f8f8;
  --cp-header-fg-dim: #cfcfcf;
  /* Dynamic height of WordPress admin bar (set via JS only when visible & fixed) */
  --cp-adminbar-h: 0px;
}

.cp-site-header { position: fixed; top: var(--cp-adminbar-h, 0); left: var(--cp-sb-left, 0); right: 0; height: var(--cp-header-h); background: var(--cp-sb-bg); color: var(--cp-sb-fg); z-index: 1001; display: flex; align-items: center; padding-left: 0 !important; transition: left .24s ease; }
.cp-header__row { width: 100%; display: grid; grid-template-columns: auto auto minmax(280px, 720px) auto auto; align-items: center; gap: 12px; padding: 0 12px; }
.cp-header__logo { display: none; justify-self: center; }
.cp-header__logo--mobile { display: none; }
.cp-header__logo img { height: 40px; width: auto; display: block; object-fit: contain; }

.cp-header__search-form { display: flex; align-items: center; gap: 8px; max-width: 720px; width: 100%; margin: 0 auto; font: inherit; grid-column: 3; justify-self: stretch; position: relative; }
.cp-header__search-input { flex: 1; height: 40px; border-radius: 10px; border: 1px solid rgba(255,255,255,.1); padding: 0 12px; background: #1a1a1a; color: var(--cp-sb-fg); font-family: 'Gilroy', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; font-weight: 600; }
.cp-header__search-input { -webkit-appearance: none; appearance: none; outline: none; }
.cp-header__search-input:focus { outline: none; box-shadow: inset 0 0 0 2px rgba(255,255,255,.18); border-color: rgba(255,255,255,.25); }
.cp-header__search-input::placeholder { color: var(--cp-header-fg-dim); font-family: 'Gilroy', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; font-weight: 600; }
.cp-header__search-submit { width: 40px; height: 40px; border-radius: 10px; border: 1px solid rgba(255,255,255,.1); background: #1a1a1a; color: var(--cp-sb-fg); display: none; place-items: center; }
.cp-header__search-cancel { width: 40px; height: 40px; border-radius: 10px; border: 1px solid rgba(255,255,255,.1); background: #1a1a1a; color: var(--cp-sb-fg); display: none; place-items: center; }

/* Remove browser-native clear (X) in search inputs */
.cp-header__search-input::-ms-clear { display: none; width: 0; height: 0; }
.cp-header__search-input::-ms-reveal { display: none; width: 0; height: 0; }
.cp-header__search-input::-webkit-search-decoration,
.cp-header__search-input::-webkit-search-cancel-button,
.cp-header__search-input::-webkit-search-results-button,
.cp-header__search-input::-webkit-search-results-decoration { display: none; }

.cp-header__search-toggle { display: grid !important; width: 40px; height: 40px; border: none; background: transparent; color: var(--cp-header-fg); }
.cp-header__icon-btn { display: grid; place-items: center; border-radius: 10px; transition: background .18s ease; }
.cp-header__icon-btn:hover, .cp-header__icon-btn:focus { background: rgba(255,255,255,.06); }
.cp-header__icon { display: block; width: 24px; height: 24px; }
.cp-header__close-icon { display: none; }

/* Search drop panel with popular carousel */
.cp-header__search-panel { position: fixed; left: calc(var(--cp-sb-left, 0) + 12px); right: 12px; top: calc(var(--cp-adminbar-h, 0px) + var(--cp-header-h) + 6px); background: var(--cp-sb-bg); border: 1px solid rgba(255,255,255,.06); border-radius: 12px; padding: 10px; z-index: 1000; box-shadow: 0 10px 24px rgba(0,0,0,.30); opacity: 0; visibility: hidden; transform: translateY(-6px); pointer-events: none; }
.cp-header__search-panel.is-visible { opacity: 1; visibility: visible; transform: translateY(0); pointer-events: auto; }
.cp-popular { display: grid; grid-template-rows: auto 1fr; gap: 8px; }
.cp-popular__header { display: grid; grid-template-columns: 1fr auto; align-items: center; }
.cp-popular__title { font-weight: 800; color: var(--cp-sb-fg); font-family: 'Gilroy', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; }
.cp-popular__controls { display: grid; grid-auto-flow: column; gap: 6px; }
.cp-popular__btn { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; border: 1px solid rgba(255,255,255,.1); background: #1a1a1a; color: var(--cp-sb-fg); }
.cp-popular__scroller { overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; scrollbar-width: none; -ms-overflow-style: none; -ms-touch-action: pan-x; touch-action: pan-x pinch-zoom; }
.cp-popular__scroller::-webkit-scrollbar { display: none; }
.cp-popular__list { display: grid; grid-auto-flow: column; grid-auto-columns: 200px; gap: 10px; list-style: none; margin: 0; padding: 4px; }
.cp-popular__item { scroll-snap-align: start; }
.cp-popular__link { display: grid; grid-template-rows: auto 1fr; gap: 8px; text-decoration: none; color: var(--cp-sb-fg); background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.06); border-radius: 10px; padding: 8px; height: 100%; }
.cp-popular__thumb { width: 100%; height: 112px; border-radius: 8px; object-fit: cover; background: #222; display: block; }
.cp-popular__meta { display: grid; gap: 4px; }
.cp-popular__name { font-weight: 700; font-size: 14px; line-height: 1.25; font-family: 'Gilroy', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; }
.cp-popular__extra { color: var(--cp-header-fg-dim); font-size: 12px; }

/* Bell panel */
.cp-bell-panel { position: fixed; right: 12px; top: calc(var(--cp-adminbar-h, 0px) + var(--cp-header-h) + 6px); width: 340px; max-width: calc(100% - 24px); background: var(--cp-sb-bg); color: var(--cp-sb-fg); border: 1px solid rgba(255,255,255,.06); border-radius: 12px; box-shadow: 0 10px 24px rgba(0,0,0,.30); padding: 8px; z-index: 1000; opacity: 0; visibility: hidden; transform: translateY(-6px); }
.cp-bell-panel.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }

/* Mobile bell panel adjustments */
@media (max-width: 768px) {
  .cp-bell-panel { 
    right: 6px; 
    left: 6px; 
    width: auto; 
    max-width: none; 
    top: calc(var(--cp-adminbar-h, 0px) + var(--cp-header-h) + 4px);
    max-height: calc(100vh - var(--cp-adminbar-h, 0px) - var(--cp-header-h) - 20px);
  }
  .cp-bell-panel__list { 
    max-height: calc(60vh - 60px); 
  }
}
.cp-bell-panel__header { display: grid; grid-template-columns: 1fr auto; align-items: center; padding: 4px 6px 6px; }
.cp-bell-panel__title { font-weight: 800; }
.cp-bell-panel__mark { border: 1px solid rgba(255,255,255,.1); background:#1a1a1a; color: var(--cp-sb-fg); border-radius: 8px; padding: 6px 10px; }
.cp-bell-panel__list { display: grid; gap: 8px; max-height: 60vh; overflow:auto; padding: 4px; }
.cp-bell-item { display:grid; grid-template-columns: 40px 1fr; gap:8px; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.06); border-radius: 10px; padding: 8px; text-decoration:none; color: inherit; }
.cp-bell-item__avatar { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; background:#222; display:block; }
.cp-bell-item__title { font-weight: 700; font-size: 14px; }
.cp-bell-item__text { color: var(--cp-header-fg-dim); font-size: 13px; }
.cp-bell__dot { position:absolute; right:6px; top:6px; width:8px; height:8px; background:#ff6b35; border-radius:50%; }

/* Header burger (mobile only) */
.cp-header__burger { display: none; width: 44px; height: 44px; border: none; border-radius: 8px; background: var(--cp-sb-bg, #1a1a1a); color: var(--cp-header-fg); display: none; align-items: center; justify-content: center; -ms-touch-action: manipulation; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

/* Sidebar toggle button (desktop only) */
.cp-header__sidebar-toggle { display: none; width: 44px; height: 44px; border: none; border-radius: 8px; background: var(--cp-sb-bg, #1a1a1a); color: var(--cp-header-fg); align-items: center; justify-content: center; -ms-touch-action: manipulation; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

.cp-header__burger-line { display: block; width: 20px; height: 2px; background: var(--cp-header-fg); margin: 3px 0; }

/* Desktop */
@media (min-width: 769px) {
  .cp-header__sidebar-toggle { display: flex; grid-column: 1; }
  .cp-header__logo { display: flex; grid-column: 2; }
  .cp-header__logo--mobile { display: none !important; }
  .cp-header__search-form { grid-column: 3; }
  .cp-header__search-toggle { grid-column: 4; }
  #cp-bell { grid-column: 5; }
}

/* Mobile */
@media (max-width: 768px) {
  .cp-site-header { left: 0; }
  .cp-header__row { 
    grid-template-columns: 44px 1fr auto auto; 
    gap: 8px; 
    align-items: center;
    justify-items: center;
  }
  .cp-header__sidebar-toggle { display: none !important; }
  .cp-header__logo { display: none !important; }
  .cp-header__logo--mobile { 
    display: flex; 
    justify-self: center;
    grid-column: 2;
  }
  
  /* Логотип на мобильных - точно по центру */
  .cp-header__logo--mobile img { 
    height: 40px; 
    width: auto; 
    object-fit: contain; 
  }
  
  /* Mobile search form - hidden by default */
  .cp-header__search-form { 
    display: none; 
  }
  
  .cp-header__search-input { height: 36px; border-radius: 8px; }
  .cp-header__search-submit { display: none !important; width: 36px; height: 36px; border-radius: 8px; }
  .cp-header__search-cancel { display: none !important; width: 36px; height: 36px; border-radius: 8px; }
  .cp-header__search-toggle { 
    display: grid !important; 
    place-items: center; 
    width: 40px; 
    height: 40px; 
    z-index: 1003; 
  }
  .cp-header__burger { display: flex; }
  .cp-header__sidebar-toggle { display: none !important; }

  /* Уведомления - фиксированный размер и позиция */
  #cp-bell {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
  }

  /* Mobile: panel follows the header height */
  .cp-header__search-panel { left: 6px; right: 6px; top: calc(var(--cp-adminbar-h, 0px) + var(--cp-header-h)); }
  .cp-popular__btn { width: 36px; height: 36px; }
  .cp-popular__list { grid-auto-columns: 180px; }
}

/* Admin bar offset handled dynamically through --cp-adminbar-h */

/* Push ALL page content below header (+ admin bar if present and fixed) */
body { padding-top: calc(var(--cp-header-h) + var(--cp-adminbar-h, 0px)); }
/* Fallback for very old browsers without CSS variables (e.g., Lumia IE) */
@supports not (padding-top: var(--cp-header-h)) {
  body { padding-top: 64px; }
  .admin-bar body { padding-top: 96px; }
  @media screen and (max-width: 782px) {
    .admin-bar body { padding-top: 110px; }
  }
}

/* Extra fallback for legacy Microsoft engines (e.g., Lumia IE/Edge Legacy) */
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
  body { padding-top: 64px; }
}

/* Mobile search dropdown alignment handled by transforms; admin bar offset is baked into header offset */

/* When search is open on mobile */
@media (max-width: 768px) {
  .cp-header--search-open .cp-header__search-form {
    display: flex;
    grid-column: 2;
    width: 100%;
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
    justify-self: center;
  }
  .cp-header--search-open .cp-header__logo--mobile { 
    display: none !important; 
  }
  .cp-header--search-open .cp-header__search-input { height: 36px; }
  .cp-header--search-open .cp-header__search-submit { display: grid !important; }
  .cp-header--search-open .cp-header__search-cancel { display: grid !important; }
  .cp-header--search-open .cp-header__search-toggle { display: none !important; }
  .cp-header--search-open .cp-header__search-icon { display: none; }
  .cp-header--search-open .cp-header__close-icon { display: block; }
}

/* Disable CSS transitions when GSAP is active */
html.cp-header-gsap .cp-header__search-form { transition: none; }

/* Ensure search form stays in place on desktop when panel opens */
@media (min-width: 769px) {
  .cp-header--search-open .cp-header__search-form { 
    position: relative !important; 
    transform: none !important; 
    display: flex !important; 
    opacity: 1 !important;
    pointer-events: auto !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    width: 100% !important;
    max-width: 720px !important;
    background: transparent !important;
    padding: 0 !important;
    border: none !important;
    grid-column: 3 !important;
  }
}

/* Follow button styles */
.cp-follow-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 8px;
  background: #1a1a1a;
  color: var(--cp-sb-fg);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.cp-follow-btn:hover,
.cp-follow-btn:focus {
  background: #2b2b2b;
  border-color: rgba(255,255,255,.3);
  color: var(--cp-sb-fg);
  text-decoration: none;
}

.cp-follow-btn.following {
  background: linear-gradient(90deg, #00c853 0%, #00e676 100%);
  color: #000;
  border-color: #00c853;
}

.cp-follow-btn.following:hover,
.cp-follow-btn.following:focus {
  background: linear-gradient(90deg, #00d65d 0%, #27ee8a 100%);
  color: #000;
}

.cp-follow-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Mobile follow button adjustments */
@media (max-width: 768px) {
  .cp-follow-btn {
    padding: 10px 18px;
    font-size: 16px;
    min-height: 44px;
  }
}

/* Author page text color fixes */
.author .entry-title,
.author .entry-content,
.author .entry-meta,
.author .author-description,
.author .author-bio,
.author h1,
.author h2,
.author h3,
.author h4,
.author h5,
.author h6,
.author p,
.author .post-title,
.author .post-content,
.author .post-meta,
.author .archive-title,
.author .page-title {
  color: #ffffff !important;
}

/* Ensure author page content is visible */
.author .entry-header,
.author .entry-content,
.author .entry-footer,
.author .author-info,
.author .author-avatar,
.author .author-description {
  color: #ffffff !important;
}

/* Author page links */
.author a:not(.cp-follow-btn) {
  color: #00c853 !important;
}

.author a:not(.cp-follow-btn):hover {
  color: #00e676 !important;
}

