/* =================================================================
   AP Markets · Cookie Consent UI
   ================================================================= */

/* Banner (bottom fixed) */
.consent-banner {
  position: fixed; left: 16px; right: 16px; bottom: 16px;
  z-index: 100;
  background: white;
  border-radius: 16px;
  box-shadow: 0 24px 60px -16px rgba(10, 22, 38, .25);
  border: 1px solid var(--apm-slate-200);
  animation: consent-slide-up .35s ease;
  max-width: 1280px; margin: 0 auto;
}
.consent-banner[hidden] { display: none; }
@keyframes consent-slide-up { from { transform: translateY(120%); opacity: 0; } to { transform: none; opacity: 1; } }

.consent-banner-inner {
  display: grid; grid-template-columns: 1fr auto; gap: 24px;
  align-items: center;
  padding: 22px 26px;
}
@media (max-width: 768px) {
  .consent-banner-inner { grid-template-columns: 1fr; gap: 16px; }
}
.consent-text { color: var(--apm-slate-700); font-size: 13.5px; line-height: 1.55; }
.consent-title { font-size: 15px; font-weight: 800; color: var(--apm-navy); margin-bottom: 4px; letter-spacing: -.01em; }
.consent-text p { margin: 0; }
.consent-text a { color: var(--apm-blue); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.consent-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.consent-actions .btn { padding: 10px 18px; font-size: 13px; }

/* Modal (preferences) */
.consent-modal {
  position: fixed; inset: 0; z-index: 101;
  background: rgba(10, 22, 38, .55);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: consent-fade .2s ease;
}
.consent-modal[hidden] { display: none; }
@keyframes consent-fade { from { opacity: 0; } to { opacity: 1; } }

.consent-modal-card {
  background: white;
  border-radius: 18px;
  max-width: 540px; width: 100%;
  max-height: 88vh;
  overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: 0 30px 60px -10px rgba(10, 22, 38, .45);
  animation: consent-slide-in .25s ease;
}
@keyframes consent-slide-in { from { transform: translateY(8px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }

.consent-modal-head {
  padding: 20px 24px;
  border-bottom: 1px solid var(--apm-slate-200);
  display: flex; align-items: center; justify-content: space-between;
}
.consent-modal-head .consent-title { font-size: 17px; margin: 0; }
.consent-modal-close {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: transparent;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--apm-slate-500); cursor: pointer;
}
.consent-modal-close:hover { background: var(--apm-slate-100); color: var(--apm-navy); }

.consent-modal-body { padding: 6px 24px 20px; overflow-y: auto; flex: 1; }

.consent-category {
  padding: 18px 0;
  border-bottom: 1px solid var(--apm-slate-100);
}
.consent-category:last-child { border-bottom: none; }
.consent-category-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 6px;
}
.consent-category-name { font-size: 14.5px; font-weight: 700; color: var(--apm-navy); }
.consent-category p { font-size: 12.5px; color: var(--apm-slate-500); margin: 0; line-height: 1.55; }
.consent-category-always {
  font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--apm-success);
  padding: 3px 10px; border-radius: 999px;
  background: #D1FAE5;
}

/* Switch (toggle) */
.consent-switch {
  position: relative; display: inline-block;
  width: 40px; height: 22px;
  cursor: pointer;
}
.consent-switch input { opacity: 0; width: 0; height: 0; }
.consent-switch span {
  position: absolute; inset: 0;
  background: var(--apm-slate-300);
  border-radius: 999px;
  transition: background .2s;
}
.consent-switch span::before {
  content: ''; position: absolute;
  top: 3px; left: 3px;
  width: 16px; height: 16px;
  background: white;
  border-radius: 50%;
  transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.18);
}
.consent-switch input:checked + span { background: var(--apm-blue); }
.consent-switch input:checked + span::before { transform: translateX(18px); }

.consent-modal-foot {
  padding: 16px 24px;
  border-top: 1px solid var(--apm-slate-200);
  display: flex; gap: 10px; justify-content: flex-end;
  background: var(--apm-slate-50);
}
@media (max-width: 480px) {
  .consent-modal-foot { flex-direction: column-reverse; }
  .consent-modal-foot .btn { width: 100%; justify-content: center; }
}
