/* Detail Pages Optimized CSS - Extracted and Minified */
/* Ensure chart containers don't clip tooltips */
.h-64 {
  overflow: visible !important;
}

/* Chart.js external HTML tooltip - dopasowuje się do treści, nie obcina */
#chartjs-external-tooltip {
  font-family: Inter, system-ui, sans-serif;
  font-size: 13px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

canvas {
  max-width: 100%;
  position: relative;
  z-index: 12;
}

.glass-card {
  overflow: visible !important;
}

.glass-card>div[style*="min-height"] {
  overflow: visible !important;
}

/* Szczegóły – nagłówek tabeli przyklejony do góry podczas przewijania listy */
.details-table-scroll .details-sortable-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  /* Bez blur (stacking/overflow — backdrop nie renderuje się na sticky th) */
  background: #252d2c;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.12);
}

/* Chart Notes List Modal – wymaga overflow hidden dla scrollbara w liście */
#chartNotesListModalContent {
  overflow: hidden !important;
}

#chartNotesListContainer {
  overflow-y: auto !important;
  overflow-x: hidden !important;
}

/* Lazy loading konkurentów – optymalizacja renderowania poza viewportem */
#competitorsList .competitor-item-wrapper,
#competitorsForSourcesList .competitor-item-source {
  content-visibility: auto;
  contain-intrinsic-size: auto 72px;
}

/* Lazy loading całej listy pytań (karty + miniwykresy) – optymalizacja poza viewportem */
#questionsList .question-card {
  content-visibility: auto;
  contain-intrinsic-size: auto 120px;
}

/* Lazy loading listy źródeł (linki i domeny) – optymalizacja poza viewportem */
#sourcesLinksContainer .source-link-item,
#sourcesDomainsContainer .domain-item {
  content-visibility: auto;
  contain-intrinsic-size: auto 100px;
}

/* Tab button styles - modern design */
.competitor-tab-btn {
  position: relative;
  background: linear-gradient(135deg, rgba(29, 30, 31, 0.6), rgba(29, 30, 31, 0.8));
  border: 1px solid rgba(20, 184, 166, 0.15);
  color: rgba(248, 250, 252, 0.95);
  backdrop-filter: blur(8px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 2px 4px rgba(0, 0, 0, 0.2);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.competitor-tab-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 6px;
  padding: 1px;
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.12), rgba(20, 184, 166, 0.04));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.competitor-tab-btn:hover {
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.1), rgba(20, 184, 166, 0.17));
  border-color: rgba(20, 184, 166, 0.22);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 4px 12px rgba(20, 184, 166, 0.1);
}

.competitor-tab-btn:hover::before {
  opacity: 1;
}

/* Checkbox styles with checkmark */
input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 12px;
  font-weight: bold;
  line-height: 1;
}

/* Active tab - modern elevated style */
.competitor-tab-active {
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.22), rgba(20, 184, 166, 0.3));
  border: 1px solid rgba(20, 184, 166, 0.45);
  color: #ffffff;
  font-weight: 600;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 4px 16px rgba(20, 184, 166, 0.22),
    0 2px 8px rgba(20, 184, 166, 0.16),
    0 0 20px rgba(20, 184, 166, 0.1);
  transform: translateY(0);
  position: relative;
  overflow: hidden;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.competitor-tab-active::before {
  opacity: 1;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.07), rgba(20, 184, 166, 0.07));
}

.competitor-tab-active::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg,
      transparent 30%,
      rgba(255, 255, 255, 0.07) 50%,
      transparent 70%);
  animation: shimmer 3s infinite;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%) translateY(-100%) rotate(45deg);
  }

  100% {
    transform: translateX(100%) translateY(100%) rotate(45deg);
  }
}

/* Radio button styles */
.radio-input {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(148, 163, 184, 0.5);
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.5);
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
}

.radio-input:checked {
  border-color: #14b8a6;
  background: rgba(20, 184, 166, 0.2);
}

.radio-input:checked::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #14b8a6;
}

.radio-input:hover {
  border-color: rgba(20, 184, 166, 0.7);
}

