/**
 * Cookie Consent Frontend Styles
 *
 * Design matches the reference screenshots:
 * - Clean white background
 * - Rounded corners
 * - Teal accent color
 * - iOS-style toggles
 */

/* CSS Variables */
:root {
	--ccm-primary: #0d9488;
	--ccm-bg: #ffffff;
	--ccm-text: #1a1a1a;
	--ccm-text-light: #6b7280;
	--ccm-border: #e5e7eb;
	--ccm-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
	--ccm-radius: 16px;
	--ccm-radius-sm: 8px;
}

/* Reset */
.ccm-banner *,
.ccm-modal *,
.ccm-floating-btn * {
	box-sizing: border-box;
}

/* ============================================
   BANNER STYLES
   ============================================ */

.ccm-banner {
	position: fixed;
	z-index: 999999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
	font-size: 14px;
	line-height: 1.5;
	color: var(--ccm-text);
}

/* Position variants */
.ccm-banner.ccm-position-bottom-left {
	bottom: 20px;
	left: 20px;
	max-width: 400px;
}

.ccm-banner.ccm-position-bottom-right {
	bottom: 20px;
	right: 20px;
	max-width: 400px;
}

.ccm-banner.ccm-position-bottom-center {
	bottom: 0;
	left: 0;
	right: 0;
	max-width: 100%;
}

.ccm-banner.ccm-position-top {
	top: 0;
	left: 0;
	right: 0;
	max-width: 100%;
}

.ccm-banner.ccm-position-modal {
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	max-width: 500px;
	width: calc(100% - 40px);
}

/* Banner Content */
.ccm-banner-content {
	background: var(--ccm-bg);
	border-radius: var(--ccm-radius);
	box-shadow: var(--ccm-shadow);
	padding: 24px;
}

.ccm-banner.ccm-position-bottom-center .ccm-banner-content,
.ccm-banner.ccm-position-top .ccm-banner-content {
	border-radius: 0;
	padding: 16px 24px;
}

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

.ccm-banner-text {
	color: var(--ccm-text);
	margin: 0 0 16px 0;
	font-size: 14px;
	line-height: 1.6;
}

.ccm-banner-text a {
	color: var(--ccm-text);
	text-decoration: underline;
}

.ccm-banner-text a:hover {
	color: var(--ccm-primary);
}

/* Banner Buttons */
.ccm-banner-buttons {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	margin-bottom: 12px;
}

.ccm-banner.ccm-position-bottom-center .ccm-banner-buttons,
.ccm-banner.ccm-position-top .ccm-banner-buttons {
	flex-wrap: nowrap;
	margin-bottom: 0;
}

.ccm-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 12px 24px;
	border-radius: 30px;
	font-size: 14px;
	font-weight: 500;
	cursor: pointer;
	border: none;
	transition: all 0.2s ease;
	text-decoration: none;
	white-space: nowrap;
}

.ccm-btn-primary {
	background: var(--ccm-primary);
	color: #ffffff;
}

.ccm-btn-primary:hover {
	opacity: 0.9;
	transform: translateY(-1px);
}

.ccm-btn-secondary {
	background: #f3f4f6;
	color: var(--ccm-text);
}

.ccm-btn-secondary:hover {
	background: #e5e7eb;
}

.ccm-btn-link {
	background: transparent;
	color: var(--ccm-text);
	padding: 12px 0;
	text-decoration: underline;
}

.ccm-btn-link:hover {
	color: var(--ccm-primary);
}

/* Full width buttons on small screens */
@media (max-width: 480px) {
	.ccm-banner-buttons {
		flex-direction: column;
	}

	.ccm-btn {
		width: 100%;
	}
}

/* ============================================
   MODAL STYLES
   ============================================ */

.ccm-modal-overlay {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, 0.5);
	z-index: 9999999;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s ease, visibility 0.3s ease;
}

.ccm-modal-overlay.ccm-active {
	opacity: 1;
	visibility: visible;
}

.ccm-modal {
	background: var(--ccm-bg);
	border-radius: var(--ccm-radius);
	box-shadow: var(--ccm-shadow);
	max-width: 560px;
	width: calc(100% - 40px);
	max-height: calc(100vh - 40px);
	overflow: hidden;
	transform: scale(0.95) translateY(20px);
	transition: transform 0.3s ease;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
	font-size: 14px;
	color: var(--ccm-text);
}

.ccm-modal-overlay.ccm-active .ccm-modal {
	transform: scale(1) translateY(0);
}

/* Modal Header */
.ccm-modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 20px 24px;
	border-bottom: 1px solid var(--ccm-border);
}

.ccm-modal-title {
	font-size: 20px;
	font-weight: 600;
	margin: 0;
	color: var(--ccm-text);
}

