/**
 * SlightlyChilled Cookie Consent — public stylesheet.
 *
 * All colours, fonts, spacing, and border radii are driven by CSS custom
 * properties with the --sc-cc- prefix. Override any property in your theme
 * CSS or via the plugin's Colour Overrides settings to rebrand without
 * editing this file.
 *
 * Structure:
 *  1. Custom properties (design tokens)
 *  2. Utility / reset
 *  3. Banner
 *  4. Modal overlay
 *  5. Modal
 *  6. Category list and toggles
 *  7. Buttons
 *  8. Footer link / reopen button
 *  9. Responsive adjustments
 * 10. Reduced-motion overrides
 *
 * @package SC_Cookie_Consent
 * @since   1.0.0
 * @licence GPL-2.0+
 */

/* ==========================================================================
   1. Custom properties (design tokens)
   ========================================================================== */

:root {
	/* Colours */
	--sc-cc-primary-colour: #1a56db;
	--sc-cc-primary-hover: #1648c4;
	--sc-cc-background-colour: #ffffff;
	--sc-cc-surface-colour: #f9fafb;
	--sc-cc-border-colour: #e5e7eb;
	--sc-cc-text-colour: #111827;
	--sc-cc-text-muted: #6b7280;
	--sc-cc-overlay-colour: rgba(0, 0, 0, 0.5);
	--sc-cc-toggle-on: #1a56db;
	--sc-cc-toggle-off: #d1d5db;
	--sc-cc-toggle-thumb: #ffffff;
	--sc-cc-warning-bg: #fef3c7;
	--sc-cc-warning-border: #f59e0b;
	--sc-cc-warning-text: #92400e;
	--sc-cc-always-active: #059669;

	/* Typography */
	--sc-cc-font-family: inherit;
	--sc-cc-font-size-base: 0.9375rem; /* 15px */
	--sc-cc-font-size-sm: 0.8125rem; /* 13px */
	--sc-cc-font-size-title: 1.0625rem; /* 17px */
	--sc-cc-font-weight-normal: 400;
	--sc-cc-font-weight-bold: 600;
	--sc-cc-line-height: 1.6;

	/* Spacing */
	--sc-cc-space-xs: 0.25rem;
	--sc-cc-space-sm: 0.5rem;
	--sc-cc-space-md: 1rem;
	--sc-cc-space-lg: 1.5rem;
	--sc-cc-space-xl: 2rem;

	/* Shape */
	--sc-cc-border-radius: 0.5rem;
	--sc-cc-border-radius-sm: 0.25rem;
	--sc-cc-border-radius-btn: 0.375rem;

	/* Elevation */
	--sc-cc-shadow:
		0 4px 24px rgba(0, 0, 0, 0.12), 0 1px 4px rgba(0, 0, 0, 0.06);
	--sc-cc-shadow-modal: 0 20px 60px rgba(0, 0, 0, 0.2);

	/* Transitions */
	--sc-cc-transition: 0.2s ease;
	--sc-cc-transition-modal: 0.25s ease;

	/* Layout */
	--sc-cc-banner-max-width: 900px;
	--sc-cc-modal-max-width: 520px;
	--sc-cc-modal-max-height: 85vh;
	--sc-cc-z-overlay: 99998;
	--sc-cc-z-banner: 99997;
	--sc-cc-z-modal: 99999;
}

/* ==========================================================================
   2. Utility / reset
   ========================================================================== */

/*
 * Scoped reset — only affects plugin elements to avoid interfering with
 * theme styles.
 */