/* Section navigator */
.section-nav {
  --dot-size: 18px;
  position: fixed;
  top: calc(50% - 80px);
  transform: translateY(-50%);
  left: clamp(-32px, calc((100vw - 1200px) / 2 - 140px), 12px);
  z-index: 40;
  padding: 16px 14px;
  border-radius: 16px;
  background: transparent;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  overflow: visible;
  pointer-events: none;
}

.section-nav-list {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  padding: 20px 0;
}

.section-nav-list::before {
  content: none;
}

.section-nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding-left: 0;
  background: transparent;
  border: none;
  color: rgba(226, 232, 240, 0.65);
  font-weight: 700;
  letter-spacing: 0.01em;
  text-transform: lowercase;
  cursor: pointer;
  transition: color 0.2s ease, transform 0.2s ease;
  pointer-events: auto;
}

.section-nav-item:hover {
  color: #34d399;
  transform: translateX(2px);
}

.section-nav-dot {
  position: relative;
  width: var(--dot-size);
  height: var(--dot-size);
  border-radius: 9999px;
  border: 2.5px solid rgba(20, 184, 166, 0.55);
  background: #0f172a;
  box-shadow: 0 0 0 6px rgba(20, 184, 166, 0.12);
  transition: all 0.25s ease;
}

.section-nav-label {
  font-size: 13px;
  color: rgba(226, 232, 240, 0.7);
}

.section-nav-item.active .section-nav-dot {
  background: #14b8a6;
  border-color: #14b8a6;
  box-shadow: 0 0 0 7px rgba(20, 184, 166, 0.28), 0 8px 20px rgba(20, 184, 166, 0.38);
  transform: scale(1.08);
}

.section-nav-item:hover .section-nav-dot {
  transform: scale(1.06);
}

.section-nav-line {
  position: relative;
  left: calc(var(--dot-size) / 2 - 1.5px);
  width: 3px;
  height: 20px;
  background: rgba(20, 184, 166, 0.7);
  opacity: 0.92;
  margin: 10px 0;
  pointer-events: none;
}

.section-nav-item.active .section-nav-label {
  color: #e9faf6;
}

/* Lazy load placeholder for charts */
.chart-lazy-placeholder {
  min-height: 300px;
  background: linear-gradient(135deg, rgba(29, 30, 31, 0.95), rgba(29, 30, 31, 1));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Responsive optimizations */
@media (max-width: 1600px) {
  .section-nav {
    --dot-size: 16px;
    top: calc(50% - 60px);
    left: clamp(-40px, calc((100vw - 1200px) / 2 - 110px), 8px);
    padding: 12px 12px;
  }

  .section-nav-list {
    padding: 16px 0;
  }

  .section-nav-item {
    gap: 10px;
  }

  .section-nav-line {
    height: 16px;
  }

  .section-nav-label {
    font-size: 12px;
  }
}

@media (max-width: 1440px) {
  .section-nav {
    --dot-size: 14px;
    top: calc(50% - 40px);
    left: clamp(-60px, calc((100vw - 1100px) / 2 - 130px), 0px);
    padding: 10px 10px;
  }

  .section-nav-list {
    padding: 12px 0;
  }

  .section-nav-line {
    height: 14px;
  }
}

.section-anchor {
  scroll-margin-top: 120px;
  content-visibility: auto;
  contain-intrinsic-size: auto 200px;
}

.section-anchor.defer-anim {
  animation: none !important;
  opacity: 0;
}

@media (max-width: 1279px) {
  .section-nav {
    display: none;
  }
}

/* Custom checkbox checked state */
input[type="checkbox"]:checked {
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.55), rgba(20, 184, 166, 0.4)) !important;
  border-color: rgba(20, 184, 166, 0.5) !important;
}

.tag-checkbox:checked,
.bulk-question-checkbox:checked {
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.55), rgba(20, 184, 166, 0.4)) !important;
  border-color: rgba(20, 184, 166, 0.5) !important;
}

.tag-checkbox:checked::after,
.bulk-question-checkbox:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 10px;
  font-weight: bold;
}

