/* ============================= */
/* Overlay для размытия фона */
#overlay {
  position: fixed;
  inset: 0;
  backdrop-filter: blur(6px);
  background: rgba(0, 0, 0, 0.3);
  z-index: 9998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}
#overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* ============================= */
/* Баннер согласия */
#consent-banner {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  width: 90%;
  max-width: 500px;
  background: rgba(255, 255, 255, 0.98);
  padding: 25px;
  border-radius: 20px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 20px;
  text-align: left;
  opacity: 0;
  pointer-events: none;
  transform-origin: center;
  transition: transform 0.5s ease, opacity 0.5s ease;
  color: #555;
}
#consent-banner.active {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  pointer-events: auto;
}

/* Заголовок и описание */
#consent-banner h3 {
  margin: 0;
  font-size: 1.5em;
  font-weight: 700;
}
#consent-banner p {
  margin: 0;
  font-size: 1em;
  color: #555;
}

/* Кнопки баннера */
#consent-banner .btn-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}
#consent-banner button {
  flex: 1 1 45%;
  min-width: 200px;
  padding: 15px 0;
  border: none;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s ease, transform 0.3s ease, opacity 0.3s ease;
}
#accept-btn { background: #4caf50; color: #fff; }
#accept-btn:hover { background: #45a049; }
#reject-btn { background: #f44336; color: #fff; }
#reject-btn:hover { background: #d7372b; }

/* Кнопка Apply всегда видна */
#apply-btn {
  display: inline-block;
  opacity: 0.6;           /* изначально неактивна */
  background: #2196f3;
  color: #fff;
  cursor: not-allowed;
  transition: background 0.3s ease, opacity 0.3s ease, transform 0.3s ease;
}
#apply-btn.show {
  opacity: 1;
  cursor: pointer;
}
#apply-btn.show:hover {
  background: #1976d2;
  transform: translateY(-2px);
}

/* ============================= */
/* Кнопка "Настройки Cookies" вне баннера */
#revoke-page-btn {
  display: none;
  position: fixed;
  bottom: 20px;
  left: 20px;
  padding: 20px 15px;
  border-radius: 8px;
  border: none;
  background: #f44336;
  color: #fff;
  cursor: pointer;
  z-index: 10000;
  transition: background 0.3s ease, transform 0.3s ease;
}
#revoke-page-btn:hover { background: #d7372b; }

/* ============================= */
/* Список метрик */
#metrics-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 10px;
}
.metric-item {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: rgba(0,0,0,0.05);
  padding: 10px 15px;
  border-radius: 15px;
  cursor: pointer;
  transition: background 0.3s ease, transform 0.3s ease;
}
.metric-item:hover { background: rgba(0,0,0,0.1); transform: translateY(-2px); }
.metric-item.required { background: rgba(255,235,59,0.2); cursor: default; }
.metric-item.required input[type="checkbox"] { pointer-events: none; }

.metric-item-header { display: flex; justify-content: space-between; align-items: center; }
.metric-item input[type="checkbox"] { position: absolute; opacity: 0; width: 0; height: 0; }
.metric-item input[type="checkbox"]:disabled + .switch span {
  background-color: #4caf50 !important;
  cursor: not-allowed;
}
.metric-item input[type="checkbox"]:disabled + .switch span::before { transform: translateX(24px); }

/* Переключатель */
.metric-item .switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
}
.metric-item .switch span {
  position: absolute;
  inset: 0;
  cursor: pointer;
  border-radius: 34px;
  background-color: #ccc;
  transition: 0.4s;
}
.metric-item .switch span::before {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  bottom: 3px;
  border-radius: 50%;
  background: #fff;
  transition: 0.4s;
}
.metric-item input:checked + .switch span { background: #4caf50; }
.metric-item input:checked + .switch span::before { transform: translateX(24px); }
.metric-item .switch span:hover { box-shadow: 0 0 5px rgba(0,0,0,0.3); }

/* Подробности метрик */
.metric-details { font-size: 0.85em; color: #666; margin-top: 5px; text-align: left; }

/* ============================= */
/* Прогресс-бар */
#progress-container {
  width: 100%;
  height: 12px;
  background: #ddd;
  border-radius: 12px;
  overflow: hidden;
  margin-top: 15px;
  display: none;
}
#progress-bar {
  height: 100%;
  width: 0;
  background: #4caf50;
  transition: width 0.4s ease;
}

/* ============================= */
/* Адаптивность */
@media (max-width: 600px) {
  #consent-banner {
    height: 90%; 
    width: calc(90% - 30px);
    padding: 20px;
    overflow-y: auto;
  }
  #revoke-page-btn { bottom: 15px; left: 15px; padding: 8px 12px; font-size: 0.9em; }
  #consent-banner button { flex: 1 1 45%; font-size: 0.95em; padding: 5px 0; }
}
@media (max-width: 400px) {
  #consent-banner { width: calc(70% - 20px); padding: 20px; }
  #revoke-page-btn { bottom: 10px; left: 10px; padding: 6px 10px; font-size: 0.8em; }
  #consent-banner button { flex: 1 1 100%; padding: 8px 0; font-size: 0.85em; }
}
