/**
 * Estilos del Banner de Cookies - Cookie Consent Perú
 *
 * Requisitos:
 * - WCAG AA compliance (contraste 4.5:1 texto, 3:1 controles)
 * - Responsive mobile-first
 * - Sin dark patterns (botones de igual jerarquía)
 * - Tamaño target: <5KB minificado
 *
 * @package Cookie_Consent_Peru
 * @since   1.0.0
 */

/* ========================================
   Variables CSS
   ======================================== */
:root {
	--ccp-primary-color: #2563eb;
	--ccp-secondary-color: #dc2626;
	--ccp-outline-color: #6b7280;
	--ccp-text-color: #1f2937;
	--ccp-text-light: #6b7280;
	--ccp-bg-color: #ffffff;
	--ccp-bg-overlay: rgba(0, 0, 0, 0.5);
	--ccp-border-color: #e5e7eb;
	--ccp-border-radius: 8px;
	--ccp-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
	--ccp-transition: 0.3s ease;
	--ccp-z-banner: 999999;
	--ccp-z-overlay: 999998;
}

/* ========================================
   Banner Container
   ======================================== */
.ccp-banner {
	position: fixed;
	background-color: var(--ccp-bg-color);
	color: var(--ccp-text-color);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-size: 14px;
	line-height: 1.6;
	z-index: var(--ccp-z-banner);
	box-shadow: var(--ccp-shadow);
	transition: transform var(--ccp-transition), opacity var(--ccp-transition);
}

/* Posición: Bottom (default) */
.ccp-banner--bottom {
	bottom: 0;
	left: 0;
	right: 0;
	max-height: 90vh;
	overflow-y: auto;
	border-top-left-radius: var(--ccp-border-radius);
	border-top-right-radius: var(--ccp-border-radius);
	transform: translateY(0);
}

.ccp-banner--bottom.ccp-banner--hidden {
	transform: translateY(100%);
	opacity: 0;
	pointer-events: none;
}

/* Posición: Top */
.ccp-banner--top {
	top: 0;
	left: 0;
	right: 0;
	max-height: 90vh;
	overflow-y: auto;
	border-bottom-left-radius: var(--ccp-border-radius);
	border-bottom-right-radius: var(--ccp-border-radius);
	transform: translateY(0);
}

.ccp-banner--top.ccp-banner--hidden {
	transform: translateY(-100%);
	opacity: 0;
	pointer-events: none;
}

/* Posición: Center (modal) */
.ccp-banner--center {
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	max-width: 600px;
	max-height: 90vh;
	overflow-y: auto;
	border-radius: var(--ccp-border-radius);
	width: 90%;
}

.ccp-banner--center.ccp-banner--hidden {
	transform: translate(-50%, -50%) scale(0.9);
	opacity: 0;
	pointer-events: none;
}

/* Overlay para posición center */
.ccp-banner--center::before {
	content: '';
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: var(--ccp-bg-overlay);
	z-index: var(--ccp-z-overlay);
	transition: opacity var(--ccp-transition);
}

.ccp-banner--center.ccp-banner--hidden::before {
	opacity: 0;
	pointer-events: none;
}

/* ========================================
   Estados del Banner
   ======================================== */
/* Estado Main (visible por defecto) */
.ccp-banner--main .ccp-banner__main {
	display: block;
}

.ccp-banner--main .ccp-banner__preferences {
	display: none;
}

/* Estado Preferences */
.ccp-banner--preferences .ccp-banner__main {
	display: none;
}

.ccp-banner--preferences .ccp-banner__preferences {
	display: block;
}

/* ========================================
   Banner Main (Estado 1)
   ======================================== */
.ccp-banner__main {
	padding: 24px;
}

.ccp-banner__content {
	margin-bottom: 20px;
}

.ccp-banner__title {
	margin: 0 0 12px 0;
	font-size: 20px;
	font-weight: 600;
	color: var(--ccp-text-color);
}

.ccp-banner__description {
	margin: 0 0 12px 0;
	color: var(--ccp-text-color);
}

