<?php

/**
 * Metabox: Podcast Info.
 *
 * @link    https://aiopodcasting.com
 * @since   1.0.0
 *
 * @package AiO_Podcast_Studio
 */

// Exit if accessed directly
if ( ! defined( 'WPINC' ) ) {
	die;
}

$rss_feed_url = isset( $post_meta['rss_feed_url'] ) ? $post_meta['rss_feed_url'][0] : '';
?>
<div class="aiopod aiopod-metabox-ui">
	<!-- Tabs -->
	<div class="aiopod-tabs">
		<button type="button" class="aiopod-tab<?php if ( empty( $rss_feed_url ) ) { echo ' aiopod-active'; } ?>" data-target="#aiopod-tab-content-podcast-details">
			<svg xmlns="http://www.w3.org/2000/svg" fill="none" width="20" height="20" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
				<path stroke-linecap="round" stroke-linejoin="round" d="M12 18.75a6 6 0 0 0 6-6v-1.5m-6 7.5a6 6 0 0 1-6-6v-1.5m6 7.5v3.75m-3.75 0h7.5M12 15.75a3 3 0 0 1-3-3V4.5a3 3 0 1 1 6 0v8.25a3 3 0 0 1-3 3Z" />
			</svg>
			<?php esc_html_e( 'Podcast Details', 'aio-podcast-studio' ); ?>
		</button>
	
		<?php if ( ! empty( $rss_feed_url ) ) : ?>
			<button type="button" class="aiopod-tab aiopod-active" data-target="#aiopod-tab-content-imported-feed-options">
				<svg xmlns="http://www.w3.org/2000/svg" fill="none" width="20" height="20" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
					<path stroke-linecap="round" stroke-linejoin="round" d="M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5M16.5 12 12 16.5m0 0L7.5 12m4.5 4.5V3" />
				</svg>
				<?php esc_html_e( 'Import Options', 'aio-podcast-studio' ); ?>
			</button>
		<?php endif; ?>

		<button type="button" class="aiopod-tab" data-target="#aiopod-tab-content-distribution">
			<svg xmlns="http://www.w3.org/2000/svg" fill="none" width="20" height="20" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
				<path stroke-linecap="round" stroke-linejoin="round" d="M7.217 10.907a2.25 2.25 0 1 0 0 2.186m0-2.186c.18.324.283.696.283 1.093s-.103.77-.283 1.093m0-2.186 9.566-5.314m-9.566 7.5 9.566 5.314m0 0a2.25 2.25 0 1 0 3.935 2.186 2.25 2.25 0 0 0-3.935-2.186Zm0-12.814a2.25 2.25 0 1 0 3.933-2.185 2.25 2.25 0 0 0-3.933 2.185Z" />
			</svg>
			<?php esc_html_e( 'Distribution', 'aio-podcast-studio' ); ?>
		</button>
	</div>

	<!-- Tab Content: Podcast Details -->
	<div id="aiopod-tab-content-podcast-details" class="aiopod-tab-content"<?php if ( ! empty( $rss_feed_url ) ) { echo ' style="display: none;"'; } ?>>
		<!-- Accordion: Podcast Details -->
		<div class="aiopod-accordion" data-collapsible="false">
			<div class="aiopod-accordion-body">
				<?php require_once AIOPOD_PLUGIN_DIR . 'admin/partials/podcasts/accordion-podcast-details.php'; ?>
			</div>
		</div>

		<!-- Accordion: Add Participants -->
		<div class="aiopod-accordion" data-collapsible="true">
			<button type="button" class="aiopod-accordion-header">
				<svg xmlns="http://www.w3.org/2000/svg" fill="none" width="20" height="20" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
					<path stroke-linecap="round" stroke-linejoin="round" d="M18 18.72a9.094 9.094 0 0 0 3.741-.479 3 3 0 0 0-4.682-2.72m.94 3.198.001.031c0 .225-.012.447-.037.666A11.944 11.944 0 0 1 12 21c-2.17 0-4.207-.576-5.963-1.584A6.062 6.062 0 0 1 6 18.719m12 0a5.971 5.971 0 0 0-.941-3.197m0 0A5.995 5.995 0 0 0 12 12.75a5.995 5.995 0 0 0-5.058 2.772m0 0a3 3 0 0 0-4.681 2.72 8.986 8.986 0 0 0 3.74.477m.94-3.197a5.971 5.971 0 0 0-.94 3.197M15 6.75a3 3 0 1 1-6 0 3 3 0 0 1 6 0Zm6 3a2.25 2.25 0 1 1-4.5 0 2.25 2.25 0 0 1 4.5 0Zm-13.5 0a2.25 2.25 0 1 1-4.5 0 2.25 2.25 0 0 1 4.5 0Z" />
				</svg>
				<?php esc_html_e( 'Add Participants', 'aio-podcast-studio' ); ?>
				<span class="dashicons dashicons-arrow-down-alt2"></span>
			</button>
			<div class="aiopod-accordion-body">
				<?php require_once AIOPOD_PLUGIN_DIR . 'admin/partials/podcasts/accordion-participants.php'; ?>
			</div>
		</div>

		<!-- Accordion: Subscribe Buttons -->
		<div class="aiopod-accordion" data-collapsible="true">
			<button type="button" class="aiopod-accordion-header">
				<svg xmlns="http://www.w3.org/2000/svg" fill="none" width="20" height="20" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
					<path stroke-linecap="round" stroke-linejoin="round" d="M14.857 17.082a23.848 23.848 0 0 0 5.454-1.31A8.967 8.967 0 0 1 18 9.75V9A6 6 0 0 0 6 9v.75a8.967 8.967 0 0 1-2.312 6.022c1.733.64 3.56 1.085 5.455 1.31m5.714 0a24.255 24.255 0 0 1-5.714 0m5.714 0a3 3 0 1 1-5.714 0" />
				</svg>
				<?php esc_html_e( 'Subscribe Buttons', 'aio-podcast-studio' ); ?>
				<span class="dashicons dashicons-arrow-down-alt2"></span>
			</button>
			<div class="aiopod-accordion-body">
				<?php require_once AIOPOD_PLUGIN_DIR . 'admin/partials/podcasts/accordion-subscribe-buttons.php'; ?>
			</div>
		</div>

		<!-- Accordion: Follow Us Buttons -->
		<div class="aiopod-accordion" data-collapsible="true">
			<button type="button" class="aiopod-accordion-header">
				<svg xmlns="http://www.w3.org/2000/svg" fill="none" width="20" height="20" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
					<path stroke-linecap="round" stroke-linejoin="round" d="M18 7.5v3m0 0v3m0-3h3m-3 0h-3m-2.25-4.125a3.375 3.375 0 1 1-6.75 0 3.375 3.375 0 0 1 6.75 0ZM3 19.235v-.11a6.375 6.375 0 0 1 12.75 0v.109A12.318 12.318 0 0 1 9.374 21c-2.331 0-4.512-.645-6.374-1.766Z" />
				</svg>
				<?php esc_html_e( 'Follow Us Buttons', 'aio-podcast-studio' ); ?>
				<span class="dashicons dashicons-arrow-down-alt2"></span>
			</button>
			<div class="aiopod-accordion-body">
				<?php require_once AIOPOD_PLUGIN_DIR . 'admin/partials/podcasts/accordion-follow-buttons.php'; ?>
			</div>
		</div>	

		<?php do_action( 'aiopod_podcast_details_accordions', $post, $post_meta ); ?>
	</div>

	<?php if ( ! empty( $rss_feed_url ) ) : ?>
		<!-- Tab Content: Import Options -->
		<div id="aiopod-tab-content-imported-feed-options" class="aiopod-tab-content">
			<div class="aiopod-accordion" data-collapsible="false">
				<div class="aiopod-accordion-body">
					<?php require_once AIOPOD_PLUGIN_DIR . 'admin/partials/podcasts/accordion-import-options.php'; ?>
				</div>
			</div>
		</div>
	<?php endif; ?>

	<!-- Tab Content: Distribution -->
	<div id="aiopod-tab-content-distribution" class="aiopod-tab-content" style="display: none;">
		<!-- RSS Feed URL -->
		<div class="aiopod-accordion" data-collapsible="false">
			<div class="aiopod-accordion-body">
				<?php require_once AIOPOD_PLUGIN_DIR . 'admin/partials/podcasts/accordion-feed-url.php'; ?>
			</div>
		</div>

		<!-- RSS Feed Settings -->
		<div class="aiopod-accordion" data-collapsible="false">
			<div class="aiopod-accordion-body">
				<?php require_once AIOPOD_PLUGIN_DIR . 'admin/partials/podcasts/accordion-rss-feed.php'; ?>
			</div>
		</div>

		<!-- Redirect & Blocking -->
		<div class="aiopod-accordion" data-collapsible="false">
			<div class="aiopod-accordion-body">
				<?php require_once AIOPOD_PLUGIN_DIR . 'admin/partials/podcasts/accordion-distribution.php'; ?>
			</div>
		</div>
	</div>

	<?php wp_nonce_field( 'aiopod_save_podcast_metabox', 'aiopod_podcast_metabox_nonce' ); // Nonce ?>
</div>