/* Tamimi Ceramics - responsive storefront (replaces the old table layout + style1.css for public pages) */

:root {
	--navy: #203560;
	--blue: #4E679F;
	--blue-light: #C0CBDC;
	--blue-pale: #D5DBEA;
	--blue-tint: #EEF2F8;
	--page-bg: #45555F;
	--text: #222833;
	--muted: #5d6675;
	--line: #d3d9e4;
	--white: #fff;
	--red: #b3261e;
	--green: #1f7a3a;
	--radius: 10px;
	--shadow: 0 1px 2px rgba(20, 30, 50, .08), 0 4px 14px rgba(20, 30, 50, .06);
	--font: Arial, Helvetica, sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
	margin: 0;
	background: var(--page-bg);
	color: var(--text);
	font-family: var(--font);
	font-size: 15px;
	line-height: 1.5;
}

img { max-width: 100%; height: auto; border: 0; }

a { color: var(--navy); font-weight: bold; text-decoration: none; }
a:hover { color: #003399; text-decoration: underline; }

h1, h2, h3 { line-height: 1.25; color: #333; }

.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;
}

/* ---------- page frame ---------- */

.site {
	max-width: 1200px;
	margin: 0 auto;
	background: var(--white);
	min-height: 100vh;
	display: flex;
	flex-direction: column;
}

/* ---------- header ---------- */

.site-header {
	border-bottom: 6px solid var(--navy);
	background: var(--white);
}

.header-inner {
	display: grid;
	grid-template-columns: auto 1fr auto;
	grid-template-areas: "brand nav side";
	align-items: end;
	gap: 12px 24px;
	padding: 10px 20px 0;
}

.brand { grid-area: brand; align-self: center; padding-bottom: 10px; }
.brand img { display: block; width: 200px; }

.main-nav { grid-area: nav; display: flex; gap: 6px; flex-wrap: wrap; }
.main-nav a {
	display: block;
	padding: 9px 18px;
	background: var(--blue);
	color: var(--white);
	border-radius: 8px 8px 0 0;
	white-space: nowrap;
}
.main-nav a:hover { background: #3d5487; color: var(--white); text-decoration: none; }
.main-nav a.is-active { background: var(--navy); }

.header-side { grid-area: side; text-align: center; padding-bottom: 8px; }
.header-side__logo img { display: block; margin: 0 auto 4px; max-height: 60px; width: auto; }
.header-badges { display: flex; gap: 4px; justify-content: center; align-items: center; flex-wrap: wrap; }
.header-badges img { display: block; height: 38px; width: auto; }

.nav-toggle { display: none; }

/* ---------- layout ---------- */

.layout {
	flex: 1;
	display: grid;
	grid-template-columns: 240px minmax(0, 1fr);
	gap: 20px;
	padding: 20px;
	align-items: start;
}

.sidebar { display: flex; flex-direction: column; gap: 16px; }

.content {
	background: var(--blue-tint);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 20px 24px;
	min-width: 0;
}

/* ---------- sidebar boxes ---------- */

.box {
	border: 1px solid var(--line);
	border-radius: var(--radius);
	overflow: hidden;
	background: #f4f5f7;
}
.box__title {
	margin: 0;
	display: flex;
	align-items: center;
	justify-content: space-between;
	background: var(--blue);
	padding: 9px 12px;
	font-size: 17px;
}
.box__title a { color: var(--white); }
.box__body { padding: 8px 10px; }
.box--search { background: var(--blue-light); padding: 10px; }
.box__toggle { display: none; }

/* category tree */
.cat-tree { list-style: none; margin: 0; padding: 0; }
.cat-tree__link {
	display: block;
	padding: 6px 6px;
	border-bottom: 1px dotted #9aa3b1;
	color: #333;
	font-size: 13px;
	border-radius: 4px;
}
.cat-tree__item:last-child .cat-tree__link { border-bottom: 0; }
a.cat-tree__link:hover { background: var(--blue-light); text-decoration: none; color: #333; }
.cat-tree__link.is-current { color: brown; background: var(--white); }
.cat-tree .level-1 .cat-tree__link { padding-left: 20px; font-weight: normal; }
.cat-tree .level-2 .cat-tree__link { padding-left: 34px; font-weight: normal; }
.cat-tree .level-3 .cat-tree__link,
.cat-tree .level-4 .cat-tree__link { padding-left: 48px; font-weight: normal; }

/* search */
.search-form { display: flex; gap: 6px; }
.search-form__input {
	flex: 1;
	min-width: 0;
	padding: 8px 10px;
	border: 1px solid #8e9ab0;
	border-radius: 6px;
	font: inherit;
	font-size: 14px;
	background: var(--white);
}
.search-form__btn {
	border: 0; background: transparent; padding: 0 2px; cursor: pointer;
	display: flex; align-items: center;
}
.lightsmall { color: #000; font-size: 80%; }

/* cart summary */
.cart-info { font-size: 13px; color: navy; font-weight: bold; }
.cart-info__link { display: inline-block; margin-top: 4px; }

/* ---------- common content pieces ---------- */

.page-title { font-size: 24px; margin: 0 0 10px; color: var(--navy); }
.section-title {
	font-size: 20px;
	color: var(--navy);
	margin: 24px 0 14px;
	padding-bottom: 6px;
	border-bottom: 2px solid var(--blue-light);
}
.greeting h1 { font-size: 20px; color: var(--navy); margin: 0 0 6px; text-align: left; }
.greeting p:empty { display: none; }

.breadcrumb {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px 6px;
	font-size: 14px;
	margin-bottom: 16px;
	color: var(--muted);
}
.breadcrumb__sep { color: #8a93a3; }
.breadcrumb [aria-current] { color: var(--muted); font-weight: bold; }

.count {
	display: inline-block;
	min-width: 22px;
	padding: 0 6px;
	border-radius: 999px;
	background: var(--blue-light);
	color: #990000;
	font-size: 12px;
	text-align: center;
	line-height: 20px;
	vertical-align: middle;
}

.empty, .notice, .results-count { color: var(--muted); }
.empty { padding: 30px 0; text-align: center; font-size: 16px; }

.pager { text-align: center; margin: 12px 0; font-size: 14px; }
.pager a {
	display: inline-block;
	padding: 3px 8px;
	margin: 2px;
	border-radius: 5px;
	background: var(--white);
	border: 1px solid var(--line);
}
.pager a:hover { background: var(--blue-light); text-decoration: none; }

.rich-text { overflow-wrap: anywhere; }
.rich-text img { height: auto; }
.rich-text table { display: block; max-width: 100%; overflow-x: auto; }
.rich-text h1 { font-size: 22px; color: var(--navy); }

/* buttons */
.btn {
	display: inline-block;
	padding: 8px 14px;
	border: 1px solid var(--navy);
	border-radius: 6px;
	background: var(--navy);
	color: var(--white);
	font: inherit;
	font-size: 14px;
	font-weight: bold;
	text-align: center;
	cursor: pointer;
	text-decoration: none;
}
.btn:hover { background: #2c4880; color: var(--white); text-decoration: none; }
.btn--ghost { background: var(--white); color: var(--navy); }
.btn--ghost:hover { background: var(--blue-tint); color: var(--navy); }
.btn--big { padding: 11px 20px; font-size: 16px; }

/* ---------- home: category cards ---------- */

.category-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 14px;
}
.category-card {
	display: flex;
	gap: 12px;
	align-items: flex-start;
	background: var(--white);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 12px;
	box-shadow: var(--shadow);
}
.category-card__media {
	flex: 0 0 84px;
	height: 84px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #f6f7f9;
	border-radius: 8px;
	overflow: hidden;
}
.category-card__media img { max-height: 100%; object-fit: contain; }
.category-card__noimg {
	font-size: 34px;
	color: var(--blue);
	text-transform: uppercase;
}
.category-card__body { min-width: 0; }
.category-card__title { display: block; font-size: 15px; color: #333; margin-bottom: 6px; }
.category-card__subs { font-size: 13px; line-height: 1.7; }
.category-card__subs a { font-weight: normal; }
.category-card__subs a:not(:last-child)::after { content: " |"; color: #9aa3b1; }

/* ---------- category page ---------- */

.category-head { display: flex; gap: 18px; align-items: flex-start; margin-bottom: 18px; }
.category-head__img {
	flex: 0 0 auto;
	max-width: 160px;
	border-radius: 8px;
	background: var(--white);
	padding: 6px;
	border: 1px solid var(--line);
}
.category-head__text { min-width: 0; }
.category-head__desc { margin-bottom: 10px; }

.subcat-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.subcat-list a {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 5px 10px;
	background: var(--white);
	border: 1px solid var(--line);
	border-radius: 999px;
	font-size: 13px;
}
.subcat-list a:hover { background: var(--blue-light); text-decoration: none; }

/* ---------- product cards ---------- */

.product-grid {
	--cols: 3;
	display: grid;
	grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
	gap: 16px;
}

.product-card {
	display: flex;
	flex-direction: column;
	background: var(--white);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	overflow: hidden;
	box-shadow: var(--shadow);
	transition: box-shadow .15s ease, transform .15s ease;
}
.product-card:hover { box-shadow: 0 6px 22px rgba(20, 30, 50, .14); transform: translateY(-2px); }

.product-card__media {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	background: #fafafa;
	border-bottom: 1px solid #eceff4;
}
.product-card__media img {
	position: absolute;
	inset: 10px;
	width: calc(100% - 20px);
	height: calc(100% - 20px);
	object-fit: contain;
}
.product-card__noimg {
	font-size: 48px;
	color: var(--blue-light);
	text-transform: uppercase;
	font-weight: bold;
}
.product-card__noimg--big { display: flex; align-items: center; justify-content: center; aspect-ratio: 1 / 1; font-size: 90px; background: #fafafa; border-radius: var(--radius); }

.product-card__body { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px 14px; flex: 1; }
.product-card__title { margin: 0; font-size: 15px; }
.product-card__title a { color: var(--text); }
.product-card__desc { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.product-card__desc img { display: none; }
.product-card__actions { margin-top: auto; display: flex; flex-wrap: wrap; gap: 6px; }
.product-card__actions .btn { flex: 1 1 auto; font-size: 13px; padding: 7px 10px; }

.price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.price__current { color: var(--red); font-size: 17px; }
.price__old { color: brown; font-size: 13px; }
.price__save { color: brown; font-size: 12px; flex-basis: 100%; }
.price--big { flex-direction: column; gap: 4px; margin: 6px 0 14px; }
.price--big .price__current { font-size: 24px; }

/* ---------- product page ---------- */

.product-detail {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	gap: 24px;
	align-items: start;
	background: var(--white);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 20px;
}
.product-detail__media { text-align: center; }
.product-detail__zoom {
	position: relative;
	display: block;
	border-radius: 8px;
	background: #fafafa;
	overflow: hidden;
	cursor: zoom-in;
}
.product-detail__zoom img {
	display: block;
	width: 100%;
	max-height: 520px;
	object-fit: contain;
	transition: transform .3s ease;
}
.product-detail__zoom:hover img { transform: scale(1.03); }
.product-detail__zoom-icon {
	position: absolute;
	right: 10px;
	bottom: 10px;
	width: 38px;
	height: 38px;
	border-radius: 50%;
	background: rgba(32, 53, 96, .85);
	box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
}
/* magnifier icon */
.product-detail__zoom-icon::before {
	content: "";
	position: absolute;
	left: 10px;
	top: 9px;
	width: 13px;
	height: 13px;
	border: 2px solid #fff;
	border-radius: 50%;
}
.product-detail__zoom-icon::after {
	content: "";
	position: absolute;
	left: 24px;
	top: 23px;
	width: 7px;
	height: 2px;
	background: #fff;
	transform: rotate(45deg);
}

/* lightbox */
body.lightbox-open { overflow: hidden; }
.lightbox {
	position: fixed;
	inset: 0;
	z-index: 1000;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 12px;
	padding: 50px 16px 20px;
	background: rgba(12, 18, 30, .9);
	opacity: 0;
	transition: opacity .2s ease;
	cursor: zoom-out;
}
.lightbox[hidden] { display: none; }
.lightbox.is-visible { opacity: 1; }
.lightbox__img {
	max-width: min(1000px, 100%);
	max-height: calc(100vh - 120px);
	object-fit: contain;
	background: #fff;
	border-radius: 8px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, .5);
	transform: scale(.96);
	transition: transform .2s ease;
	cursor: default;
}
.lightbox.is-visible .lightbox__img { transform: scale(1); }
.lightbox__caption { color: #fff; font-weight: bold; font-size: 16px; text-align: center; }
.lightbox__close {
	position: absolute;
	top: 10px;
	right: 14px;
	width: 42px;
	height: 42px;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, .15);
	color: #fff;
	font-size: 30px;
	line-height: 1;
	cursor: pointer;
}
.lightbox__close:hover { background: rgba(255, 255, 255, .3); }

.product-meta { margin: 0 0 16px; }
.product-meta__row { display: flex; gap: 8px; padding: 6px 0; border-bottom: 1px solid #eef0f4; }
.product-meta dt { color: var(--muted); min-width: 110px; }
.product-meta dd { margin: 0; font-weight: bold; }
.stock--yes { color: var(--green); }
.stock--no { color: var(--red); }

.product-detail__desc {
	margin-top: 20px;
	background: var(--white);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 18px 20px;
}

/* ---------- cart ---------- */

.cart__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.cart__clear { display: inline-flex; align-items: center; gap: 4px; }

.cart-table { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--white); }
.cart-row {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 110px 120px 44px;
	align-items: center;
	border-top: 1px solid #e6e9ef;
}
.cart-row:first-child { border-top: 0; }
.cart-row--head { background: var(--blue); color: var(--white); font-weight: bold; text-align: center; }
.cart-row--total { grid-template-columns: minmax(0, 1fr) 164px; background: var(--blue-tint); }
.cart-cell { padding: 10px 12px; }
.cart-cell--qty, .cart-cell--cost, .cart-cell--del { text-align: center; }
.cart-cell--qty input { width: 70px; padding: 6px; border: 1px solid #a8b2c3; border-radius: 6px; font: inherit; text-align: center; }
.cart-cell--total { text-align: center; background: var(--blue-light); color: var(--navy); }

.form-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.form-actions--end { justify-content: flex-end; }
.form-actions--split { justify-content: space-between; }

/* ---------- checkout form ---------- */

.checkout { max-width: 620px; margin: 0 auto; }
.form { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 0 20px 20px; overflow: hidden; }
.form__title { margin: 0 -20px 10px; background: var(--blue); color: var(--white); font-weight: bold; text-align: center; padding: 8px; }
.form__note { text-align: center; font-size: 13px; color: var(--muted); }
.form-row { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 10px; align-items: center; margin-bottom: 10px; }
.form-row label { text-align: right; font-size: 14px; }
.form-row input, .form-row textarea {
	width: 100%;
	padding: 8px 10px;
	border: 1px solid #a8b2c3;
	border-radius: 6px;
	font: inherit;
}
.req { color: red; }

/* ---------- price list ---------- */

.pricelist { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--white); }
.pricelist__row {
	display: flex;
	justify-content: space-between;
	gap: 10px;
	padding: 7px 12px;
	border-top: 1px solid rgba(0, 0, 0, .06);
}
.pricelist__row:first-child { border-top: 0; }
.pricelist__row.is-product .pricelist__name { font-weight: normal; }
.pricelist__price { white-space: nowrap; font-weight: bold; }
.pricelist .level-1 { padding-left: 28px; }
.pricelist .level-2 { padding-left: 44px; }
.pricelist .level-3, .pricelist .level-4 { padding-left: 60px; }

.order-result { text-align: center; padding: 20px 0; }
.paypal-form { margin-top: 16px; }

/* ---------- footer ---------- */

.site-footer {
	text-align: center;
	font-size: 13px;
	font-style: italic;
	color: var(--muted);
	padding: 12px 20px 18px;
	border-top: 1px solid var(--line);
	margin: 0 20px;
}

/* =================== responsive =================== */

@media (max-width: 1024px) {
	.product-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
	.layout { grid-template-columns: 210px minmax(0, 1fr); }
	.header-inner { grid-template-columns: auto 1fr; grid-template-areas: "brand side" "nav nav"; }
}

@media (max-width: 860px) {
	body { font-size: 15px; }

	.header-inner {
		grid-template-columns: 1fr auto;
		grid-template-areas: "brand toggle" "nav nav";
		align-items: center;
		padding: 8px 14px;
	}
	.brand { padding-bottom: 0; }
	.brand img { width: 160px; }
	.header-side { display: none; grid-area: auto; grid-column: 1 / -1; padding: 4px 0 10px; }
	.nav-open .header-side { display: block; }
	.header-side__logo { display: none; }

	.nav-toggle {
		grid-area: toggle;
		display: inline-flex;
		flex-direction: column;
		justify-content: center;
		gap: 4px;
		width: 44px;
		height: 44px;
		padding: 0 10px;
		border: 1px solid var(--line);
		border-radius: 8px;
		background: var(--white);
		cursor: pointer;
	}
	.nav-toggle__bar { display: block; height: 3px; border-radius: 2px; background: var(--navy); }

	.main-nav { display: none; flex-direction: column; gap: 4px; padding-bottom: 8px; }
	.nav-open .main-nav { display: flex; }
	.main-nav a { border-radius: 6px; padding: 11px 14px; }

	.layout { grid-template-columns: minmax(0, 1fr); padding: 12px; gap: 12px; }

	/* catalog list collapses on phones */
	.box__toggle {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 34px;
		height: 30px;
		border: 1px solid rgba(255, 255, 255, .5);
		border-radius: 6px;
		background: transparent;
		cursor: pointer;
	}
	.box__toggle::before { content: ""; width: 8px; height: 8px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); margin-top: -4px; }
	.box--catalog.is-open .box__toggle::before { transform: rotate(-135deg); margin-top: 4px; }
	.box--catalog .box__body { display: none; }
	.box--catalog.is-open .box__body { display: block; }

	.content { padding: 14px; }
	.product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
	.product-detail { grid-template-columns: minmax(0, 1fr); padding: 14px; }
	.cat-tree__link { padding: 9px 6px; font-size: 14px; }
}

@media (max-width: 560px) {
	.page-title { font-size: 20px; }
	.category-head { flex-direction: column; }
	.category-head__img { max-width: 120px; }
	.product-card__body { padding: 10px; }
	.product-card__title { font-size: 14px; }
	.product-card__actions .btn { flex-basis: 100%; }

	/* cart rows become small cards */
	.cart-row--head { display: none; }
	.cart-row { grid-template-columns: 1fr auto; grid-template-areas: "name del" "qty cost"; gap: 4px; padding: 8px 0; }
	.cart-cell { padding: 4px 12px; }
	.cart-cell--name { grid-area: name; }
	.cart-cell--del { grid-area: del; }
	.cart-cell--qty { grid-area: qty; text-align: left; }
	.cart-cell--cost { grid-area: cost; text-align: right; }
	.cart-cell[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-size: 13px; }
	.cart-row--total { grid-template-columns: 1fr auto; grid-template-areas: none; }

	.form-row { grid-template-columns: minmax(0, 1fr); gap: 4px; }
	.form-row label { text-align: left; }
	.form-actions--split .btn { flex: 1 1 100%; }
}

@media (max-width: 330px) {
	.product-grid { grid-template-columns: minmax(0, 1fr); }
}