.sc-cc-banner *,
.sc-cc-banner *::before,
.sc-cc-banner *::after,
.sc-cc-modal *,
.sc-cc-modal *::before,
.sc-cc-modal *::after,
.sc-cc-overlay {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

/* ==========================================================================
   3. Banner
   ========================================================================== */

.sc-cc-banner {
	position: fixed;
	bottom: 0;
	left: 0;
	right: 0;
	z-index: var(--sc-cc-z-banner);
	background: var(--sc-cc-background-colour);
	border-top: 1px solid var(--sc-cc-border-colour);
	box-shadow: var(--sc-cc-shadow);
	font-family: var(--sc-cc-font-family);
	font-size: var(--sc-cc-font-size-base);
	color: var(--sc-cc-text-colour);
	line-height: var(--sc-cc-line-height);

	/* Hidden by default — JS adds .sc-cc-banner--visible */
	opacity: 0;
	transform: translateY(100%);
	pointer-events: none;
	transition:
		opacity var(--sc-cc-transition-modal),
		transform var(--sc-cc-transition-modal);
}

.sc-cc-banner--visible {
	opacity: 1;
	transform: translateY(0);
	pointer-events: auto;
}

.sc-cc-banner__inner {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--sc-cc-space-md);
	max-width: var(--sc-cc-banner-max-width);
	margin: 0 auto;
	padding: var(--sc-cc-space-md) var(--sc-cc-space-lg);
}

.sc-cc-banner__content {
	flex: 1 1 175px;
}

.sc-cc-banner__title {
	font-size: var(--sc-cc-font-size-title);
	font-weight: var(--sc-cc-font-weight-bold);
	margin-bottom: var(--sc-cc-space-xs);
}

.sc-cc-banner__message {
	font-size: var(--sc-cc-font-size-sm);
	color: var(--sc-cc-text-muted);
}

.sc-cc-banner__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--sc-cc-space-sm);
	flex-shrink: 0;
}

/* ==========================================================================
   4. Overlay
   ========================================================================== */

.sc-cc-overlay {
	position: fixed;
	inset: 0;
	z-index: var(--sc-cc-z-overlay);
	background: var(--sc-cc-overlay-colour);

	/* Hidden by default */
	opacity: 0;
	pointer-events: none;
	transition: opacity var(--sc-cc-transition-modal);
}

.sc-cc-overlay--visible {
	opacity: 1;
	pointer-events: auto;
}

/* ==========================================================================
   5. Modal
   ========================================================================== */

.sc-cc-modal {
	position: fixed;
	inset: 0;
	z-index: var(--sc-cc-z-modal);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: var(--sc-cc-space-md);
	pointer-events: none;

	/* Hidden by default */
	opacity: 0;
	transition: opacity var(--sc-cc-transition-modal);
}

.sc-cc-modal--visible {
	opacity: 1;
	pointer-events: auto;
}

/* Required for programmatic focus() calls */
.sc-cc-modal:focus {
	outline: none;
}

.sc-cc-modal__inner {
	background: var(--sc-cc-background-colour);
	border-radius: var(--sc-cc-border-radius);
	box-shadow: var(--sc-cc-shadow-modal);
	width: 100%;
	max-width: var(--sc-cc-modal-max-width);
	max-height: var(--sc-cc-modal-max-height);
	display: flex;
	flex-direction: column;
	font-family: var(--sc-cc-font-family);
	font-size: var(--sc-cc-font-size-base);
	color: var(--sc-cc-text-colour);
	line-height: var(--sc-cc-line-height);
	overflow: hidden;
}

/* Transform: slide up on open */
.sc-cc-modal__inner {
	transform: translateY(12px);
	transition: transform var(--sc-cc-transition-modal);
}

.sc-cc-modal--visible .sc-cc-modal__inner {
	transform: translateY(0);
}

.sc-cc-modal__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: var(--sc-cc-space-lg);
	border-bottom: 1px solid var(--sc-cc-border-colour);
	flex-shrink: 0;
}

.sc-cc-modal__title {
	font-size: var(--sc-cc-font-size-title);
	font-weight: var(--sc-cc-font-weight-bold);
	color: var(--sc-cc-text-colour);
}

.sc-cc-modal__close {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 2rem;
	height: 2rem;
	background: transparent;
	border: 1px solid transparent;
	border-radius: var(--sc-cc-border-radius-sm);
	cursor: pointer;
	color: var(--sc-cc-text-muted);
	padding: 0;
	transition:
		background var(--sc-cc-transition),
		color var(--sc-cc-transition),
		border-color var(--sc-cc-transition);
}

.sc-cc-modal__close:hover,
.sc-cc-modal__close:focus-visible {
	background: var(--sc-cc-surface-colour);
	color: var(--sc-cc-text-colour);
	border-color: var(--sc-cc-border-colour);
	outline: none;
}

