/**
 * UrduPaper — Cookies Consent banner styles.
 *
 * Values flow through CSS custom properties (--ucc-*) which are written to
 * the page from PHP (inc/cookies-consent.php → upaper_cookies_consent_inline_vars).
 * That keeps this file static + cacheable while colors / fonts stay admin-editable.
 *
 * Layout variants:
 *   .upaper-cc--full-bottom   docked to the bottom of the viewport, full width
 *   .upaper-cc--full-top      docked to the top of the viewport, full width
 *   .upaper-cc--compact-left  card pinned bottom-left
 *   .upaper-cc--compact-right card pinned bottom-right
 *
 * Direction:
 *   .upaper-cc--ltr (English)
 *   .upaper-cc--rtl (Urdu)
 */

/* Hidden until JS opens it — avoids the FOUC of a banner flashing on load. */
.upaper-cc[hidden] {
	display: none;
}

.upaper-cc {
	position: fixed;
	z-index: 99990;
	color: var(--ucc-text, #fff);
	/* !important because the host theme's body { font-family: ... } would
	 * otherwise win the cascade for descendants of <body> (the banner sits in
	 * <body> via the wp_footer hook). The custom property is still admin-
	 * editable from the Typography tab. */
	font-family: var(--ucc-font-family, 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif) !important;
	font-size: var(--ucc-font-size, 14px);
	font-weight: var(--ucc-font-weight, 400);
	line-height: 1.55;
	box-sizing: border-box;
}

/* Body copy elements re-assert font family AND font size so theme rules
 * like `p { font-size: 16px; }` or `button { font-family: ... }` can't
 * punch through the inherited values from .upaper-cc.
 *
 * .upaper-cc__cat-title is split off below because it uses a calc() that's
 * one notch larger than body — flattening it to var() would lose that. */
.upaper-cc .upaper-cc__msg,
.upaper-cc .upaper-cc__cat-desc,
.upaper-cc .upaper-cc__btn {
	font-family: var(--ucc-font-family, inherit) !important;
	font-size: var(--ucc-font-size, 14px) !important;
	font-weight: var(--ucc-font-weight, 400);
}

.upaper-cc .upaper-cc__cat-title {
	font-family: var(--ucc-font-family, inherit) !important;
	font-size: calc(var(--ucc-font-size, 14px) + 1px) !important;
}

/* The theme sets `body { direction: rtl; }` for its Urdu front-end. The
 * banner picks language independently (auto / force_en / force_ur) — so on
 * an RTL page rendering the English copy, descendants still inherit RTL
 * text-align + flex direction unless we force the opposite. The .upaper-cc--ltr
 * / .upaper-cc--rtl classes carry the explicit direction the banner needs,
 * regardless of what the host page is doing. */
.upaper-cc--ltr,
.upaper-cc--ltr * {
	direction: ltr;
}

.upaper-cc--ltr,
.upaper-cc--ltr .upaper-cc__title,
.upaper-cc--ltr .upaper-cc__msg,
.upaper-cc--ltr .upaper-cc__cat-desc,
.upaper-cc--ltr .upaper-cc__modal-header h2 {
	text-align: left;
}

.upaper-cc--rtl,
.upaper-cc--rtl * {
	direction: rtl;
}

.upaper-cc *,
.upaper-cc *::before,
.upaper-cc *::after {
	box-sizing: border-box;
}

/* ------------------------------------------------------------------------
 * Notice (the banner itself)
 * --------------------------------------------------------------------- */

.upaper-cc__notice {
	background: var(--ucc-bg, #121212);
	color: var(--ucc-text, #fff);
	border: 1px solid var(--ucc-border, #2a2a2a);
	box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.15);
	overflow: hidden;
}

.upaper-cc__notice-inner {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 18px 24px;
	padding: 20px 28px;
}

.upaper-cc__icon {
	flex-shrink: 0;
	color: var(--ucc-accent-bg, #f4ac04);
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.upaper-cc__icon svg {
	display: block;
}

.upaper-cc__body {
	flex: 1 1 100px;
	min-width: 0;
}

.upaper-cc__title {
	margin: 0 0 6px;
	padding: 0;
	font-family: var(--ucc-title-family, var(--ucc-font-family, 'Poppins', sans-serif)) !important;
	font-size: var(--ucc-title-size, 18px);
	font-weight: var(--ucc-title-weight, 600);
	line-height: 1.3;
	colo	r: var(--ucc-text, #fff);
}

.upaper-cc__msg {
	margin: 0;
	color: var(--ucc-text, #fff);
	opacity: 0.92;
	line-height: 1.6;
}

.upaper-cc__msg a,
.upaper-cc__policy {
	color: var(--ucc-link, #f4ac04);
	text-decoration: underline;
	text-underline-offset: 2px;
}

.upaper-cc__msg a:hover,
.upaper-cc__policy:hover {
	opacity: 0.85;
}

.upaper-cc__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	flex-shrink: 0;
	align-items: center;
}

/* ------------------------------------------------------------------------
 * Buttons (shared between banner + modal)
 * --------------------------------------------------------------------- */

.upaper-cc__btn {
	appearance: none;
	-webkit-appearance: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 11px 22px;
	border-radius: 999px;
	font-family: inherit;
	font-size: inherit;
	font-weight: 600;
	line-height: 1.2;
	cursor: pointer;
	text-decoration: none;
	transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease, background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
	border: 1px solid transparent;
	white-space: nowrap;
}

.upaper-cc__btn:hover {
	transform: translateY(-1px);
}

.upaper-cc__btn:focus-visible {
	outline: 2px solid var(--ucc-accent-bg, #f4ac04);
	outline-offset: 2px;
}

.upaper-cc__btn--primary {
	background: var(--ucc-accent-bg, #f4ac04);
	color: var(--ucc-accent-text, #121212);
	border-color: var(--ucc-accent-bg, #f4ac04);
}

.upaper-cc__btn--primary:hover {
	box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.upaper-cc__btn--secondary {
	background: var(--ucc-sec-bg, transparent);
	color: var(--ucc-sec-text, #fff) !important;
	border-color: var(--ucc-sec-border, #fff);
}

.upaper-cc__btn--secondary:hover,
.upaper-cc__btn--secondary:focus {
	/* Invert: pill background = the button's normal text color (typically
	 * white on a dark banner), pill text = the banner's main background so
	 * the label stays readable. !important on color so the host theme's
	 * `button:hover { color: ... }` rules can't repaint the label to its
	 * pre-invert colour and make the text disappear into the pill. */
	background: var(--ucc-sec-text, #fff) !important;
	color: var(--ucc-bg, #121212) !important;
	border-color: var(--ucc-sec-text, #fff) !important;
}

/* ------------------------------------------------------------------------
 * Layout: full-width bottom
 * --------------------------------------------------------------------- */

.upaper-cc--full-bottom {
	left: 0;
	right: 0;
	bottom: 0;
}

.upaper-cc--full-bottom .upaper-cc__notice {
	border-left: 0;
	border-right: 0;
	border-bottom: 0;
}

/* ------------------------------------------------------------------------
 * Layout: full-width top
 * --------------------------------------------------------------------- */

.upaper-cc--full-top {
	left: 0;
	right: 0;
	top: 0;
}

.upaper-cc--full-top .upaper-cc__notice {
	border-left: 0;
	border-right: 0;
	border-top: 0;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

/* ------------------------------------------------------------------------
 * Layout: compact card — left / right
 * --------------------------------------------------------------------- */

.upaper-cc--compact-left,
.upaper-cc--compact-right {
	bottom: 24px;
	max-width: 420px;
	width: calc(100% - 32px);
}

.upaper-cc--compact-left  { left: 24px; }
.upaper-cc--compact-right { right: 24px; }

.upaper-cc--compact-left  .upaper-cc__notice,
.upaper-cc--compact-right .upaper-cc__notice {
	border-radius: 14px;
	border: 1px solid var(--ucc-border, #2a2a2a);
	box-shadow: 0 14px 40px rgba(0, 0, 0, 0.25);
}

.upaper-cc--compact-left  .upaper-cc__notice-inner,
.upaper-cc--compact-right .upaper-cc__notice-inner {
	flex-direction: column;
	align-items: stretch;
	gap: 14px;
	padding: 22px 24px;
}

.upaper-cc--compact-left  .upaper-cc__actions,
.upaper-cc--compact-right .upaper-cc__actions {
	width: 100%;
	justify-content: flex-start;
}

.upaper-cc--compact-left  .upaper-cc__btn,
.upaper-cc--compact-right .upaper-cc__btn {
	flex: 1 1 auto;
	min-width: 0;
	padding: 10px 14px;
}
.upaper-cc--compact-left  .upaper-cc__btn:hover,
.upaper-cc--compact-right .upaper-cc__btn:hover {
	color: #ffffff;
}
/* ------------------------------------------------------------------------
 * RTL — Urdu
 *
 * Direction inversion is handled via the `dir="rtl"` attribute set on the
 * root (so flex items reverse automatically). These overrides cover the
 * spacing / borders that don't follow the flex direction.
 * --------------------------------------------------------------------- */

.upaper-cc--rtl {
	text-align: right;
}

.upaper-cc--rtl .upaper-cc__title,
.upaper-cc--rtl .upaper-cc__msg {
	text-align: right;
}

.upaper-cc--rtl.upaper-cc--compact-left,
.upaper-cc--rtl.upaper-cc--compact-right {
	/* Keep the positional intent: "left" still means visually left, even in
	 * RTL pages. Otherwise the card flips when a site loads in Urdu, which is
	 * confusing for an admin who picked "compact-left" on purpose. */
}

/* Title gets a bit of breathing room from the icon on LTR; flip on RTL. */
.upaper-cc--ltr .upaper-cc__msg a:not(:last-child),
.upaper-cc--ltr .upaper-cc__policy {
	margin-left: 4px;
}

.upaper-cc--rtl .upaper-cc__msg a:not(:last-child),
.upaper-cc--rtl .upaper-cc__policy {
	margin-right: 4px;
}

/* ------------------------------------------------------------------------
 * Settings modal (GDPR mode only)
 * --------------------------------------------------------------------- */

.upaper-cc__modal[hidden] {
	display: none;
}

.upaper-cc__modal {
	position: fixed;
	inset: 0;
	z-index: 99991;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
}

.upaper-cc__modal-backdrop {
	position: absolute;
	inset: 0;
	background: var(--ucc-overlay, rgba(0, 0, 0, 0.35));
	backdrop-filter: blur(2px);
}

.upaper-cc__modal-panel {
	position: relative;
	width: 100%;
	max-width: 640px;
	max-height: 88vh;
	background: var(--ucc-bg, #121212);
	color: var(--ucc-text, #fff);
	border-radius: 14px;
	border: 1px solid var(--ucc-border, #2a2a2a);
	box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	animation: ucc-modal-in 0.22s ease;
}

@keyframes ucc-modal-in {
	from { transform: translateY(12px); opacity: 0; }
	to   { transform: translateY(0); opacity: 1; }
}

.upaper-cc__modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 18px 22px;
	border-bottom: 1px solid var(--ucc-border, #2a2a2a);
	gap: 14px;
}

.upaper-cc__modal-header h2 {
	margin: 0;
	padding: 0;
	font-family: var(--ucc-title-family, var(--ucc-font-family, 'Poppins', sans-serif)) !important;
	font-size: var(--ucc-title-size, 18px);
	font-weight: var(--ucc-title-weight, 600);
	color: var(--ucc-text, #fff);
	line-height: 1.2;
}

.upaper-cc__modal-close {
	appearance: none;
	background: transparent;
	border: 0;
	color: var(--ucc-text, #fff);
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
	padding: 4px 10px;
	border-radius: 6px;
	transition: background 0.15s ease;
}

.upaper-cc__modal-close:hover {
	background: rgba(255, 255, 255, 0.1);
}

.upaper-cc__modal-body {
	flex: 1;
	overflow-y: auto;
	padding: 18px 22px;
}

.upaper-cc__modal-footer {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	justify-content: flex-end;
	padding: 14px 22px;
	border-top: 1px solid var(--ucc-border, #2a2a2a);
}

.upaper-cc--rtl .upaper-cc__modal-footer {
	justify-content: flex-start;
}

/* ------------------------------------------------------------------------
 * Category rows (inside the settings modal)
 * --------------------------------------------------------------------- */

.upaper-cc__cat {
	padding: 14px 0;
	border-bottom: 1px dashed var(--ucc-border, #2a2a2a);
}

.upaper-cc__cat:last-child {
	border-bottom: 0;
}

.upaper-cc__cat-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	cursor: pointer;
}

.upaper-cc__cat.is-locked .upaper-cc__cat-head {
	cursor: default;
}

.upaper-cc__cat-title {
	font-weight: 600;
	color: var(--ucc-text, #fff);
	font-size: calc(var(--ucc-font-size, 14px) + 1px);
}

.upaper-cc__cat-desc {
	margin: 8px 0 0;
	color: var(--ucc-muted, #bdbdbd);
	font-size: var(--ucc-font-size, 14px);
	line-height: 1.55;
}

/* iOS-style switch (matches the admin dashboard switch visually) */
.upaper-cc__switch {
	position: relative;
	display: inline-block;
	width: 46px;
	height: 26px;
	flex-shrink: 0;
}

.upaper-cc__switch input {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
}

.upaper-cc__switch-track {
	position: absolute;
	inset: 0;
	cursor: pointer;
	background: #555;
	border-radius: 999px;
	transition: background 0.22s ease;
}

.upaper-cc__switch-track::before {
	content: "";
	position: absolute;
	width: 20px;
	height: 20px;
	left: 3px;
	top: 3px;
	background: #fff;
	border-radius: 50%;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
	transition: transform 0.22s ease;
}

.upaper-cc__switch input:checked + .upaper-cc__switch-track {
	background: var(--ucc-accent-bg, #f4ac04);
}

.upaper-cc__switch input:checked + .upaper-cc__switch-track::before {
	transform: translateX(20px);
}

.upaper-cc__switch input:disabled + .upaper-cc__switch-track {
	opacity: 0.65;
	cursor: not-allowed;
}

/* RTL: the toggle thumb starts on the right and slides left. */
.upaper-cc--rtl .upaper-cc__switch-track::before {
	left: auto;
	right: 3px;
}

.upaper-cc--rtl .upaper-cc__switch input:checked + .upaper-cc__switch-track::before {
	transform: translateX(-20px);
}

/* ------------------------------------------------------------------------
 * Small screens
 *
 * Collapse compact cards to full-width on phones — the 420px card overlaps
 * the viewport otherwise. Stack the inline notice into a vertical layout.
 * --------------------------------------------------------------------- */

@media (max-width: 640px) {
	.upaper-cc--full-bottom,
	.upaper-cc--full-top,
	.upaper-cc--compact-left,
	.upaper-cc--compact-right {
		left: 0;
		right: 0;
		bottom: 0;
		top: auto;
		max-width: none;
		width: 100%;
	}

	.upaper-cc--full-top {
		bottom: auto;
		top: 0;
	}

	.upaper-cc--compact-left .upaper-cc__notice,
	.upaper-cc--compact-right .upaper-cc__notice {
		border-radius: 14px 14px 0 0;
		border-left: 0;
		border-right: 0;
		border-bottom: 0;
	}

	.upaper-cc__notice-inner {
		flex-direction: column;
		align-items: stretch;
		padding: 18px 18px 20px;
		gap: 12px;
	}

	.upaper-cc__actions {
		width: 100%;
	}

	.upaper-cc__btn {
		flex: 1 1 auto;
		justify-content: center;
	}

	.upaper-cc__modal {
		padding: 0;
		align-items: flex-end;
	}

	.upaper-cc__modal-panel {
		max-width: 100%;
		max-height: 92vh;
		border-radius: 14px 14px 0 0;
	}
}

/* ------------------------------------------------------------------------
 * Footer / shortcode trigger — basic styling so it doesn't look orphaned
 * when dropped into a widget area. Authors can override with their own
 * widget CSS or class= attribute on the shortcode.
 * --------------------------------------------------------------------- */

.upaper-cc-trigger {
	cursor: pointer;
	text-decoration: underline;
	text-underline-offset: 2px;
}
