/**
 * Bricofix Components
 * Styles for Header, Footer, Buttons, Cards.
 */

/* Storefront's .col-full::before/::after clearfix (display:table) turns into
   phantom flex/grid items wherever a .col-full is also flex/grid, shifting
   every real child by one position. Neutralize it on every such container. */
.bricofix-header-top .col-full::before,
.bricofix-header-top .col-full::after,
.bricofix-header-main .col-full::before,
.bricofix-header-main .col-full::after,
.bricofix-newsletter .col-full::before,
.bricofix-newsletter .col-full::after,
.bricofix-footer-main::before,
.bricofix-footer-main::after {
	content: none;
}

/* Storefront's #masthead.site-header ships with its own dark background,
   ~26px top/bottom padding and a huge (~68px) bottom margin — meant for
   Storefront's own header markup. Our .bricofix-header fully replaces that
   markup but still renders *inside* #masthead, so all of that leftover
   styling showed up as an empty dark bar above the header and a large gap
   below it (pushing the hero down / adding excess space before every page's
   breadcrumb). Neutralize it since .bricofix-header supplies its own look. */
#masthead.site-header {
	background: none;
	padding: 0;
	margin-bottom: 0;
	border-bottom: none;
}

/* ==================================================
   Buttons
   ================================================== */
.bricofix-btn,
button.button,
a.button {
	background-color: var(--color-primary);
	color: var(--color-text-inverse);
	border: none;
	border-radius: var(--radius-md);
	padding: 12px 24px;
	font-family: var(--font-heading);
	font-weight: 600;
	cursor: pointer;
	transition: all 0.3s ease;
	display: inline-block;
}

.bricofix-btn:hover,
button.button:hover,
a.button:hover {
	background-color: var(--color-primary-hover);
	transform: translateY(-2px);
	box-shadow: var(--shadow-sm);
	color: var(--color-text-inverse);
}

.bricofix-btn-secondary {
	background-color: var(--color-secondary);
}

.bricofix-btn-secondary:hover {
	background-color: var(--color-secondary-light);
}

/* ==================================================
   Header (Glassmorphism)
   ================================================== */
.bricofix-header {
	position: sticky;
	top: 0;
	z-index: 1000;
	background: rgba(255, 255, 255, 0.9);
	backdrop-filter: blur(10px);
	border-bottom: 1px solid var(--color-border);
}

.bricofix-header-top {
	background: var(--color-secondary);
	color: var(--color-text-inverse);
	font-size: 0.92em;
	padding: 8px 0;
}

.bricofix-header-top .col-full {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 6px;
}

.bricofix-usp,
.bricofix-top-nav {
	min-width: 0;
}

.bricofix-usp span {
	margin-right: 15px;
}

.bricofix-top-nav a {
	color: var(--color-text-inverse);
	margin-left: 15px;
}

.bricofix-header-main .col-full {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 10px;
	padding: 15px 20px;
}

.bricofix-logo,
.bricofix-actions {
	min-width: 0;
}

.bricofix-logo img {
	max-height: 60px;
	width: auto;
	display: block;
}

.bricofix-logo .site-title,
.bricofix-logo .site-title a {
	font-family: var(--font-heading);
	font-weight: 800;
	color: var(--color-secondary);
	font-size: 1.4em;
}

.bricofix-search {
	flex: 1;
	max-width: 500px;
	margin: 0 30px;
}

.bricofix-search form {
	display: flex;
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	overflow: hidden;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
	background: var(--color-bg-surface);
}

.bricofix-search form:focus-within {
	border-color: var(--color-primary);
	box-shadow: 0 0 0 3px rgba(254, 105, 8, 0.15);
}

.bricofix-search input[type="search"] {
	width: 100%;
	padding: 11px 16px;
	border: none;
	background: transparent;
	font-family: var(--font-body);
}

.bricofix-search input[type="search"]:focus {
	outline: none;
}

.bricofix-search button {
	border: none;
	padding: 10px 20px;
	display: flex;
	align-items: center;
}

.bricofix-actions {
	display: flex;
	align-items: center;
	gap: 20px;
}

.bricofix-cart-drawer-trigger .cart-contents {
	display: flex;
	align-items: center;
	background: var(--color-bg-body);
	padding: 8px 15px;
	border-radius: var(--radius-md);
	font-weight: bold;
	color: var(--color-secondary);
}

.bricofix-cart-drawer-trigger .amount {
	margin-right: 8px;
}

