/* AT Cookie Consent – Front-end Banner */

/* ── CSS Variables (overridden by JS) ── */
:root {
  --at-cc-primary:  #0F172A;
  --at-cc-accent:   #6366F1;
  --at-cc-text:     #334155;
  --at-cc-bg:       #FFFFFF;
  --at-cc-radius:   12px;
  --at-cc-font:     -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --at-cc-shadow:   0 20px 60px rgba(0,0,0,.18), 0 4px 16px rgba(0,0,0,.08);
  --at-cc-border:   rgba(0,0,0,.08);
}

.at-cc-hidden { display: none !important; }

.at-cc-banner, .at-cc-modal, .at-cc-preferences,
.at-cc-banner *, .at-cc-modal *, .at-cc-preferences * { box-sizing: border-box; }
.at-cc-preferences { position: fixed; left: 12px; bottom: 12px; z-index: 99998; display: flex; flex-wrap: wrap; gap: 6px; max-width: calc(100vw - 24px); font-family: var(--at-cc-font); }
.at-cc-reopen { border: 1px solid var(--at-cc-border); border-radius: 6px; padding: 7px 10px; background: var(--at-cc-bg); color: var(--at-cc-primary); box-shadow: 0 2px 8px rgba(0,0,0,.12); font: inherit; font-size: 12px; cursor: pointer; }
.at-cc-banner button:focus-visible, .at-cc-modal button:focus-visible, .at-cc-reopen:focus-visible,
.at-cc-cat-toggle input:focus-visible + .at-cc-cat-toggle__slider { outline: 3px solid var(--at-cc-accent); outline-offset: 3px; }
.at-cc-banner.pos-top.layout-box, .at-cc-banner.pos-top.layout-floating { top: 24px; bottom: auto; }
.at-cc-banner.pos-center.layout-box, .at-cc-banner.pos-center.layout-floating { left: 50%; right: auto; top: 50%; bottom: auto; }

/* ─────────────────────────────────────────────
   BANNER
────────────────────────────────────────────── */
.at-cc-banner {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 99999;
  padding: 16px 20px;
  background: var(--at-cc-bg);
  border-top: 1px solid var(--at-cc-border);
  box-shadow: 0 -4px 24px rgba(0,0,0,.07);
  font-family: var(--at-cc-font);
  color: var(--at-cc-text);
  animation: atCCSlideUp .35s cubic-bezier(.22,1,.36,1) both;
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
}

/* Positions */
.at-cc-banner.pos-bottom { bottom: 0; top: auto; border-top: 1px solid var(--at-cc-border); border-bottom: none; }
.at-cc-banner.pos-top    { top: 0; bottom: auto; border-bottom: 1px solid var(--at-cc-border); border-top: none; animation-name: atCCSlideDown; }
.at-cc-banner.pos-center { top: 50%; left: 50%; right: auto; bottom: auto; transform: translate(-50%,-50%); border-radius: var(--at-cc-radius); border: 1px solid var(--at-cc-border); box-shadow: var(--at-cc-shadow); max-width: 520px; width: calc(100% - 40px); animation: atCCFadeScale .3s cubic-bezier(.22,1,.36,1) both; }

/* Layouts */
.at-cc-banner.layout-bar .at-cc-banner__inner { max-width: 1200px; margin: 0 auto; display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.at-cc-banner.layout-bar .at-cc-banner__content { flex: 1; min-width: 200px; }
.at-cc-banner.layout-bar .at-cc-banner__actions { display: flex; gap: 8px; flex-shrink: 0; flex-wrap: wrap; align-items: center; }

.at-cc-banner.layout-box { max-width: 420px; right: 24px; left: auto; bottom: 24px; border-radius: var(--at-cc-radius); border: 1px solid var(--at-cc-border); box-shadow: var(--at-cc-shadow); }
.at-cc-banner.layout-box .at-cc-banner__inner { display: block; }
.at-cc-banner.layout-box .at-cc-banner__actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

.at-cc-banner.layout-floating { max-width: 480px; right: 24px; left: auto; bottom: 24px; border-radius: 20px; border: 1px solid var(--at-cc-border); box-shadow: var(--at-cc-shadow); padding: 24px; }
.at-cc-banner.layout-floating .at-cc-banner__inner { display: block; }
.at-cc-banner.layout-floating .at-cc-banner__actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }

/* Content */
.at-cc-banner__title { font-size: 15px; font-weight: 700; color: var(--at-cc-primary); margin: 0 0 4px; }
.at-cc-banner__desc  { font-size: 13px; line-height: 1.5; margin: 0; color: var(--at-cc-text); }
.at-cc-banner__links { margin: 6px 0 0; font-size: 12px; }
.at-cc-banner__links a { color: var(--at-cc-accent); text-decoration: none; margin-right: 12px; }
.at-cc-banner__links a:hover { text-decoration: underline; }

