/**
 * Amad – Site geneli (global) eklenti stilleri.
 *
 * Bu dosya HER ön yüz sayfasında koşulsuz yüklenir (amad.php → theme_enqueue_styles_amad).
 * Buradaki tüm seçiciler namespace'lidir (.amad-*), ilgili işaretleme sayfada yoksa
 * hiçbir etkisi olmaz. Sayfaya/şablona özel, jenerik seçici kullanan override'lar
 * BURAYA konmaz; onlar ilgili yerde koşullu yüklenmeye devam eder.
 *
 * ─────────────────────────────────────────────────────────────────────────────
 * İçindekiler
 *   1) Kategori Özellik Filtresi (CAF) – beyaz kutu + akordiyon
 *   2) WhatsApp Destek Butonu
 * ─────────────────────────────────────────────────────────────────────────────
 */

/* ===========================================================================
 * 1) Kategori Özellik Filtresi (CAF) – beyaz kutu + akordiyon
 *    Kaynak: widgets/assets/amad-caf-accordion.css (2026-09-08 buraya taşındı).
 *    Widget çıktısı ( .amad-caf-wrapper ) tek bir beyaz panele alınır; her filtre
 *    bloğunun başlığı tıklanabilir bir akordiyon başlığına dönüştürülür (JS ile).
 * ======================================================================== */

.amad-caf-wrapper {
	background: #fff;
	/* border: 1px solid #e6e6e6; */
	border-radius: 5px;
	padding: 15px;
	/* box-shadow: 0 1px 3px rgba( 0, 0, 0, 0.04 ); */
}

/* Kutunun sabit ana başlığı */
.amad-caf-title {
	margin: 0 0 12px;
	padding: 0 0 12px;
	border-bottom: 1px solid #eee;
	font-size: 1rem;
	line-height: 1.3;
	font-weight: 600;
}

/* Akordiyon paneli = tek bir filtre bloğu */
.amad-caf-panel {
	border-bottom: 1px solid #f0f0f0;
	border-bottom-width: 0;
}

.amad-caf-panel:last-of-type {
	border-bottom: 0;
}

/* h3 başlık -> tıklanabilir satır */
.amad-caf-panel>.wp-block-heading.amad-caf-panel__toggle {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin: 0;
	padding: 12px 2px;
	cursor: pointer;
	font-size: 0.95rem;
	font-weight: 600;
	user-select: none;
	/* */
	font-size: 14px;
	padding: 5px 10px;
	background: #f9f9f9;
	border-radius: 3px;
}

.amad-caf-wrapper .wp-block-woocommerce-product-filter-active {
	padding-bottom: 15px;
	display: flex;
	gap: 10px;
	flex-direction: column;
}

.amad-caf-wrapper .wp-block-woocommerce-product-filter-active.wc-block-product-filter--hidden {
	display: none;
}

.amad-caf-wrapper :where(.wc-block-product-filters) .wc-block-product-filters__content {
	gap: 10px;
	gap: 0;
}

.amad-caf-panel .wc-block-product-filter-checkbox-list__text {
	font-size: 13px;
}

.amad-caf-wrapper .wc-block-product-filter-removable-chips__items .wc-block-product-filter-removable-chips__item .wc-block-product-filter-removable-chips__remove {
	min-height: 0;
	line-height: 1.5em;
	gap: 0;
}

.amad-caf-panel__toggle:focus-visible {
	outline: 2px solid #2271b1;
	outline-offset: 2px;
	border-radius: 4px;
}

.amad-caf-panel__toggle:hover {
	color: #2271b1;
}

/* Expand / collapse ikonu (chevron) */
.amad-caf-panel__icon {
	flex: 0 0 auto;
	width: 16px;
	height: 16px;
	transition: transform 0.18s ease;
}

.amad-caf-panel.is-collapsed .amad-caf-panel__icon {
	transform: rotate(-90deg);
}

/* Gövde (checkbox listesi vb.) */
.amad-caf-panel__body {
	padding: 0 2px 14px;
}

.amad-caf-panel.is-collapsed .amad-caf-panel__body {
	display: none;
}

/**
 * Sticky sidebar (yalnızca masaüstü, JS ile açılır/kapanır — amad-caf-accordion.js).
 * İlk pozisyonundan itibaren, footer'a değene kadar ekranda sabit kalır; scroll
 * ile birlikte içerik uzunsa kendi içinde kayar (max-height + overflow).
 * NOT: JS tarafında STICKY_ENABLED = false; class'lar eklenmediği için bu blok etkisiz.
 */
@media ( min-width: 1025px ) {
	.amad-caf-wrapper.amad-caf-is-sticky {
		position: fixed;
		z-index: 20;
	}

	.amad-caf-wrapper.amad-caf-is-stopped {
		position: absolute;
	}

	.amad-caf-wrapper.amad-caf-is-sticky,
	.amad-caf-wrapper.amad-caf-is-stopped {
		max-height: calc( 100vh - 40px );
		overflow-y: auto;
		overscroll-behavior: contain;
	}

	/* Orijinal konumun boşluğu çökmesin diye JS'in eklediği yer tutucu. */
	.amad-caf-sticky-placeholder {
		display: block;
	}
}

