/* AE Cookies – banner. Colors come from CSS variables set in the settings. */
.aepc {
	--aepc-primary: #3858e9;
	--aepc-bg: #fff;
	--aepc-text: #1e1e1e;
	--aepc-radius: 12px;
	--aepc-btn-radius: 8px;
	--aepc-shadow: 0 12px 40px rgba(0, 0, 0, .18);
	color: var(--aepc-text);
	font-size: 15px;
	line-height: 1.5;
}
.aepc[hidden], .aepc [hidden], .aepc-float[hidden] { display: none !important; }
.aepc *, .aepc *::before, .aepc *::after { box-sizing: border-box; }

.aepc-backdrop { display: none; position: fixed; inset: 0; z-index: 2147482999; background: rgba(0, 0, 0, .45); }
.aepc--modal.aepc--overlay.is-open .aepc-backdrop,
.aepc.is-prefs .aepc-backdrop { display: block; }

/* ---------- Banner ---------- */
.aepc-banner {
	position: fixed;
	z-index: 2147483000;
	background: var(--aepc-bg);
	color: var(--aepc-text);
	box-shadow: var(--aepc-shadow);
	padding: 18px 20px;
	border-radius: var(--aepc-radius);
}
.aepc-logo { display: block; max-height: 36px; width: auto; margin: 0 0 12px; }
.aepc-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 0 0 6px; }
.aepc-head .aepc-title { margin: 0; }
.aepc-brand { flex: none; font-size: 12px; font-weight: 300; letter-spacing: .02em; color: var(--aepc-primary); text-decoration: none; opacity: .75; }
.aepc-brand:hover { opacity: 1; }
.aepc-prefs__head .aepc-brand { margin-left: auto; }
.aepc-title { margin: 0 0 4px; font-size: 16px; font-weight: 700; line-height: 1.3; color: inherit; }
.aepc-message { margin: 0 0 8px; color: inherit; opacity: .85; font-size: 14px; line-height: 1.45; }
.aepc-links { margin: 0 0 12px; font-size: 12px; }
.aepc-links a { white-space: nowrap; }
.aepc-links a, .aepc-controller a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.aepc-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; }

/* Box in a corner */
.aepc--box-left .aepc-banner, .aepc--box-right .aepc-banner { bottom: 16px; width: min(380px, calc(100% - 32px)); }
.aepc--box-left .aepc-banner { left: 16px; }
.aepc--box-right .aepc-banner { right: 16px; }
/* Caixa e janela: "Minhas opções" como link à esquerda, Rejeitar e Aceitar lado a lado, numa linha só */
.aepc--box-left .aepc-actions, .aepc--box-right .aepc-actions, .aepc--modal .aepc-actions { flex-wrap: nowrap; justify-content: flex-end; }
.aepc--box-left .aepc-btn--link, .aepc--box-right .aepc-btn--link, .aepc--modal .aepc-btn--link { margin-right: auto; padding-left: 0; }

/* Bar fixed at the bottom or top */
.aepc--bar-bottom .aepc-banner, .aepc--bar-top .aepc-banner {
	left: 0; right: 0; border-radius: 0;
	display: grid; grid-template-columns: 1fr auto; column-gap: 32px; align-items: center;
	padding: 18px max(24px, calc((100% - 1200px) / 2));
}
.aepc--bar-bottom .aepc-banner { bottom: 0; }
.aepc--bar-top .aepc-banner { top: 0; }
.aepc--bar-bottom .aepc-banner > :not(.aepc-actions), .aepc--bar-top .aepc-banner > :not(.aepc-actions) { grid-column: 1; }
.aepc--bar-bottom .aepc-actions, .aepc--bar-top .aepc-actions { grid-column: 2; grid-row: 1 / span 4; flex-wrap: nowrap; }
.aepc--bar-bottom .aepc-links, .aepc--bar-top .aepc-links { margin-bottom: 0; }

/* Centered window */
.aepc--modal .aepc-banner { left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(480px, calc(100% - 32px)); max-height: calc(100% - 32px); overflow: auto; padding: 22px 24px; }

