/**
 * ITSWEBER CMS – Consent Banner Styles
 * Theme-independent, loaded globally in all layouts.
 * Phase 6d – Cookie/Consent Management
 *
 * CSS Variables can be overridden per theme in the theme's style.css
 */

/* ── CSS Custom Properties (Theme-able Defaults) ──────────────────────────── */
:root {
    --iw-consent-bg: #ffffff;
    --iw-consent-text: #111827;
    --iw-consent-text-muted: #6b7280;
    --iw-consent-border: #e5e7eb;
    --iw-consent-primary: #15779b;
    --iw-consent-primary-hover: #0d5c7a;
    --iw-consent-primary-text: #ffffff;
    --iw-consent-secondary-bg: #ffffff;
    --iw-consent-secondary-text: #374151;
    --iw-consent-secondary-border: #d1d5db;
    --iw-consent-secondary-hover: #f3f4f6;
    --iw-consent-badge-bg: #e0f2f7;
    --iw-consent-badge-text: #15779b;
    --iw-consent-toggle-active: #15779b;
    --iw-consent-backdrop: rgba(0, 0, 0, 0.45);
    --iw-consent-radius: 12px;
    --iw-consent-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
    --iw-consent-font: inherit;
}

/* ── Backdrop & Layout ────────────────────────────────────────────────────── */
.iw-consent-banner {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 1rem;
  pointer-events: none;
}

.iw-consent-backdrop {
  position: fixed;
  inset: 0;
  background: var(--iw-consent-backdrop);
  pointer-events: all;
}

/* ── Banner Box ───────────────────────────────────────────────────────────── */
.iw-consent-box {
  position: relative;
  z-index: 1;
  background: var(--iw-consent-bg);
  border-radius: var(--iw-consent-radius);
  box-shadow: var(--iw-consent-shadow);
  padding: 2rem 2rem 1.5rem;
  max-width: 560px;
  width: 100%;
  pointer-events: all;
  margin-bottom: 0.5rem;
}

/* ── Logo (optional) ──────────────────────────────────────────────────────── */
.iw-consent-logo {
  margin-bottom: 1.25rem;
  text-align: center;
}

.iw-consent-logo img {
  max-height: 48px;
  width: auto;
}

/* ── Typography ───────────────────────────────────────────────────────────── */
.iw-consent-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--iw-consent-text);
  margin: 0 0 0.75rem;
  line-height: 1.3;
}

.iw-consent-text {
  font-size: 0.875rem;
  color: var(--iw-consent-text-muted);
  margin: 0 0 1.25rem;
  line-height: 1.6;
}

.iw-consent-privacy {
  font-size: 0.75rem;
  color: var(--iw-consent-text-muted);
  text-align: center;
  margin: 1rem 0 0;
}

.iw-consent-privacy a {
  color: var(--iw-consent-text-muted);
  text-decoration: underline;
}

.iw-consent-privacy a:hover {
  color: var(--iw-consent-text);
}

/* ── Categories ───────────────────────────────────────────────────────────── */
.iw-consent-categories {
  border-top: 1px solid var(--iw-consent-border);
  border-bottom: 1px solid var(--iw-consent-border);
  padding: 1rem 0;
  margin-bottom: 1rem;
}

.iw-consent-category {
  margin-bottom: 0.75rem;
}

.iw-consent-category:last-child {
  margin-bottom: 0;
}

.iw-consent-category-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--iw-consent-text);
}

.iw-consent-category-label input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  cursor: pointer;
  accent-color: var(--iw-consent-toggle-active);
}

.iw-consent-category-label input[type="checkbox"]:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.iw-consent-badge {
  margin-left: auto;
  font-size: 0.688rem;
  font-weight: 600;
  color: var(--iw-consent-badge-text);
  background: var(--iw-consent-badge-bg);
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  white-space: nowrap;
}

.iw-consent-category-desc {
  font-size: 0.8125rem;
  color: var(--iw-consent-text-muted);
  margin: 0.25rem 0 0 1.5rem;
  line-height: 1.5;
}

/* ── Action Buttons ───────────────────────────────────────────────────────── */
.iw-consent-actions,
.iw-consent-save-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
}

.iw-consent-save-row {
  margin-top: 0.75rem;
}

.iw-consent-btn {
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  line-height: 1.25;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
}

.iw-consent-btn-primary {
  background: var(--iw-consent-primary);
  color: var(--iw-consent-primary-text);
  border-color: var(--iw-consent-primary);
}

.iw-consent-btn-primary:hover {
  background: var(--iw-consent-primary-hover);
  border-color: var(--iw-consent-primary-hover);
}

.iw-consent-btn-secondary {
  background: var(--iw-consent-secondary-bg);
  color: var(--iw-consent-secondary-text);
  border-color: var(--iw-consent-secondary-border);
}

.iw-consent-btn-secondary:hover {
  background: var(--iw-consent-secondary-hover);
  border-color: var(--iw-consent-text-muted);
}

.iw-consent-btn-ghost {
  background: transparent;
  color: var(--iw-consent-text-muted);
  border-color: transparent;
  padding-left: 0;
  padding-right: 0;
}

.iw-consent-btn-ghost:hover {
  color: var(--iw-consent-text);
  text-decoration: underline;
}

/* ── Body scroll-lock when banner is open ─────────────────────────────────── */
body.iw-consent-open {
  overflow: hidden;
}

/* ── Footer reopen button ─────────────────────────────────────────────────── */
.iw-consent-reopen {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.8125rem;
  color: inherit;
  opacity: 0.65;
  padding: 0;
  text-decoration: underline;
  transition: opacity 0.15s;
}

.iw-consent-reopen:hover {
  opacity: 1;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .iw-consent-box {
    border-radius: 12px 12px 0 0;
    padding: 1.5rem 1.25rem 1.25rem;
    margin-bottom: 0;
    max-width: 100%;
  }

  .iw-consent-banner {
    align-items: flex-end;
    padding: 0;
  }

  .iw-consent-actions {
    flex-direction: column;
  }

  .iw-consent-btn {
    width: 100%;
    text-align: center;
  }

  .iw-consent-btn-ghost {
    width: auto;
    padding-left: 0;
    text-align: left;
  }
}
