/* =========================================================
   PrediCookies – Frontend Styles
   ========================================================= */

:root {
	--pc-color: #2c3e50;
	--pc-color-light: #3d5166;
	--pc-white: #ffffff;
	--pc-radius: 8px;
	--pc-shadow: 0 4px 24px rgba(0,0,0,0.15);
	--pc-z: 999999;
	--pc-transition: 0.3s ease;
}

/* ─── Reset interno ────────────────────────────────────── */

#pc-banner *,
#pc-widget *,
#pc-panel * {
	box-sizing: border-box;
}

/* ─── Banner ───────────────────────────────────────────── */

#pc-banner {
	position: fixed;
	bottom: 0;
	left: 0;
	right: 0;
	z-index: var(--pc-z);
	background: var(--pc-white);
	border-top: 3px solid var(--pc-color);
	box-shadow: 0 -4px 20px rgba(0,0,0,0.12);
	padding: 16px 20px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	font-size: 14px;
	line-height: 1.5;
	animation: pcSlideUp 0.4s ease;
}

@keyframes pcSlideUp {
	from { transform: translateY(100%); opacity: 0; }
	to   { transform: translateY(0);    opacity: 1; }
}

.pc-banner-inner {
	max-width: 1200px;
	margin: 0 auto;
	display: flex;
	align-items: flex-start;
	gap: 16px;
	flex-wrap: wrap;
}

.pc-banner-icon {
	flex-shrink: 0;
	color: var(--pc-color);
	padding-top: 2px;
}

.pc-banner-content {
	flex: 1;
	min-width: 200px;
}

.pc-banner-text {
	margin: 0 0 8px 0;
	color: #333;
}

.pc-banner-links {
	display: flex;
	gap: 12px;
	flex-wrap: wrap;
}

.pc-banner-links a {
	color: var(--pc-color);
	font-size: 12px;
	text-decoration: underline;
}

.pc-banner-actions {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
	flex-shrink: 0;
}

/* ─── Botones ──────────────────────────────────────────── */

.pc-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 10px 18px;
	border-radius: var(--pc-radius);
	font-family: inherit;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	border: 2px solid transparent;
	transition: background var(--pc-transition), color var(--pc-transition);
	white-space: nowrap;
	text-decoration: none;
}

.pc-btn-primary {
	background: var(--pc-color);
	color: var(--pc-white);
	border-color: var(--pc-color);
}

.pc-btn-primary:hover {
	background: var(--pc-color-light);
	border-color: var(--pc-color-light);
}

.pc-btn-secondary {
	background: transparent;
	color: var(--pc-color);
	border-color: var(--pc-color);
}

.pc-btn-secondary:hover {
	background: rgba(44,62,80,0.08);
}

.pc-btn-outline {
	background: transparent;
	color: #555;
	border-color: #ccc;
}

.pc-btn-outline:hover {
	background: #f5f5f5;
	border-color: #999;
}

.pc-btn-full {
	width: 100%;
}

/* ─── Widget lateral ───────────────────────────────────── */

#pc-widget {
	position: fixed;
	top: 50%;
	left: 0;
	transform: translateY(-50%);
	z-index: var(--pc-z);
	transition: left var(--pc-transition);
}

#pc-widget.pc-pos-right {
	left: auto;
	right: 0;
}

#pc-widget-btn {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	padding: 12px 8px;
	background: var(--pc-color);
	color: var(--pc-white);
	border: none;
	border-radius: 0 6px 6px 0;
	cursor: pointer;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	font-size: 10px;
	font-weight: 600;
	letter-spacing: 0.5px;
	text-transform: uppercase;
	box-shadow: 2px 2px 8px rgba(0,0,0,0.2);
	transition: background var(--pc-transition), transform var(--pc-transition);
}

#pc-widget-btn:hover {
	background: var(--pc-color-light);
	transform: translateX(3px);
}

#pc-widget.pc-pos-right #pc-widget-btn {
	border-radius: 6px 0 0 6px;
}

#pc-widget.pc-pos-right #pc-widget-btn:hover {
	transform: translateX(-3px);
}

.pc-widget-label {
	writing-mode: vertical-rl;
	text-orientation: mixed;
}

/* ─── Panel deslizante ─────────────────────────────────── */

#pc-panel {
	position: fixed;
	inset: 0;
	z-index: calc(var(--pc-z) + 1);
	visibility: hidden;
}

#pc-panel.pc-panel-open {
	visibility: visible;
}

.pc-panel-overlay {
	position: absolute;
	inset: 0;
	background: rgba(0,0,0,0.5);
	opacity: 0;
	transition: opacity var(--pc-transition);
}

#pc-panel.pc-panel-open .pc-panel-overlay {
	opacity: 1;
}

