/* =========================================================
   Custom GDPR Banner — Frontend Styles
   v2.0.0
========================================================= */

/* CSS variables (defaults — overridden inline by PHP) */
:root {
  --cgb-primary: #4f46e5;
  --cgb-bg: #ffffff;
  --cgb-text: #111111;
  --cgb-radius: 12px;
  --cgb-muted: #6b7280;
  --cgb-border: #e5e7eb;
  --cgb-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
  --cgb-z-banner: 999998;
  --cgb-z-modal: 999999;
}

/* =========================
   BANNER WRAPPER
========================= */
#cgb-banner {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 960px;
  z-index: var(--cgb-z-banner);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
  animation: cgbSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.cgb-position-bottom #cgb-banner { bottom: 16px; }
.cgb-position-top #cgb-banner    { top: 16px; }

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

/* Layout: popup (corner card) */
.cgb-layout-popup #cgb-banner {
  left: auto;
  right: 16px;
  transform: none;
  max-width: 380px;
  width: calc(100% - 32px);
}
.cgb-layout-popup.cgb-position-bottom #cgb-banner { bottom: 16px; }
.cgb-layout-popup.cgb-position-top #cgb-banner    { top: 16px; }

@keyframes cgbSlideInPopup {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
.cgb-layout-popup #cgb-banner { animation-name: cgbSlideInPopup; }

/* Layout: modal (centered overlay) */
.cgb-layout-modal #cgb-banner {
  top: 50%;
  bottom: auto;
  transform: translate(-50%, -50%);
  max-width: 520px;
}
.cgb-layout-modal #cgb-banner::before {
  content: '';
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: -1;
}
.cgb-layout-modal .cgb-container { flex-direction: column; align-items: stretch; }
.cgb-layout-modal .cgb-text { max-width: 100%; }
.cgb-layout-modal .cgb-buttons { justify-content: flex-end; }

/* =========================
   MAIN CONTAINER
========================= */
.cgb-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  background: var(--cgb-bg);
  color: var(--cgb-text);
  padding: 18px 22px;
  border-radius: var(--cgb-radius);
  box-shadow: var(--cgb-shadow);
  border: 1px solid var(--cgb-border);
}

.cgb-layout-popup .cgb-container {
  flex-direction: column;
  align-items: stretch;
}

/* =========================
   TEXT
========================= */
.cgb-text {
  flex: 1;
  min-width: 0;
}

.cgb-text strong {
  display: block;
  margin-bottom: 6px;
  font-size: 16px;
  font-weight: 600;
  color: var(--cgb-text);
}

.cgb-text p {
  font-size: 13.5px;
  color: var(--cgb-muted);
  margin: 0 0 4px;
  line-height: 1.5;
}

.cgb-privacy-link {
  display: inline-block;
  margin-top: 6px;
  font-size: 13px;
  color: var(--cgb-primary);
  text-decoration: underline;
}
.cgb-privacy-link:hover { opacity: 0.85; }

/* =========================
   BUTTONS
========================= */
.cgb-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.cgb-buttons button,
.cgb-modal-actions button {
  padding: 10px 18px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  font-size: 13.5px;
  font-family: inherit;
  transition: all 0.15s ease;
  border: 1px solid transparent;
  line-height: 1.2;
  white-space: nowrap;
}

.cgb-primary {
  background: var(--cgb-primary);
  color: #fff;
  border-color: var(--cgb-primary);
}
.cgb-primary:hover { filter: brightness(0.92); }
.cgb-primary:active { transform: translateY(1px); }

.cgb-outline {
  background: transparent;
  border-color: var(--cgb-border);
  color: var(--cgb-text);
}
.cgb-outline:hover { background: rgba(0, 0, 0, 0.04); }

.cgb-buttons button:focus-visible,
.cgb-modal-actions button:focus-visible {
  outline: 2px solid var(--cgb-primary);
  outline-offset: 2px;
}

/* =========================
   PREFERENCES MODAL
========================= */
#cgb-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--cgb-z-modal);
  padding: 20px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  animation: cgbFadeIn 0.2s ease;
}

@keyframes cgbFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.cgb-modal-box {
  background: #fff;
  padding: 28px;
  border-radius: var(--cgb-radius);
  width: 460px;
  max-width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.25);
  animation: cgbModalIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes cgbModalIn {
  from { opacity: 0; transform: translateY(15px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.cgb-modal-box h2 {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 600;
  color: var(--cgb-text);
}

.cgb-modal-box > p {
  margin: 0 0 20px;
  font-size: 14px;
  color: var(--cgb-muted);
  line-height: 1.5;
}

/* =========================
   OPTION ROWS
========================= */
.cgb-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--cgb-border);
}
.cgb-option:last-of-type { border-bottom: none; }

.cgb-option-label { flex: 1; min-width: 0; }
.cgb-option-title {
  display: block;
  font-weight: 600;
  font-size: 14px;
  color: var(--cgb-text);
  margin-bottom: 2px;
}
.cgb-option-desc {
  display: block;
  font-size: 12.5px;
  color: var(--cgb-muted);
  line-height: 1.4;
}

/* =========================
   TOGGLE SWITCH
========================= */
.cgb-toggle {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
  cursor: pointer;
}
.cgb-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.cgb-slider {
  position: absolute;
  inset: 0;
  background: #d1d5db;
  border-radius: 999px;
  transition: background 0.2s ease;
}
.cgb-slider::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
.cgb-toggle input:checked + .cgb-slider { background: var(--cgb-primary); }
.cgb-toggle input:checked + .cgb-slider::before { transform: translateX(18px); }
.cgb-toggle input:disabled + .cgb-slider { opacity: 0.55; cursor: not-allowed; }
.cgb-toggle input:focus-visible + .cgb-slider {
  outline: 2px solid var(--cgb-primary);
  outline-offset: 2px;
}

/* =========================
   MODAL ACTIONS
========================= */
.cgb-modal-actions {
  margin-top: 24px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.cgb-modal-actions button { flex: 0 1 auto; }

/* =========================
   REOPEN BUTTON (floating)
========================= */
#cgb-reopen {
  position: fixed;
  bottom: 16px;
  background: var(--cgb-primary);
  color: #fff;
  border: none;
  padding: 10px 14px;
  font-size: 12.5px;
  font-weight: 500;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  border-radius: 999px;
  cursor: pointer;
  z-index: var(--cgb-z-banner);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
#cgb-reopen:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22); }
#cgb-reopen[data-position="bottom-left"]  { left: 16px; }
#cgb-reopen[data-position="bottom-right"] { right: 16px; }

/* =========================
   MOBILE
========================= */
@media (max-width: 640px) {
  .cgb-container {
    flex-direction: column;
    align-items: stretch;
    padding: 16px;
    gap: 14px;
  }
  .cgb-text { max-width: 100%; }
  .cgb-buttons {
    width: 100%;
    flex-direction: column;
  }
  .cgb-buttons button { width: 100%; text-align: center; }
  .cgb-modal-box { padding: 22px; }
  .cgb-modal-actions { flex-direction: column-reverse; }
  .cgb-modal-actions button { width: 100%; }
}

/* =========================
   REDUCED MOTION
========================= */
@media (prefers-reduced-motion: reduce) {
  #cgb-banner,
  #cgb-modal,
  .cgb-modal-box,
  #cgb-reopen,
  .cgb-slider,
  .cgb-slider::before {
    animation: none !important;
    transition: none !important;
  }
}