.bricofix-header-nav {
	background: var(--color-bg-surface);
	border-top: 1px solid var(--color-border);
}

.bricofix-mega-menu {
	display: flex;
	align-items: center;
	gap: 30px;
}

.bricofix-mega-menu .primary-navigation > ul,
.bricofix-categories-dropdown {
	display: flex;
	align-items: center;
	gap: 30px;
	list-style: none;
	margin: 0;
	padding: 14px 0;
}

.bricofix-mega-menu .primary-navigation > ul li,
.bricofix-categories-dropdown > li {
	margin: 0;
}

.bricofix-mega-menu .primary-navigation > ul a,
.bricofix-categories-dropdown > li > a {
	color: var(--color-text-main);
	font-weight: 600;
	font-size: 0.95em;
	letter-spacing: 0.02em;
}

.bricofix-mega-menu .primary-navigation > ul a:hover,
.bricofix-mega-menu .primary-navigation > ul .current-menu-item > a,
.bricofix-categories-dropdown > li > a:hover {
	color: var(--color-primary);
}

/* Catégories dropdown */
.bricofix-categories-dropdown {
	padding: 0;
}

.bricofix-categories-dropdown > li {
	position: relative;
	padding: 4px 0;
}

.bricofix-categories-dropdown > li > a {
	display: flex;
	align-items: center;
	gap: 8px;
	background: var(--color-primary);
	color: var(--color-text-inverse);
	padding: 10px 18px !important;
	border-radius: var(--radius-md);
	font-weight: 700;
	box-shadow: 0 0 0 0 rgba(254, 105, 8, 0.45);
	animation: bricofix-cta-pulse 2.4s ease-in-out infinite;
	transition: background-color 0.25s ease, transform 0.2s ease, box-shadow 0.25s ease;
}

.bricofix-categories-dropdown > li > a::before {
	content: "";
	width: 15px;
	height: 15px;
	flex-shrink: 0;
	background-color: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Crect x='3' y='3' width='7' height='7' rx='1.5'/%3E%3Crect x='14' y='3' width='7' height='7' rx='1.5'/%3E%3Crect x='3' y='14' width='7' height='7' rx='1.5'/%3E%3Crect x='14' y='14' width='7' height='7' rx='1.5'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Crect x='3' y='3' width='7' height='7' rx='1.5'/%3E%3Crect x='14' y='3' width='7' height='7' rx='1.5'/%3E%3Crect x='3' y='14' width='7' height='7' rx='1.5'/%3E%3Crect x='14' y='14' width='7' height='7' rx='1.5'/%3E%3C/svg%3E") center / contain no-repeat;
}

.bricofix-categories-dropdown > li > a:hover,
.bricofix-categories-dropdown > li:focus-within > a {
	background: var(--color-primary-hover);
	color: var(--color-text-inverse);
	transform: translateY(-2px);
	animation-play-state: paused;
	box-shadow: var(--shadow-sm);
}

@keyframes bricofix-cta-pulse {
	0%, 100% { box-shadow: 0 0 0 0 rgba(254, 105, 8, 0.45); }
	50% { box-shadow: 0 0 0 7px rgba(254, 105, 8, 0); }
}

.bricofix-categories-dropdown > li > a::after {
	content: "▾";
	display: inline-block;
	margin-left: 2px;
	font-size: 0.75em;
	transition: transform 0.2s ease;
}

.bricofix-categories-dropdown .sub-menu {
	position: absolute;
	top: 100%;
	left: 0;
	min-width: 240px;
	background: var(--color-bg-surface);
	border-radius: var(--radius-md);
	box-shadow: var(--shadow-md);
	list-style: none;
	margin: 0;
	padding: 8px 0;
	display: flex;
	flex-direction: column;
	gap: 0;
	z-index: 1100;
	opacity: 0;
	visibility: hidden;
	transform: translateY(-8px);
	transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}

