/*
Theme Name: Tessi Light Theme
Theme URI: https://tessi.lv
Author: Codex
Description: Lightweight, high-performance autonomous WooCommerce theme for Tessi.lv preserving the original brand design without Impreza or WPBakery dependencies.
Version: 1.1.2
Text Domain: tessi-light
Tested up to: 6.7
Requires at least: 6.0
Requires PHP: 7.4
License: GNU General Public License v2 or later
*/

:root {
	--tl-primary: #d02c1e;
	--tl-primary-hover: #b02418;
	--tl-text: #1d2929;
	--tl-muted: #666666;
	--tl-light: #f5f5f5;
	--tl-border: #ebe6e9;
	--tl-white: #ffffff;
	--tl-font: Verdana, Geneva, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	--tl-container: 1240px;
	--tl-radius: 8px;
}

*, *::before, *::after {
	box-sizing: border-box;
}

html {
	font-family: var(--tl-font);
	font-size: 15px;
	line-height: 1.6;
	color: var(--tl-text);
	background-color: var(--tl-white);
	-webkit-text-size-adjust: 100%;
}

body {
	margin: 0;
	padding: 0;
	color: var(--tl-text);
	background: #ffffff;
	overflow-x: hidden;
}

a {
	color: var(--tl-text);
	text-decoration: none;
	transition: color 0.2s ease;
}

a:hover {
	color: var(--tl-primary);
}

img {
	max-width: 100%;
	height: auto;
	display: block;
}

.tl-container {
	width: 100%;
	max-width: var(--tl-container);
	margin: 0 auto;
	padding: 0 16px;
}

/* ==========================================================================
   Header
   ========================================================================== */
.tl-topbar {
	background: #e8e8e8;
	color: #333333;
	font-size: 13px;
	border-bottom: 1px solid #ddd;
}

.tl-topbar .tl-container {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding-top: 6px;
	padding-bottom: 6px;
}

.tl-topbar__left {
	display: flex;
	align-items: center;
	gap: 16px;
	flex-wrap: wrap;
}

.tl-topbar__phone {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	color: #222;
	font-weight: 600;
}

.tl-topbar__phone:hover {
	color: var(--tl-primary);
}

.tl-topbar__right {
	display: flex;
	align-items: center;
	gap: 16px;
}

.tl-topbar__hours {
	color: #555;
	font-size: 12px;
}

.tl-topbar__login {
	font-weight: 600;
	color: #222;
	text-transform: uppercase;
	font-size: 12px;
}

.tl-header {
	background: #ffffff;
	border-bottom: 1px solid var(--tl-border);
	position: sticky;
	top: 0;
	z-index: 1000;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.tl-header__main {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 12px 16px;
}

.tl-logo {
	display: flex;
	align-items: center;
	max-width: 140px;
}

.tl-logo img {
	height: 48px;
	width: auto;
	object-fit: contain;
}

.tl-catalog-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	background: var(--tl-primary);
	color: #ffffff !important;
	padding: 10px 18px;
	border-radius: 4px;
	font-weight: 700;
	font-size: 14px;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	cursor: pointer;
	border: none;
	transition: background 0.2s ease;
}

.tl-catalog-btn:hover {
	background: var(--tl-primary-hover);
}

.tl-search {
	flex: 1;
	max-width: 580px;
	position: relative;
}

.tl-search input[type="search"],
.tl-search input[type="text"] {
	width: 100%;
	padding: 10px 42px 10px 14px;
	border: 2px solid var(--tl-border);
	border-radius: 4px;
	font-size: 14px;
	font-family: inherit;
	background: #fafafa;
	transition: border-color 0.2s ease, background 0.2s ease;
}

.tl-search input:focus {
	outline: none;
	border-color: var(--tl-primary);
	background: #ffffff;
}

.tl-search button {
	position: absolute;
	right: 0;
	top: 0;
	bottom: 0;
	width: 40px;
	background: none;
	border: none;
	color: var(--tl-primary);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}

.tl-header__actions {
	display: flex;
	align-items: center;
	gap: 16px;
}

.tl-cart-link {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 8px 12px;
	border: 1px solid var(--tl-border);
	border-radius: 4px;
	font-weight: 600;
	color: var(--tl-text);
	position: relative;
	transition: border-color 0.2s;
}

.tl-cart-link:hover {
	border-color: var(--tl-primary);
	color: var(--tl-primary);
}

