:root {
  --sh-primary: #1f6f4a;
  --sh-primary-dark: #175a3c;
  --sh-accent: #f2a900;
  --sh-text: #1c2b24;
  --sh-muted: #5d6b64;
  --sh-bg: #ffffff;
  --sh-line: #e3e9e5;
  --sh-soft: #f4f8f5;
}

/* Consent Gate Backdrop */
#sh-consent-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 30, 22, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 99996;
  display: none;
  opacity: 0;
  transition: opacity 0.25s ease;
}

#sh-consent-backdrop.show {
  display: block;
  opacity: 1;
}

body.sh-consent-locked {
  overflow: hidden !important;
  touch-action: none;
}

/* ---------- Dropdown menu for language switcher ---------- */
.sh-dropdown {
  position: relative;
  display: inline-block;
  flex: none;
}

.sh-dropdown-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #ffffff;
  border: 1.5px solid var(--sh-line);
  border-radius: 99px;
  color: var(--sh-primary-dark);
  font: 600 12.5px system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Malayalam", "Noto Sans Devanagari", "Nirmala UI", sans-serif;
  padding: 6px 14px 6px 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  white-space: nowrap;
  line-height: 1.2;
}

.sh-dropdown-toggle:hover {
  background: var(--sh-soft);
  border-color: var(--sh-primary);
}

.sh-dropdown-toggle:focus-visible {
  outline: 3px solid var(--sh-accent);
  outline-offset: 1px;
}

.sh-dropdown-icon {
  width: 14px;
  height: 14px;
  color: var(--sh-primary);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.sh-dropdown.open .sh-dropdown-icon {
  transform: rotate(180deg);
}

.sh-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 135px;
  background: #ffffff;
  border: 1px solid var(--sh-line);
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(15, 30, 22, 0.18);
  padding: 6px 0;
  margin: 0;
  list-style: none;
  display: none;
  z-index: 100000;
  animation: sh-drop-in 0.18s ease;
}

@keyframes sh-drop-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.sh-dropdown.open .sh-dropdown-menu {
  display: block;
}

.sh-dropdown-menu li {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Malayalam", "Noto Sans Devanagari", "Nirmala UI", sans-serif;
  color: var(--sh-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.12s ease, color 0.12s ease;
  user-select: none;
}

.sh-dropdown-menu li:hover,
.sh-dropdown-menu li:focus {
  background: var(--sh-soft);
  color: var(--sh-primary-dark);
  outline: none;
}

.sh-dropdown-menu li.selected {
  font-weight: 700;
  color: var(--sh-primary);
  background: var(--sh-soft);
}

.sh-dropdown-menu li.selected::after {
  content: "✓";
  font-size: 12px;
  color: var(--sh-primary);
  margin-left: 8px;
  font-weight: 800;
}

/* ---------- Consent notice dialog ---------- */
#sh-consent {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 99998;
  width: min(500px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  background: var(--sh-bg);
  border: 1px solid var(--sh-line);
  border-top: 4px solid var(--sh-primary);
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(10, 25, 18, 0.35);
  padding: 24px 26px 20px;
  display: none;
  animation: sh-modal-pop 0.28s ease;
  box-sizing: border-box;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Malayalam", "Noto Sans Devanagari", "Nirmala UI", sans-serif;
}

#sh-consent.show {
  display: block;
}

/* On privacy policy page: show notice at bottom without locking scroll */
#sh-consent.on-privacy-page {
  top: auto;
  bottom: 24px;
  transform: translateX(-50%);
  box-shadow: 0 12px 40px rgba(10, 25, 18, 0.25);
  animation: sh-up-sheet 0.28s ease;
}

@keyframes sh-modal-pop {
  from {
    opacity: 0;
    transform: translate(-50%, calc(-50% + 14px));
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

@keyframes sh-up-sheet {
  from {
    opacity: 0;
    transform: translate(-50%, 20px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

.sh-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

#sh-consent h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--sh-text);
  line-height: 1.3;
}

#sh-consent p {
  margin: 0 0 16px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--sh-muted);
}

#sh-consent a {
  color: var(--sh-primary);
  font-weight: 600;
  text-decoration: underline;
  transition: color 0.15s;
}

#sh-consent a:hover {
  color: var(--sh-primary-dark);
}

.sh-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.sh-btn {
  flex: 1 1 auto;
  min-width: 100px;
  padding: 10px 16px;
  border-radius: 8px;
  font: 600 13.5px inherit;
  font-family: inherit;
  cursor: pointer;
  border: 1.5px solid var(--sh-primary);
  background: #ffffff;
  color: var(--sh-primary);
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
  text-align: center;
  box-sizing: border-box;
}