.pc-panel-drawer {
	position: absolute;
	top: 0;
	left: 0;
	bottom: 0;
	width: min(420px, 100vw);
	background: var(--pc-white);
	box-shadow: var(--pc-shadow);
	transform: translateX(-100%);
	transition: transform var(--pc-transition);
	display: flex;
	flex-direction: column;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	font-size: 14px;
}

#pc-panel.pc-pos-right .pc-panel-drawer {
	left: auto;
	right: 0;
	transform: translateX(100%);
}

#pc-panel.pc-panel-open .pc-panel-drawer {
	transform: translateX(0);
}

/* ─── Panel: Header ────────────────────────────────────── */

.pc-panel-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px 20px;
	background: var(--pc-color);
	color: var(--pc-white);
	flex-shrink: 0;
}

.pc-panel-title {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	font-size: 16px;
	font-weight: 600;
	color: var(--pc-white);
}

.pc-panel-close {
	background: none;
	border: none;
	color: var(--pc-white);
	cursor: pointer;
	padding: 4px;
	border-radius: 4px;
	display: flex;
	align-items: center;
	opacity: 0.8;
	transition: opacity var(--pc-transition);
}

.pc-panel-close:hover {
	opacity: 1;
}

/* ─── Panel: Body ──────────────────────────────────────── */

.pc-panel-body {
	flex: 1;
	overflow-y: auto;
	padding: 0;
}

/* ─── Categoría ────────────────────────────────────────── */

.pc-category {
	border-bottom: 1px solid #eee;
}

.pc-category-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 20px;
	cursor: pointer;
	transition: background var(--pc-transition);
}

.pc-category-header:hover {
	background: #f8f9fa;
}

.pc-category-info {
	flex: 1;
}

.pc-category-name {
	font-weight: 600;
	font-size: 14px;
	color: #222;
	margin: 0 0 2px 0;
}

.pc-category-desc {
	font-size: 12px;
	color: #666;
	margin: 0;
}

/* ─── Toggle switch ────────────────────────────────────── */

.pc-toggle {
	position: relative;
	width: 44px;
	height: 24px;
	flex-shrink: 0;
}

.pc-toggle input {
	opacity: 0;
	width: 0;
	height: 0;
	position: absolute;
}

.pc-toggle-slider {
	position: absolute;
	inset: 0;
	background: #ccc;
	border-radius: 24px;
	transition: background var(--pc-transition);
	cursor: pointer;
}

.pc-toggle-slider::before {
	content: '';
	position: absolute;
	width: 18px;
	height: 18px;
	left: 3px;
	top: 3px;
	background: white;
	border-radius: 50%;
	transition: transform var(--pc-transition);
	box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.pc-toggle input:checked + .pc-toggle-slider {
	background: var(--pc-color);
}

.pc-toggle input:checked + .pc-toggle-slider::before {
	transform: translateX(20px);
}

.pc-toggle input:disabled + .pc-toggle-slider {
	background: var(--pc-color);
	opacity: 0.7;
	cursor: not-allowed;
}

.pc-always-active {
	font-size: 11px;
	font-weight: 600;
	color: #46b450;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

/* ─── Lista de cookies por categoría ───────────────────── */

.pc-cookie-list {
	padding: 0 20px 14px 20px;
	display: none;
}

.pc-cookie-list.pc-expanded {
	display: block;
}

.pc-cookie-item {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 4px;
	padding: 8px 0;
	border-bottom: 1px solid #f5f5f5;
	font-size: 12px;
}

.pc-cookie-item:last-child {
	border-bottom: none;
}

.pc-cookie-name {
	font-weight: 600;
	color: #333;
	font-family: monospace;
}

.pc-cookie-provider {
	color: #666;
	text-align: right;
}

.pc-cookie-purpose {
	color: #555;
	grid-column: 1 / -1;
}

.pc-cookie-duration {
	color: #888;
	font-size: 11px;
}

.pc-expand-btn {
	background: none;
	border: none;
	color: var(--pc-color);
	font-size: 11px;
	font-weight: 600;
	cursor: pointer;
	padding: 2px 4px;
	text-decoration: underline;
}

/* ─── Panel: Footer ────────────────────────────────────── */

.pc-panel-footer {
	padding: 16px 20px;
	border-top: 1px solid #eee;
	flex-shrink: 0;
}

.pc-panel-footer-links {
	display: flex;
	justify-content: center;
	gap: 12px;
	margin-top: 12px;
	flex-wrap: wrap;
}

.pc-panel-footer-links a {
	color: #666;
	font-size: 12px;
	text-decoration: underline;
}

.pc-powered-by {
	text-align: center;
	font-size: 11px;
	color: #aaa;
	margin: 8px 0 0;
}

/* ─── Responsive ───────────────────────────────────────── */

@media (max-width: 600px) {
	#pc-banner {
		padding: 12px 14px;
	}

	.pc-banner-actions {
		width: 100%;
	}

	.pc-btn {
		flex: 1;
		font-size: 12px;
		padding: 9px 12px;
	}
}