/* ---------- Buttons ---------- */
.aepc-btn {
	appearance: none; cursor: pointer; font: inherit; font-weight: 600; font-size: 14px; line-height: 1.2;
	min-height: 40px; padding: 8px 16px; border-radius: var(--aepc-btn-radius);
	border: 1.5px solid var(--aepc-primary); transition: filter .15s, background .15s;
	white-space: nowrap; text-align: center;
}
.aepc-btn--primary { background: var(--aepc-primary); color: #fff; }
.aepc-btn--primary:hover { filter: brightness(.92); }
.aepc-btn--secondary { background: transparent; color: var(--aepc-text); border-color: currentColor; }
.aepc-btn--secondary:hover { background: rgba(127, 127, 127, .1); }
.aepc-btn--link { background: none; border-color: transparent; color: inherit; text-decoration: underline; text-underline-offset: 3px; padding-left: 8px; padding-right: 8px; }
.aepc-btn:focus-visible, .aepc-close:focus-visible, .aepc-float:focus-visible, .aepc-switch input:focus-visible + .aepc-switch__ui { outline: 3px solid var(--aepc-primary); outline-offset: 2px; }

/* ---------- Preferences ---------- */
.aepc-prefs { position: fixed; inset: 0; z-index: 2147483001; display: grid; place-items: center; padding: 16px; }
.aepc-prefs__box {
	background: var(--aepc-bg); color: var(--aepc-text); border-radius: var(--aepc-radius); box-shadow: var(--aepc-shadow);
	width: min(460px, 100%); max-height: min(720px, 100%); display: flex; flex-direction: column; overflow: hidden;
}
/* Título centralizado na cor principal e "X" redondo, como no AdOpt */
.aepc-prefs__head { position: relative; display: flex; align-items: center; justify-content: center; padding: 20px 56px 8px; }
.aepc-prefs__head .aepc-title { margin: 0; font-size: 17px; text-align: center; color: var(--aepc-primary); }
.aepc-close { appearance: none; position: absolute; right: 16px; top: 16px; border: 0; background: var(--aepc-primary); color: #fff; cursor: pointer; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; }
.aepc-close svg { width: 16px; height: 16px; }
.aepc-close:hover { filter: brightness(.92); }
.aepc-prefs__body { padding: 4px 24px 8px; overflow: auto; }
.aepc-prefs__body > .aepc-message { font-size: 13px; text-align: center; }
.aepc-prefs__foot { display: flex; flex-wrap: wrap; gap: 10px; padding: 12px 24px 20px; }
.aepc-prefs__foot .aepc-btn { flex: 1 1 0; }
.aepc-prefs__credit { flex: 1 0 100%; margin: 0 0 2px; text-align: center; font-size: 13px; opacity: .85; }
.aepc-prefs__credit .aepc-brand { font-size: inherit; font-weight: 400; opacity: 1; }
.aepc-cats { list-style: none; margin: 8px 0 0; padding: 0; }
.aepc-cat { padding: 12px 0; }
.aepc-cat + .aepc-cat { border-top: 1px solid rgba(127, 127, 127, .2); }
.aepc-cat__head { display: flex; }
.aepc-cat__name { display: inline-flex; align-items: center; gap: 6px; }
.aepc-cat__icon { flex: none; opacity: .7; }
.aepc-cat__count { font-weight: 700; }
/* "Mostrar mais" abre a lista de serviços da categoria */
.aepc-cat__more > summary { list-style: none; display: inline-flex; align-items: center; gap: 4px; min-height: 32px; cursor: pointer; font-size: 13px; font-weight: 700; }
.aepc-cat__more > summary::-webkit-details-marker, .aepc-service summary::-webkit-details-marker { display: none; }
.aepc-cat__more > summary::after { content: "›"; font-size: 16px; line-height: 1; transition: transform .15s; }
.aepc-cat__more[open] > summary::after { transform: rotate(90deg); }
.aepc-more__close, .aepc-cat__more[open] .aepc-more__open { display: none; }
.aepc-cat__more[open] .aepc-more__close { display: inline; }
.aepc-services { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 8px; }
.aepc-service { position: relative; border: 1px solid rgba(127, 127, 127, .3); border-radius: 10px; }
.aepc-service > details > summary { list-style: none; display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 8px 64px 8px 12px; cursor: pointer; font-size: 14px; }
.aepc-chevron { flex: none; transition: transform .15s; }
.aepc-service details[open] .aepc-chevron { transform: rotate(180deg); }
.aepc-service > .aepc-switch { position: absolute; top: 9px; right: 12px; width: auto; }
.aepc-service > details > .aepc-cookie:last-child { margin-bottom: 12px; }
.aepc-cookie { margin: 0 12px 8px; padding: 10px 12px; border-radius: 6px; background: rgba(127, 127, 127, .12); font-size: 13px; line-height: 1.45; }
.aepc-cookie p { margin: 4px 0 0; }
.aepc-cookie .aepc-cookie__name { margin: 0; font-weight: 700; font-size: 14px; word-break: break-all; }
.aepc-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.aepc-switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; cursor: pointer; font-weight: 700; }
.aepc-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.aepc-switch__ui { position: relative; flex: 0 0 44px; width: 44px; height: 26px; border-radius: 13px; background: rgba(127, 127, 127, .45); transition: background .15s; }
.aepc-switch__ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .15s; }
.aepc-switch input:checked + .aepc-switch__ui { background: var(--aepc-primary); }
.aepc-switch input:checked + .aepc-switch__ui::after { transform: translateX(18px); }
.aepc-switch input:disabled + .aepc-switch__ui { opacity: .55; cursor: not-allowed; }
.aepc-switch--sm .aepc-switch__ui { flex-basis: 40px; width: 40px; height: 24px; }
.aepc-switch--sm .aepc-switch__ui::after { width: 18px; height: 18px; }
.aepc-switch--sm input:checked + .aepc-switch__ui::after { transform: translateX(16px); }
.aepc-cat__desc { margin: 4px 0 0; font-size: 13px; opacity: .85; }
.aepc-controller, .aepc-consent-id { margin: 12px 0 0; font-size: 13px; opacity: .85; }
.aepc-consent-id code { font-size: 12px; word-break: break-all; }