.ccm-modal-close {
	background: none;
	border: none;
	cursor: pointer;
	padding: 8px;
	margin: -8px;
	color: var(--ccm-text-light);
	transition: color 0.2s;
	line-height: 0;
}

.ccm-modal-close:hover {
	color: var(--ccm-text);
}

.ccm-modal-close svg {
	width: 24px;
	height: 24px;
}

/* Modal Body */
.ccm-modal-body {
	padding: 24px;
	overflow-y: auto;
	max-height: calc(100vh - 200px);
}

.ccm-modal-description {
	color: var(--ccm-text);
	margin: 0 0 24px 0;
	line-height: 1.6;
}

.ccm-modal-description a {
	color: var(--ccm-text);
	text-decoration: underline;
}

/* Categories */
.ccm-category {
	border-bottom: 1px solid var(--ccm-border);
	padding-bottom: 16px;
	margin-bottom: 16px;
}

.ccm-category:last-child {
	border-bottom: none;
	margin-bottom: 0;
	padding-bottom: 0;
}

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

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

.ccm-category-name {
	font-size: 16px;
	font-weight: 600;
	margin: 0 0 4px 0;
	display: flex;
	align-items: center;
	gap: 8px;
	color: var(--ccm-text);
}

.ccm-category-name .ccm-chevron {
	color: var(--ccm-text-light);
	transition: transform 0.2s;
}

.ccm-category.ccm-expanded .ccm-chevron {
	transform: rotate(180deg);
}

.ccm-category-description {
	color: var(--ccm-text-light);
	margin: 0;
	font-size: 14px;
	line-height: 1.5;
	display: none;
}

.ccm-category.ccm-expanded .ccm-category-description {
	display: block;
	margin-top: 8px;
}

/* Required Badge */
.ccm-required-badge {
	font-size: 12px;
	color: var(--ccm-text-light);
	font-weight: normal;
}

/* Toggle Switch */
.ccm-toggle {
	position: relative;
	display: inline-block;
	width: 50px;
	height: 28px;
	flex-shrink: 0;
}

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

.ccm-toggle-slider {
	position: absolute;
	cursor: pointer;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background-color: #d1d5db;
	transition: 0.3s;
	border-radius: 28px;
}

.ccm-toggle-slider:before {
	position: absolute;
	content: "";
	height: 22px;
	width: 22px;
	left: 3px;
	bottom: 3px;
	background-color: white;
	transition: 0.3s;
	border-radius: 50%;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

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

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

.ccm-toggle input:disabled + .ccm-toggle-slider {
	opacity: 0.6;
	cursor: not-allowed;
}

/* Modal Footer */
.ccm-modal-footer {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	padding: 20px 24px;
	border-top: 1px solid var(--ccm-border);
	background: #f9fafb;
}

.ccm-modal-footer .ccm-btn {
	flex: 1;
	min-width: 120px;
}

@media (max-width: 480px) {
	.ccm-modal-footer {
		flex-direction: column;
	}

	.ccm-modal-footer .ccm-btn {
		width: 100%;
	}
}

/* ============================================
   FLOATING BUTTON
   ============================================ */

.ccm-floating-btn {
	position: fixed;
	bottom: 20px;
	left: 20px;
	width: 48px;
	height: 48px;
	border-radius: 50%;
	background: var(--ccm-bg);
	border: none;
	box-shadow: var(--ccm-shadow);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--ccm-primary);
	transition: transform 0.2s, box-shadow 0.2s;
	z-index: 999998;
}

.ccm-floating-btn:hover {
	transform: scale(1.1);
	box-shadow: 0 6px 30px rgba(0, 0, 0, 0.2);
}

.ccm-floating-btn svg {
	width: 24px;
	height: 24px;
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes ccm-fade-in {
	from {
		opacity: 0;
		transform: translateY(20px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.ccm-banner {
	animation: ccm-fade-in 0.4s ease;
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

.ccm-btn:focus,
.ccm-toggle input:focus + .ccm-toggle-slider,
.ccm-modal-close:focus,
.ccm-floating-btn:focus {
	outline: 2px solid var(--ccm-primary);
	outline-offset: 2px;
}

/* Screen reader only */
.ccm-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
	.ccm-banner.ccm-position-bottom-left,
	.ccm-banner.ccm-position-bottom-right {
		left: 10px;
		right: 10px;
		bottom: 10px;
		max-width: none;
	}

	.ccm-modal {
		width: calc(100% - 20px);
		max-height: calc(100vh - 20px);
	}

	.ccm-modal-body {
		max-height: calc(100vh - 180px);
	}

	.ccm-floating-btn {
		bottom: 10px;
		left: 10px;
	}
}

/* ============================================
   PRINT
   ============================================ */

@media print {
	.ccm-banner,
	.ccm-modal-overlay,
	.ccm-floating-btn {
		display: none !important;
	}
}

/* ============================================
   HIDDEN STATE
   ============================================ */

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