/**
 * Unified Consent Banner Styles
 *
 * @package DPDP_Consent_Banner
 */

/* Overlay */
.dpdp-ub {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
	font-size: 14px;
	line-height: 1.5;
	box-sizing: border-box;
	animation: dpdpUbFadeIn 0.25s ease-out;
}

.dpdp-ub *,
.dpdp-ub *::before,
.dpdp-ub *::after {
	box-sizing: border-box;
}

.dpdp-ub__overlay {
	position: absolute;
	inset: 0;
	background-color: rgba(0, 0, 0, 0.55);
}

/* Dialog card */
.dpdp-ub__dialog {
	position: relative;
	background-color: #ffffff;
	color: #1a1a2e;
	border-radius: 10px;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
	width: 100%;
	max-width: 560px;
	max-height: 90vh;
	display: flex;
	flex-direction: column;
	animation: dpdpUbSlideUp 0.25s ease-out;
	overflow: hidden;
}

/* Header */
.dpdp-ub__header {
	padding: 24px 24px 16px;
	border-bottom: 1px solid #f0f0f0;
	flex-shrink: 0;
}

.dpdp-ub__title {
	margin: 0;
	font-size: 20px;
	font-weight: 700;
	line-height: 1.3;
}

/* Body */
.dpdp-ub__body {
	padding: 20px 24px;
	overflow-y: auto;
	flex: 1;
}

.dpdp-ub__message {
	margin: 0 0 20px 0;
	font-size: 14px;
	opacity: 0.85;
	line-height: 1.6;
}

/* Collapsible DPDP section */
.dpdp-ub__details {
	border: 1px solid #e8e8e8;
	border-radius: 6px;
	margin-bottom: 20px;
}

.dpdp-ub__details-summary {
	padding: 12px 16px;
	cursor: pointer;
	font-weight: 600;
	font-size: 14px;
	color: #1976d2;
	list-style: none;
	display: flex;
	align-items: center;
	gap: 8px;
	user-select: none;
}

.dpdp-ub__details-summary::-webkit-details-marker {
	display: none;
}

.dpdp-ub__details-summary::before {
	content: '▶';
	font-size: 10px;
	transition: transform 0.2s ease;
	flex-shrink: 0;
}

.dpdp-ub__details[open] > .dpdp-ub__details-summary::before {
	transform: rotate(90deg);
}

.dpdp-ub__details-summary:hover {
	background-color: #f5f9ff;
	border-radius: 6px 6px 0 0;
}

.dpdp-ub__details-body {
	padding: 0 16px 16px;
	border-top: 1px solid #f0f0f0;
}

/* Sections */
.dpdp-ub__section {
	margin-top: 16px;
}

.dpdp-ub__section-title {
	margin: 0 0 10px 0;
	font-size: 14px;
	font-weight: 600;
}

.dpdp-ub__purposes-list,
.dpdp-ub__rights-list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.dpdp-ub__purposes-list li,
.dpdp-ub__rights-list li {
	padding: 6px 0 6px 22px;
	position: relative;
	font-size: 13px;
	line-height: 1.5;
	opacity: 0.85;
}

.dpdp-ub__purposes-list li::before {
	content: '✓';
	position: absolute;
	left: 0;
	color: #4caf50;
	font-weight: bold;
}

.dpdp-ub__rights-list li::before {
	content: '→';
	position: absolute;
	left: 0;
	color: #1976d2;
}

/* Cookie section */
.dpdp-ub__cookie-section {
	margin-bottom: 4px;
}

.dpdp-ub__cookie-desc {
	margin: 6px 0 0 0;
	font-size: 13px;
	opacity: 0.75;
}

/* Detailed preferences */
.dpdp-ub__categories {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin: 16px 0 4px;
}

.dpdp-ub__category {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	padding: 10px;
	border-radius: 6px;
	border: 1px solid #f0f0f0;
	cursor: pointer;
	transition: background-color 0.15s ease;
}