.ccp-banner__description p {
	margin: 0 0 8px 0;
}

.ccp-banner__description p:last-child {
	margin-bottom: 0;
}

#ccp-banner .ccp-banner__description a {
	color: var(--ccp-primary-color);
	text-decoration: underline;
	font-size: 14px;
	line-height: inherit;
	font-weight: inherit;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
}

.ccp-banner__links {
	margin: 12px 0 0 0;
	font-size: 13px;
}

.ccp-banner__link {
	color: var(--ccp-primary-color);
	text-decoration: underline;
	margin-right: 16px;
	transition: color 0.2s ease;
}

.ccp-banner__link:hover,
.ccp-banner__link:focus {
	color: #1d4ed8;
	text-decoration: none;
}

/* Acciones (botones) */
.ccp-banner__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
}

/* ========================================
   Banner Preferences (Estado 2)
   ======================================== */
.ccp-banner__preferences {
	padding: 24px;
}

.ccp-banner__prefs-title {
	margin: 0 0 12px 0;
	font-size: 18px;
	font-weight: 600;
	color: var(--ccp-text-color);
}

.ccp-banner__prefs-description {
	margin: 0 0 20px 0;
	color: var(--ccp-text-light);
	font-size: 13px;
}

.ccp-categories {
	margin-bottom: 20px;
}

.ccp-category {
	padding: 16px;
	border: 1px solid var(--ccp-border-color);
	border-radius: var(--ccp-border-radius);
	margin-bottom: 12px;
	background: #f9fafb;
}

.ccp-category__header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 8px;
}

.ccp-category__name {
	font-weight: 600;
	color: var(--ccp-text-color);
	font-size: 15px;
}

.ccp-category__description {
	margin: 0;
	font-size: 13px;
	color: var(--ccp-text-light);
}

.ccp-category__badge {
	display: inline-block;
	padding: 4px 12px;
	font-size: 12px;
	border-radius: 12px;
	font-weight: 500;
}

.ccp-category__badge--always-on {
	background-color: #d1fae5;
	color: #065f46;
}

/* Acciones del panel de preferencias */
.ccp-banner__prefs-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
}

/* ========================================
   Botones
   ======================================== */
.ccp-btn {
	padding: 12px 24px;
	border: none;
	border-radius: var(--ccp-border-radius);
	font-size: 14px;
	font-weight: 500;
	cursor: pointer;
	transition: all 0.2s ease;
	font-family: inherit;
	min-width: 120px;
	min-height: 44px; /* Touch-friendly */
}

.ccp-btn:focus {
	outline: 2px solid var(--ccp-primary-color);
	outline-offset: 2px;
}

/* Botón Primary (Aceptar) */
.ccp-btn--primary {
	background-color: #10b981;
	color: #ffffff;
}

.ccp-btn--primary:hover,
.ccp-btn--primary:focus {
	background-color: #059669;
}

/* Botón Secondary (Rechazar) - MISMO PESO VISUAL que Primary */
.ccp-btn--secondary {
	background-color: #ef4444;
	color: #ffffff;
}

.ccp-btn--secondary:hover,
.ccp-btn--secondary:focus {
	background-color: #dc2626;
}

/* Botón Outline (Personalizar) */
.ccp-btn--outline {
	background-color: transparent;
	color: var(--ccp-outline-color);
	border: 2px solid var(--ccp-border-color);
}

.ccp-btn--outline:hover,
.ccp-btn--outline:focus {
	background-color: #f3f4f6;
	border-color: var(--ccp-outline-color);
}

/* ========================================
   Toggle Switch (Custom)
   ======================================== */
.ccp-toggle {
	position: relative;
	display: inline-block;
	width: 48px;
	height: 24px;
}

.ccp-toggle__input {
	opacity: 0;
	position: absolute;
	width: 100%;
	height: 100%;
	top: 0;
	left: 0;
	cursor: pointer;
	z-index: 2;
	margin: 0;
}

.ccp-toggle__slider {
	position: absolute;
	cursor: pointer;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background-color: #d1d5db;
	transition: 0.2s;
	border-radius: 24px;
}