.sh-btn:hover {
  background: var(--sh-soft);
}

.sh-btn.primary {
  background: var(--sh-primary);
  color: #ffffff;
}

.sh-btn.primary:hover {
  background: var(--sh-primary-dark);
  border-color: var(--sh-primary-dark);
}

.sh-btn.link {
  border-color: transparent;
  background: none;
  text-decoration: underline;
  flex-basis: 100%;
  padding: 6px;
  color: var(--sh-muted);
  font-weight: 500;
}

.sh-btn.link:hover {
  background: none;
  color: var(--sh-text);
}

.sh-btn:focus-visible,
.sh-switch input:focus-visible + span {
  outline: 3px solid var(--sh-accent);
  outline-offset: 2px;
}

/* ---------- Preferences modal ---------- */
#sh-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 30, 22, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 99999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}

#sh-overlay.show {
  display: flex;
}

#sh-modal {
  background: #ffffff;
  border-radius: 16px;
  width: min(620px, 100%);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  box-sizing: border-box;
  animation: sh-modal-scale 0.22s ease;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Malayalam", "Noto Sans Devanagari", "Nirmala UI", sans-serif;
}

@keyframes sh-modal-scale {
  from {
    opacity: 0;
    transform: scale(0.97) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.sh-head {
  padding: 20px 24px 14px;
  border-bottom: 1px solid var(--sh-line);
  background: #ffffff;
}

.sh-head-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.sh-head h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  color: var(--sh-text);
}

.sh-head p {
  margin: 0;
  font-size: 13px;
  color: var(--sh-muted);
  line-height: 1.55;
}

.sh-head-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sh-close {
  background: none;
  border: 0;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  color: var(--sh-muted);
  height: 32px;
  width: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: background-color 0.15s, color 0.15s;
}

.sh-close:hover {
  background: var(--sh-soft);
  color: var(--sh-text);
}

.sh-close:focus-visible {
  outline: 3px solid var(--sh-accent);
  outline-offset: 1px;
}

.sh-body {
  padding: 8px 24px;
  overflow-y: auto;
}

.sh-cat {
  padding: 16px 0;
  border-bottom: 1px solid var(--sh-line);
}

.sh-cat:last-child {
  border-bottom: 0;
}

.sh-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.sh-row h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--sh-text);
}

.sh-cat p {
  margin: 6px 0 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--sh-muted);
}

.sh-tag {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--sh-primary);
  background: var(--sh-soft);
  padding: 3px 9px;
  border-radius: 99px;
  white-space: nowrap;
}

.sh-switch {
  position: relative;
  width: 46px;
  height: 26px;
  flex: none;
}

.sh-switch input {
  position: absolute;
  opacity: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
  z-index: 1;
}

.sh-switch span {
  position: absolute;
  inset: 0;
  background: #c5cfca;
  border-radius: 99px;
  transition: background-color 0.2s;
}

.sh-switch span::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 20px;
  height: 20px;
  background: #ffffff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.sh-switch input:checked + span {
  background: var(--sh-primary);
}

.sh-switch input:checked + span::after {
  transform: translateX(20px);
}

.sh-foot {
  padding: 14px 24px;
  border-top: 1px solid var(--sh-line);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--sh-soft);
}

/* ---------- Re-open button ---------- */
#sh-reopen {
  position: fixed;
  left: 20px;
  bottom: 20px;
  z-index: 99995;
  display: none;
  background: var(--sh-primary);
  color: #ffffff;
  border: 0;
  border-radius: 99px;
  padding: 9px 16px;
  font: 600 12.5px system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Malayalam", "Noto Sans Devanagari", "Nirmala UI", sans-serif;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s, background-color 0.15s;
  text-decoration: none;
}

#sh-reopen:hover {
  background: var(--sh-primary-dark);
  transform: translateY(-1px);
}

#sh-reopen:focus-visible {
  outline: 3px solid var(--sh-accent);
  outline-offset: 2px;
}

#sh-reopen.show {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

#sh-reopen svg {
  flex-shrink: 0;
}

/* ---------- Responsive adjustments ---------- */
@media (max-width: 480px) {
  #sh-consent {
    width: calc(100vw - 20px);
    padding: 20px 16px 16px;
  }
  #sh-consent.on-privacy-page {
    bottom: 12px;
    width: calc(100vw - 20px);
  }
  .sh-btn {
    flex-basis: 100%;
  }
  .sh-head {
    padding: 16px 18px 12px;
  }
  .sh-body {
    padding: 8px 18px;
  }
  .sh-foot {
    padding: 12px 18px;
  }
  .sh-foot .sh-btn {
    flex-basis: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