/* Close */
.at-cc-close { position: absolute; top: 10px; right: 12px; background: none; border: none; font-size: 22px; cursor: pointer; color: #94A3B8; line-height: 1; padding: 2px 6px; border-radius: 6px; }
.at-cc-close:hover { background: #F1F5F9; color: var(--at-cc-primary); }

/* ── Buttons ── */
.at-cc-btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 9px 18px; border-radius: 8px; font-size: 13px; font-weight: 600;
  cursor: pointer; border: none; transition: all .15s; white-space: nowrap;
  font-family: var(--at-cc-font);
}
.at-cc-btn--accept  { background: var(--at-cc-accent); color: #fff; }
.at-cc-btn--accept:hover  { filter: brightness(1.08); transform: translateY(-1px); }
.at-cc-btn--reject  { background: transparent; border: 1.5px solid var(--at-cc-border); color: var(--at-cc-text); }
.at-cc-btn--reject:hover  { border-color: var(--at-cc-accent); color: var(--at-cc-accent); }
.at-cc-btn--manage  { background: transparent; color: var(--at-cc-accent); font-weight: 500; padding: 9px 12px; text-decoration: underline; }
.at-cc-btn--manage:hover  { opacity: .8; }
.at-cc-btn--save    { background: var(--at-cc-accent); color: #fff; }
.at-cc-btn--save:hover    { filter: brightness(1.08); }

/* ─────────────────────────────────────────────
   MODAL
────────────────────────────────────────────── */
.at-cc-modal { position: fixed; inset: 0; z-index: 100000; font-family: var(--at-cc-font); }
.at-cc-modal__overlay { position: absolute; inset: 0; background: rgba(15,23,42,.5); backdrop-filter: blur(3px); }
.at-cc-modal__box {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  background: var(--at-cc-bg);
  border-radius: calc(var(--at-cc-radius) + 4px);
  box-shadow: var(--at-cc-shadow);
  width: min(540px, calc(100vw - 40px));
  max-height: calc(100vh - 80px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: atCCFadeScale .28s cubic-bezier(.22,1,.36,1) both;
}
.at-cc-modal__header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--at-cc-border); flex-shrink: 0; }
.at-cc-modal__header h2 { font-size: 16px; font-weight: 700; color: var(--at-cc-primary); margin: 0; }
.at-cc-modal__header .at-cc-close { position: static; }
.at-cc-modal__body { flex: 1; overflow-y: auto; padding: 20px 24px; }
.at-cc-modal__footer { display: flex; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--at-cc-border); flex-shrink: 0; justify-content: flex-end; flex-wrap: wrap; }

/* ── Category rows ── */
.at-cc-cat {
  padding: 16px 0;
  border-bottom: 1px solid var(--at-cc-border);
}
.at-cc-cat:last-child { border-bottom: none; }
.at-cc-cat__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.at-cc-cat__desc {
  font-size: 12px;
  line-height: 1.5;
  color: var(--at-cc-text);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  word-break: break-word;
}
.at-cc-cat__desc p {
  margin: 0 0 8px;
}
.at-cc-cat__desc p:last-child {
  margin-bottom: 0;
}
.at-cc-cat__desc table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
  font-size: 12px;
  line-height: 1.4;
  border: 1px solid var(--at-cc-border, #e2e8f0);
}
.at-cc-cat__desc th,
.at-cc-cat__desc td {
  padding: 8px 10px;
  border: 1px solid var(--at-cc-border, #e2e8f0);
  text-align: left;
  vertical-align: top;
}
.at-cc-cat__desc th {
  font-weight: 600;
  color: var(--at-cc-primary);
  background: rgba(0, 0, 0, 0.03);
}
.at-cc-cat__desc a {
  color: var(--at-cc-accent);
  text-decoration: underline;
}
.at-cc-cat__desc a:hover {
  text-decoration: none;
}
.at-cc-cat__lock  { font-size: 11px; font-weight: 600; color: #15803D; background: #DCFCE7; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }

/* ── Toggle ── */
.at-cc-cat-toggle { position: relative; flex-shrink: 0; }
.at-cc-cat-toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.at-cc-cat-toggle__slider { display: block; width: 44px; height: 24px; background: #CBD5E1; border-radius: 999px; cursor: pointer; transition: background .2s; position: relative; }
.at-cc-cat-toggle__slider::after { content:''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; background: #fff; border-radius: 50%; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.at-cc-cat-toggle input:checked + .at-cc-cat-toggle__slider { background: var(--at-cc-accent); }
.at-cc-cat-toggle input:checked + .at-cc-cat-toggle__slider::after { transform: translateX(20px); }
.at-cc-cat-toggle input:disabled + .at-cc-cat-toggle__slider { opacity: .5; cursor: not-allowed; }

/* ─────────────────────────────────────────────
   Animations
────────────────────────────────────────────── */
@keyframes atCCSlideUp   { from { transform: translateY(100%); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes atCCSlideDown { from { transform: translateY(-100%); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes atCCFadeScale { from { opacity: 0; transform: translate(-50%,-50%) scale(.96); } to { opacity: 1; transform: translate(-50%,-50%) scale(1); } }

/* center modal has own transform */
.at-cc-banner.pos-center { animation: atCCFadeScale2 .3s cubic-bezier(.22,1,.36,1) both; }
@keyframes atCCFadeScale2 { from { opacity: 0; transform: translate(-50%,-48%) scale(.97); } to { opacity: 1; transform: translate(-50%,-50%) scale(1); } }

/* ── Mobile ── */
@media (max-width: 600px) {
  .at-cc-banner.layout-box,
  .at-cc-banner.layout-floating { left: 12px; right: 12px; bottom: 12px; max-width: none; }
  .at-cc-banner.layout-bar .at-cc-banner__inner { flex-direction: column; align-items: flex-start; }
  .at-cc-banner.layout-bar .at-cc-banner__actions { width: 100%; }
  .at-cc-modal__box { max-height: calc(100vh - 40px); }
  .at-cc-banner.pos-top.layout-box, .at-cc-banner.pos-top.layout-floating { top: 12px; bottom: auto; }
  .at-cc-banner.pos-center.layout-box, .at-cc-banner.pos-center.layout-floating { left: 50%; right: auto; top: 50%; bottom: auto; width: calc(100% - 24px); }
  .at-cc-banner__actions .at-cc-btn, .at-cc-modal__footer .at-cc-btn { white-space: normal; }
}

@media (prefers-reduced-motion: reduce) {
  .at-cc-banner, .at-cc-modal__box { animation: none; }
  .at-cc-btn, .at-cc-cat-toggle__slider, .at-cc-cat-toggle__slider::after { transition: none; }
}