.bricofix-categories-dropdown > li:hover .sub-menu,
.bricofix-categories-dropdown > li:focus-within .sub-menu {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.bricofix-categories-dropdown > li:hover > a::after,
.bricofix-categories-dropdown > li:focus-within > a::after {
	transform: rotate(180deg);
}

.bricofix-categories-dropdown .sub-menu li {
	margin: 0;
}

.bricofix-categories-dropdown .sub-menu a {
	display: block;
	padding: 10px 20px;
	color: var(--color-text-main);
	font-weight: 500;
	font-size: 0.9em;
}

.bricofix-categories-dropdown .sub-menu a:hover {
	background: var(--color-bg-body);
	color: var(--color-primary);
}

.bricofix-categories-see-all a {
	border-top: 1px solid var(--color-border);
	margin-top: 4px;
	padding-top: 12px !important;
	color: var(--color-primary) !important;
	font-weight: 600;
}

/* ==================================================
   Footer
   ================================================== */
.bricofix-footer {
	background: var(--color-bg-surface);
	margin-top: 60px;
	border-top: 1px solid var(--color-border);
}

.bricofix-newsletter {
	background: var(--color-primary);
	color: var(--color-text-inverse);
	padding: 40px 0;
}

.bricofix-newsletter .col-full {
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.newsletter-form {
	display: flex;
}

.newsletter-form input {
	padding: 12px;
	border: none;
	border-radius: var(--radius-sm) 0 0 var(--radius-sm);
	min-width: 250px;
}

.newsletter-form button {
	background: var(--color-secondary);
	border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.bricofix-footer-main {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 30px;
	padding: 50px 20px;
}

.footer-widget:not(.brand-widget) {
	border-left: 1px solid var(--color-border);
	padding-left: 24px;
}

.footer-widget h4 {
	border-bottom: 2px solid var(--color-primary);
	padding-bottom: 8px;
	margin-bottom: 16px;
	display: inline-block;
}

.footer-widget ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

.footer-widget ul li {
	margin-bottom: 10px;
}

.bricofix-social-icons {
	display: flex;
	gap: 10px;
	margin-top: 16px;
}

.social-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.social-icon:hover {
	transform: translateY(-3px);
	box-shadow: var(--shadow-sm);
}

.social-icon--facebook { background: #1877F2; }
.social-icon--instagram { background: radial-gradient(circle at 30% 110%, #ffdb73 0%, #fd5949 30%, #d6249f 60%, #285AEB 90%); }
.social-icon--whatsapp { background: #25D366; }
.social-icon--tiktok { background: #010101; }
.social-icon--mail { background: var(--color-primary); }

.brand-widget img {
	max-height: 50px;
	width: auto;
	display: block;
	margin-bottom: 15px;
}

.bricofix-footer-bottom {
	text-align: center;
	padding: 20px;
	border-top: 1px solid var(--color-border);
	color: var(--color-text-muted);
}

/* ==================================================
   Product Cards
   ================================================== */
.bricofix-product-img-wrap {
	position: relative;
	overflow: hidden;
	border-radius: var(--radius-md);
	aspect-ratio: 1 / 1;
	background: var(--color-bg-body);
}

.bricofix-product-img-wrap img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: contain;
	object-position: center;
	transition: filter 0.4s ease;
}

ul.products li.product:hover .bricofix-product-img-wrap img {
	filter: invert(1);
}

ul.products li.product {
	background: var(--color-bg-surface);
	border-radius: var(--radius-lg);
	padding: 15px;
	box-shadow: var(--shadow-sm);
	transition: box-shadow 0.3s ease, transform 0.3s ease;
	border: 1px solid var(--color-border);
	display: flex !important;
	flex-direction: column;
	height: 100%;
	/* Storefront sets ul.products { font-size: 0.875em }, so every em-based
	   child rule below was cascading from 14px, not the 16px body base. */
	font-size: 16px;
}

ul.products li.product:hover {
	box-shadow: var(--shadow-md);
	transform: translateY(-5px);
}

ul.products li.product .woocommerce-loop-product__title {
	font-size: 1.15em;
	font-weight: 700;
	margin: 15px 0 6px;
	color: var(--color-text-main);
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	min-height: 2.6em;
}

ul.products li.product .star-rating {
	font-size: 1em;
	margin: 0 0 6px;
}

ul.products li.product .woocommerce-product-rating:empty,
ul.products li.product .star-rating:empty {
	display: none;
}

ul.products li.product .price {
	color: var(--color-primary);
	font-weight: 700;
	font-size: 1.2em;
	margin-bottom: 10px;
}

ul.products li.product a.button,
ul.products li.product .bricofix-quick-add {
	margin-top: auto;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

@media (max-width: 768px) {
	.bricofix-footer-main {
		grid-template-columns: 1fr 1fr;
	}
	.footer-widget:not(.brand-widget) {
		border-left: none;
		padding-left: 0;
	}
	.bricofix-newsletter .col-full {
		flex-direction: column;
		gap: 20px;
		text-align: center;
	}
}
