/* ============================================================
   CHANNEL NEXUS — Cookie Consent Banner
   Brand: Navy #0A2540 | Gold #E4AF3B | Font: Poppins
   Covers: GDPR (EU), CCPA (USA), PIPEDA (Canada) & Global
   ============================================================ */

/* ---------- Overlay backdrop ---------- */
#cnx-cookie-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 21, 37, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 99998;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}
#cnx-cookie-overlay.visible {
  opacity: 1;
  pointer-events: all;
}

/* ---------- Main Banner ---------- */
#cnx-cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 99999;
  font-family: 'Poppins', sans-serif;
  transform: translateY(110%);
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
#cnx-cookie-banner.cnx-visible {
  transform: translateY(0);
}
#cnx-cookie-banner.cnx-hiding {
  transform: translateY(110%);
  transition: transform 0.4s ease-in;
}

.cnx-banner-inner {
  background: linear-gradient(135deg, #0A2540 0%, #0d2d4a 50%, #051525 100%);
  border-top: 3px solid #E4AF3B;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.45);
  padding: 20px 32px;
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.cnx-cookie-icon {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  background: rgba(228, 175, 59, 0.15);
  border: 2px solid rgba(228, 175, 59, 0.4);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.cnx-banner-text {
  flex: 1;
  min-width: 200px;
}
.cnx-banner-text h3 {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  margin: 0 0 4px;
  letter-spacing: 0.2px;
}
.cnx-banner-text p {
  font-size: 13px;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.75);
  margin: 0;
  line-height: 1.6;
}
.cnx-banner-text p a {
  color: #E4AF3B;
  text-decoration: none;
  font-weight: 500;
  border-bottom: 1px solid rgba(228, 175, 59, 0.4);
  transition: border-color 0.2s;
}
.cnx-banner-text p a:hover {
  border-color: #E4AF3B;
}

.cnx-jurisdiction {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.cnx-jurisdiction-flags {
  display: flex;
  gap: 6px;
}
.cnx-flag {
  font-size: 22px;
  line-height: 1;
}
.cnx-jurisdiction-label {
  font-size: 9px;
  color: rgba(255,255,255,0.45);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  text-align: center;
}

.cnx-banner-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.cnx-btn {
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  font-weight: 700;
  padding: 10px 22px;
  border-radius: 6px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.25s ease;
  letter-spacing: 0.3px;
  white-space: nowrap;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.cnx-btn-accept {
  background: #E4AF3B;
  color: #0A2540;
  border-color: #E4AF3B;
}
.cnx-btn-accept:hover {
  background: transparent;
  color: #E4AF3B;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(228, 175, 59, 0.3);
}
.cnx-btn-necessary {
  background: transparent;
  color: rgba(255,255,255,0.8);
  border-color: rgba(255,255,255,0.25);
}
.cnx-btn-necessary:hover {
  border-color: rgba(255,255,255,0.6);
  color: #fff;
  transform: translateY(-2px);
}
.cnx-btn-settings {
  background: transparent;
  color: rgba(228, 175, 59, 0.8);
  border-color: rgba(228, 175, 59, 0.4);
  padding: 10px 16px;
}
.cnx-btn-settings:hover {
  background: rgba(228, 175, 59, 0.1);
  color: #E4AF3B;
  border-color: #E4AF3B;
  transform: translateY(-2px);
}

/* ============================================================
   Preferences Modal
   ============================================================ */
#cnx-cookie-modal {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
#cnx-cookie-modal.cnx-modal-visible {
  opacity: 1;
  pointer-events: all;
}

.cnx-modal-box {
  background: #ffffff;
  border-radius: 16px;
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0,0,0,0.5);
  transform: scale(0.92) translateY(20px);
  transition: transform 0.35s cubic-bezier(0.34, 1.3, 0.64, 1);
  scrollbar-width: thin;
  scrollbar-color: #E4AF3B #f0f0f0;
}
#cnx-cookie-modal.cnx-modal-visible .cnx-modal-box {
  transform: scale(1) translateY(0);
}

.cnx-modal-header {
  background: linear-gradient(135deg, #0A2540, #051525);
  border-radius: 16px 16px 0 0;
  padding: 24px 28px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 3px solid #E4AF3B;
}
.cnx-modal-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}
.cnx-modal-logo-badge {
  width: 44px;
  height: 44px;
  background: rgba(228,175,59,0.15);
  border: 2px solid rgba(228,175,59,0.5);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}
.cnx-modal-header h2 {
  font-size: 17px;
  font-weight: 700;
  color: #ffffff;
  margin: 0 0 2px;
}
.cnx-modal-header p {
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  margin: 0;
}
.cnx-modal-close {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.7);
  border-radius: 8px;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s;
  flex-shrink: 0;
}
.cnx-modal-close:hover {
  background: rgba(228,175,59,0.2);
  color: #E4AF3B;
}

.cnx-jurisdiction-bar {
  background: rgba(228,175,59,0.08);
  border-left: 3px solid #E4AF3B;
  margin: 20px 28px 0;
  padding: 10px 14px;
  border-radius: 0 6px 6px 0;
  font-size: 11.5px;
  color: #0A2540;
  line-height: 1.5;
}
.cnx-jurisdiction-bar strong {
  color: #0A2540;
  font-weight: 700;
}

