/**
 * Simple Cookie Consent — Frontend styles.
 * Unified light theme across all three display modes.
 * Scoped: #sccon-banner, #sccon-cookie-icon, #sccon-popup-overlay, .sccon-*
 */

/* ===== Reset ===== */
#sccon-banner,
#sccon-cookie-icon,
#sccon-popup-overlay,
#sccon-banner *,
#sccon-cookie-icon *,
#sccon-popup-overlay * {
	box-sizing: border-box;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
	line-height: 1.5;
}

/* ===== Theme Variables ===== */
#sccon-banner,
#sccon-cookie-icon,
#sccon-popup-overlay {
	--sccon-accent: var(--wp--preset--color--primary, #4b6ef5);
	--sccon-bg: #eaeaea;
	--sccon-text: #000;
	--sccon-text-muted: #555;
	--sccon-border: #ddd;
	--sccon-shadow: 0 10px 20px rgba(0, 0, 0, 0.19), 0 6px 6px rgba(0, 0, 0, 0.23);
	font-size: 14px;
}

/* ===== Style 1: Standard Banner ===== */
#sccon-banner {
	position: fixed;
	bottom: 0;
	left: 0;
	right: 0;
	z-index: 999999;
}

/* Compact bar */
.sccon-bar {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 16px 24px;
	background: var(--sccon-bg);
	color: var(--sccon-text);
	box-shadow: var(--sccon-shadow);
}

.sccon-bar-text {
	flex: 1;
	margin: 0;
	font-size: 14px;
	color: var(--sccon-text);
}

.sccon-bar-actions {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-shrink: 0;
}

/* Expand icon button */
.sccon-btn-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	padding: 0;
	border: none;
	border-radius: 0;
	background: none;
	color: var(--sccon-text-muted);
	cursor: pointer;
	transition: color 0.2s;
}

.sccon-btn-icon:hover {
	color: var(--sccon-text);
}

/* Banner state: expanded ↔ collapsed (class-based safety net) */
#sccon-banner.sccon-expanded .sccon-bar {
	display: none;
}

#sccon-banner.sccon-expanded .sccon-panel {
	display: block;
}

/* Expanded settings panel (banner style) */
#sccon-banner .sccon-panel {
	background: var(--sccon-bg);
	color: var(--sccon-text);
	border-top: 1px solid var(--sccon-border);
	max-height: 80vh;
	overflow-y: auto;
	animation: sccon-slide-up 0.3s ease-out;
}

@keyframes sccon-slide-up {
	from { max-height: 0; opacity: 0; }
	to { max-height: 80vh; opacity: 1; }
}

/* ===== Style 2: Popup (positioned modal) ===== */
.sccon-popup-overlay {
	position: fixed;
	inset: 0;
	z-index: 999999;
	background: rgba(0, 0, 0, 0.4);
	display: flex;
	align-items: flex-end;
	justify-content: flex-start;
	padding: 10px;
}

.sccon-popup-dialog {
	width: 480px;
	max-width: 100%;
	max-height: calc(100vh - 20px);
	overflow-y: auto;
	background: var(--sccon-bg);
	color: var(--sccon-text);
	box-shadow: var(--sccon-shadow);
	animation: sccon-popup-in 0.25s ease-out;
}

@keyframes sccon-popup-in {
	from { opacity: 0; transform: translateY(12px); }
	to { opacity: 1; transform: translateY(0); }
}

/* ===== Style 3: Cookie Icon ===== */
#sccon-cookie-icon {
	font-size: 14px;
}

.sccon-icon-btn {
	position: fixed;
	z-index: 999999;
	width: 48px;
	height: 48px;
	padding: 0;
	border: none;
	border-radius: 50%;
	background: var(--sccon-accent);
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
	transition: transform 0.2s, box-shadow 0.2s;
}