/* ---------- Cookie table (banner and shortcode) ---------- */
.aepc-table { width: 100%; border-collapse: collapse; margin: 8px 0 16px; font-size: 13px; }
.aepc-table th, .aepc-table td { text-align: left; vertical-align: top; padding: 6px 8px; border-bottom: 1px solid rgba(127, 127, 127, .25); }
.aepc-table th { font-weight: 700; }
.aepc-table code { font-size: 12px; word-break: break-all; }
.aepc-open-prefs { cursor: pointer; }

/* ---------- Floating preferences button ---------- */
.aepc-float {
	position: fixed; bottom: 16px; z-index: 2147482998; width: 48px; height: 48px; border-radius: 50%;
	border: 0; cursor: pointer; display: grid; place-items: center;
	background: var(--aepc-primary); color: #fff; box-shadow: 0 6px 18px rgba(0, 0, 0, .2);
}
.aepc-float--left { left: 16px; }
.aepc-float--right { right: 16px; }

/* ---------- Blocked embeds ---------- */
.aepc-placeholder {
	display: grid; place-content: center; gap: 12px; text-align: center; padding: 24px;
	min-height: var(--aepc-ph-h, 315px); background: #f1f1f1; color: #1e1e1e; border-radius: 8px; font-size: 14px;
}
.aepc-placeholder p { margin: 0; max-width: 420px; }
.aepc-placeholder button { justify-self: center; cursor: pointer; font: inherit; font-weight: 600; min-height: 44px; padding: 10px 18px; border-radius: 8px; border: 0; background: #1e1e1e; color: #fff; }

/* ---------- Small screens ---------- */
@media (max-width: 782px) {
	.aepc--bar-bottom .aepc-banner, .aepc--bar-top .aepc-banner { display: block; padding: 16px; }
	/* Celular: tudo numa linha só ("Minhas opções" à esquerda, Rejeitar e Aceitar à direita) para o banner ficar baixo.
	   Em telas muito estreitas quebra sozinho. Seletores com o layout para vencer o nowrap/flex-end da caixa. */
	.aepc .aepc-actions, .aepc--box-left .aepc-actions, .aepc--box-right .aepc-actions, .aepc--modal .aepc-actions,
	.aepc--bar-bottom .aepc-actions, .aepc--bar-top .aepc-actions { flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
	.aepc-actions .aepc-btn--primary, .aepc-actions .aepc-btn--secondary { flex: 1 1 auto; min-height: 38px; padding: 6px 12px; }
	.aepc .aepc-actions .aepc-btn--link { flex: none; margin-right: auto; padding: 6px 4px 6px 0; min-height: 38px; font-size: 13px; }
	.aepc-banner { padding: 14px 16px; }
	.aepc-head { margin-bottom: 2px; }
	.aepc-title { font-size: 15px; }
	.aepc-message { font-size: 13px; margin-bottom: 4px; }
	.aepc-links { margin-bottom: 10px; font-size: 11px; }
	.aepc--box-left .aepc-banner, .aepc--box-right .aepc-banner { left: 8px; right: 8px; bottom: 8px; width: auto; }
	.aepc-prefs { padding: 12px; }
	.aepc-prefs__body { padding: 4px 16px 8px; }
	.aepc-prefs__foot { padding: 12px 16px 16px; }
	.aepc-table thead { display: none; }
	.aepc-table tr { display: block; padding: 6px 0; border-bottom: 1px solid rgba(127, 127, 127, .25); }
	.aepc-table td { display: block; border: 0; padding: 2px 0; }
}

@media (prefers-reduced-motion: reduce) {
	.aepc *, .aepc-float { transition: none !important; }
}

/* ---------- Admin preview: inside the mock window instead of the viewport ---------- */
.aepc--preview .aepc-banner, .aepc--preview .aepc-backdrop, .aepc--preview ~ .aepc-float { position: absolute; }
.aepc--preview .aepc-prefs { position: absolute; display: none; }
.aepc--preview.is-prefs .aepc-prefs { display: grid; }
.aepc--preview.is-prefs .aepc-banner { display: none; }
.aepc--preview.is-prefs .aepc-backdrop { display: block; }