.tl-cart-badge {
	background: var(--tl-primary);
	color: #ffffff;
	font-size: 11px;
	font-weight: 700;
	border-radius: 50%;
	min-width: 20px;
	height: 20px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0 4px;
}

/* ==========================================================================
   Notice Banner / Hero
   ========================================================================== */
.tl-notice-box {
	background: #ffd1d1;
	padding: 20px;
	border-radius: 4px;
	margin: 20px 0;
	text-align: center;
	font-size: 14px;
	line-height: 1.5;
}

.tl-notice-box p {
	margin: 0 0 10px;
}

.tl-section-title {
	font-size: 24px;
	font-weight: 700;
	color: var(--tl-text);
	text-transform: uppercase;
	margin: 28px 0 16px;
	padding-bottom: 8px;
	border-bottom: 2px solid var(--tl-primary);
	display: inline-block;
}

/* ==========================================================================
   Product Grid
   ========================================================================== */
.tl-products-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 20px;
	margin: 20px 0 40px;
}

@media (max-width: 1200px) {
	.tl-products-grid {
		grid-template-columns: repeat(3, 1fr);
	}
}

@media (max-width: 768px) {
	.tl-products-grid {
		grid-template-columns: repeat(2, 1fr);
		gap: 12px;
	}
}

.tl-card {
	background: #ffffff;
	border: 1px solid var(--tl-border);
	border-radius: 4px;
	display: flex;
	flex-direction: column;
	padding: 12px;
	transition: box-shadow 0.2s ease, border-color 0.2s ease;
	position: relative;
}