.cnx-modal-body {
  padding: 20px 28px 28px;
}

.cnx-category {
  border: 1px solid #e5e8ec;
  border-radius: 10px;
  margin-bottom: 12px;
  overflow: hidden;
  transition: border-color 0.2s;
}
.cnx-category:hover {
  border-color: #E4AF3B;
}

.cnx-category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: #f8fafc;
  cursor: pointer;
  user-select: none;
}
.cnx-category-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.cnx-category-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.cnx-cat-necessary .cnx-category-icon { background: rgba(34,197,94,0.15); }
.cnx-cat-analytics .cnx-category-icon { background: rgba(59,130,246,0.15); }
.cnx-cat-marketing .cnx-category-icon { background: rgba(239,68,68,0.12); }
.cnx-cat-preferences .cnx-category-icon { background: rgba(168,85,247,0.12); }

.cnx-category-title {
  font-size: 13.5px;
  font-weight: 700;
  color: #0A2540;
  margin: 0 0 2px;
}
.cnx-category-subtitle {
  font-size: 11px;
  color: #64748b;
  margin: 0;
  font-weight: 400;
}

.cnx-toggle-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.cnx-toggle-required {
  font-size: 10px;
  font-weight: 700;
  color: #22c55e;
  background: rgba(34,197,94,0.1);
  padding: 3px 8px;
  border-radius: 20px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
.cnx-toggle {
  position: relative;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}
.cnx-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.cnx-toggle-slider {
  position: absolute;
  inset: 0;
  background: #d1d5db;
  border-radius: 34px;
  cursor: pointer;
  transition: background 0.3s;
}
.cnx-toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: white;
  border-radius: 50%;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.cnx-toggle input:checked + .cnx-toggle-slider {
  background: #E4AF3B;
}
.cnx-toggle input:checked + .cnx-toggle-slider::before {
  transform: translateX(18px);
}
.cnx-toggle input:disabled + .cnx-toggle-slider {
  background: #22c55e;
  cursor: not-allowed;
}
.cnx-toggle input:disabled + .cnx-toggle-slider::before {
  transform: translateX(18px);
}

.cnx-category-body {
  padding: 0 18px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease, padding 0.35s ease;
}
.cnx-category.expanded .cnx-category-body {
  max-height: 200px;
  padding: 0 18px 14px;
}
.cnx-category-body p {
  font-size: 12px;
  color: #64748b;
  line-height: 1.65;
  margin: 0;
  padding-top: 10px;
  border-top: 1px solid #e5e8ec;
}

.cnx-expand-arrow {
  display: inline-block;
  font-size: 12px;
  color: #64748b;
  margin-left: 6px;
  transition: transform 0.3s ease;
}
.cnx-category.expanded .cnx-expand-arrow {
  transform: rotate(180deg);
}

.cnx-modal-footer {
  padding: 16px 28px 24px;
  display: flex;
  gap: 10px;
  border-top: 1px solid #e5e8ec;
  flex-wrap: wrap;
  align-items: center;
}
.cnx-btn-save-prefs {
  background: #0A2540;
  color: #E4AF3B;
  border: 2px solid #0A2540;
  flex: 1;
  justify-content: center;
}
.cnx-btn-save-prefs:hover {
  background: transparent;
  color: #0A2540;
}
.cnx-btn-accept-all-modal {
  background: #E4AF3B;
  color: #0A2540;
  border: 2px solid #E4AF3B;
  flex: 1;
  justify-content: center;
}
.cnx-btn-accept-all-modal:hover {
  background: transparent;
  color: #E4AF3B;
}

/* ============================================================
   Cookie Re-open FAB
   ============================================================ */
#cnx-cookie-fab {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 9999;
  background: #0A2540;
  color: #E4AF3B;
  border: 2px solid rgba(228,175,59,0.4);
  border-radius: 50px;
  padding: 8px 16px 8px 12px;
  font-family: 'Poppins', sans-serif;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: none;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  transition: all 0.3s ease;
}
#cnx-cookie-fab:hover {
  background: #E4AF3B;
  color: #0A2540;
  border-color: #E4AF3B;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(228,175,59,0.3);
}
#cnx-cookie-fab.cnx-fab-visible {
  display: flex;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 768px) {
  .cnx-banner-inner {
    padding: 16px 20px;
    gap: 16px;
  }
  .cnx-cookie-icon { width: 42px; height: 42px; font-size: 20px; }
  .cnx-jurisdiction { display: none; }
  .cnx-banner-actions {
    width: 100%;
    justify-content: stretch;
  }
  .cnx-btn {
    flex: 1;
    justify-content: center;
    font-size: 12px;
    padding: 9px 12px;
  }
  .cnx-modal-header { padding: 18px 20px 16px; }
  .cnx-modal-body { padding: 16px 20px 20px; }
  .cnx-modal-footer { padding: 14px 20px 20px; }
  .cnx-jurisdiction-bar { margin: 16px 20px 0; }
  #cnx-cookie-fab { bottom: 16px; left: 16px; font-size: 11px; padding: 7px 13px 7px 10px; }
}

@media (max-width: 480px) {
  .cnx-banner-text h3 { font-size: 14px; }
  .cnx-banner-text p { font-size: 12px; }
  .cnx-btn-settings { display: none; }
  .cnx-modal-header h2 { font-size: 15px; }
}
