/* Smart Cookie Consent — Frontend Styles v2.0 */
*,*::before,*::after{box-sizing:border-box}

/* ── Banner ── */
#scc-banner {
  position: fixed;
  z-index: 999999;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: var(--scc-fs, 14px);
  color: var(--scc-text, #1a1a2e);
  background: var(--scc-bg, #fff);
  box-shadow: 0 -4px 32px rgba(0,0,0,.13);
  border-radius: var(--scc-radius, 12px);
  transition: transform .4s cubic-bezier(.22,1,.36,1), opacity .4s ease;
  max-width: 680px;
  width: calc(100% - 32px);
}

/* Positions */
#scc-banner.scc-pos-bottom       { bottom: 16px; left: 50%; transform: translateX(-50%); border-radius: var(--scc-radius,12px); }
#scc-banner.scc-pos-top          { top: 0; left: 0; width: 100%; max-width: 100%; border-radius: 0 0 var(--scc-radius,12px) var(--scc-radius,12px); box-shadow: 0 4px 32px rgba(0,0,0,.13); }
#scc-banner.scc-pos-bottom-left  { bottom: 16px; left: 16px; border-radius: var(--scc-radius,12px); }
#scc-banner.scc-pos-bottom-right { bottom: 16px; right: 16px; border-radius: var(--scc-radius,12px); }
#scc-banner.scc-pos-center       { top: 50%; left: 50%; transform: translate(-50%,-50%); border-radius: var(--scc-radius,12px); }

/* Entry animation */
#scc-banner.scc-animate-in  { animation: sccSlideUp .45s cubic-bezier(.22,1,.36,1) forwards; }
#scc-banner.scc-animate-out { animation: sccSlideDown .35s ease forwards; }

@keyframes sccSlideUp   { from{opacity:0;transform:translateX(-50%) translateY(24px)} to{opacity:1;transform:translateX(-50%) translateY(0)} }
@keyframes sccSlideDown { from{opacity:1;transform:translateX(-50%) translateY(0)}    to{opacity:0;transform:translateX(-50%) translateY(24px)} }

/* For non-center positions */
#scc-banner:not(.scc-pos-bottom).scc-animate-in  { animation: sccFadeIn  .4s ease forwards; }
#scc-banner:not(.scc-pos-bottom).scc-animate-out { animation: sccFadeOut .35s ease forwards; }
@keyframes sccFadeIn  { from{opacity:0;transform:translateY(12px)} to{opacity:1;transform:translateY(0)} }
@keyframes sccFadeOut { from{opacity:1} to{opacity:0} }

/* Center overlay */
#scc-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 999998;
  display: none;
  backdrop-filter: blur(2px);
}
#scc-banner.scc-pos-center ~ #scc-overlay,
#scc-overlay.scc-active { display: block; }

.scc-inner { padding: 20px 24px 18px; position: relative; }

