/* ===== KwK Cookie Consent — Dark Theme, Centered, Blur ===== */

/* Backdrop — blurs page content */
.kwk-cb-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(13px);
  -webkit-backdrop-filter: blur(13px);
  animation: kwkCbFadeIn 0.4s ease-out;
}

/* Banner — centered */
.kwk-cb {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  pointer-events: none;
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
}
.kwk-cb-inner {
  position: relative;
  max-width: 440px;
  width: 100%;
  background: rgba(18, 18, 18, 0.95);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 32px;
  pointer-events: auto;
  text-align: center;
  animation: kwkCbScaleIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes kwkCbFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes kwkCbScaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.kwk-cb-text {
  text-align: left;
}
.kwk-cb-text strong {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  display: block;
  margin-bottom: 10px;
}
.kwk-cb-text p {
  font-size: 13px;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.5);
  margin: 0;
  text-align: justify;
}

/* Primary CTA — full width, dominant */
.kwk-cb-actions {
  margin-top: 24px;
}
.kwk-cb-btn-accept {
  width: 100%;
  padding: 14px 24px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: linear-gradient(135deg, #6B422C, #8D5A3B);
  color: #fff;
  transition: all 0.25s;
  position: relative;
  overflow: hidden;
}
.kwk-cb-btn-accept::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.06), transparent);
  animation: kwkCbShimmer 3s ease-in-out infinite;
}
@keyframes kwkCbShimmer {
  0%, 100% { left: -100%; }
  50% { left: 100%; }
}
.kwk-cb-btn-accept:hover {
  background: linear-gradient(135deg, #8D5A3B, #a07050);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(107, 66, 44, 0.3);
}

/* Secondary links — subtle */
.kwk-cb-links {
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.kwk-cb-link {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.25);
  cursor: pointer;
  padding: 4px 0;
  transition: color 0.2s;
}
.kwk-cb-link:hover {
  color: rgba(255, 255, 255, 0.5);
}
.kwk-cb-legal {
  margin-top: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.kwk-cb-legal a, .kwk-cb-legal a:visited {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.25);
  text-decoration: none !important;
  transition: color 0.2s;
}
.kwk-cb-legal a:hover { color: rgba(255, 255, 255, 0.45); }
.kwk-cb-legal .kwk-cb-link-sep {
  font-size: 16px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.18);
  vertical-align: middle;
  line-height: 1;
}

/* Legal link tooltip */
.kwk-cb-legal-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.kwk-cb-legal-link {
  text-decoration: none !important;
}
.kwk-cb-legal-tooltip {
  display: none;
  padding: 10px 16px;
  background: #1a1a1a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  white-space: nowrap;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}
.kwk-cb-legal-tooltip::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  margin-left: -5px;
  width: 10px;
  height: 10px;
  background: #1a1a1a;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  border-right: 1px solid rgba(255, 255, 255, 0.12);
  transform: rotate(45deg);
}
.kwk-cb-legal-tooltip:hover { color: #fff; background: #222; }
.kwk-cb-legal-tooltip:hover::after { background: #222; }
.kwk-cb-legal-tooltip.active { display: block; }
.kwk-cb-link-sep {
  font-size: 16px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.18);
  line-height: 1;
  vertical-align: middle;
}

/* ===== Settings Modal ===== */
.kwk-cm {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
}
.kwk-cm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.kwk-cm-dialog {
  position: relative;
  width: 90%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  background: #141414;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  animation: kwkCbScaleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.kwk-cm-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.kwk-cm-header-buttons {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  position: relative;
}
.kwk-cm-header-buttons > .kwk-cb-x-wrap {
  position: static;
}
.kwk-cm-header-buttons > .kwk-cb-x-wrap .kwk-cb-x-tooltip {
  position: absolute;
  right: 0;
  top: 42px;
}
.kwk-cm-header strong {
  font-size: 16px;
  color: #fff;
}
/* X close button — top right */
.kwk-cb-x-wrap {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.kwk-cb-x {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 20px;
  font-weight: 300;
  line-height: 1;
  color: rgba(255, 255, 255, 0.25);
  transition: color 0.2s, border-color 0.2s, background 0.2s;
  padding: 0 0 3px 0;
  font-family: inherit;
}
.kwk-cb-x:hover { color: rgba(255, 255, 255, 0.5); border-color: rgba(255, 255, 255, 0.2); background: rgba(255, 255, 255, 0.04); }
.kwk-cb-x-tooltip {
  display: none;
  margin-top: 10px;
  padding: 10px 16px;
  background: #1a1a1a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  white-space: nowrap;
  cursor: pointer;
  font-family: inherit;
  animation: kwkCbScaleIn 0.2s ease-out;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  z-index: 2;
  position: relative;
}
.kwk-cb-x-tooltip::before {
  content: '';
  position: absolute;
  top: -6px;
  right: 14px;
  width: 10px;
  height: 10px;
  background: #1a1a1a;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  border-left: 1px solid rgba(255, 255, 255, 0.12);
  transform: rotate(45deg);
}
.kwk-cb-x-tooltip:hover { color: #fff; background: #222; }
.kwk-cb-x-tooltip:hover::before { background: #222; }
.kwk-cb-x-tooltip.active { display: block; }

/* Blur main popup content when tooltip is shown */
.kwk-cb-inner.blurred .kwk-cb-text,
.kwk-cb-inner.blurred .kwk-cb-actions,
.kwk-cb-inner.blurred .kwk-cb-links,
.kwk-cb-inner.blurred .kwk-cb-legal {
  filter: blur(3px);
  opacity: 0.4;
  pointer-events: none;
  transition: filter 0.3s, opacity 0.3s;
}
.kwk-cb-inner.blurred .kwk-cb-legal-tooltip.active {
  filter: none !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}
.kwk-cm-dialog.blurred .kwk-cm-body,
.kwk-cm-dialog.blurred .kwk-cm-footer {
  filter: blur(3px);
  opacity: 0.4;
  pointer-events: none;
  transition: filter 0.3s, opacity 0.3s;
}
.kwk-cm-dialog.blurred .kwk-cb-legal-tooltip.active {
  filter: none !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

.kwk-cm-body {
  padding: 16px 24px;
}

/* Category */
.kwk-cm-category {
  padding: 16px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.kwk-cm-category:last-child { border-bottom: none; }
.kwk-cm-cat-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}
.kwk-cm-cat-title {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 4px;
}
.kwk-cm-cat-desc {
  font-size: 12px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.4);
  max-width: 340px;
}

/* Toggle Switch */
.kwk-cm-toggle {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.kwk-cm-toggle-locked span {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.3);
  white-space: nowrap;
}
.kwk-cm-toggle-locked input { display: none; }

.kwk-cm-switch {
  position: relative;
  width: 42px;
  height: 24px;
  display: inline-block;
}
.kwk-cm-switch input { display: none; }
.kwk-cm-slider {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.3s;
}
.kwk-cm-slider::before {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 18px;
  height: 18px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  transition: transform 0.3s, background 0.3s;
}
.kwk-cm-switch input:checked + .kwk-cm-slider {
  background: rgba(255, 255, 255, 0.15);
}
.kwk-cm-switch input:checked + .kwk-cm-slider::before {
  transform: translateX(18px);
  background: rgba(255, 255, 255, 0.45);
}

/* Modal Footer */
.kwk-cm-footer {
  padding: 16px 24px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  text-align: center;
}
.kwk-cm-footer-main {
  margin-bottom: 16px;
}

#kwkCmStep2 .kwk-cm-footer-main {
  transition: margin-top 0.2s ease;
}
#kwkCmStep2 .kwk-cb-links {
  transition: opacity 0.3s ease;
}

/* Skeleton loader for step2 text buttons */
.kwk-cm-skeleton {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
}
.kwk-cm-skeleton-line {
  height: 10px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.04);
  overflow: hidden;
  position: relative;
}
.kwk-cm-skeleton-line::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.03) 50%, transparent 100%);
  animation: kwkSkelShimmer 1.5s ease-in-out infinite;
}
@keyframes kwkSkelShimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Step 1: Selection buttons */
.kwk-cm-step1-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 24px;
  margin-bottom: 16px;
  align-items: center;
}
.kwk-cm-select-btn {
  width: 100%;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.5);
  transition: all 0.2s;
}
.kwk-cm-select-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.8);
}

