/* =========================
   Cookie banner & prefs CSS
   (täiustatud, sobib cookie-script.js-ga)
   ========================= */

/* vaikimisi peidetud bänner */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  background: #111;
  color: #fff;
  padding: 20px;
  font-size: 15px;
  text-align: center;
  z-index: 1000;
  box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.2);
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  overflow: visible;
  display: none;
  transform: translateY(100%);
  opacity: 0;
}

/* nähtav bänner (JS lisab .visible) */
.cookie-banner.visible {
  display: block;
  animation: slideUpIn 360ms cubic-bezier(.2,.9,.2,1) forwards;
  transform: translateY(0);
  opacity: 1;
}

/* Sliding up animation keyframes */
@keyframes slideUpIn {
  0% { transform: translateY(100%); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}
@keyframes slideUpOut {
  0% { transform: translateY(0); opacity: 1; }
  100% { transform: translateY(100%); opacity: 0; }
}

/* Overlay tumedaks taustaks menüü taga.
   Z-index madalam kui banner, kõrgem kui lehe sisu. */
.cookie-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.6);
  z-index: 999; /* < banner (1000) < prefs (1001) */
  display: none;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

/* nähtav overlay */
.cookie-overlay.visible {
  display: block;
  pointer-events: auto;
  opacity: 1;
}

/* Küpsiste eelistuste kast ekraani keskel (vaikimisi peidetud) */
.cookie-preferences {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 600px;
  width: 90%;
  padding: 30px 40px;
  background-color: #2a1e32;
  border-radius: 20px;
  color: #fff;
  box-shadow: 0 0 30px rgba(0,0,0,0.5);
  font-size: 18px;
  line-height: 1.6;
  z-index: 1001;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  transform-origin: center;
  display: block; /* layout element present, visibility controlled by opacity/pointer-events */
}

/* Kui kast avatud (JS lisab .open) */
.cookie-preferences.open {
  opacity: 1 !important;
  pointer-events: auto !important;
  transform: translate(-50%, -50%) scale(1);
}

/* Pealkiri kastis */
.cookie-preferences h3,
.cookie-group legend {
  color: #fff;
  font-weight: 600;
  font-size: 20px;
  margin-bottom: 20px;
}

/* Peida kast slide-up animatsiooniga (lisavõimalus) */
.cookie-preferences.hide {
  animation: slideUpOut 0.32s ease forwards;
}

/* Checkbox toggle grupi stiilid */
.cookie-group {
  margin: 0;
  padding: 0;
  border: none;
}

.cookie-toggle-label {
  display: flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
  margin-top: 12px;
  font-size: 14px;
  color: #eee;
  gap: 10px;
  position: relative;
  justify-content: flex-start;
}

/* Toggle switch stiil */
.toggle-switch {
  width: 34px;
  height: 18px;
  background-color: #555;
  border-radius: 9px;
  position: relative;
  transition: background-color 0.3s;
  flex-shrink: 0;
}

.toggle-switch::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background-color: white;
  border-radius: 50%;
  transition: transform 0.3s;
}

.cookie-toggle-label input[type="checkbox"]:checked + .toggle-switch {
  background-color: #4caf50;
}

.cookie-toggle-label input[type="checkbox"]:checked + .toggle-switch::before {
  transform: translateX(16px);
}

.cookie-toggle-label input[type="checkbox"]:disabled + .toggle-switch {
  background-color: #888;
  cursor: not-allowed;
}

.cookie-toggle-label input[type="checkbox"]:disabled + .toggle-switch::before {
  background-color: #ccc;
}

/* Peida tavaline checkbox */
.cookie-toggle-label input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
}

/* Kirjeldus toggle all */
.cookie-desc {
  margin: 6px 0 12px 44px; /* ruumi vasakul toggle jaoks */
  font-size: 13px;
  color: #bbb;
  line-height: 1.3;
  user-select: none;
}

/* Bänneri nupud ja linkide stiilid */
.cookie-banner button {
  background: #ffffff;
  color: #111;
  padding: 10px 18px;
  border: none;
  border-radius: 6px;
  margin: 0 10px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 500;
  transition: all 0.28s ease;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.cookie-banner button:hover {
  background: #e54eff;
  color: #fff;
  transform: scale(1.03);
}

.cookie-banner .cookie-more {
  background: transparent;
  border: 1px solid #ffffff;
  color: #ffffff;
  padding: 8px 16px;
  margin-left: 12px;
  border-radius: 6px;
  font-size: 14px;
  transition: all 0.3s ease;
}

.cookie-banner .cookie-more:hover {
  background: #ffffff;
  color: #111;
}

.cookie-banner a {
  color: #bbbbbb;
  text-decoration: underline;
  margin-left: 16px;
  font-size: 14px;
  display: inline-block;
  transition: color 0.3s ease;
}

.cookie-banner a:hover {
  color: #ffffff;
}

/* Mobiili jaoks */
@media screen and (max-width: 600px) {
  .cookie-banner {
    padding: 18px 12px;
    font-size: 14px;
  }

  .cookie-banner button,
  .cookie-banner .cookie-more {
    display: block;
    width: 100%;
    margin: 10px 0;
    font-size: 16px;
  }

  .cookie-banner a {
    display: block;
    margin-top: 16px;
    font-size: 13px;
    margin-left: 0;
  }

  .cookie-preferences {
    max-width: 100%;
    margin: 15px 0 0 0;
    padding: 20px;
    border-radius: 12px;
  }

  .cookie-toggle-label {
    font-size: 16px;
    margin-top: 16px;
    gap: 14px;
  }

  .toggle-switch {
    width: 38px;
    height: 20px;
  }

  .toggle-switch::before {
    width: 16px;
    height: 16px;
    top: 2px;
    left: 2px;
  }

  .cookie-desc {
    font-size: 14px;
    margin-left: 50px;
  }
}

/* Cookie policy button — kohandatud plugina stiiliga */
.cookie-banner .cookie-policy-link,
.cookie-policy-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #ffffff;
  color: #111111;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid rgba(0,0,0,0.08);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
  transition: transform 0.16s ease, background 0.16s ease, box-shadow 0.16s ease, color 0.16s ease;
  white-space: nowrap;
}

