/* Logical properties (inline-start/end) mirror everything automatically in Arabic. */
.itgcc {
	--itgcc-accent: #0a6adb;
	--itgcc-bg: #ffffff;
	--itgcc-bg-2: #f4f5f7;
	--itgcc-text: #3b404c;
	--itgcc-head: #111318;
	--itgcc-line: rgba(17, 19, 24, 0.14);
	font-family: inherit;
	font-size: 15px;
	line-height: 1.55;
	text-align: start;
}

.itgcc--dark,
[data-theme="dark"] .itgcc--auto {
	--itgcc-bg: #16181e;
	--itgcc-bg-2: #1c1f26;
	--itgcc-text: #c4c8d0;
	--itgcc-head: #f5f6f8;
	--itgcc-line: rgba(255, 255, 255, 0.14);
}

.itgcc *,
.itgcc *::before,
.itgcc *::after { box-sizing: border-box; }
.itgcc [hidden] { display: none !important; }

.itgcc .itgcc-title { margin: 0 0 6px; font-size: 18px; font-weight: 600; line-height: 1.3; letter-spacing: -0.01em; color: var(--itgcc-head); }
.itgcc .itgcc-text { margin: 0 0 8px; font-size: 14px; color: var(--itgcc-text); }
.itgcc .itgcc-link { display: inline-block; margin-bottom: 4px; font-size: 14px; font-weight: 600; color: var(--itgcc-accent); text-decoration: underline; text-underline-offset: 3px; }
.itgcc--dark .itgcc-link,
[data-theme="dark"] .itgcc--auto .itgcc-link { color: #5aa3f5; }

/* ---------- Banner ---------- */

.itgcc-banner {
	position: fixed;
	z-index: 100000;
	background: var(--itgcc-bg);
	border: 1px solid var(--itgcc-line);
	border-radius: 12px;
	box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.45);
	padding: 20px;
	max-height: calc(100vh - 24px);
	max-height: calc(100dvh - 24px);
	overflow-y: auto;
	overscroll-behavior: contain;
	animation: itgcc-in 0.35s ease both;
}
.itgcc-banner.is-behind { visibility: hidden; }
.itgcc--box .itgcc-banner { bottom: 16px; inset-inline-start: 16px; width: min(430px, calc(100vw - 32px)); }
.itgcc--box.itgcc--end .itgcc-banner { inset-inline-start: auto; inset-inline-end: 16px; }
.itgcc--bar .itgcc-banner { bottom: 12px; left: 12px; right: 12px; display: flex; gap: 24px; align-items: center; justify-content: space-between; }
.itgcc--bar .itgcc-banner__copy { max-width: 780px; }
.itgcc--bar .itgcc-actions { flex: 0 0 360px; }
.itgcc--popup .itgcc-banner { top: 50%; left: 50%; width: min(520px, calc(100vw - 32px)); transform: translate(-50%, -50%); box-shadow: 0 0 0 100vmax rgba(5, 6, 8, 0.55); animation: none; }

.itgcc-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.itgcc--bar .itgcc-banner .itgcc-actions { margin-top: 0; }

.itgcc .itgcc-btn {
	min-height: 44px;
	margin: 0;
	padding: 10px 14px;
	border: 1px solid var(--itgcc-accent);
	border-radius: 7px;
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.3;
	cursor: pointer;
	transition: filter 0.2s, background-color 0.2s;
}
.itgcc .itgcc-btn--solid { background: var(--itgcc-accent); color: #fff; }
.itgcc .itgcc-btn--solid:hover { filter: brightness(1.12); }
.itgcc .itgcc-btn--line { grid-column: 1 / -1; background: transparent; border-color: var(--itgcc-line); color: var(--itgcc-head); }
.itgcc .itgcc-btn--line:hover { background: var(--itgcc-bg-2); }

.itgcc :focus-visible { outline: 3px solid var(--itgcc-accent); outline-offset: 2px; }
.itgcc .itgcc-banner:focus, .itgcc .itgcc-modal__box:focus { outline: none; }

/* ---------- Preference window ---------- */

html.itgcc-lock, html.itgcc-lock body { overflow: hidden !important; }

.itgcc-modal { position: fixed; inset: 0; z-index: 100001; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(5, 6, 8, 0.62); }
.itgcc-modal__box { display: flex; flex-direction: column; width: min(680px, 100%); max-height: 100%; background: var(--itgcc-bg); border: 1px solid var(--itgcc-line); border-radius: 14px; overflow: hidden; animation: itgcc-in 0.3s ease both; }
.itgcc-modal__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--itgcc-line); }
.itgcc .itgcc-modal__head .itgcc-title { margin: 0; }
.itgcc .itgcc-close { width: 40px; height: 40px; flex: none; margin: 0; padding: 0; border: 1px solid var(--itgcc-line); border-radius: 7px; background: transparent; color: var(--itgcc-head); font-size: 24px; line-height: 1; cursor: pointer; }
.itgcc-modal__body { padding: 16px 20px; overflow-y: auto; overscroll-behavior: contain; }
.itgcc .itgcc-modal__foot { grid-template-columns: 1fr 1fr 1fr; margin: 0; padding: 14px 20px; border-top: 1px solid var(--itgcc-line); }
.itgcc .itgcc-modal__foot .itgcc-btn--line { grid-column: auto; }