/* Filtrele (apply) butonu */
.amad-caf-apply-bar {
	position: sticky;
	bottom: 0;
	margin-top: 12px;
	padding-top: 10px;
	background: #fff;
	border-top: 1px solid #eee;
}

.amad-caf-apply-button {
	display: block;
	width: 100%;
	padding: 10px 12px;
	border: 0;
	border-radius: 3px;
	background: #2c2c2c;
	color: #fff;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: opacity 0.15s ease;
}

.amad-caf-apply-button:disabled {
	opacity: 0.4;
	cursor: default;
}

/* ===========================================================================
 * 2) WhatsApp Destek Butonu
 *    Kaynak: whatsapp-support.php (markup). Sağ altta, Woodmart'ın scrollToTop
 *    butonuyla (right/bottom:20px, 50x50, mobilde 12px/40x40) aynı sırada
 *    durur; her zaman görünür (scrollToTop gibi yalnızca scroll'da değil).
 *    scrollToTop, scroll ile .button-show class'ını alıp göründüğünde bu
 *    buton sola kayar. scrollToTop DOM'da bu butondan önce basıldığı
 *    (woodmart_before_wp_footer -> wp_footer) ve ikisi de <body>'nin
 *    doğrudan çocuğu olduğu için genel kardeş (~) seçici yeterli, ayrıca
 *    scroll dinleyen bir JS gerekmiyor.
 * ======================================================================== */

#amad-whatsapp-button {
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 350;
	display: flex;
	align-items: center;
	gap: 8px;
	height: 50px;
	padding: 0 18px 0 14px;
	border-radius: 25px;
	background-color: #25d366;
	color: #fff;
	box-shadow: 0 0 5px rgba(0, 0, 0, 0.17);
	text-decoration: none !important;
	font-size: 14px;
	font-weight: 600;
	line-height: 1;
	white-space: nowrap;
	transition: right 0.3s ease, background-color 0.15s ease;
}

#amad-whatsapp-button:hover,
#amad-whatsapp-button:focus {
	background-color: #1ebe5d;
	color: #fff;
}

#amad-whatsapp-button:focus-visible {
	outline: 2px solid #128c7e;
	outline-offset: 2px;
}

.amad-whatsapp-button__icon {
	display: flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
}

.amad-whatsapp-button__icon svg {
	display: block;
	width: 100%;
	height: 100%;
}

.amad-whatsapp-button__label {
	flex: 0 0 auto;
}

/* scrollToTop görünür olduğunda (scroll > 100px) aynı sırada yer açmak için
   sola kayar. */
.scrollToTop.button-show ~ #amad-whatsapp-button {
	right: 82px; /* 20 (taban) + 50 (scrollToTop genişliği) + 12 (boşluk) */
}

/* scrollToTop, WooCommerce sticky "sepete ekle" barı açıkken kendi bottom'unu
   yükseltiyor (bkz. tema style-elementor.css, .wd-sticky-btn-shown.scrollToTop);
   aynı hizada kalmak için bu buton da aynı miktarda yükselir. */
.scrollToTop.wd-sticky-btn-shown ~ #amad-whatsapp-button {
	bottom: calc(12px + var(--wd-sticky-btn-height));
}

.wd-search-opened #amad-whatsapp-button {
	display: none;
}

@media (max-width: 1024px) {
	#amad-whatsapp-button {
		right: 12px;
		bottom: 12px;
		width: 40px;
		height: 40px;
		padding: 0;
		border-radius: 50%;
		justify-content: center;
	}

	.amad-whatsapp-button__icon {
		width: 20px;
		height: 20px;
	}

	.amad-whatsapp-button__label {
		/* Mobilde yer kısıtlı: yazı gizlenir, buton scrollToTop'un mobil
		   boyutuyla birebir aynı ikon-only daireye daralır. Erişilebilir
		   isim zaten aria-label ile mevcut. */
		position: absolute;
		width: 1px;
		height: 1px;
		padding: 0;
		margin: -1px;
		overflow: hidden;
		clip: rect(0, 0, 0, 0);
		white-space: nowrap;
		border: 0;
	}

	.scrollToTop.button-show ~ #amad-whatsapp-button {
		right: 64px; /* 12 (taban) + 40 (scrollToTop mobil genişliği) + 12 (boşluk) */
	}

	/* Mobil alt navigasyon çubuğu (wd-toolbar) aktifken scrollToTop 67px'e
	   çıkıyor; sticky sepete ekle barı da açıksa ayrıca yükseliyor. */
	.sticky-toolbar-on #amad-whatsapp-button {
		bottom: 67px;
	}

	.sticky-toolbar-on .scrollToTop.wd-sticky-btn-shown ~ #amad-whatsapp-button {
		bottom: calc(12px + 55px + var(--wd-sticky-btn-height));
	}
}

@media (prefers-reduced-motion: reduce) {
	#amad-whatsapp-button {
		transition: none;
	}
}