/* noole-ikoon */
.cookie-banner .cookie-policy-link::after,
.cookie-policy-link::after {
  content: "→";
  display: inline-block;
  margin-left: 6px;
  font-weight: 700;
  transition: transform 0.16s ease;
}

/* hover/focus */
.cookie-banner .cookie-policy-link:hover,
.cookie-policy-link:hover,
.cookie-banner .cookie-policy-link:focus,
.cookie-policy-link:focus {
  background: #e54eff;
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(229,78,255,0.12);
  outline: none;
}

/* a11y focus ring */
.cookie-banner .cookie-policy-link:focus-visible,
.cookie-policy-link:focus-visible {
  box-shadow: 0 0 0 3px rgba(229,78,255,0.16), 0 6px 18px rgba(0,0,0,0.08);
}

/* mobiil */
@media (max-width:600px) {
  .cookie-banner .cookie-policy-link,
  .cookie-policy-link {
    width:100%;
    justify-content:center;
    padding:10px 12px;
  }
  .cookie-policy-link::after { display:none; }
}



/* Save preferences — ID- vs class-variandid */
#saveCookiePreferences,
.saveCookiePreferences {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  min-width: 160px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(180deg,#18c457,#12a846); /* roheline "salvesta" toon */
  color: #ffffff;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(18,168,70,0.18);
  transition: transform 0.14s ease, box-shadow 0.14s ease, filter 0.14s ease;
  white-space: nowrap;
}

/* Väike check-ikoon enne teksti (CSS pseudo) */
#saveCookiePreferences::before,
.saveCookiePreferences::before {
  content: "✓";
  display: inline-block;
  font-weight: 700;
  margin-right: 6px;
  transform: translateY(-1px);
  opacity: 0.95;
  font-size: 14px;
}

/* Hover / active */
#saveCookiePreferences:hover,
.saveCookiePreferences:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(18,168,70,0.22);
  filter: brightness(1.02);
}

#saveCookiePreferences:active,
.saveCookiePreferences:active {
  transform: translateY(0);
  box-shadow: 0 6px 14px rgba(18,168,70,0.18);
}

/* Disabled state */
#saveCookiePreferences[disabled],
.saveCookiePreferences[disabled] {
  opacity: 0.55;
  pointer-events: none;
  transform: none;
  box-shadow: none;
}

/* Focus-visible (A11Y) */
#saveCookiePreferences:focus-visible,
.saveCookiePreferences:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(18,168,70,0.18), 0 6px 14px rgba(18,168,70,0.12);
}

/* Mobiili optimeeritud */
@media (max-width: 600px) {
  #saveCookiePreferences,
  .saveCookiePreferences {
    width: 100%;
    min-width: 0;
    padding: 12px;
    font-size: 16px;
    border-radius: 12px;
  }
  #saveCookiePreferences::before,
  .saveCookiePreferences::before { display: none; } /* säästame ruumi */
}

/* Manage (open) button — outline / subtle action */
#manage-cookies-inline,
.manage-cookies-inline {
  background: yellow;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.18);
  color: black;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  box-shadow: none;
  transition: background 0.18s ease, color 0.18s ease, transform 0.12s ease, box-shadow 0.12s ease;
  white-space: nowrap;
}

/* small icon before text (optional visual hint) */
#manage-cookies-inline::before,
.manage-cookies-inline::before {
  content: "⚙";
  display: inline-block;
  margin-right: 6px;
  font-size: 14px;
  opacity: 0.9;
  transform: translateY(-1px);
}

/* Hover and focus states (contrast + subtle lift) */
#manage-cookies-inline:hover,
.manage-cookies-inline:focus {
  background: rgba(229,78,255,0.12); /* gentle fill using your hover color */
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(229,78,255,0.06);
  outline: none;
}

/* Stronger keyboard-focus ring for accessibility */
#manage-cookies-inline:focus-visible,
.manage-cookies-inline:focus-visible {
  box-shadow: 0 0 0 4px rgba(229,78,255,0.12), 0 6px 18px rgba(0,0,0,0.06);
}

/* Active / pressed state */
#manage-cookies-inline:active,
.manage-cookies-inline:active {
  transform: translateY(0);
  box-shadow: none;
}

/* Disabled state */
#manage-cookies-inline[disabled],
.manage-cookies-inline[disabled] {
  opacity: 0.5;
  pointer-events: none;
}

/* Mobile: make it full-width inside narrow containers */
@media (max-width: 600px) {
  #manage-cookies-inline,
  .manage-cookies-inline {
    display: block;
    width: 100%;
    text-align: center;
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 15px;
  }
  #manage-cookies-inline::before,
  .manage-cookies-inline::before { display: none; }
}


/* Ekraanilugejatele nähtav, visuaalselt peidetud */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Fookusrõngad nuppudele, linkidele ja lülititele */
.cookie-banner button:focus-visible,
.cookie-banner a:focus-visible,
#cookie-preferences button:focus-visible,
.cookie-toggle-label input[type="checkbox"]:focus-visible + .toggle-switch {
  outline: 2px solid #e54eff;
  outline-offset: 3px;
}