/* Read-only toggles + vibrate animation */
.kwk-cm-toggle-readonly {
  cursor: not-allowed;
}
.kwk-cm-toggle-readonly .kwk-cm-switch {
  pointer-events: none;
}
@keyframes kwkToggleShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-3px); }
  40% { transform: translateX(3px); }
  60% { transform: translateX(-2px); }
  80% { transform: translateX(2px); }
}
.kwk-cm-step1-buttons.vibrate .kwk-cm-select-btn {
  animation: kwkToggleShake 0.9s ease-in-out;
  border-color: rgba(141, 90, 59, 0.5);
}
.kwk-cm-step1-buttons.vibrate .kwk-cm-select-btn:nth-child(2) {
  animation-delay: 0.08s;
}
.kwk-cm-step1-buttons.vibrate .kwk-cm-select-btn:nth-child(3) {
  animation-delay: 0.16s;
}

/* Footer legal separator */
.kwk-cm-footer-legal {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 12px;
  margin: 12px -24px 0;
  padding-left: 24px;
  padding-right: 24px;
}
.kwk-cm-footer .kwk-cb-btn-accept {
  width: 100%;
  text-align: center;
  padding: 14px 24px;
  font-size: 15px;
}
.kwk-cm-footer .kwk-cb-btn-accept::after { display: none; }
.kwk-cm-footer .kwk-cb-links {
  margin-top: 0;
}
.kwk-cm-footer .kwk-cb-legal {
  margin-top: 4px;
}

/* Mobile */
@media (max-width: 480px) {
  .kwk-cb-inner { padding: 24px 20px; max-width: 340px; }
  .kwk-cb-text strong { font-size: 16px; }
  .kwk-cm-dialog { width: 95%; }
  .kwk-cm-cat-header { flex-direction: column; gap: 10px; }
  .kwk-cm-cat-desc { max-width: 100%; }
  .kwk-cm-footer { flex-direction: column; }
  .kwk-cm-footer .kwk-cb-links,
  .kwk-cm-footer .kwk-cb-legal {
    flex-direction: column !important;
    align-items: center;
    gap: 0;
  }
  .kwk-cm-footer .kwk-cb-links > .kwk-cb-link-sep { display: none !important; }
  .kwk-cm-footer .kwk-cb-legal-wrap .kwk-cb-link-sep { display: inline !important; }
  .kwk-cm-footer .kwk-cb-link,
  .kwk-cm-footer .kwk-cb-legal a { white-space: nowrap; font-size: 11px; padding: 5px 0; }
  .kwk-cm-footer .kwk-cb-links .kwk-cb-legal-wrap {
    display: contents !important;
  }
  .kwk-cm-select-btn { font-size: 12px !important; padding: 10px 16px !important; }
  .kwk-cm-step1-buttons { gap: 12px !important; margin-top: 20px !important; margin-bottom: 10px !important; }
  .kwk-cm-footer-legal { margin-top: 8px !important; padding-top: 8px !important; }
}