.itgcc-gpc { margin: 8px 0; padding: 10px 12px; border-radius: 7px; background: var(--itgcc-bg-2); font-size: 13.5px; color: var(--itgcc-head); }
.itgcc-cat { margin-top: 12px; padding: 14px 16px; border: 1px solid var(--itgcc-line); border-radius: 10px; }
.itgcc-cat__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.itgcc .itgcc-cat h3 { margin: 0; font-size: 15.5px; font-weight: 600; line-height: 1.35; color: var(--itgcc-head); }
.itgcc-always { flex: none; font-size: 12.5px; font-weight: 600; color: var(--itgcc-accent); }
.itgcc--dark .itgcc-always,
[data-theme="dark"] .itgcc--auto .itgcc-always { color: #5aa3f5; }

.itgcc-switch { position: relative; flex: none; width: 46px; height: 26px; margin: 0; cursor: pointer; }
.itgcc-switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.itgcc-switch span { position: absolute; inset: 0; border-radius: 999px; background: #8b919c; transition: background-color 0.2s; }
.itgcc-switch span::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform 0.2s; }
.itgcc-switch input:checked + span { background: var(--itgcc-accent); }
.itgcc-switch input:checked + span::after { transform: translateX(20px); }
.itgcc[dir="rtl"] .itgcc-switch input:checked + span::after { transform: translateX(-20px); }
.itgcc-switch input:focus-visible + span { outline: 3px solid var(--itgcc-accent); outline-offset: 2px; }

.itgcc-details summary { cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--itgcc-head); }
.itgcc .itgcc-none { margin: 8px 0 0; font-size: 13.5px; }
.itgcc .itgcc-table { width: 100%; margin: 10px 0 0; border-collapse: collapse; font-size: 12.5px; color: var(--itgcc-text); }
.itgcc .itgcc-table th, .itgcc .itgcc-table td { padding: 7px 8px; border: 0; border-bottom: 1px solid var(--itgcc-line); text-align: start; vertical-align: top; overflow-wrap: anywhere; }
.itgcc .itgcc-table th { font-weight: 600; color: var(--itgcc-head); }

/* ---------- The button that reopens the choices ---------- */

.itgcc .itgcc-revisit {
	position: fixed;
	z-index: 99990;
	bottom: 18px;
	inset-inline-start: 16px;
	display: flex;
	align-items: center;
	width: 44px;
	height: 44px;
	margin: 0;
	padding: 0 10px;
	overflow: hidden;
	border: 1px solid var(--itgcc-line);
	border-radius: 999px;
	background: var(--itgcc-bg);
	color: var(--itgcc-head);
	box-shadow: 0 10px 26px -10px rgba(0, 0, 0, 0.45);
	font: inherit;
	font-size: 13px;
	font-weight: 600;
	white-space: nowrap;
	cursor: pointer;
	transition: width 0.25s ease;
}
.itgcc.itgcc--end .itgcc-revisit { inset-inline-start: auto; inset-inline-end: 84px; }
.itgcc-revisit svg { flex: none; }
.itgcc-revisit span { padding-inline-start: 8px; opacity: 0; transition: opacity 0.2s; }
@media (hover: hover) {
	.itgcc .itgcc-revisit:hover, .itgcc .itgcc-revisit:focus-visible { width: 200px; }
	.itgcc-revisit:hover span, .itgcc-revisit:focus-visible span { opacity: 1; }
}

@keyframes itgcc-in { from { opacity: 0; translate: 0 14px; } to { opacity: 1; translate: 0 0; } }

/* ---------- Smaller screens ---------- */

@media (max-width: 900px) {
	.itgcc--bar .itgcc-banner { display: block; }
	.itgcc--bar .itgcc-banner .itgcc-actions { margin-top: 12px; }
}

@media (max-width: 600px) {
	.itgcc--box .itgcc-banner, .itgcc--box.itgcc--end .itgcc-banner, .itgcc--bar .itgcc-banner { bottom: 8px; left: 8px; right: 8px; width: auto; max-height: 72vh; max-height: 72dvh; padding: 16px; }
	.itgcc .itgcc-banner .itgcc-text { font-size: 13.5px; }
	.itgcc-modal { padding: 8px; }
	.itgcc .itgcc-modal__foot { grid-template-columns: 1fr 1fr; padding: 12px; }
	.itgcc .itgcc-modal__foot .itgcc-btn--line { grid-column: 1 / -1; }
	.itgcc-modal__head, .itgcc-modal__body { padding-inline: 14px; }
	.itgcc .itgcc-table thead { display: none; }
	.itgcc .itgcc-table tr, .itgcc .itgcc-table td { display: block; }
	.itgcc .itgcc-table tr { padding: 8px 0; border-bottom: 1px solid var(--itgcc-line); }
	.itgcc .itgcc-table td { padding: 2px 0; border: 0; }
	.itgcc .itgcc-table td::before { content: attr(data-label) ": "; font-weight: 600; color: var(--itgcc-head); }
}

@media (prefers-reduced-motion: reduce) {
	.itgcc *, .itgcc *::before, .itgcc *::after { animation: none !important; transition: none !important; }
}

@media print { .itgcc { display: none !important; } }
