/**
 * WP Cookie Consent — Banner & Modal Styles
 *
 * Colour values are set as CSS custom properties on the banner and modal
 * elements by the PHP template (via inline style attribute), so no
 * hardcoded colour values appear here. This means the admin colour pickers
 * take effect without any CSS changes.
 *
 * Custom properties used:
 *   --wcc-bar       Banner background colour
 *   --wcc-button    Primary button background colour
 *   --wcc-text      Banner text colour
 *   --wcc-btn-text  Button text colour
 *
 * @package WP_Cookie_Consent
 * @since   1.0.0
 */

/* ==========================================================================
   Utility
   ========================================================================== */

.wcc-hidden {
	display: none !important;
}

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

/* Visually hidden but accessible to screen readers */
.screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ==========================================================================
   Banner — base styles
   ========================================================================== */

.wcc-banner {
	position: fixed;
	z-index: 99998;
	left: 0;
	right: 0;
	background-color: var(--wcc-bar, #32323a);
	color: var(--wcc-text, #ffffff);
	box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.25);
	font-family: inherit;
	font-size: 14px;
	line-height: 1.5;
}

/* ==========================================================================
   Banner — position variants
   ========================================================================== */

.wcc-position-bottom {
	bottom: 0;
	padding: 16px 20px;
}

.wcc-position-bottom-right {
	bottom: 20px;
	right: 20px;
	left: auto;
	max-width: 380px;
	border-radius: 8px;
	padding: 20px;
}

.wcc-position-modal {
	/* When position=modal, the banner itself is not used —
	   the modal opens immediately instead. This class is a
	   fallback in case JS opens the modal before hiding the banner. */
	bottom: 0;
	padding: 16px 20px;
}

/* ==========================================================================
   Banner — inner layout
   ========================================================================== */

.wcc-banner-inner {
	display: flex;
	align-items: center;
	gap: 20px;
	max-width: 1200px;
	margin: 0 auto;
	flex-wrap: wrap;
}

.wcc-banner-message {
	flex: 1 1 300px;
}

.wcc-banner-message p {
	margin: 0 0 6px;
	color: var(--wcc-text, #ffffff);
}

.wcc-banner-message p:last-child {
	margin-bottom: 0;
}

.wcc-privacy-link {
	color: var(--wcc-text, #ffffff);
	font-size: 12px;
	opacity: 0.8;
	text-decoration: underline;
}

.wcc-privacy-link:hover,
.wcc-privacy-link:focus {
	opacity: 1;
}

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

/* ==========================================================================
   Buttons
   ========================================================================== */

.wcc-btn {
	display: inline-block;
	padding: 9px 18px;
	border: 2px solid transparent;
	border-radius: 4px;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.4;
	cursor: pointer;
	text-decoration: none;
	transition: opacity 0.15s ease, box-shadow 0.15s ease;
	white-space: nowrap;
	font-family: inherit;
}

.wcc-btn:focus-visible {
	outline: 3px solid var(--wcc-button, #00a99d);
	outline-offset: 2px;
}

/* Primary — filled, for Accept All */
.wcc-btn-primary {
	background-color: var(--wcc-button, #00a99d);
	color: var(--wcc-btn-text, #ffffff);
	border-color: var(--wcc-button, #00a99d);
}

.wcc-btn-primary:hover {
	opacity: 0.88;
}

/* Secondary — outlined, for Reject / Save Preferences */
.wcc-btn-secondary {
	background-color: transparent;
	color: var(--wcc-text, #ffffff);
	border-color: var(--wcc-text, #ffffff);
}

.wcc-btn-secondary:hover {
	background-color: rgba(255, 255, 255, 0.1);
}

/* Tertiary — text-only, for Manage Preferences */
.wcc-btn-tertiary {
	background-color: transparent;
	color: var(--wcc-text, #ffffff);
	border-color: transparent;
	padding-left: 4px;
	padding-right: 4px;
	text-decoration: underline;
	font-weight: 400;
}

.wcc-btn-tertiary:hover {
	opacity: 0.8;
}

/* Preferences link shortcode button — unstyled by default */
.wcc-preferences-link {
	background: none;
	border: none;
	padding: 0;
	margin: 0;
	font: inherit;
	color: inherit;
	cursor: pointer;
	text-decoration: underline;
}

.wcc-preferences-link:hover,
.wcc-preferences-link:focus {
	opacity: 0.8;
}

/* ==========================================================================
   Modal — overlay
   ========================================================================== */

.wcc-modal {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

.wcc-modal.wcc-hidden {
	display: none !important;
}

.wcc-modal-overlay {
	position: absolute;
	inset: 0;
	background-color: rgba(0, 0, 0, 0.6);
}

/* ==========================================================================
   Modal — dialog
   ========================================================================== */

.wcc-modal-dialog {
	position: relative;
	z-index: 1;
	background: #ffffff;
	color: #1a1a1a;
	border-radius: 8px;
	width: 100%;
	max-width: 640px;
	max-height: 90vh;
	display: flex;
	flex-direction: column;
	box-shadow: 0 8px 40px rgba(0, 0, 0, 0.3);
	overflow: hidden;
}

.wcc-modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 20px 24px 16px;
	border-bottom: 1px solid #e5e5e5;
	flex-shrink: 0;
}

.wcc-modal-header h2 {
	margin: 0;
	font-size: 18px;
	font-weight: 700;
	color: #1a1a1a;
	line-height: 1.3;
}

.wcc-modal-close {
	background: none;
	border: none;
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
	color: #666;
	padding: 4px 8px;
	border-radius: 4px;
	flex-shrink: 0;
}

.wcc-modal-close:hover {
	background-color: #f0f0f0;
	color: #1a1a1a;
}

.wcc-modal-close:focus-visible {
	outline: 3px solid var(--wcc-button, #00a99d);
	outline-offset: 2px;
}

.wcc-modal-body {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 0 24px;
}

.wcc-modal-footer {
	display: flex;
	gap: 10px;
	padding: 16px 24px;
	border-top: 1px solid #e5e5e5;
	flex-wrap: wrap;
	flex-shrink: 0;
	background: #fafafa;
}

/* Override button colours inside the modal — use site theme colours */
.wcc-modal .wcc-btn-primary {
	background-color: var(--wcc-button, #00a99d);
	color: var(--wcc-btn-text, #ffffff);
	border-color: var(--wcc-button, #00a99d);
}

.wcc-modal .wcc-btn-secondary {
	background-color: transparent;
	color: #1a1a1a;
	border-color: #cccccc;
}

.wcc-modal .wcc-btn-secondary:hover {
	background-color: #f0f0f0;
}

.wcc-modal .wcc-btn-tertiary {
	color: #555555;
	border-color: transparent;
}

/* ==========================================================================
   Category rows
   ========================================================================== */

.wcc-category {
	padding: 16px 0;
	border-bottom: 1px solid #f0f0f0;
}

.wcc-category:last-child {
	border-bottom: none;
}

.wcc-category-header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
}

.wcc-category-info {
	flex: 1 1 auto;
}

.wcc-category-name {
	margin: 0 0 4px;
	font-size: 15px;
	font-weight: 600;
	color: #1a1a1a;
}

.wcc-category-desc {
	margin: 0;
	font-size: 13px;
	color: #555555;
	line-height: 1.5;
}

.wcc-toggle-wrap {
	flex-shrink: 0;
	padding-top: 2px;
}

.wcc-always-on {
	display: inline-block;
	font-size: 12px;
	font-weight: 600;
	color: #155724;
	background-color: #d4edda;
	padding: 3px 8px;
	border-radius: 12px;
	white-space: nowrap;
}

/* ==========================================================================
   Toggle switch
   ========================================================================== */

.wcc-toggle {
	position: relative;
	display: inline-block;
	width: 46px;
	height: 26px;
	cursor: pointer;
}

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

.wcc-toggle-slider {
	position: absolute;
	inset: 0;
	background-color: #cccccc;
	border-radius: 26px;
	transition: background-color 0.2s ease;
}

.wcc-toggle-slider::before {
	content: '';
	position: absolute;
	height: 20px;
	width: 20px;
	left: 3px;
	bottom: 3px;
	background-color: #ffffff;
	border-radius: 50%;
	transition: transform 0.2s ease;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.wcc-toggle input:checked + .wcc-toggle-slider {
	background-color: var(--wcc-button, #00a99d);
}

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

/* Focus ring on the hidden checkbox — shown via the slider */
.wcc-toggle input:focus-visible + .wcc-toggle-slider {
	outline: 3px solid var(--wcc-button, #00a99d);
	outline-offset: 2px;
}

/* ==========================================================================
   Cookie details table (inside <details> element)
   ========================================================================== */

.wcc-cookie-details {
	margin-top: 10px;
}

.wcc-cookie-details summary {
	font-size: 12px;
	color: #666666;
	cursor: pointer;
	user-select: none;
	padding: 4px 0;
}

.wcc-cookie-details summary:hover {
	color: var(--wcc-button, #00a99d);
}

.wcc-cookie-table {
	width: 100%;
	border-collapse: collapse;
	margin-top: 8px;
	font-size: 12px;
}

.wcc-cookie-table th,
.wcc-cookie-table td {
	text-align: left;
	padding: 6px 8px;
	border: 1px solid #e5e5e5;
	vertical-align: top;
	line-height: 1.4;
}

.wcc-cookie-table th {
	background-color: #f7f7f7;
	font-weight: 600;
	color: #333333;
}

.wcc-cookie-table td code {
	font-size: 11px;
	background: #f0f0f0;
	padding: 1px 4px;
	border-radius: 2px;
}

/* ==========================================================================
   Responsive — narrow screens
   ========================================================================== */

@media ( max-width: 600px ) {
	.wcc-banner-inner {
		flex-direction: column;
		align-items: stretch;
		gap: 14px;
	}

	.wcc-banner-actions {
		flex-direction: column;
	}

	.wcc-btn {
		width: 100%;
		text-align: center;
	}

	.wcc-position-bottom-right {
		bottom: 0;
		right: 0;
		left: 0;
		max-width: none;
		border-radius: 8px 8px 0 0;
	}

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

	.wcc-modal-dialog {
		max-height: 85vh;
		border-radius: 16px 16px 0 0;
		max-width: none;
	}

	.wcc-modal-footer {
		flex-direction: column;
	}

	.wcc-modal .wcc-btn {
		width: 100%;
		text-align: center;
	}
}

/* ==========================================================================
   Reduced motion
   ========================================================================== */

@media ( prefers-reduced-motion: reduce ) {
	.wcc-btn,
	.wcc-toggle-slider,
	.wcc-toggle-slider::before {
		transition: none;
	}
}

/* ==========================================================================
   High contrast mode
   ========================================================================== */

@media ( forced-colors: active ) {
	.wcc-toggle-slider {
		border: 2px solid ButtonText;
	}

	.wcc-toggle input:checked + .wcc-toggle-slider {
		background-color: Highlight;
	}

	.wcc-toggle-slider::before {
		background-color: ButtonFace;
		border: 1px solid ButtonText;
	}
}
