/**
 * Theme Name: Rey Child
 * Theme URI: http://reytheme.com/
 * Description: This is a child theme of Rey.
 * Author: Marius H.
 * Author URI:  https://twitter.com/mariushoria
 * Template: rey
 * Version: 1.0.1
 * License: General Public License
 * License URI: http://www.gnu.org/licenses/gpl.html
 * Text Domain: rey-child
 */

/* Brand Color Palette */
:root {
	--rey-child-white: #ffffff;
	--rey-child-dark-gray: #424548;
	--rey-child-light-gray: #9fa1a4;
	--rey-child-very-light-gray: #e4e5e6;
	--rey-child-orange: #fe4604;
	--rey-child-orange-hover: #e03d04;
	
	/* Proto Skin Border Customizations */
	--proto-border-color: var(--rey-child-very-light-gray);
	--proto-border-color-hover: var(--rey-child-light-gray);
	--proto-border-width: 1px;
	--proto-border-radius: 8px;
}

/* Custom Modern Sidebar Styles - Optimized for Performance */
.rey-child-custom-sidebar-wrapper {
	display: flex;
	gap: 30px;
	align-items: flex-start;
	margin-top: 20px;
	contain: layout style;
}

.rey-child-custom-sidebar {
	width: 320px;
    flex-shrink: 0;
	background: var(--rey-child-white);
	border: 1px solid var(--rey-child-very-light-gray);
	border-radius: 12px;
	box-shadow: 0 4px 16px rgba(66, 69, 72, 0.08);
	overflow: visible;
	position: sticky;
	top: 20px;
	transition: box-shadow 0.3s ease, transform 0.3s ease;
	will-change: box-shadow, transform;
	contain: layout style paint;
}

.rey-child-custom-sidebar:hover {
	box-shadow: 0 6px 20px rgba(66, 69, 72, 0.12);
	transform: translateY(-2px);
}

.rey-child-main-content {
	flex: 1;
	min-width: 0;
}

/* Modern Grid Header */
.rey-child-grid-header {
	background: var(--rey-child-white);
	border: 1px solid var(--rey-child-very-light-gray);
	border-radius: 12px;
	box-shadow: 0 4px 16px rgba(66, 69, 72, 0.08);
	margin-bottom: 30px;
	overflow: hidden;
}

.rey-child-grid-header-content {
	padding: 24px 30px;
    position: relative;
}