/* Close button */
.scc-close {
  position: absolute; top: 12px; right: 14px;
  z-index: 1; /* FIX: .scc-inner is position:relative and renders after this button,
                  pushing it into a higher stacking layer that swallows click events.
                  z-index:1 ensures the close button always stays on top. */
  background: none; border: none; cursor: pointer;
  font-size: 16px; color: var(--scc-text,#666);
  opacity: .55; padding: 4px 6px; border-radius: 4px; line-height: 1;
  transition: opacity .2s, background .2s;
}
.scc-close:hover { opacity: 1; background: rgba(0,0,0,.06); }

/* Heading */
.scc-heading { margin: 0 0 8px; font-size: 1em; font-weight: 700; color: var(--scc-text,#1a1a2e); }

/* Message */
.scc-message { margin: 0 0 14px; line-height: 1.55; opacity: .85; }
.scc-policy-link { color: var(--scc-btn,#0a7c59); font-weight: 600; text-decoration: none; margin-left: 4px; }
.scc-policy-link:hover { text-decoration: underline; }

/* ── Buttons ── */
.scc-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }

.scc-btn {
  padding: 9px 18px; font-size: .875em; font-weight: 600;
  border-radius: calc(var(--scc-radius,12px) * .6);
  cursor: pointer; border: 2px solid transparent;
  transition: filter .2s, transform .15s, box-shadow .2s;
  white-space: nowrap; line-height: 1.2;
}
.scc-btn:hover { filter: brightness(1.08); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,.15); }
.scc-btn:active { transform: translateY(0); filter: brightness(.96); }
.scc-btn:focus-visible { outline: 3px solid var(--scc-btn,#0a7c59); outline-offset: 2px; }

.scc-btn-accept {
  background: var(--scc-btn,#0a7c59);
  color: var(--scc-btn-text,#fff);
  border-color: var(--scc-btn,#0a7c59);
}
.scc-btn-reject {
  background: transparent;
  color: var(--scc-text,#333);
  border-color: currentColor;
  opacity: .75;
}
.scc-btn-reject:hover { opacity: 1; background: rgba(0,0,0,.04); }
.scc-btn-settings {
  background: transparent;
  color: var(--scc-text,#333);
  border-color: rgba(0,0,0,.18);
  opacity: .8;
}
.scc-btn-settings:hover { opacity: 1; }
.scc-btn-save {
  background: var(--scc-btn,#0a7c59);
  color: var(--scc-btn-text,#fff);
}

/* ── Settings Panel ── */
.scc-settings-panel {
  margin: 12px 0 4px;
  border-top: 1px solid rgba(0,0,0,.08);
  padding-top: 12px;
}
.scc-category {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 8px 0;
  border-bottom: 1px solid rgba(0,0,0,.05);
}
.scc-category:last-child { border-bottom: none; }
.scc-cat-label { flex: 1; cursor: default; }
.scc-cat-name  { display: block; font-weight: 600; font-size: .875em; }
.scc-cat-desc  { display: block; font-size: .78em; opacity: .65; margin-top: 1px; }

/* Toggle Switch */
.scc-toggle-wrap { flex-shrink: 0; }
.scc-toggle { position: absolute; opacity: 0; width: 0; height: 0; }
.scc-toggle-label {
  display: block; width: 42px; height: 24px;
  background: #ccc; border-radius: 24px; cursor: pointer;
  position: relative; transition: background .25s;
}
.scc-toggle-label::after {
  content: ''; position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  background: #fff; border-radius: 50%;
  transition: left .25s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.scc-toggle:checked + .scc-toggle-label { background: var(--scc-btn,#0a7c59); }
.scc-toggle:checked + .scc-toggle-label::after { left: 21px; }
.scc-toggle:disabled + .scc-toggle-label { cursor: not-allowed; opacity: .6; }
.scc-always { font-size: .72em; font-weight: 600; color: var(--scc-btn,#0a7c59); }

/* ── Dark Theme ── */
.scc-theme-dark { box-shadow: 0 -4px 32px rgba(0,0,0,.4); }

/* ── Reopen Button ── */
#scc-reopen {
  position: fixed; bottom: 18px; left: 18px;
  z-index: 999990; width: 44px; height: 44px;
  border-radius: 50%; font-size: 22px; line-height: 1;
  background: var(--scc-bg,#fff);
  border: 2px solid rgba(0,0,0,.1);
  box-shadow: 0 3px 12px rgba(0,0,0,.15);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: transform .2s, box-shadow .2s;
}
#scc-reopen:hover { transform: scale(1.12); box-shadow: 0 6px 18px rgba(0,0,0,.2); }

/* ══════════════════════════════════════════════════════
   RESPONSIVE — TABLET  (≤ 768px)
   ══════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  #scc-banner {
    max-width: 520px;
    font-size: calc(var(--scc-fs, 14px) * 0.97);
  }
  .scc-inner { padding: 18px 20px 16px; }
}

/* ══════════════════════════════════════════════════════
   RESPONSIVE — MOBILE  (≤ 600px)
   All positions collapse to a full-width bottom sheet.
   Center/popup also becomes bottom sheet on phones.
   ══════════════════════════════════════════════════════ */
@media (max-width: 600px) {

  /* ── Base banner: full-width bottom sheet ── */
  #scc-banner {
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    top: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    transform: none !important;
    border-radius: var(--scc-radius, 12px) var(--scc-radius, 12px) 0 0 !important;
    box-shadow: 0 -6px 32px rgba(0,0,0,.18) !important;
    /* Scroll inside if settings panel is open */
    max-height: 80dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    /* Respect notch / home-bar (iOS & Android) */
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  /* Top-bar: keep at top, full-width */
  #scc-banner.scc-pos-top {
    top: 0 !important;
    bottom: auto !important;
    border-radius: 0 0 var(--scc-radius, 12px) var(--scc-radius, 12px) !important;
    box-shadow: 0 6px 32px rgba(0,0,0,.18) !important;
    max-height: 70dvh;
  }

  /* Center mode: hide the overlay on phones, use bottom-sheet instead */
  #scc-overlay { display: none !important; }

  /* ── Inner padding ── */
  .scc-inner { padding: 16px 16px 14px; }

  /* ── Close button — bigger tap target (44×44 min) ── */
  .scc-close {
    top: 10px; right: 10px;
    padding: 8px;
    font-size: 15px;
    min-width: 44px; min-height: 44px;
    display: flex; align-items: center; justify-content: center;
  }

  /* ── Typography ── */
  .scc-heading { font-size: .95em; margin-bottom: 6px; }
  .scc-message { font-size: .875em; margin-bottom: 12px; line-height: 1.5; }

  /* ── Buttons — full-width stacked, 44px touch height ── */
  .scc-buttons { flex-direction: column; gap: 8px; margin-top: 8px; }
  .scc-btn {
    width: 100%; text-align: center;
    min-height: 44px;
    padding: 10px 16px; font-size: .875em;
  }

  /* ── Settings panel ── */
  .scc-settings-panel { margin: 10px 0 6px; padding-top: 10px; }
  .scc-category { gap: 10px; padding: 10px 0; flex-wrap: wrap; }
  .scc-cat-name  { font-size: .85em; }
  .scc-cat-desc  { font-size: .75em; }

  /* Toggle — slightly bigger */
  .scc-toggle-label { width: 46px; height: 26px; }
  .scc-toggle-label::after { width: 20px; height: 20px; }
  .scc-toggle:checked + .scc-toggle-label::after { left: 22px; }

  /* ── Reopen button — above home-bar ── */
  #scc-reopen {
    bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    left: 14px;
    width: 46px; height: 46px; font-size: 21px;
  }

  /* ── Animation: slide up from bottom for all positions ── */
  #scc-banner.scc-animate-in  { animation: sccMobileIn  .4s cubic-bezier(.22,1,.36,1) forwards !important; }
  #scc-banner.scc-animate-out { animation: sccMobileOut .3s ease forwards !important; }
}

@keyframes sccMobileIn  { from{opacity:0;transform:translateY(100%)} to{opacity:1;transform:translateY(0)} }
@keyframes sccMobileOut { from{opacity:1;transform:translateY(0)}    to{opacity:0;transform:translateY(100%)} }

/* ══════════════════════════════════════════════════════
   RESPONSIVE — SMALL PHONES  (≤ 380px)
   iPhone SE, Galaxy A-series, budget Androids
   ══════════════════════════════════════════════════════ */
@media (max-width: 380px) {
  .scc-inner { padding: 14px 12px 12px; }
  #scc-banner { font-size: 13px; }
  .scc-heading { font-size: .9em; }
  .scc-message { font-size: .82em; }
  .scc-btn { font-size: .82em; padding: 9px 12px; }
  .scc-cat-name  { font-size: .82em; }
  .scc-cat-desc  { font-size: .72em; }
  /* Stack category row vertically so toggle doesn't get cramped */
  .scc-category { flex-direction: column; align-items: flex-start; gap: 6px; }
  .scc-toggle-wrap { align-self: flex-end; }
}

/* ══════════════════════════════════════════════════════
   ACCESSIBILITY
   ══════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  #scc-banner, .scc-btn, .scc-toggle-label, #scc-reopen {
    animation: none !important; transition: none !important;
  }
}
