/**
 * LTanDev WooCommerce Expandable Category List - Frontend Styles
 *
 * @package LtanDev\WC_Customizations
 */

/* Block Wrapper */
.wp-block-ltandev-expandable-category-list {
	margin: 1.5em 0;
	font-family: inherit;
}

/* Navigation Container */
.ltandev-category-tree {
	width: 100%;
}

/* Category List */
.ltandev-category-tree .category-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.ltandev-category-tree .category-list.level-0 {
	padding-left: 0;
}

.ltandev-category-tree .category-list.level-1 {
	padding-left: 20px;
}

.ltandev-category-tree .category-list.level-2 {
	padding-left: 20px;
}

.ltandev-category-tree .category-list.level-3 {
	padding-left: 20px;
}

.ltandev-category-tree .category-list.level-4 {
	padding-left: 20px;
}

.ltandev-category-tree .category-list.level-5 {
	padding-left: 20px;
}

/* Category Item */
.ltandev-category-tree .category-item {
	margin: 0.5em 0;
	line-height: 1.6;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
}

.ltandev-category-tree .category-item.level-0 {
	font-weight: 600;
}

/* Toggle Button */
.ltandev-category-tree .category-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	margin-right: 8px;
	cursor: pointer;
	border: 1px solid #ddd;
	border-radius: 3px;
	background-color: #fff;
	transition: all 0.2s ease;
	flex-shrink: 0;
}

.ltandev-category-tree .category-toggle:hover {
	background-color: #f7f7f7;
	border-color: #999;
}

.ltandev-category-tree .category-toggle:focus {
	outline: 2px solid #007cba;
	outline-offset: 2px;
	border-color: #007cba;
}

/* Toggle Icon */
.ltandev-category-tree .toggle-icon {
	width: 16px;
	height: 16px;
	color: #333;
	transition: transform 0.2s ease;
}

/* Category Link */
.ltandev-category-tree .category-link {
	color: #007cba;
	text-decoration: none;
	transition: color 0.2s ease;
	flex-shrink: 1;
}

.ltandev-category-tree .category-link:hover {
	color: #005a87;
	text-decoration: underline;
}

.ltandev-category-tree .category-link:focus {
	outline: 2px solid #007cba;
	outline-offset: 2px;
	border-radius: 2px;
}

/* Product Count */
.ltandev-category-tree .product-count {
	margin-left: 6px;
	color: #666;
	font-size: 0.9em;
	flex-shrink: 0;
}

/* Category Children Container */
.ltandev-category-tree .category-children {
	width: 100%;
	overflow: hidden;
	transition: opacity 0.3s ease, max-height 0.3s ease;
	opacity: 1;
	max-height: none;
}

.ltandev-category-tree .category-item.is-collapsed .category-children {
	display: none;
	opacity: 0;
	max-height: 0;
}

.ltandev-category-tree .category-item.is-expanded .category-children {
	display: block;
	opacity: 1;
	max-height: none;
}

/* Empty State */
.ltandev-category-list-empty {
	padding: 2em;
	text-align: center;
	color: #666;
	font-style: italic;
	background-color: #f7f7f7;
	border: 1px solid #ddd;
	border-radius: 4px;
}

/* Error State */
.ltandev-category-list-error {
	padding: 1em;
	background-color: #f8d7da;
	color: #721c24;
	border: 1px solid #f5c6cb;
	border-radius: 4px;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
	.ltandev-category-tree .category-list.level-1,
	.ltandev-category-tree .category-list.level-2,
	.ltandev-category-tree .category-list.level-3,
	.ltandev-category-tree .category-list.level-4,
	.ltandev-category-tree .category-list.level-5 {
		padding-left: 15px;
	}

	.ltandev-category-tree .category-toggle {
		width: 20px;
		height: 20px;
		margin-right: 6px;
	}

	.ltandev-category-tree .toggle-icon {
		width: 14px;
		height: 14px;
	}

	.ltandev-category-tree .category-link {
		font-size: 0.95em;
	}

	.ltandev-category-tree .product-count {
		font-size: 0.85em;
	}
}

/* Accessibility - High Contrast Mode */
@media (prefers-contrast: high) {
	.ltandev-category-tree .category-toggle {
		border-width: 2px;
	}

	.ltandev-category-tree .category-link {
		text-decoration: underline;
	}
}

/* Print Styles */
@media print {
	.ltandev-category-tree .category-toggle {
		display: none;
	}

	.ltandev-category-tree .category-children {
		display: block !important;
		opacity: 1 !important;
		max-height: none !important;
	}

	.ltandev-category-tree .category-item.is-collapsed .category-children {
		display: block !important;
	}
}

/* Dark Mode Support (if theme supports) */
@media (prefers-color-scheme: dark) {
	.ltandev-category-tree .category-toggle {
		background-color: #1e1e1e;
		border-color: #444;
	}

	.ltandev-category-tree .category-toggle:hover {
		background-color: #2a2a2a;
		border-color: #666;
	}

	.ltandev-category-tree .toggle-icon {
		color: #e0e0e0;
	}

	.ltandev-category-tree .category-link {
		color: #4a9eff;
	}

	.ltandev-category-tree .category-link:hover {
		color: #76b7ff;
	}

	.ltandev-category-tree .product-count {
		color: #999;
	}

	.ltandev-category-list-empty {
		background-color: #1e1e1e;
		border-color: #444;
		color: #999;
	}
}

/* Animation for smooth expand/collapse */
@keyframes ltandev-category-expand {
	from {
		opacity: 0;
		max-height: 0;
	}
	to {
		opacity: 1;
		max-height: 1000px;
	}
}

@keyframes ltandev-category-collapse {
	from {
		opacity: 1;
		max-height: 1000px;
	}
	to {
		opacity: 0;
		max-height: 0;
	}
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
	.ltandev-category-tree .category-children {
		transition: none;
	}

	.ltandev-category-tree .toggle-icon {
		transition: none;
	}

	.ltandev-category-tree .category-toggle {
		transition: none;
	}

	.ltandev-category-tree .category-link {
		transition: none;
	}
}