.tl-card:hover {
	border-color: #d8d0d5;
	box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.tl-card__thumb {
	position: relative;
	width: 100%;
	padding-bottom: 100%;
	overflow: hidden;
	background: #fafafa;
	border-radius: 2px;
	margin-bottom: 10px;
}

.tl-card__thumb img {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.3s ease;
}

.tl-card:hover .tl-card__thumb img {
	transform: scale(1.04);
}

.tl-card__title {
	font-size: 13px;
	line-height: 1.35;
	font-weight: 400;
	color: var(--tl-text);
	height: 38px;
	overflow: hidden;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	margin: 6px 0 10px;
	text-align: center;
}

.tl-card__title a {
	color: inherit;
}

.tl-card__title a:hover {
	color: var(--tl-primary);
}

.tl-card__price {
	font-size: 15px;
	font-weight: 700;
	color: var(--tl-text);
	text-align: center;
	margin: auto 0 8px;
}

.tl-card__price small {
	font-size: 11px;
	font-weight: 400;
	color: #777;
	margin-left: 4px;
}

.tl-card__btn {
	background: var(--tl-primary);
	color: #ffffff !important;
	text-align: center;
	padding: 8px 12px;
	border-radius: 3px;
	font-size: 12px;
	font-weight: 700;
	text-transform: uppercase;
	display: block;
	transition: background 0.2s;
}

.tl-card__btn:hover {
	background: var(--tl-primary-hover);
}

/* ==========================================================================
   Footer
   ========================================================================== */
.tl-footer {
	background: #1d2929;
	color: #cccccc;
	padding: 40px 0 20px;
	font-size: 13px;
	margin-top: 60px;
}

.tl-footer a {
	color: #cccccc;
}

.tl-footer a:hover {
	color: #ffffff;
}

.tl-footer__nav {
	display: flex;
	gap: 20px;
	flex-wrap: wrap;
	justify-content: center;
	margin-bottom: 24px;
	font-weight: 600;
}

.tl-footer__copy {
	text-align: center;
	color: #888888;
	font-size: 12px;
	border-top: 1px solid rgba(255, 255, 255, 0.1);
	padding-top: 16px;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 768px) {
	.tl-topbar {
		display: none;
	}

	.tl-header__main {
		flex-wrap: wrap;
		padding: 8px 12px;
	}

	.tl-logo img {
		height: 38px;
	}

	.tl-search {
		order: 3;
		flex: 1 1 100%;
		max-width: 100%;
		width: 100%;
		margin-top: 6px;
	}

	.tl-catalog-btn {
		padding: 8px 12px;
		font-size: 12px;
	}

	/* The live-search trigger is position:absolute inside a collapsed .wpls-search,
	   so its box is about x=-26. Show the plugin field on its own full-width row. */
	.tl-search .wpls-search {
		display: block;
		width: 100%;
		min-height: 44px;
		position: relative;
	}

	.tl-search .wpls-search__trigger,
	.tl-search .wpls-search__close,
	.tl-search .wpls-search__backdrop {
		display: none !important;
	}

	.tl-search .wpls-search__overlay,
	.tl-search .wpls-search__overlay[hidden] {
		display: block !important;
		position: relative !important;
		inset: auto !important;
		top: auto !important;
		right: auto !important;
		bottom: auto !important;
		left: auto !important;
		width: 100% !important;
		height: auto !important;
		padding: 0 !important;
		z-index: auto !important;
		background: transparent !important;
		animation: none !important;
	}

	.tl-search .wpls-search__box {
		width: 100% !important;
		max-width: none !important;
		margin: 0 !important;
		border: 2px solid var(--tl-border) !important;
		border-radius: 4px !important;
		background: #fafafa !important;
		box-shadow: none !important;
		overflow: visible !important;
		animation: none !important;
	}

	.tl-search .wpls-search__form {
		height: 44px !important;
		border-bottom: 0 !important;
		background: transparent !important;
		padding: 0 12px !important;
	}

	.tl-search .wpls-search__input {
		width: 100% !important;
		height: 44px !important;
		min-height: 44px !important;
		opacity: 1 !important;
		color: var(--tl-text) !important;
		background: transparent !important;
	}

	.tl-search .wpls-search__results {
		position: absolute;
		left: 0;
		right: 0;
		top: 100%;
		z-index: 40;
		max-height: min(60vh, 420px);
		overflow-y: auto;
		background: #ffffff;
		border: 1px solid var(--tl-border);
		border-radius: 4px;
	}

	.tl-search .wpls-search__result,
	.tl-search .wpls-search__status {
		display: block;
		padding: 10px 12px;
		color: var(--tl-text);
		font-size: 14px;
		line-height: 1.35;
	}
}

/* ==========================================================================
   Builder visibility, logo, catalog, product and cart
   ========================================================================== */
button.tl-catalog-btn {
	font-family: inherit;
	line-height: 1.2;
}

.tl-logo__img,
.tl-logo .custom-logo {
	height: 48px;
	width: auto;
	max-width: 160px;
	object-fit: contain;
}

.tl-logo__name {
	display: block;
	max-width: 160px;
	font-size: 13px;
	font-weight: 700;
	line-height: 1.25;
}

.tl-catalog {
	position: relative;
}

.tl-catalog__panel {
	display: none;
	position: absolute;
	z-index: 1001;
	top: calc(100% + 8px);
	left: 0;
	min-width: 240px;
	max-width: min(420px, calc(100vw - 24px));
	max-height: 70vh;
	overflow: auto;
	background: #ffffff;
	border: 1px solid var(--tl-border);
	border-radius: 4px;
	box-shadow: 0 10px 28px rgba(0, 0, 0, 0.08);
	padding: 8px 0;
}

.tl-catalog.is-open .tl-catalog__panel:not([hidden]) {
	display: block;
}

.tl-catalog__list,
.tl-catalog__list ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

.tl-catalog__list a {
	display: block;
	padding: 8px 16px;
	font-size: 14px;
}

.tl-catalog__list .children,
.tl-catalog__list .sub-menu {
	padding-left: 12px;
}

.tl-separator {
	border: none;
	border-top: 1px solid #ebe6e9;
	margin: 16px 0;
}

.tl-product-title {
	font-size: 28px;
	font-weight: 700;
	line-height: 1.3;
	margin: 0 0 12px;
	text-transform: none;
	border: 0;
	display: block;
	color: var(--tl-text);
}

.tl-breadcrumbs {
	font-size: 13px;
	color: var(--tl-muted);
	margin: 0 0 10px;
}

.tl-breadcrumbs a {
	color: var(--tl-muted);
}

.tl-breadcrumbs__current {
	color: var(--tl-text);
}

.tl-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: var(--tl-primary);
	color: #ffffff !important;
	padding: 8px 14px;
	border-radius: 3px;
	font-size: 13px;
	font-weight: 700;
}

.tl-store-notices:empty {
	display: none;
}

.woocommerce-message,
.woocommerce-info,
.woocommerce-error {
	margin: 12px 0;
	padding: 12px 16px;
	background: #f7f7f7;
	border-top: 3px solid var(--tl-primary);
	list-style: none;
}