.sc-cc-modal__body {
	padding: var(--sc-cc-space-lg);
	overflow-y: auto;
	flex: 1 1 auto;
}

.sc-cc-modal__intro {
	font-size: var(--sc-cc-font-size-sm);
	color: var(--sc-cc-text-muted);
	margin-bottom: var(--sc-cc-space-lg);
}

.sc-cc-modal__footer {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--sc-cc-space-sm);
	padding: var(--sc-cc-space-md) var(--sc-cc-space-lg);
	border-top: 1px solid var(--sc-cc-border-colour);
	flex-shrink: 0;
	background: var(--sc-cc-surface-colour);
}

/* Prevent body scroll when modal is open */
body.sc-cc-modal-open {
	overflow: hidden;
}

/* ==========================================================================
   6. Category list and toggles
   ========================================================================== */

.sc-cc-categories {
	display: flex;
	flex-direction: column;
	gap: 0;
}

.sc-cc-category {
	padding: var(--sc-cc-space-md) 0;
	border-bottom: 1px solid var(--sc-cc-border-colour);
}

.sc-cc-category:last-child {
	border-bottom: none;
	padding-bottom: 0;
}

.sc-cc-category:first-child {
	padding-top: 0;
}

.sc-cc-category__header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: var(--sc-cc-space-md);
}

.sc-cc-category__label-wrap {
	flex: 1 1 auto;
}

.sc-cc-category__label {
	display: block;
	font-weight: var(--sc-cc-font-weight-bold);
	font-size: var(--sc-cc-font-size-base);
	margin-bottom: var(--sc-cc-space-xs);
}

.sc-cc-category__description {
	font-size: var(--sc-cc-font-size-sm);
	color: var(--sc-cc-text-muted);
	line-height: var(--sc-cc-line-height);
}

.sc-cc-category__control {
	flex-shrink: 0;
	display: flex;
	align-items: center;
}

/* "Always active" label for required categories */
.sc-cc-always-active {
	font-size: var(--sc-cc-font-size-sm);
	font-weight: var(--sc-cc-font-weight-bold);
	color: var(--sc-cc-always-active);
}

/* Toggle switch */
.sc-cc-toggle {
	display: inline-flex;
	align-items: center;
	gap: var(--sc-cc-space-sm);
	cursor: pointer;
	user-select: none;
}