.dpdp-ub__category:hover {
	background-color: #f8f9fa;
}

.dpdp-ub__category input[type="checkbox"] {
	margin-top: 2px;
	width: 17px;
	height: 17px;
	min-width: 17px;
	accent-color: #1976d2;
	cursor: pointer;
	flex-shrink: 0;
}

.dpdp-ub__category input[type="checkbox"]:disabled {
	cursor: not-allowed;
	opacity: 0.55;
}

.dpdp-ub__cat-label {
	display: flex;
	flex-direction: column;
	gap: 3px;
	flex: 1;
}

.dpdp-ub__cat-label strong {
	font-size: 13px;
	font-weight: 600;
}

.dpdp-ub__cat-desc {
	font-size: 12px;
	opacity: 0.65;
}

.dpdp-ub__prefs-actions {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin-top: 16px;
}

/* Actions footer */
.dpdp-ub__actions {
	padding: 16px 24px 20px;
	border-top: 1px solid #f0f0f0;
	display: flex;
	flex-direction: column;
	gap: 10px;
	flex-shrink: 0;
}

/* Buttons */
.dpdp-ub__btn {
	padding: 11px 18px;
	border: none;
	border-radius: 5px;
	cursor: pointer;
	font-size: 14px;
	font-weight: 500;
	text-align: center;
	text-decoration: none;
	display: inline-block;
	transition: all 0.18s ease;
	width: 100%;
}

.dpdp-ub__btn--primary {
	background-color: #1976d2;
	color: #ffffff;
}

.dpdp-ub__btn--primary:hover {
	background-color: #1565c0;
}

.dpdp-ub__btn--secondary {
	background-color: #f0f0f0;
	color: #1a1a2e;
	border: 1px solid #ddd;
}

.dpdp-ub__btn--secondary:hover {
	background-color: #e0e0e0;
}

.dpdp-ub__btn--link {
	background: none;
	color: #1976d2;
	padding: 6px 0;
	text-decoration: underline;
	font-weight: 400;
	font-size: 13px;
}

.dpdp-ub__btn--link:hover {
	opacity: 0.75;
}

.dpdp-ub__btn:focus-visible {
	outline: 2px solid #1976d2;
	outline-offset: 2px;
}

/* Animations */
@keyframes dpdpUbFadeIn {
	from { opacity: 0; }
	to   { opacity: 1; }
}

@keyframes dpdpUbSlideUp {
	from { opacity: 0; transform: translateY(24px); }
	to   { opacity: 1; transform: translateY(0); }
}

/* Mobile */
@media (max-width: 600px) {
	.dpdp-ub {
		padding: 0;
		align-items: flex-end;
	}

	.dpdp-ub__dialog {
		border-radius: 14px 14px 0 0;
		max-height: 92vh;
	}
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
	.dpdp-ub__overlay {
		background-color: rgba(0, 0, 0, 0.7);
	}

	.dpdp-ub__dialog {
		background-color: #1e1e2e;
		color: #e0e0e0;
	}

	.dpdp-ub__header {
		border-bottom-color: #333;
	}

	.dpdp-ub__details {
		border-color: #333;
	}

	.dpdp-ub__details-body {
		border-top-color: #333;
	}

	.dpdp-ub__details-summary:hover {
		background-color: rgba(25, 118, 210, 0.1);
	}

	.dpdp-ub__category {
		border-color: #333;
	}

	.dpdp-ub__category:hover {
		background-color: #2a2a3e;
	}

	.dpdp-ub__actions {
		border-top-color: #333;
	}

	.dpdp-ub__btn--secondary {
		background-color: #2a2a3e;
		color: #e0e0e0;
		border-color: #444;
	}

	.dpdp-ub__btn--secondary:hover {
		background-color: #333;
	}

	.dpdp-ub__btn--link {
		color: #64b5f6;
	}
}

@media print {
	.dpdp-ub { display: none !important; }
}