.woocommerce ul.products {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 16px;
	margin: 16px 0 32px;
	padding: 0;
	list-style: none;
}

.woocommerce ul.products::before,
.woocommerce ul.products::after {
	content: none;
	display: none;
}

.woocommerce ul.products li.product {
	float: none;
	width: auto !important;
	margin: 0 !important;
	padding: 12px;
	border: 1px solid var(--tl-border);
	border-radius: 4px;
	background: #ffffff;
	display: flex;
	flex-direction: column;
}

.woocommerce ul.products li.product a img {
	width: 100%;
	height: auto;
	margin: 0 0 10px;
}

.woocommerce ul.products li.product .woocommerce-loop-product__title {
	font-size: 14px;
	font-weight: 400;
	line-height: 1.35;
	padding: 0;
	margin: 0 0 8px;
}

.woocommerce ul.products li.product .price {
	margin-top: auto;
	font-weight: 700;
}

.woocommerce ul.products li.product .button {
	display: block;
	width: 100%;
	box-sizing: border-box;
	white-space: normal;
	line-height: 1.25;
	padding: 8px 6px;
	font-size: 12px;
}

.woocommerce ul.products li.product .button,
.woocommerce div.product form.cart .button,
.woocommerce a.button,
.woocommerce button.button,
.woocommerce a.button.alt,
.woocommerce button.button.alt {
	background: var(--tl-primary);
	color: #ffffff;
	border: 0;
	border-radius: 3px;
	font-weight: 700;
	text-align: center;
}

.woocommerce ul.products li.product .button:hover,
.woocommerce div.product form.cart .button:hover,
.woocommerce a.button:hover,
.woocommerce button.button:hover {
	background: var(--tl-primary-hover);
	color: #ffffff;
}

.woocommerce div.product:not(.woocommerce-page-builder-template) {
	display: grid;
	grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
	gap: 28px;
	align-items: start;
}

.woocommerce div.product:not(.woocommerce-page-builder-template) div.images,
.woocommerce div.product:not(.woocommerce-page-builder-template) div.summary {
	float: none;
	width: auto;
	margin: 0;
}

.woocommerce div.product .woocommerce-product-gallery {
	opacity: 1 !important;
}

@media (max-width: 767px) {
	.tl-hide-mobiles {
		display: none !important;
	}

	.tl-product-title {
		font-size: 22px;
	}

	.woocommerce div.product:not(.woocommerce-page-builder-template) {
		grid-template-columns: 1fr;
	}
}

@media (min-width: 768px) and (max-width: 1024px) {
	.tl-hide-tablets {
		display: none !important;
	}

	.woocommerce ul.products {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (min-width: 1025px) and (max-width: 1280px) {
	.tl-hide-laptops {
		display: none !important;
	}
}

@media (min-width: 1281px) {
	.tl-hide-default {
		display: none !important;
	}
}

/*
 * Phone catalog. This block stays after the default 4-column rule.
 * WooCommerce smallscreen.css sets columns-* items to width:48% with float
 * and clear, but an earlier width:auto !important cancels that. A 2-column
 * grid declared before the base 4-column rule never wins.
 */
@media (max-width: 767px) {
	.woocommerce ul.products.columns-2,
	.woocommerce ul.products.columns-3,
	.woocommerce ul.products.columns-4,
	.woocommerce ul.products.columns-5,
	.woocommerce ul.products.columns-6,
	.woocommerce-page ul.products[class*="columns-"] {
		display: grid;
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 10px;
	}

	.woocommerce ul.products[class*="columns-"] li.product,
	.woocommerce-page ul.products[class*="columns-"] li.product {
		width: auto !important;
		max-width: 100%;
		min-width: 0;
		float: none !important;
		clear: none !important;
		margin: 0 !important;
		padding: 8px;
	}

	.woocommerce ul.products li.product .woocommerce-loop-product__title {
		font-size: 13px;
		line-height: 1.3;
		overflow-wrap: break-word;
		word-break: normal;
	}

	.woocommerce ul.products li.product .button {
		font-size: 12px;
		line-height: 1.2;
		padding: 8px 6px;
		white-space: normal;
		word-break: normal;
		overflow-wrap: normal;
	}

	.woocommerce ul.products li.product a img {
		margin-bottom: 8px;
	}
}