.rey-child-grid-header-content::after {
	content: '';
    position: absolute;
	bottom: 0;
    left: 0;
    right: 0;
	height: 3px;
	background: linear-gradient(90deg, var(--rey-child-orange) 0%, #ff6b35 100%);
}

.rey-child-grid-title {
	margin: 0 0 8px 0;
	font-size: 28px;
	font-weight: 700;
	color: var(--rey-child-dark-gray);
	letter-spacing: -0.5px;
	line-height: 1.2;
}

.rey-child-grid-description {
	margin: 0 0 16px 0;
	font-size: 16px;
	color: var(--rey-child-light-gray);
	line-height: 1.5;
}

.rey-child-grid-meta {
	display: flex;
	align-items: center;
	gap: 16px;
}

.rey-child-product-count {
	background: linear-gradient(135deg, var(--rey-child-orange) 0%, #ff6b35 100%);
	color: var(--rey-child-white);
	font-size: 14px;
	font-weight: 600;
	padding: 8px 16px;
	border-radius: 20px;
	box-shadow: 0 2px 8px rgba(254, 70, 4, 0.3);
}

.rey-child-sidebar-header {
	background: var(--rey-child-dark-gray);
	padding: 18px 20px;
	border-bottom: 1px solid var(--rey-child-very-light-gray);
}

.rey-child-sidebar-title {
	margin: 0;
	font-size: 16px;
	font-weight: 600;
	color: var(--rey-child-white);
    display: flex;
    align-items: center;
    gap: 10px;
	letter-spacing: 0.5px;
}

.rey-child-sidebar-icon {
	width: 18px;
	height: 18px;
	color: var(--rey-child-orange);
}

.rey-child-category-tree {
	padding: 0;
}

.rey-child-category-item {
	border-bottom: 1px solid var(--rey-child-very-light-gray);
	transition: background-color 0.2s ease, transform 0.2s ease;
	contain: layout style;
}

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

.rey-child-category-item:hover {
	background: #f8f9fa;
	transform: translateX(4px);
}

.rey-child-category-item.current-category {
	background: var(--rey-child-orange);
	animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
	0%, 100% {
		box-shadow: 0 0 0 0 rgba(254, 70, 4, 0.4);
	}
	50% {
		box-shadow: 0 0 0 8px rgba(254, 70, 4, 0);
	}
}

/* Current/Selected Category - Enhanced specificity for Rey compatibility */
.rey-child-custom-sidebar .rey-child-category-item.current-category .rey-child-category-link {
	color: var(--rey-child-white) !important;
}

.rey-child-custom-sidebar .rey-child-category-item.current-category .rey-child-category-link:hover {
	color: var(--rey-child-light-gray) !important;
}

.rey-child-custom-sidebar .rey-child-category-item.current-category .rey-child-category-name {
	color: var(--rey-child-white) !important;
}

.rey-child-custom-sidebar .rey-child-category-item.current-category .rey-child-category-link:hover .rey-child-category-name {
	color: var(--rey-child-light-gray) !important;
}

.rey-child-custom-sidebar .rey-child-category-item.current-category .toggle-icon {
	color: var(--rey-child-white) !important;
}

.rey-child-custom-sidebar .rey-child-category-item.current-category .rey-child-category-link:hover .toggle-icon {
	color: var(--rey-child-light-gray) !important;
}

.rey-child-custom-sidebar .rey-child-category-item.current-category .rey-child-category-count {
	background: rgba(255, 255, 255, 0.2) !important;
	color: var(--rey-child-white) !important;
}

.rey-child-custom-sidebar .rey-child-category-item.current-category .rey-child-category-link:hover .rey-child-category-count {
	background: rgba(255, 255, 255, 0.3) !important;
	color: var(--rey-child-light-gray) !important;
}

/* Fix subcategory visibility when parent is selected - Enhanced specificity */
.rey-child-category-item.current-category .rey-child-subcategory-list .rey-child-category-link {
	color: var(--rey-child-dark-gray) !important;
}

.rey-child-category-item.current-category .rey-child-subcategory-list .rey-child-category-link:hover {
	color: var(--rey-child-orange) !important;
}

.rey-child-category-item.current-category .rey-child-subcategory-list .rey-child-category-count {
	background: var(--rey-child-very-light-gray) !important;
	color: var(--rey-child-light-gray) !important;
}

.rey-child-category-item.current-category .rey-child-subcategory-list .rey-child-category-link:hover .rey-child-category-count {
	background: var(--rey-child-orange) !important;
	color: var(--rey-child-white) !important;
}

/* Additional fix for subcategory names */
.rey-child-category-item.current-category .rey-child-subcategory-list .rey-child-category-name {
	color: var(--rey-child-dark-gray) !important;
}

.rey-child-category-item.current-category .rey-child-subcategory-list .rey-child-category-link:hover .rey-child-category-name {
	color: var(--rey-child-orange) !important;
}

.rey-child-category-link {
    display: flex;
	align-items: center;
	padding: 14px 20px;
	color: var(--rey-child-dark-gray);
	text-decoration: none;
	transition: color 0.2s ease, transform 0.2s ease;
	font-weight: 500;
    position: relative;
    overflow: hidden;
	contain: layout style;
}

.rey-child-category-link::before {
	content: '';
	position: absolute;
	top: 0;
	left: -100%;
    width: 100%;
    height: 100%;
	background: linear-gradient(90deg, transparent, rgba(254, 70, 4, 0.1), transparent);
	transition: left 0.5s ease;
}

.rey-child-category-link:hover::before {
	left: 100%;
}

.rey-child-category-link:hover {
	color: var(--rey-child-orange);
	text-decoration: none;
	background: transparent;
	transform: translateX(2px);
}

.rey-child-category-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
	width: 24px;
	height: 24px;
	margin-right: 12px;
    cursor: pointer;
	border-radius: 4px;
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	position: relative;
}

.rey-child-category-toggle:hover {
	background: rgba(254, 70, 4, 0.1);
    transform: scale(1.1);
}

.rey-child-category-toggle:active {
	transform: scale(0.95);
}

.toggle-icon {
	width: 16px;
	height: 16px;
	color: var(--rey-child-light-gray);
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.rey-child-category-item.expanded .toggle-icon {
	transform: rotate(90deg);
	color: var(--rey-child-orange);
}

.rey-child-category-name {
	flex: 1;
	font-size: 14px;
    font-weight: 500;
	line-height: 1.4;
}

.rey-child-category-count {
	background: var(--rey-child-very-light-gray);
	color: var(--rey-child-light-gray);
    font-size: 12px;
    font-weight: 600;
	padding: 4px 8px;
    border-radius: 12px;
	min-width: 24px;
	text-align: center;
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	position: relative;
    overflow: hidden;
}

.rey-child-category-count::before {
    content: '';
    position: absolute;
    top: 0;
	left: -100%;
    width: 100%;
	height: 100%;
	background: var(--rey-child-orange);
	transition: left 0.3s ease;
	z-index: -1;
}

.rey-child-category-link:hover .rey-child-category-count {
	color: var(--rey-child-white);
	transform: scale(1.05);
}

.rey-child-category-link:hover .rey-child-category-count::before {
	left: 0;
}

/* Subcategory styling */
.rey-child-subcategory-list {
	background: #f8f9fa;
	border-top: 1px solid var(--rey-child-very-light-gray);
	animation: slideDown 0.4s ease-out;
	overflow: hidden;
}

@keyframes slideDown {
	from {
		max-height: 0;
		opacity: 0;
	}
	to {
		max-height: 500px;
        opacity: 1;
	}
}

/* Level 1 subcategories - Always visible */
.rey-child-category-item.level-1 .rey-child-category-link {
	padding-left: 52px;
        font-size: 13px;
	color: var(--rey-child-dark-gray) !important;
}

.rey-child-category-item.level-1 .rey-child-category-name {
	font-weight: 400;
	color: var(--rey-child-dark-gray) !important;
}

.rey-child-category-item.level-1 .rey-child-category-link:hover {
	color: var(--rey-child-orange) !important;
}

.rey-child-category-item.level-1 .rey-child-category-link:hover .rey-child-category-name {
	color: var(--rey-child-orange) !important;
}

/* Level 2 subcategories - Always visible */
.rey-child-category-item.level-2 .rey-child-category-link {
	padding-left: 72px;
	font-size: 12px;
	color: var(--rey-child-light-gray) !important;
}

.rey-child-category-item.level-2 .rey-child-category-name {
	font-weight: 400;
	color: var(--rey-child-light-gray) !important;
}

.rey-child-category-item.level-2 .rey-child-category-link:hover {
	color: var(--rey-child-orange) !important;
}

.rey-child-category-item.level-2 .rey-child-category-link:hover .rey-child-category-name {
	color: var(--rey-child-orange) !important;
}

/* Ensure subcategory counts are always visible */
.rey-child-category-item.level-1 .rey-child-category-count,
.rey-child-category-item.level-2 .rey-child-category-count {
	background: var(--rey-child-very-light-gray) !important;
	color: var(--rey-child-light-gray) !important;
}

.rey-child-category-item.level-1 .rey-child-category-link:hover .rey-child-category-count,
.rey-child-category-item.level-2 .rey-child-category-link:hover .rey-child-category-count {
	background: var(--rey-child-orange) !important;
	color: var(--rey-child-white) !important;
}

/* Override any parent category white text inheritance for subcategories */
.rey-child-category-item.current-category .rey-child-subcategory-list .rey-child-category-item .rey-child-category-link,
.rey-child-category-item.current-category .rey-child-subcategory-list .rey-child-category-item .rey-child-category-name {
	color: var(--rey-child-dark-gray) !important;
}

.rey-child-category-item.current-category .rey-child-subcategory-list .rey-child-category-item.level-2 .rey-child-category-link,
.rey-child-category-item.current-category .rey-child-subcategory-list .rey-child-category-item.level-2 .rey-child-category-name {
	color: var(--rey-child-light-gray) !important;
}

/* Ensure proper layout integration with Rey - Inline with Grid */
.woocommerce-page .rey-child-custom-sidebar-wrapper {
    display: flex;
	align-items: flex-start;
}

.woocommerce-page .rey-child-custom-sidebar-wrapper .woocommerce-products-header {
	width: 100%;
	margin-bottom: 0;
}

.woocommerce-page .rey-child-custom-sidebar-wrapper .woocommerce {
	background: transparent;
    padding: 0;
	width: 100%;
}

/* Hide the default WooCommerce results count and sorting when sidebar is present */
.rey-child-custom-sidebar-wrapper ~ .woocommerce-result-count,
.rey-child-custom-sidebar-wrapper ~ .woocommerce-ordering {
	display: none;
}

/* Responsive Design */
@media (max-width: 768px) {
	.rey-child-custom-sidebar-wrapper {
		flex-direction: column;
		gap: 20px;
		margin-top: 15px;
	}
	
	.rey-child-custom-sidebar {
		width: 100%;
        position: static;
		max-height: none;
    border-radius: 12px;
		order: 2; /* Show sidebar after content on mobile */
	}
	
	.rey-child-main-content {
		order: 1; /* Show content first on mobile */
	}
	
	.rey-child-sidebar-header {
		padding: 16px 18px;
	}
	
	.rey-child-sidebar-title {
		font-size: 15px;
		gap: 10px;
	}
	
	.rey-child-category-link {
		padding: 12px 18px;
	}
	
	.rey-child-category-item.level-1 .rey-child-category-link {
		padding-left: 54px;
	}
	
		.rey-child-category-item.level-2 .rey-child-category-link {
		padding-left: 72px;
	}
	
	/* Grid header responsive */
	.rey-child-grid-header-content {
		padding: 20px 24px;
	}
	
	.rey-child-grid-title {
		font-size: 24px;
	}
	
	.rey-child-grid-description {
		font-size: 15px;
	}
}

@media (max-width: 480px) {
	.rey-child-custom-sidebar-wrapper {
		gap: 15px;
		margin-top: 10px;
	}
	
	.rey-child-sidebar-header {
		padding: 14px 16px;
	}
	
	.rey-child-sidebar-title {
		font-size: 14px;
		gap: 8px;
	}
	
	.rey-child-category-link {
		padding: 10px 16px;
	}
	
	.rey-child-category-name {
		font-size: 14px;
	}
	
	.rey-child-category-count {
		font-size: 10px;
		padding: 4px 8px;
		min-width: 24px;
	}
	
	.rey-child-category-item.level-1 .rey-child-category-link {
		padding-left: 50px;
	}
	
		.rey-child-category-item.level-2 .rey-child-category-link {
		padding-left: 68px;
	}
	
	/* Grid header mobile */
	.rey-child-grid-header-content {
		padding: 18px 20px;
	}
	
	.rey-child-grid-title {
		font-size: 22px;
		letter-spacing: -0.3px;
	}
	
	.rey-child-grid-description {
		font-size: 14px;
		margin-bottom: 12px;
	}
	
	.rey-child-product-count {
		font-size: 13px;
		padding: 6px 12px;
    }
}

/* ========================================
   PROTO SKIN BORDER CUSTOMIZATIONS
   ======================================== */

/* Proto Skin - Subtle Borders with Brand Colors */
.rey-wc-skin--proto .rey-productInner {
	border: var(--proto-border-width) solid var(--proto-border-color);
	border-radius: var(--proto-border-radius);
	transition: border-color 0.3s ease, box-shadow 0.3s ease;
	background-color: var(--rey-child-white);
}

/* Proto Skin - Hover State Borders */
.rey-wc-skin--proto .rey-productInner:hover {
	border-color: var(--proto-border-color-hover);
	box-shadow: 0 2px 8px rgba(159, 161, 164, 0.15);
}

/* Proto Skin - Focus State for Accessibility */
.rey-wc-skin--proto .rey-productInner:focus-within {
	border-color: var(--rey-child-orange);
	box-shadow: 0 0 0 2px rgba(254, 70, 4, 0.1);
}

/* Proto Skin - Active/Selected State */
.rey-wc-skin--proto .rey-productInner.--active {
	border-color: var(--rey-child-orange);
	box-shadow: 0 0 0 1px var(--rey-child-orange);
}

/* Proto Skin - Enhanced Shadow on Hover */
.rey-wc-skin--proto:hover .rey-protoShadowHolder:after {
	--proto-shadow: 0 4px 12px rgba(159, 161, 164, 0.2);
}

/* Proto Skin - Mobile Optimizations */
@media (max-width: 768px) {
	.rey-wc-skin--proto .rey-productInner {
		border-width: 0.5px;
		border-radius: 6px;
	}
}

/* Proto Skin - High Contrast Mode Support */
@media (prefers-contrast: high) {
	.rey-wc-skin--proto .rey-productInner {
		border-color: var(--rey-child-dark-gray);
		border-width: 2px;
	}
}

/* Proto Skin - Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
	.rey-wc-skin--proto .rey-productInner {
		transition: none;
    }
}