.ccp-toggle__slider::before {
	position: absolute;
	content: "";
	height: 18px;
	width: 18px;
	left: 3px;
	bottom: 3px;
	background-color: white;
	transition: 0.2s;
	border-radius: 50%;
}

.ccp-toggle__input:checked + .ccp-toggle__slider {
	background-color: var(--ccp-primary-color);
}

.ccp-toggle__input:checked + .ccp-toggle__slider::before {
	transform: translateX(24px);
}

.ccp-toggle__input:focus + .ccp-toggle__slider {
	box-shadow: 0 0 0 2px var(--ccp-bg-color), 0 0 0 4px var(--ccp-primary-color);
}

/* ========================================
   Enlace de Reapertura
   ======================================== */
.ccp-reopen {
	position: fixed;
	bottom: 20px;
	right: 20px;
	z-index: var(--ccp-z-banner);
}

.ccp-reopen__btn {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 12px 20px;
	background-color: var(--ccp-bg-color);
	color: var(--ccp-text-color);
	border: 1px solid var(--ccp-border-color);
	border-radius: 24px;
	font-size: 14px;
	font-weight: 500;
	cursor: pointer;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
	transition: all 0.2s ease;
	font-family: inherit;
	min-height: 44px; /* Touch-friendly */
}

.ccp-reopen__btn:hover,
.ccp-reopen__btn:focus {
	box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
	transform: scale(1.05);
}

.ccp-reopen__btn:focus {
	outline: 2px solid var(--ccp-primary-color);
	outline-offset: 2px;
}

.ccp-reopen__icon {
	font-size: 18px;
	line-height: 1;
}

.ccp-reopen__text {
	line-height: 1;
}

/* ========================================
   Responsive
   ======================================== */

/* Mobile (<768px) */
@media (max-width: 767px) {
	.ccp-banner--bottom,
	.ccp-banner--top {
		max-height: 80vh; /* No más del 80% en móviles */
	}

	.ccp-banner__main,
	.ccp-banner__preferences {
		padding: 20px;
	}

	.ccp-banner__title {
		font-size: 18px;
	}

	.ccp-banner__actions,
	.ccp-banner__prefs-actions {
		flex-direction: column;
	}

	.ccp-btn {
		width: 100%;
	}

	.ccp-reopen__text {
		display: none; /* Solo emoji en móvil */
	}

	.ccp-reopen__btn {
		padding: 12px;
		border-radius: 50%;
		width: 48px;
		height: 48px;
		justify-content: center;
	}
}

/* Tablet (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
	.ccp-banner--bottom,
	.ccp-banner--top {
		max-width: 90%;
		left: 5%;
		right: 5%;
	}

	.ccp-banner--center {
		max-width: 560px;
	}
}

/* Desktop (1024px+) */
@media (min-width: 1024px) {
	.ccp-banner--bottom,
	.ccp-banner--top {
		max-width: 800px;
		left: 50%;
		transform: translateX(-50%);
	}

	.ccp-banner--bottom.ccp-banner--hidden {
		transform: translateX(-50%) translateY(100%);
	}

	.ccp-banner--top.ccp-banner--hidden {
		transform: translateX(-50%) translateY(-100%);
	}

	.ccp-banner__actions,
	.ccp-banner__prefs-actions {
		justify-content: flex-start;
	}
}

/* ========================================
   Print
   ======================================== */
@media print {
	.ccp-banner,
	.ccp-reopen {
		display: none !important;
	}
}

/* ========================================
   Accesibilidad - High Contrast Mode
   ======================================== */
@media (prefers-contrast: high) {
	.ccp-banner {
		border: 2px solid currentColor;
	}

	.ccp-btn {
		border: 2px solid currentColor;
	}
}

/* ========================================
   Accesibilidad - Reduced Motion
   ======================================== */
@media (prefers-reduced-motion: reduce) {
	.ccp-banner,
	.ccp-btn,
	.ccp-toggle__slider,
	.ccp-toggle__slider::before,
	.ccp-reopen__btn {
		transition: none;
	}
}