.competitor-tab-active:hover {
  transform: translateY(0);
  color: #ffffff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.15),
    0 4px 20px rgba(20, 184, 166, 0.2),
    0 2px 10px rgba(20, 184, 166, 0.14),
    0 0 30px rgba(20, 184, 166, 0.1);
}

#chartAnswersTab,
#chartSourcesTab {
  will-change: transform, opacity;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.model-option.model-tile {
  width: 100%;
  height: auto;
  margin-bottom: 0;
  justify-content: flex-start;
}

select.btn-secondary {
  background: linear-gradient(135deg, rgba(29, 30, 31, 0.95), rgba(29, 30, 31, 1)) !important;
  color: rgba(248, 250, 252, 0.95) !important;
  border: 1px solid rgba(20, 184, 166, 0.15) !important;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  cursor: pointer;
}

select.btn-secondary option {
  background: rgba(29, 30, 31, 1) !important;
  color: rgba(248, 250, 252, 0.95) !important;
}

select.btn-secondary option:hover,
select.btn-secondary option:checked,
select.btn-secondary option:focus {
  background: rgba(20, 184, 166, 0.4) !important;
  color: #ffffff !important;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mini-chart-container {
  background: #1d1e1f;
  border-radius: 8px;
  padding: 6px;
  border: 1px solid rgba(22, 184, 166, 0.3);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#showPositionChart:checked,
#showMentionPctChart:checked {
  background: rgba(20, 184, 166, 0.45) !important;
  border-color: rgba(20, 184, 166, 0.55) !important;
}

#showPositionChart:checked::after,
#showMentionPctChart:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 10px;
  font-weight: bold;
}

#showPositionChart:hover,
#showMentionPctChart:hover {
  border-color: rgba(20, 184, 166, 0.6) !important;
  background: rgba(20, 184, 166, 0.2) !important;
}

/* Calendar base */
#calendarContainer {
  position: fixed !important;
  z-index: 2147483646 !important;
  isolation: isolate;
  transform: translateZ(0) !important;
  will-change: transform !important;
}

#calendarContainer .glass-card {
  backdrop-filter: blur(30px) !important;
  -webkit-backdrop-filter: blur(30px) !important;
  background: rgba(30, 34, 38, 0.95) !important;
  position: relative;
  z-index: 2147483646 !important;
  transform: translateZ(0) !important;
}

#calendarContainer * {
  position: relative;
}

body>#calendarContainer {
  position: fixed !important;
  z-index: 2147483646 !important;
}

.calendar-day {
  aspect-ratio: 1;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.calendar-day:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-1px);
}

.calendar-day.other-month {
  opacity: 0.5;
}

.calendar-day.has-snapshot.has-brand {
  border-color: rgba(34, 197, 94, 0.3);
  background: rgba(34, 197, 94, 0.1);
}

.calendar-day.has-snapshot.has-brand::before {
  content: '';
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(34, 197, 94, 0.6);
  box-shadow: 0 0 4px rgba(34, 197, 94, 0.4);
}

.calendar-day.has-snapshot.no-brand {
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.1);
}

.calendar-day.has-snapshot.no-brand::before {
  content: '';
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.6);
  box-shadow: 0 0 4px rgba(239, 68, 68, 0.4);
}

.calendar-day.selected {
  border: 2px solid #14b8a6 !important;
  background: rgba(20, 184, 166, 0.2) !important;
  font-weight: 600;
}

.calendar-day.in-range,
.calendar-day.in-range:not(.selected),
.calendar-day.selected.in-range {
  border: 2px solid #14b8a6 !important;
  background: rgba(20, 184, 166, 0.2) !important;
}

.calendar-day.in-range.has-snapshot.has-brand:not(.selected),
.calendar-day.in-range.has-snapshot.no-brand:not(.selected) {
  border: 2px solid #14b8a6 !important;
  background: rgba(20, 184, 166, 0.2) !important;
}

.calendar-day.in-range.has-snapshot.has-brand::before {
  content: '';
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(34, 197, 94, 0.6);
  box-shadow: 0 0 4px rgba(34, 197, 94, 0.4);
}