.sccon-icon-btn:hover {
	transform: scale(1.1);
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

/* Cookie icon popup panel */
.sccon-popup {
	position: fixed;
	z-index: 999999;
	width: 380px;
	max-width: calc(100vw - 32px);
	background: var(--sccon-bg);
	color: var(--sccon-text);
	box-shadow: var(--sccon-shadow);
	animation: sccon-fade-in 0.25s ease-out;
}

@keyframes sccon-fade-in {
	from { opacity: 0; transform: translateY(8px); }
	to { opacity: 1; transform: translateY(0); }
}

/* ===== Shared Panel Styles ===== */
.sccon-panel-header {
	position: relative;
	display: flex;
	align-items: flex-end;
	gap: 12px;
	padding: 20px;
	border-bottom: 1px solid var(--sccon-border);
}

.sccon-panel-logo {
	display: block;
	height: auto;
}

.sccon-panel-logo-rounded {
	aspect-ratio: 1 / 1;
	object-fit: cover;
	border-radius: 50%;
}

.sccon-panel-title {
	margin: 0;
	flex: 1;
	text-align: center;
	font-size: 16px;
	font-weight: 600;
	color: var(--sccon-text);
}

/* When a logo is present, push the title to the right — it looks off-centre
   sharing remaining flex space with a wide logo, so we anchor it instead. */
.sccon-panel-header:has(.sccon-panel-logo) .sccon-panel-title {
	text-align: right;
	padding-right: 12px;
}

.sccon-panel-close {
	position: absolute;
	top: 10px;
	right: 10px;
	width: 32px;
	height: 32px;
	background: none;
	border: none;
	margin: 0;
	padding: 0;
	color: var(--sccon-text-muted);
	font-size: 22px;
	cursor: pointer;
	line-height: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: color 0.2s;
}

.sccon-panel-close:hover {
	color: var(--sccon-text);
}

.sccon-panel-body {
	padding: 16px 20px;
}

.sccon-panel-text {
	margin: 0 0 16px;
	font-size: 14px;
	line-height: 1.5;
	color: var(--sccon-text);
}

/* Two-column layout (banner expanded panel) */
.sccon-panel-columns {
	display: grid;
	grid-template-columns: 1fr 1fr;
}

.sccon-panel-actions {
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding: 16px 20px;
	justify-content: flex-end;
}

.sccon-panel-actions .sccon-btn {
	display: flex;
	height: 45px;
	padding: 10px;
	font-size: 15px;
	width: 100%;
}

.sccon-panel-footer {
	padding: 16px 20px;
	border-top: 1px solid var(--sccon-border);
	display: grid;
	grid-gap: 10px;
}

.sccon-panel-buttons {
	display: flex;
	gap: 10px;
}

/* ===== Buttons ===== */

/* Compact buttons (banner bar) */
.sccon-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 8px 20px;
	border: none;
	font-size: 14px;
	font-weight: 500;
	cursor: pointer;
	white-space: nowrap;
	transition: opacity 0.2s;
}

.sccon-btn:hover {
	opacity: 0.85;
}

.sccon-btn-primary {
	background: var(--sccon-accent);
	color: #fff;
}

.sccon-btn-secondary {
	background: #fff;
	border: 1px solid #fff;
	color: var(--sccon-text);
}

/* Full-size buttons in panels and dialogs */
.sccon-panel-footer .sccon-btn,
.sccon-popup-dialog .sccon-btn {
	display: flex;
	height: 45px;
	padding: 10px;
	font-size: 15px;
	width: 100%;
}

/* ===== Category Toggles ===== */
.sccon-categories {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.sccon-category {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	background: rgba(239, 239, 239, 0.5);
	padding: 10px;
}

.sccon-toggle {
	display: flex;
	align-items: center;
	gap: 10px;
	cursor: pointer;
	position: relative;
}

.sccon-toggle input {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
}

.sccon-toggle-slider {
	position: relative;
	display: inline-block;
	width: 40px;
	height: 22px;
	background: #bbb;
	border-radius: 11px;
	flex-shrink: 0;
	transition: background 0.2s;
}

.sccon-toggle-slider::after {
	content: "";
	position: absolute;
	top: 3px;
	left: 3px;
	width: 16px;
	height: 16px;
	background: #fff;
	border-radius: 50%;
	transition: transform 0.2s;
}

.sccon-toggle input:checked + .sccon-toggle-slider {
	background: var(--sccon-accent);
}

.sccon-toggle input:checked + .sccon-toggle-slider::after {
	transform: translateX(18px);
}

.sccon-toggle input:disabled + .sccon-toggle-slider {
	opacity: 0.6;
	cursor: default;
}

.sccon-toggle-label {
	font-size: 14px;
	font-weight: 500;
	color: var(--sccon-text);
}

.sccon-category-desc {
	font-size: 12px;
	color: var(--sccon-text-muted);
	flex-shrink: 0;
}

/* ===== Legal Links ===== */
.sccon-legal-links {
	font-size: 12px;
	color: var(--sccon-text);
}

.sccon-legal-links a {
	color: var(--sccon-text);
	text-decoration: underline;
	transition: color 0.2s;
}

.sccon-legal-links a:hover {
	color: var(--sccon-accent);
}

.sccon-sep {
	margin: 0 6px;
	color: #999;
}

/* ===== Shortcode trigger ===== */
.sccon-shortcode-trigger {
	background: none;
	border: none;
	padding: 0;
	font: inherit;
	color: inherit;
	text-decoration: underline;
	cursor: pointer;
}

.sccon-shortcode-trigger:hover {
	opacity: 0.8;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
	.sccon-bar {
		flex-direction: column;
		gap: 12px;
		padding: 16px;
		text-align: center;
	}

	.sccon-bar-actions {
		width: 100%;
		justify-content: center;
		flex-wrap: wrap;
	}

	.sccon-bar-actions .sccon-btn {
		flex: 1;
		min-width: 120px;
	}

	.sccon-panel-columns {
		grid-template-columns: 1fr;
	}

	.sccon-panel-buttons {
		flex-direction: column;
	}

	.sccon-popup {
		left: 16px !important;
		right: 16px !important;
		width: auto !important;
	}

	.sccon-category {
		flex-direction: column;
		align-items: flex-start;
		gap: 2px;
	}

	.sccon-category-desc {
		text-align: left;
		margin-left: 50px;
	}

	.sccon-popup-overlay {
		padding: 10px !important;
		align-items: flex-end !important;
		justify-content: center !important;
	}

	.sccon-popup-dialog {
		width: 100%;
		max-width: 400px;
		max-height: 80vh;
		overflow-y: auto;
	}
}
