<?php
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}
$platformlar = tilfy_platform_listesi();
$hedef_platformlar = function_exists( 'tilfy_hedef_platform_listesi' ) ? tilfy_hedef_platform_listesi() : $platformlar;

$tilfy_icerikler_url = function ( $ek = array() ) use ( $sekme, $sira, $senkron, $senkron_hedef, $tarih_baslangic, $arama, $medya_grup, $gorunum, $sayfa ) {
	$q = array_merge(
		array(
			'page'  => 'tilfy-icerikler',
			'sekme' => $sekme,
			'sira'  => $sira,
		),
		$ek
	);
	if ( $senkron !== '' && ! isset( $ek['senkron'] ) ) {
		$q['senkron'] = $senkron;
	}
	if ( $senkron_hedef !== '' && ! isset( $ek['senkron_hedef'] ) ) {
		$q['senkron_hedef'] = $senkron_hedef;
	}
	if ( $tarih_baslangic !== '' && ! isset( $ek['tarih_baslangic'] ) ) {
		$q['tarih_baslangic'] = $tarih_baslangic;
	}
	if ( $arama !== '' && ! isset( $ek['arama'] ) ) {
		$q['arama'] = $arama;
	}
	if ( $medya_grup !== '' && ! isset( $ek['medya_grup'] ) ) {
		$q['medya_grup'] = $medya_grup;
	}
	$gor = (string) ( $ek['gorunum'] ?? $gorunum );
	if ( $gor === 'grid' && ! isset( $ek['gorunum'] ) ) {
		$q['gorunum'] = 'grid';
	} elseif ( isset( $ek['gorunum'] ) && $ek['gorunum'] === 'grid' ) {
		$q['gorunum'] = 'grid';
	}
	$sayfa_no = (int) ( $ek['sayfa'] ?? $sayfa );
	if ( $sayfa_no > 1 ) {
		$q['sayfa'] = $sayfa_no;
	}
	return add_query_arg( $q, admin_url( 'admin.php' ) );
};
$filtre_aktif = ( $senkron !== '' || $senkron_hedef !== '' || $tarih_baslangic !== '' || $arama !== '' || $medya_grup !== '' );