.calendar-day.in-range.has-snapshot.no-brand::before {
  content: '';
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.6);
  box-shadow: 0 0 4px rgba(239, 68, 68, 0.4);
}

.calendar-day.preview-range,
.calendar-day.preview-range:not(.selected) {
  border: 2px solid #14b8a6 !important;
  background: rgba(20, 184, 166, 0.2) !important;
  transition: all 0.2s ease;
}

/* Tags carousel base */
.tags-carousel-viewport {
  width: 100%;
  height: 36px;
  overflow: hidden !important;
  overflow-x: hidden !important;
  overflow-y: hidden !important;
  scrollbar-width: none;
  -ms-overflow-style: none;
  cursor: grab;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  position: relative;
}

.tags-carousel-viewport::-webkit-scrollbar {
  display: none;
}

.tags-carousel-viewport:active {
  cursor: grabbing;
}

.tags-carousel-track {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  height: 100%;
  gap: 0.5rem;
  padding: 0 20px;
  width: max-content;
  will-change: transform;
  -webkit-user-select: none;
  user-select: none;
}

.tags-carousel-viewport::before,
.tags-carousel-viewport::after {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 20px;
  pointer-events: none;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: rgba(248, 250, 252, 0.5);
  font-weight: bold;
}

.tags-carousel-viewport::before {
  left: 0;
  content: "‹";
}

.tags-carousel-viewport::after {
  right: 0;
  content: "›";
}

.tags-carousel-track .tag-chip {
  flex-shrink: 0;
  min-width: fit-content;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* Tag filter chip — inactive (default) */
.tag-filter-inactive {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  color: rgba(226, 232, 240, 0.55);
  transition: all 0.2s ease;
}

.tag-filter-inactive:hover {
  background: rgba(20, 184, 166, 0.08);
  border-color: rgba(20, 184, 166, 0.3) !important;
  color: rgba(226, 232, 240, 0.85);
  transform: translateY(-1px);
}

/* Tag filter chip — ACTIVE (currently selected) */
.tag-filter-active {
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.16), rgba(20, 184, 166, 0.1)) !important;
  border: 1.5px solid rgba(20, 184, 166, 0.45) !important;
  color: #d1fae5 !important;
  font-weight: 600;
  box-shadow:
    0 0 0 2px rgba(20, 184, 166, 0.08),
    0 0 10px rgba(20, 184, 166, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  position: relative;
  overflow: hidden;
}

.tag-filter-active::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg,
      transparent 35%,
      rgba(255, 255, 255, 0.07) 50%,
      transparent 65%);
  animation: tag-shimmer 2.5s ease-in-out infinite;
}

@keyframes tag-shimmer {
  0% {
    transform: translateX(-120%);
  }

  60% {
    transform: translateX(120%);
  }

  100% {
    transform: translateX(120%);
  }
}

/* Loading indicators */
.checkbox-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.7;
}

.checkbox-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border: 2px solid transparent;
  border-top: 2px solid #14b8a6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

.chart-loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  border-radius: 8px;
}

.chart-loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(20, 184, 166, 0.2);
  border-top: 4px solid #14b8a6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Infinite scroll */
.infinite-scroll-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(20, 184, 166, 0.2);
  border-top-color: #14b8a6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 16px auto;
}

.infinite-scroll-sentinel {
  min-height: 1px;
  visibility: hidden;
}

.infinite-scroll-sentinel.loading .infinite-scroll-spinner {
  visibility: visible;
}

.progress-bar-container {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 0 0 8px 8px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #0d9488, #0f766e);
  width: 0%;
  transition: width 0.3s ease;
}

.error-message {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(239, 68, 68, 0.9);
  color: white;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 11;
  max-width: 80%;
  text-align: center;
}

.retry-button {
  background: #14b8a6;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  margin-top: 8px;
  cursor: pointer;
  font-size: 12px;
  transition: background 0.2s;
}

.retry-button:hover {
  background: #0d9488;
}