/* Visually hidden checkbox */
.sc-cc-toggle__input {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Toggle track */
.sc-cc-toggle__track {
	position: relative;
	display: inline-block;
	width: 2.75rem; /* 44px */
	height: 1.5rem; /* 24px */
	background: var(--sc-cc-toggle-off);
	border-radius: 1rem;
	transition: background var(--sc-cc-transition);
}

/* Toggle thumb */
.sc-cc-toggle__thumb {
	position: absolute;
	top: 0.1875rem; /* 3px */
	left: 0.1875rem;
	width: 1.125rem; /* 18px */
	height: 1.125rem;
	background: var(--sc-cc-toggle-thumb);
	border-radius: 50%;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
	transition: transform var(--sc-cc-transition);
}

/* Checked state */
.sc-cc-toggle__input:checked + .sc-cc-toggle__track {
	background: var(--sc-cc-toggle-on);
}

.sc-cc-toggle__input:checked + .sc-cc-toggle__track .sc-cc-toggle__thumb {
	transform: translateX(1.25rem); /* 20px */
}

/* Focus ring on the track */
.sc-cc-toggle__input:focus-visible + .sc-cc-toggle__track {
	outline: 2px solid var(--sc-cc-primary-colour);
	outline-offset: 2px;
}

/* Visually-hidden screen reader label */
.sc-cc-toggle__sr-label {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ==========================================================================
   7. Buttons
   ========================================================================== */

.sc-cc-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0.5rem 1.125rem;
	font-family: var(--sc-cc-font-family);
	font-size: var(--sc-cc-font-size-sm);
	font-weight: var(--sc-cc-font-weight-bold);
	line-height: 1.4;
	border-radius: var(--sc-cc-border-radius-btn);
	border: 1px solid transparent;
	cursor: pointer;
	text-decoration: none;
	white-space: nowrap;
	transition:
		background var(--sc-cc-transition),
		color var(--sc-cc-transition),
		border-color var(--sc-cc-transition),
		box-shadow var(--sc-cc-transition);
}

/* Focus ring for all buttons */
.sc-cc-btn:focus-visible {
	outline: 2px solid var(--sc-cc-primary-colour);
	outline-offset: 2px;
}

/* Primary: filled background */
.sc-cc-btn--primary {
	background: var(--sc-cc-primary-colour);
	color: #ffffff;
	border-color: var(--sc-cc-primary-colour);
}

.sc-cc-btn--primary:hover {
	background: var(--sc-cc-primary-hover);
	border-color: var(--sc-cc-primary-hover);
}

/* Secondary: outlined */
.sc-cc-btn--secondary {
	background: transparent;
	color: var(--sc-cc-text-colour);
	border-color: var(--sc-cc-border-colour);
}

.sc-cc-btn--secondary:hover {
	background: var(--sc-cc-surface-colour);
	border-color: var(--sc-cc-text-muted);
}

/* Ghost: minimal, text-like */
.sc-cc-btn--ghost {
	background: transparent;
	color: var(--sc-cc-text-muted);
	border-color: transparent;
	padding-left: 0.5rem;
	padding-right: 0.5rem;
}

.sc-cc-btn--ghost:hover {
	color: var(--sc-cc-text-colour);
}

/* ==========================================================================
   8. Footer link / reopen button
   ========================================================================== */

.sc-cc-footer-link {
	position: fixed;
	bottom: var(--sc-cc-space-md);
	left: var(--sc-cc-space-md);
	z-index: var(--sc-cc-z-banner);
}

.sc-cc-reopen-btn {
	display: inline-flex;
	align-items: center;
	padding: 0.375rem 0.875rem;
	font-family: var(--sc-cc-font-family);
	font-size: var(--sc-cc-font-size-sm);
	font-weight: var(--sc-cc-font-weight-normal);
	color: var(--sc-cc-text-muted);
	background: var(--sc-cc-background-colour);
	border: 1px solid var(--sc-cc-border-colour);
	border-radius: var(--sc-cc-border-radius-btn);
	cursor: pointer;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
	transition:
		background var(--sc-cc-transition),
		color var(--sc-cc-transition);
}

.sc-cc-reopen-btn:hover {
	background: var(--sc-cc-surface-colour);
	color: var(--sc-cc-text-colour);
}

.sc-cc-reopen-btn:focus-visible {
	outline: 2px solid var(--sc-cc-primary-colour);
	outline-offset: 2px;
}

/*
 * Hide the footer link while the banner is visible — the banner already
 * provides the same affordance.
 */
.sc-cc-banner--visible ~ .sc-cc-footer-link {
	display: none;
}

/* ==========================================================================
   9. Responsive adjustments
   ========================================================================== */

@media (max-width: 600px) {
	.sc-cc-banner__inner {
		flex-direction: column;
		align-items: stretch;
		padding: var(--sc-cc-space-md);
	}

	.sc-cc-banner__actions {
		flex-direction: column;
	}

	.sc-cc-banner__actions .sc-cc-btn {
		width: 100%;
		justify-content: center;
	}

	.sc-cc-modal {
		align-items: flex-end;
		padding: 0;
	}

	.sc-cc-modal__inner {
		border-radius: var(--sc-cc-border-radius) var(--sc-cc-border-radius) 0 0;
		max-height: 92vh;
	}

	.sc-cc-modal__footer {
		flex-direction: column;
	}

	.sc-cc-modal__footer .sc-cc-btn {
		width: 100%;
		justify-content: center;
	}

	.sc-cc-footer-link {
		bottom: var(--sc-cc-space-sm);
		left: var(--sc-cc-space-sm);
	}
}

/* ==========================================================================
   10. Reduced-motion overrides
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
	.sc-cc-banner,
	.sc-cc-overlay,
	.sc-cc-modal,
	.sc-cc-modal__inner,
	.sc-cc-btn,
	.sc-cc-toggle__track,
	.sc-cc-toggle__thumb,
	.sc-cc-modal__close,
	.sc-cc-reopen-btn {
		transition: none;
	}
}