$tilfy_filtre_gizli = function () use ( $sekme, $sira, $senkron, $senkron_hedef, $tarih_baslangic, $arama, $medya_grup, $gorunum ) {
	?>
	<input type="hidden" name="page" value="tilfy-icerikler" />
	<input type="hidden" name="sekme" value="<?php echo esc_attr( $sekme ); ?>" />
	<input type="hidden" name="sira" value="<?php echo esc_attr( $sira ); ?>" />
	<?php if ( $senkron !== '' ) : ?><input type="hidden" name="senkron" value="<?php echo esc_attr( $senkron ); ?>" /><?php endif; ?>
	<?php if ( $senkron_hedef !== '' ) : ?><input type="hidden" name="senkron_hedef" value="<?php echo esc_attr( $senkron_hedef ); ?>" /><?php endif; ?>
	<?php if ( $tarih_baslangic !== '' ) : ?><input type="hidden" name="tarih_baslangic" value="<?php echo esc_attr( $tarih_baslangic ); ?>" /><?php endif; ?>
	<?php if ( $arama !== '' ) : ?><input type="hidden" name="arama" value="<?php echo esc_attr( $arama ); ?>" /><?php endif; ?>
	<?php if ( $medya_grup !== '' ) : ?><input type="hidden" name="medya_grup" value="<?php echo esc_attr( $medya_grup ); ?>" /><?php endif; ?>
	<?php if ( $gorunum === 'grid' ) : ?><input type="hidden" name="gorunum" value="grid" /><?php endif; ?>
	<?php
};
?>
<div class="wrap tilfy-wrap">
	<header class="tilfy-header">
		<h1><?php echo esc_html( tilfy__( 'İçerikler' ) ); ?></h1>
		<p class="tilfy-sub"><?php echo esc_html( tilfy__( 'Kaynak platformdaki içerikleri seçip hedef platformlara paylaşın' ) ); ?></p>
	</header>

	<?php if ( $mesaj === 'secim_eksik' ) : ?>
		<div class="tilfy-notice tilfy-notice--hata"><?php echo esc_html( tilfy__( 'En az bir içerik ve en az bir hedef platform seçin.' ) ); ?></div>
	<?php endif; ?>

	<form method="get" class="tilfy-icerik-filtre tilfy-icerik-filtre--v2 tilfy-kart" action="<?php echo esc_url( admin_url( 'admin.php' ) ); ?>">
		<input type="hidden" name="page" value="tilfy-icerikler" />
		<input type="hidden" name="sekme" value="<?php echo esc_attr( $sekme ); ?>" />
		<?php if ( $arama !== '' ) : ?><input type="hidden" name="arama" value="<?php echo esc_attr( $arama ); ?>" /><?php endif; ?>
		<div class="tilfy-icerik-filtre__ust">
			<label class="tilfy-filtre-alan">
				<span class="tilfy-filtre-alan__etiket"><?php echo esc_html( tilfy__( 'Sıralama' ) ); ?></span>
				<select name="sira" class="tilfy-filtre-kontrol">
					<option value="yeni" <?php selected( $sira, 'yeni' ); ?>><?php echo esc_html( tilfy__( 'Yeni → eski' ) ); ?></option>
					<option value="eski" <?php selected( $sira, 'eski' ); ?>><?php echo esc_html( tilfy__( 'Eski → yeni' ) ); ?></option>
				</select>
			</label>
			<label class="tilfy-filtre-alan">
				<span class="tilfy-filtre-alan__etiket"><?php echo esc_html( tilfy__( 'Başlangıç tarihi' ) ); ?></span>
				<input type="date" name="tarih_baslangic" class="tilfy-filtre-kontrol" value="<?php echo esc_attr( $tarih_baslangic ); ?>" />
			</label>
			<label class="tilfy-filtre-alan">
				<span class="tilfy-filtre-alan__etiket"><?php echo esc_html( tilfy__( 'Paylaşım' ) ); ?></span>
				<select name="senkron" class="tilfy-filtre-kontrol">
					<option value="" <?php selected( $senkron, '' ); ?>><?php echo esc_html( tilfy__( 'Tümü' ) ); ?></option>
					<option value="var" <?php selected( $senkron, 'var' ); ?>><?php echo esc_html( tilfy__( 'Hedefe paylaşıldı' ) ); ?></option>
					<option value="yok" <?php selected( $senkron, 'yok' ); ?>><?php echo esc_html( tilfy__( 'Hedefe paylaşılmadı' ) ); ?></option>
				</select>
			</label>
			<label class="tilfy-filtre-alan">
				<span class="tilfy-filtre-alan__etiket"><?php echo esc_html( tilfy__( 'Hedef platform' ) ); ?></span>
				<select name="senkron_hedef" class="tilfy-filtre-kontrol">
					<option value=""><?php echo esc_html( tilfy__( 'Seçin' ) ); ?></option>
					<?php foreach ( $hedef_platformlar as $anahtar => $bilgi ) : ?>
						<option value="<?php echo esc_attr( $anahtar ); ?>" <?php selected( $senkron_hedef, $anahtar ); ?>><?php echo esc_html( $bilgi['etiket'] ); ?></option>
					<?php endforeach; ?>
				</select>
			</label>
			<label class="tilfy-filtre-alan">
				<span class="tilfy-filtre-alan__etiket"><?php echo esc_html( tilfy__( 'Medya' ) ); ?></span>
				<select name="medya_grup" class="tilfy-filtre-kontrol">
					<option value="" <?php selected( $medya_grup, '' ); ?>><?php echo esc_html( tilfy__( 'Video + görsel' ) ); ?></option>
					<option value="video" <?php selected( $medya_grup, 'video' ); ?>><?php echo esc_html( tilfy__( 'Yalnız video' ) ); ?></option>
					<option value="gorsel" <?php selected( $medya_grup, 'gorsel' ); ?>><?php echo esc_html( tilfy__( 'Yalnız görsel' ) ); ?></option>
					<option value="kapaksiz" <?php selected( $medya_grup, 'kapaksiz' ); ?>><?php echo esc_html( tilfy__( 'Kapaksız' ) ); ?></option>
				</select>
			</label>
			<div class="tilfy-filtre-alan tilfy-filtre-alan--aksiyon">
				<button type="submit" class="tilfy-btn tilfy-btn--birincil tilfy-btn--kucuk"><?php echo esc_html( tilfy__( 'Filtrele' ) ); ?></button>
				<?php if ( $filtre_aktif ) : ?>
					<a class="tilfy-btn tilfy-btn--ghost tilfy-btn--kucuk" href="<?php echo esc_url( $tilfy_icerikler_url( array( 'sekme' => $sekme, 'sayfa' => 1, 'senkron' => '', 'senkron_hedef' => '', 'tarih_baslangic' => '', 'arama' => '', 'medya_grup' => '' ) ) ); ?>"><?php echo esc_html( tilfy__( 'Sıfırla' ) ); ?></a>
				<?php endif; ?>
			</div>
		</div>
	</form>

	<form method="get" class="tilfy-icerik-arama tilfy-kart" action="<?php echo esc_url( admin_url( 'admin.php' ) ); ?>">
		<input type="hidden" name="page" value="tilfy-icerikler" />
		<input type="hidden" name="sekme" value="<?php echo esc_attr( $sekme ); ?>" />
		<input type="hidden" name="sira" value="<?php echo esc_attr( $sira ); ?>" />
		<?php if ( $senkron !== '' ) : ?><input type="hidden" name="senkron" value="<?php echo esc_attr( $senkron ); ?>" /><?php endif; ?>
		<?php if ( $senkron_hedef !== '' ) : ?><input type="hidden" name="senkron_hedef" value="<?php echo esc_attr( $senkron_hedef ); ?>" /><?php endif; ?>
		<?php if ( $tarih_baslangic !== '' ) : ?><input type="hidden" name="tarih_baslangic" value="<?php echo esc_attr( $tarih_baslangic ); ?>" /><?php endif; ?>
		<?php if ( $medya_grup !== '' ) : ?><input type="hidden" name="medya_grup" value="<?php echo esc_attr( $medya_grup ); ?>" /><?php endif; ?>
		<?php if ( $gorunum === 'grid' ) : ?><input type="hidden" name="gorunum" value="grid" /><?php endif; ?>
		<div class="tilfy-icerik-arama__ic">
			<label class="tilfy-icerik-arama__alan">
				<span class="tilfy-icerik-arama__ikon" aria-hidden="true"><?php echo esc_html( tilfy__( '⌕' ) ); ?></span>
				<input type="search" name="arama" class="tilfy-filtre-kontrol tilfy-icerik-arama__input" value="<?php echo esc_attr( $arama ); ?>" placeholder="<?php echo esc_attr( tilfy__( 'Başlık veya açıklama ara…' ) ); ?>" />
			</label>
			<button type="submit" class="tilfy-btn tilfy-btn--ikincil tilfy-btn--kucuk"><?php echo esc_html( tilfy__( 'Ara' ) ); ?></button>
		</div>
	</form>

	<?php
	$bagli_senkron = array();
	foreach ( $platformlar as $anahtar => $bilgi ) {
		if ( ! empty( ( $baglanti[ $anahtar ] ?? array() )['bagli'] ) && in_array( $anahtar, array( 'instagram', 'facebook', 'youtube', 'threads' ), true ) ) {
			$bagli_senkron[ $anahtar ] = $bilgi;
		}
	}
	if ( ! empty( $bagli_senkron ) ) :
		?>
		<div class="tilfy-icerik-senkron tilfy-icerik-senkron--v2 tilfy-kart">
			<h2 class="tilfy-icerik-senkron__baslik"><?php echo esc_html( tilfy__( 'İÇERİK BİLGİLERİNİ PLATFORMDAN ÇEK' ) ); ?></h2>
			<?php $tilfy_senkron_mod = function_exists( 'tilfy_senkron_modu' ) ? tilfy_senkron_modu() : 'yeni'; ?>
			<div class="tilfy-senkron-mod" style="margin-bottom:10px;text-align:center;">
				<label class="tilfy-check" style="margin-right:16px;">
					<input type="radio" name="tilfy_senkron_mod" value="yeni" <?php checked( $tilfy_senkron_mod, 'yeni' ); ?> />
					<?php echo esc_html( tilfy__( 'Yeni' ) ); ?>
				</label>
				<label class="tilfy-check">
					<input type="radio" name="tilfy_senkron_mod" value="tam" <?php checked( $tilfy_senkron_mod, 'tam' ); ?> />
					<?php echo esc_html( tilfy__( 'Tam' ) ); ?>
				</label>
			</div>
			<div class="tilfy-senkron-butonlar tilfy-senkron-butonlar--merkez">
				<?php foreach ( $bagli_senkron as $anahtar => $bilgi ) : ?>
					<button type="button" class="tilfy-btn tilfy-btn--ikincil tilfy-btn--kucuk tilfy-senkron-btn" data-platform="<?php echo esc_attr( $anahtar ); ?>"><?php echo esc_html( $bilgi['etiket'] . ' ' . tilfy__( 'senkronize et' ) ); ?></button>
				<?php endforeach; ?>
				<button type="button" class="tilfy-btn tilfy-btn--birincil tilfy-btn--kucuk tilfy-senkron-btn" data-platform="tumu"><?php echo esc_html( tilfy__( 'Tümünü senkronize et' ) ); ?></button>
			</div>
		</div>
		<div id="tilfy-icerik-senkron-durum" class="tilfy-icerik-senkron-durum tilfy-is-gizli" role="status" aria-live="polite"></div>
	<?php endif; ?>

	<p class="tilfy-icerik-ozet">
		<?php echo (int) $toplam; ?> <?php echo esc_html( tilfy__( 'içerik · Sayfa' ) ); ?> <?php echo (int) $sayfa; ?> / <?php echo (int) $sayfa_sayisi; ?>
	</p>

	<form method="post" id="tilfy-capraz-form">

		<div class="tilfy-capraz-bar tilfy-capraz-bar--v2">
			<div class="tilfy-capraz-bar__sol">
				<div class="tilfy-capraz-dd-satir">
					<label class="tilfy-capraz-dd">
						<span class="tilfy-capraz-dd__etiket"><?php echo esc_html( tilfy__( 'Kaynak' ) ); ?></span>
						<select id="tilfy-kaynak-select" class="tilfy-filtre-kontrol tilfy-capraz-dd__select">
							<option value="tumu" <?php selected( $sekme, 'tumu' ); ?>><?php echo esc_html( tilfy__( 'Tümü' ) ); ?></option>
							<?php foreach ( $platformlar as $anahtar => $bilgi ) : ?>
								<option value="<?php echo esc_attr( $anahtar ); ?>" <?php selected( $sekme, $anahtar ); ?>><?php echo esc_html( $bilgi['etiket'] ); ?></option>
							<?php endforeach; ?>
						</select>
					</label>
					<div class="tilfy-capraz-dd tilfy-capraz-dd--hedef">
						<span class="tilfy-capraz-dd__etiket"><?php echo esc_html( tilfy__( 'Hedef' ) ); ?></span>
						<div class="tilfy-capraz-dd__hedef-satir">
							<details class="tilfy-capraz-dd__detay" id="tilfy-hedef-detay">
								<summary class="tilfy-filtre-kontrol tilfy-capraz-dd__ozet"><?php echo esc_html( tilfy__( 'Platform seçin…' ) ); ?></summary>
								<div class="tilfy-capraz-dd__menu" id="tilfy-capraz-hedef">
									<?php foreach ( $hedef_platformlar as $anahtar => $bilgi ) :
										$hedef_bagli = ! empty( ( $baglanti[ $anahtar ] ?? array() )['bagli'] );
										?>
										<label class="tilfy-capraz-hedef-opt<?php echo $hedef_bagli ? '' : ' is-disabled'; ?>" data-platform="<?php echo esc_attr( $anahtar ); ?>">
											<input type="checkbox" name="hedef_platformlar[]" value="<?php echo esc_attr( $anahtar ); ?>" <?php disabled( ! $hedef_bagli ); ?> />
											<span><?php echo esc_html( $bilgi['etiket'] ); ?><?php echo $hedef_bagli ? '' : esc_html( tilfy__( '· bağlantı gerekli' ) ); ?></span>
										</label>
									<?php endforeach; ?>
								</div>
							</details>
							<div class="tilfy-hedef-chips" id="tilfy-hedef-chips" aria-live="polite"></div>
						</div>
					</div>
				</div>
				<div class="tilfy-icerik-gorunum tilfy-icerik-gorunum--bar">
					<a class="tilfy-gorunum-btn <?php echo $gorunum === 'liste' ? 'is-active' : ''; ?>" href="<?php echo esc_url( $tilfy_icerikler_url( array( 'gorunum' => 'liste' ) ) ); ?>"><?php echo esc_html( tilfy__( 'Liste' ) ); ?></a>
					<a class="tilfy-gorunum-btn <?php echo $gorunum === 'grid' ? 'is-active' : ''; ?>" href="<?php echo esc_url( $tilfy_icerikler_url( array( 'gorunum' => 'grid' ) ) ); ?>"><?php echo esc_html( tilfy__( 'Izgara' ) ); ?></a>
				</div>
			</div>
			<div class="tilfy-capraz-bar__sag">
				<button type="button" class="tilfy-btn tilfy-btn--yesil tilfy-btn--kucuk" id="tilfy-icerik-tumu-sec"><?php echo esc_html( tilfy__( 'Tümünü seç' ) ); ?></button>
				<button type="button" class="tilfy-btn tilfy-btn--ikincil tilfy-btn--kucuk" id="tilfy-icerik-medya-ata-secili"><?php echo esc_html( tilfy__( 'Seçilenlere yeni ekle' ) ); ?></button>
				<button type="button" class="tilfy-btn tilfy-btn--ikincil tilfy-btn--kucuk" id="tilfy-icerik-one-cikan-secili"><?php echo esc_html( tilfy__( 'Seçilenlere öne çıkanı kullan' ) ); ?></button>
				<button type="button" class="tilfy-btn tilfy-btn--kirmizi tilfy-btn--kucuk" id="tilfy-icerik-sil-secili"><?php echo esc_html( tilfy__( 'Seçilenleri sil' ) ); ?></button>
				<button type="button" class="tilfy-btn tilfy-btn--kirmizi tilfy-btn--kucuk" id="tilfy-icerik-sifirla-secili"><?php echo esc_html( tilfy__( 'Seçilenleri sıfırla' ) ); ?></button>
				<button type="button" class="tilfy-btn tilfy-btn--kirmizi tilfy-btn--kucuk" id="tilfy-icerik-gizle-secili"><?php echo esc_html( tilfy__( 'Seçilenleri gizle' ) ); ?></button>
				<button type="button" class="tilfy-btn tilfy-btn--yesil tilfy-btn--kucuk" id="tilfy-secili-sepete-ekle"><?php echo esc_html( tilfy__( 'Seçilenleri sepete ekle' ) ); ?></button>
				<button type="button" class="tilfy-btn tilfy-btn--yesil tilfy-btn--kucuk" id="tilfy-sayfa-sepete-ekle"><?php echo esc_html( tilfy__( 'Sayfadakileri sepete ekle' ) ); ?></button>
				<button type="button" class="tilfy-btn tilfy-btn--yesil tilfy-btn--kucuk" id="tilfy-capraz-zamanla"><?php echo esc_html( tilfy__( 'Seçilenleri zamanla' ) ); ?></button>
				<button type="button" class="tilfy-btn tilfy-btn--yesil tilfy-btn--kucuk" id="tilfy-sepet-ac"><?php echo esc_html( tilfy__( 'Sepet' ) ); ?> (<span id="tilfy-sepet-say">0</span>)</button>
				<button type="submit" class="tilfy-btn tilfy-btn--yesil tilfy-btn--kucuk" id="tilfy-capraz-gonder"><?php echo esc_html( tilfy__( 'Sepetten paylaş' ) ); ?></button>
			</div>
		</div>

		<div class="tilfy-kart tilfy-capraz-ayarlar tilfy-is-gizli" id="tilfy-capraz-ayarlar">
			<h2><?php echo esc_html( tilfy__( 'Hedef platform seçenekleri' ) ); ?></h2>
			<p class="tilfy-yardim"><?php echo esc_html( tilfy__( 'Seçtiğiniz hedef platformlar için paylaşım ayarları (Studyo ile aynı).' ) ); ?></p>
			<?php foreach ( $hedef_platformlar as $anahtar => $bilgi ) : ?>
				<div class="tilfy-capraz-ayar-blok tilfy-is-gizli" id="tilfy-capraz-ayar-<?php echo esc_attr( $anahtar ); ?>" data-platform="<?php echo esc_attr( $anahtar ); ?>">
					<h3><?php echo esc_html( $bilgi['etiket'] ); ?></h3>
					<?php
					$tilfy_pa_platform       = $anahtar;
					$tilfy_pa_yt_listeler    = $yt_listeler;
					$tilfy_pa_yt_scope_eksik = $yt_scope_eksik;
					require TILFY_YOL . 'includes/sayfalar/partials/platform-ayar-alanlari.php';
					?>
				</div>
			<?php endforeach; ?>
		</div>

		<div id="tilfy-capraz-dogrulama" class="tilfy-studyosu-dogrulama" hidden aria-live="polite"></div>

		<div class="tilfy-tablo-wrap<?php echo $gorunum === 'grid' ? ' tilfy-is-gizli' : ''; ?>">
			<table class="tilfy-tablo tilfy-icerik-liste-tablo" id="tilfy-icerik-tablo">
				<thead>
					<tr>
						<th class="tilfy-col-check"></th>
						<th class="tilfy-icerik-liste-col-gorsel"><?php echo esc_html( tilfy__( 'Kaynak' ) ); ?></th>
						<th><?php echo esc_html( tilfy__( 'İçerik' ) ); ?></th>
						<th class="tilfy-icerik-liste-col-paylasim"><?php echo esc_html( tilfy__( 'Paylaşım' ) ); ?></th>
						<th class="tilfy-icerik-liste-col-aksiyon"></th>
					</tr>
				</thead>
				<tbody>
					<?php if ( empty( $icerikler ) ) : ?>
						<tr><td colspan="5" class="tilfy-bos"><?php echo esc_html( tilfy__( 'Henüz içerik yok. Ayarlardan platformları bağlayın; Panelden içerikleri çekebilir veya Studyo ile yeni paylaşım oluşturabilirsiniz.' ) ); ?></td></tr>
					<?php else : ?>
						<?php foreach ( $icerikler as $satir ) :
							require TILFY_YOL . 'includes/sayfalar/partials/icerik-liste-satir.php';
						endforeach; ?>
					<?php endif; ?>
				</tbody>
			</table>
		</div>

		<div class="tilfy-grid-wrap<?php echo $gorunum !== 'grid' ? ' tilfy-is-gizli' : ''; ?>" id="tilfy-icerik-grid">
			<?php if ( empty( $icerikler ) ) : ?>
				<p class="tilfy-bos"><?php echo esc_html( tilfy__( 'Henüz içerik yok.' ) ); ?></p>
			<?php else : ?>
				<?php foreach ( $icerikler as $satir ) :
					require TILFY_YOL . 'includes/sayfalar/partials/icerik-grid-kart.php';
				endforeach; ?>
			<?php endif; ?>
		</div>

	</form>

	<?php if ( $sayfa_sayisi > 1 ) : ?>
		<nav class="tilfy-sayfalama tilfy-sayfalama--merkez" aria-label="<?php echo esc_attr( tilfy__( 'Sayfalama' ) ); ?>">
			<?php if ( $sayfa > 1 ) : ?>
				<a class="tilfy-btn tilfy-btn--ikincil tilfy-btn--kucuk" href="<?php echo esc_url( $tilfy_icerikler_url( array( 'sayfa' => $sayfa - 1 ) ) ); ?>"><?php echo esc_html( tilfy__( '← Önceki' ) ); ?></a>
			<?php endif; ?>
			<form method="get" class="tilfy-sayfa-atla" action="<?php echo esc_url( admin_url( 'admin.php' ) ); ?>">
				<?php $tilfy_filtre_gizli(); ?>
				<label class="tilfy-sayfa-atla__etiket">
					<span><?php echo esc_html( tilfy__( 'Sayfa' ) ); ?></span>
					<input type="number" class="tilfy-filtre-kontrol tilfy-sayfa-atla__input" name="sayfa" min="1" max="<?php echo (int) $sayfa_sayisi; ?>" value="<?php echo (int) $sayfa; ?>" required />
				</label>
				<span class="tilfy-sayfalama__bilgi">/ <?php echo (int) $sayfa_sayisi; ?></span>
				<button type="submit" class="tilfy-btn tilfy-btn--ikincil tilfy-btn--kucuk"><?php echo esc_html( tilfy__( 'Git' ) ); ?></button>
			</form>
			<?php if ( $sayfa < $sayfa_sayisi ) : ?>
				<a class="tilfy-btn tilfy-btn--ikincil tilfy-btn--kucuk" href="<?php echo esc_url( $tilfy_icerikler_url( array( 'sayfa' => $sayfa + 1 ) ) ); ?>"><?php echo esc_html( tilfy__( 'Sonraki →' ) ); ?></a>
			<?php endif; ?>
		</nav>
	<?php endif; ?>

	<div class="tilfy-sepet-drawer" id="tilfy-sepet-drawer" aria-hidden="true">
		<div class="tilfy-sepet-drawer__panel">
			<header class="tilfy-sepet-drawer__baslik">
				<h2><?php echo esc_html( tilfy__( 'İçerik sepeti' ) ); ?></h2>
				<button type="button" class="tilfy-btn tilfy-btn--ikincil tilfy-btn--kucuk" id="tilfy-sepet-kapat"><?php echo esc_html( tilfy__( 'Kapat' ) ); ?></button>
			</header>
			<p class="tilfy-yardim"><?php echo esc_html( tilfy__( 'Farklı sayfalardan eklediğiniz içerikler burada toplanır. Paylaşım hedeflerini üstten seçip «Sepetten paylaş» ile gönderin.' ) ); ?></p>
			<div class="tilfy-sepet-liste" id="tilfy-sepet-liste"></div>
			<footer class="tilfy-sepet-drawer__alt">
				<button type="button" class="tilfy-btn tilfy-btn--ikincil tilfy-btn--kucuk" id="tilfy-sepet-temizle"><?php echo esc_html( tilfy__( 'Sepeti boşalt' ) ); ?></button>
				<button type="button" class="tilfy-btn tilfy-btn--birincil tilfy-btn--kucuk" id="tilfy-sepet-paylas"><?php echo esc_html( tilfy__( 'Sepetten paylaş' ) ); ?></button>
			</footer>
		</div>
	</div>

	<div class="tilfy-iy-modal" id="tilfy-icerik-detay-modal" hidden>
		<div class="tilfy-iy-modal__backdrop" data-icerik-modal-kapat></div>
		<div class="tilfy-iy-modal__panel" role="dialog" aria-modal="true" aria-labelledby="tilfy-icerik-detay-baslik">
			<header class="tilfy-iy-modal__ust">
				<h2 id="tilfy-icerik-detay-baslik"><?php echo esc_html( tilfy__( 'İçerik detayı' ) ); ?></h2>
				<button type="button" class="tilfy-iy-modal__kapat" id="tilfy-icerik-detay-kapat" aria-label="<?php echo esc_attr( tilfy__( 'Kapat' ) ); ?>">&times;</button>
			</header>
			<div class="tilfy-iy-modal__govde" id="tilfy-icerik-detay-icerik"></div>
		</div>
	</div>

	<div class="tilfy-capraz-zaman-modal" id="tilfy-capraz-zaman-modal" hidden>
		<div class="tilfy-studyosu-zaman-modal__panel tilfy-studyosu-zaman-modal__panel--genis" role="dialog" aria-labelledby="tilfy-capraz-zaman-baslik">
			<h3 id="tilfy-capraz-zaman-baslik"><?php echo esc_html( tilfy__( 'Seçilenleri zamanla' ) ); ?></h3>
			<p class="tilfy-meta" id="tilfy-capraz-zaman-meta" hidden></p>
			<div id="tilfy-capraz-zaman-hata" class="tilfy-studyosu-dogrulama" hidden aria-live="polite"></div>
			<label class="tilfy-alan tilfy-alan--tam">
				<span><?php echo esc_html( tilfy__( 'İlk paylaşım ne zaman?' ) ); ?></span>
				<input type="datetime-local" id="tilfy-capraz-zaman-input" />
			</label>
			<div class="tilfy-zaman-yayilim-grid">
				<label class="tilfy-alan">
					<span><?php echo esc_html( tilfy__( 'Günde kaç video' ) ); ?></span>
					<input type="number" id="tilfy-capraz-gunluk-adet" class="tilfy-filtre-kontrol" min="1" max="50" step="1" value="1" />
					<small class="tilfy-meta" id="tilfy-capraz-gunluk-yardim" hidden></small>
				</label>
				<label class="tilfy-alan">
					<span><?php echo esc_html( tilfy__( 'Paylaşım arası (dk)' ) ); ?></span>
					<input type="number" id="tilfy-capraz-arasi-dk" class="tilfy-filtre-kontrol" min="0" max="1440" step="1" value="80" />
				</label>
			</div>
			<div class="tilfy-studyosu-zaman-bilgi" id="tilfy-capraz-yayilim-onizleme" hidden></div>
			<div class="tilfy-studyosu-zaman-modal__aksiyon">
				<button type="button" class="tilfy-btn tilfy-btn--birincil" id="tilfy-capraz-zaman-kaydet"><?php echo esc_html( tilfy__( 'Zamanla' ) ); ?></button>
				<button type="button" class="tilfy-btn tilfy-btn--ikincil" id="tilfy-capraz-zaman-iptal"><?php echo esc_html( tilfy__( 'İptal' ) ); ?></button>
			</div>
		</div>
	</div>
</div>
