/**
 * DW Cookie Consent — front-end banner styles.
 * Driven by CSS custom properties emitted by the plugin (see inline_css_vars()).
 */

/* Visibility model: hidden by default, shown by adding `.dwcc-show`. */
.dwcc-root { display: none; position: fixed !important; z-index: 2147483646 !important; inset: 0; pointer-events: none; font-family: var(--dwcc-font, inherit); }
.dwcc-root.dwcc-show { display: block !important; visibility: visible !important; opacity: 1 !important; }

/* Overlay */
.dwcc-overlay {
	position: fixed; inset: 0; z-index: 1;
	background: var(--dwcc-overlay-colour, rgba(0,0,0,.5));
	-webkit-backdrop-filter: blur(var(--dwcc-overlay-blur, 0px));
	backdrop-filter: blur(var(--dwcc-overlay-blur, 0px));
	pointer-events: auto;
	animation: dwcc-fade .25s ease;
}

/* Banner shell */
.dwcc-banner {
	position: fixed !important;
	z-index: 999;
	box-sizing: border-box;
	width: min(var(--dwcc-max-width, 420px), calc(100vw - 32px));
	max-height: calc(100vh - 32px);
	overflow: auto;
	background: var(--dwcc-bg, #fff);
	color: var(--dwcc-text, #1a1a1a);
	font-size: var(--dwcc-font-size, 14px);
	line-height: 1.5;
	border: var(--dwcc-border-width, 1px) solid var(--dwcc-border, #e2e2e2);
	border-radius: var(--dwcc-radius, 12px);
	box-shadow: var(--dwcc-shadow, 0 6px 24px rgba(17,24,39,.12));
	padding: var(--dwcc-padding, 24px);
	pointer-events: auto;
	animation: dwcc-slide .3s cubic-bezier(.16,1,.3,1);
}

/* Positions — 9-point grid (box layout) */
.dwcc-pos-top-left      .dwcc-banner { top: 16px; left: 16px; }
.dwcc-pos-top-center    .dwcc-banner { top: 16px; left: 50%; transform: translateX(-50%); }
.dwcc-pos-top-right     .dwcc-banner { top: 16px; right: 16px; }
.dwcc-pos-center-left   .dwcc-banner { top: 50%; left: 16px; transform: translateY(-50%); }
.dwcc-pos-center        .dwcc-banner { top: 50%; left: 50%; transform: translate(-50%, -50%); }
.dwcc-pos-center-right  .dwcc-banner { top: 50%; right: 16px; transform: translateY(-50%); }
.dwcc-pos-bottom-left   .dwcc-banner { bottom: 16px; left: 16px; }
.dwcc-pos-bottom-center .dwcc-banner { bottom: 16px; left: 50%; transform: translateX(-50%); }
.dwcc-pos-bottom-right  .dwcc-banner { bottom: 16px; right: 16px; }

/* Bar layout spans full width, hugging the nearest edge (top vs bottom). */
.dwcc-layout-bar .dwcc-banner {
	width: 100%; max-width: 100%; left: 0; right: 0; border-radius: 0;
	display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px;
	transform: none;
}
.dwcc-layout-bar[class*="dwcc-pos-top"] .dwcc-banner    { top: 0; bottom: auto; transform: none; }
.dwcc-layout-bar[class*="dwcc-pos-bottom"] .dwcc-banner { bottom: 0; top: auto; transform: none; }
.dwcc-layout-bar[class*="dwcc-pos-center"] .dwcc-banner { bottom: 0; top: auto; transform: none; }
.dwcc-layout-bar .dwcc-body { flex: 1 1 320px; }
.dwcc-layout-bar .dwcc-actions { margin-top: 0; }

/* Typography */
.dwcc-title { margin: 0 0 8px; font-size: var(--dwcc-title-size, 18px); font-weight: var(--dwcc-title-weight, 700); color: var(--dwcc-title, #111); }
.dwcc-body { margin: 0 0 14px; }
.dwcc-body p { margin: 0 0 8px; }
.dwcc-link, .dwcc-body a { color: var(--dwcc-link, #1a5fb4); text-decoration: underline; }
.dwcc-policy-links { font-size: .92em; margin-top: 6px; }

/* Buttons */
.dwcc-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.dwcc-btn {
	appearance: none; cursor: pointer; font-family: inherit;
	font-size: var(--dwcc-btn-font-size, 14px); font-weight: var(--dwcc-btn-weight, 600);
	padding: var(--dwcc-btn-padding, 9px 16px); border-style: solid;
	border-width: var(--dwcc-btn-border-width, 1px); line-height: 1.2;
	transition: filter .15s ease, transform .05s ease;
}
.dwcc-btn:hover { filter: brightness(.94); }
.dwcc-btn:active { transform: translateY(1px); }
.dwcc-btn:focus-visible { outline: 2px solid var(--dwcc-link); outline-offset: 2px; }

.dwcc-btn-accept   { background: var(--dwcc-accept-bg); color: var(--dwcc-accept-text); border-color: var(--dwcc-accept-border); border-radius: var(--dwcc-accept-radius); }
.dwcc-btn-deny     { background: var(--dwcc-deny-bg); color: var(--dwcc-deny-text); border-color: var(--dwcc-deny-border); border-radius: var(--dwcc-deny-radius); }
.dwcc-btn-settings { background: var(--dwcc-settings-bg); color: var(--dwcc-settings-text); border-color: var(--dwcc-settings-border); border-radius: var(--dwcc-settings-radius); }
.dwcc-btn-save     { background: var(--dwcc-save-bg); color: var(--dwcc-save-text); border-color: var(--dwcc-save-border); border-radius: var(--dwcc-save-radius); }

.dwcc-close {
	position: absolute; top: 8px; right: 10px; background: none; border: 0;
	font-size: 24px; line-height: 1; cursor: pointer; color: var(--dwcc-close, #1a1a1a); opacity: .6;
}
.dwcc-close:hover { opacity: 1; }

/* Preferences modal — hidden by default, shown with .dwcc-show. */
.dwcc-prefs {
	display: none; position: fixed !important; inset: 0; align-items: center; justify-content: center;
	pointer-events: auto; padding: 16px; z-index: 2147483647 !important;
	background: var(--dwcc-overlay-colour, rgba(0,0,0,.5));
}
.dwcc-prefs.dwcc-show { display: flex !important; }
.dwcc-prefs-inner {
	box-sizing: border-box; width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
	overflow: auto; background: var(--dwcc-bg, #fff); color: var(--dwcc-text);
	border-radius: var(--dwcc-radius, 12px); padding: var(--dwcc-padding, 24px);
	box-shadow: var(--dwcc-shadow); animation: dwcc-slide .3s cubic-bezier(.16,1,.3,1);
	position: relative; /* anchor the close button to THIS window, not the overlay. */
}
/* Reserve room so the title never runs under the absolutely-positioned close. */
.dwcc-prefs-head { display: flex; align-items: flex-start; justify-content: space-between; padding-right: 28px; }
/* Pin the prefs close to the top-right corner of the window (its containing
   block is now .dwcc-prefs-inner). */
.dwcc-prefs .dwcc-close { top: 12px; right: 12px; }

.dwcc-category { padding: 14px 0; border-bottom: 1px solid var(--dwcc-border, #eee); }
.dwcc-category:last-child { border-bottom: 0; }
.dwcc-category-row { display: flex; align-items: center; gap: 12px; }
.dwcc-category-label { font-weight: 600; }
.dwcc-always-on { font-style: normal; font-weight: 500; font-size: .8em; opacity: .65; margin-left: 6px; }
.dwcc-category-desc { margin: 8px 0 0 56px; font-size: .92em; color: var(--dwcc-desc, #5a6472); }
.dwcc-category-note { margin: 4px 0 0 56px; font-size: .85em; font-style: italic; color: var(--dwcc-desc, #5a6472); opacity: .9; }

/* Toggle switch */
.dwcc-switch { position: relative; display: inline-block; width: 44px; height: 24px; flex: 0 0 auto; }
.dwcc-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.dwcc-slider {
	position: absolute; inset: 0; cursor: pointer; background: var(--dwcc-toggle-off, #c9c9c9);
	border-radius: 999px; transition: background .2s ease;
}
.dwcc-slider::before {
	content: ""; position: absolute; height: 18px; width: 18px; left: 3px; top: 3px;
	background: var(--dwcc-toggle-knob, #fff); border-radius: 50%; transition: transform .2s ease;
}
.dwcc-switch input:checked + .dwcc-slider { background: var(--dwcc-toggle-on, #1a5fb4); }
.dwcc-switch input:checked + .dwcc-slider::before { transform: translateX(20px); }
.dwcc-switch input:disabled + .dwcc-slider { opacity: .6; cursor: not-allowed; }

.dwcc-prefs-actions { margin-top: 20px; }

/* Always-visible "Manage consent" tab — fixed bottom-right, forced on top. */
.dwcc-reopen {
	position: fixed !important; bottom: 0 !important; right: 18px !important; z-index: 2147483640 !important;
	display: inline-flex !important; visibility: visible !important; opacity: 1 !important;
	align-items: center; gap: 8px; margin: 0;
	background: var(--dwcc-tab-bg, #2563a8); color: var(--dwcc-tab-text, #fff);
	border: 0; border-radius: 8px 8px 0 0; padding: 8px 14px; font-size: 13px; font-weight: 600;
	cursor: pointer; box-shadow: 0 -2px 14px rgba(0,0,0,.18); line-height: 1.2; width: auto; height: auto;
	transition: transform .15s ease, filter .15s ease;
}
.dwcc-reopen:hover { filter: brightness(.95); transform: translateY(-2px); }
.dwcc-reopen:focus-visible { outline: 2px solid #fff; outline-offset: -4px; }
.dwcc-reopen-icon {
	width: 14px; height: 14px; border-radius: 50%;
	border: 2px solid currentColor; position: relative; flex: 0 0 auto;
}
.dwcc-reopen-icon::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: currentColor; }
@media (max-width: 480px) { .dwcc-reopen-text { display: none; } .dwcc-reopen { right: 12px; padding: 10px; border-radius: 50% 50% 0 0; } }

/* ---------------- Banner shapes ---------------- */
.dwcc-shape-sharp   .dwcc-banner { border-radius: 0; }
.dwcc-shape-rounded .dwcc-banner { border-radius: var(--dwcc-radius, 12px); }
.dwcc-shape-circle  .dwcc-banner {
	border-radius: 50%; aspect-ratio: 1 / 1; display: flex; flex-direction: column;
	align-items: center; justify-content: center; text-align: center; padding: 14%;
	width: min(var(--dwcc-max-width, 420px), calc(100vw - 32px));
}
.dwcc-shape-hexagon .dwcc-banner,
.dwcc-shape-pentagon .dwcc-banner {
	border: 0; border-radius: 0; text-align: center;
}
.dwcc-shape-hexagon .dwcc-banner {
	clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
	padding: 56px 18%;
}
.dwcc-shape-pentagon .dwcc-banner {
	clip-path: polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0% 38%);
	padding: 64px 16% 28px;
}
/* In bar layout, shapes other than rounded/sharp don't apply. */
.dwcc-layout-bar .dwcc-banner { clip-path: none !important; aspect-ratio: auto !important; border-radius: 0 !important; }

@keyframes dwcc-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes dwcc-slide { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.dwcc-pos-center .dwcc-banner { animation: dwcc-fade .25s ease; }

/* Tablet: keep everything, just cap width sensibly. */
@media (max-width: 1024px) {
	.dwcc-layout-box .dwcc-banner { width: min(var(--dwcc-max-width, 420px), calc(100vw - 32px)); }
}

/* Phone: full-width sheet that still honours the chosen vertical anchor. */
@media (max-width: 600px) {
	.dwcc-layout-box .dwcc-banner {
		width: auto; max-width: none; left: 10px; right: 10px;
	}
	/* Top anchors stay at top, bottom at bottom; horizontal centring removed. */
	.dwcc-pos-top-left .dwcc-banner, .dwcc-pos-top-center .dwcc-banner, .dwcc-pos-top-right .dwcc-banner { top: 10px; bottom: auto; transform: none; }
	.dwcc-pos-bottom-left .dwcc-banner, .dwcc-pos-bottom-center .dwcc-banner, .dwcc-pos-bottom-right .dwcc-banner { bottom: 10px; top: auto; transform: none; }
	.dwcc-pos-center-left .dwcc-banner, .dwcc-pos-center .dwcc-banner, .dwcc-pos-center-right .dwcc-banner { top: 50%; bottom: auto; transform: translateY(-50%); }
	/* Decorative shapes are illegible at phone width — fall back to a rounded sheet. */
	.dwcc-shape-circle .dwcc-banner, .dwcc-shape-hexagon .dwcc-banner, .dwcc-shape-pentagon .dwcc-banner {
		aspect-ratio: auto; clip-path: none; border-radius: var(--dwcc-radius, 12px); padding: 18px; width: auto;
	}
	.dwcc-actions .dwcc-btn { flex: 1 1 auto; }
	.dwcc-prefs-inner { padding: 18px; }
	.dwcc-category-desc, .dwcc-category-note { margin-left: 0; }
	.dwcc-category-row { gap: 10px; }
}

@media (prefers-reduced-motion: reduce) {
	.dwcc-banner, .dwcc-prefs-inner, .dwcc-overlay { animation: none; }
}
