/*
Theme Name: Dub
Theme URI: https://dub.ancorathemes.com/
Description: Dub is a Premium WordPress theme that has built-in support for popular Page Builders, slider with swipe gestures, and is SEO- and Retina-ready. The unique system of inheritance and override options allows setting up individual parameters for different sections of your site and supported plugins.
Author: AncoraThemes
Author URI: https://ancorathemes.com/
Version: 1.3.0
Tested up to: 6.6
Requires at least: 5.0
Requires PHP: 7.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: blog, e-commerce, portfolio, grid-layout, one-column, two-columns, three-columns, four-columns, left-sidebar, right-sidebar, custom-background, custom-colors, custom-header, custom-logo, custom-menu, editor-style, featured-image-header, featured-images, flexible-header, footer-widgets, full-width-template, microformats, post-formats, sticky-post, theme-options, threaded-comments, translation-ready, block-styles, wide-blocks
Text Domain: dub
*/
/* TABLE OF CONTENTS:

1. Reset tags and predefined classes
2+ See in the active skin styles

-------------------------------------------------------------- */
/* 1. Reset tags
-------------------------------------------------------------- */
html, body, div, span, applet, object, iframe, video, audio,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend, input, textarea, button,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, address, section {
  font-family: inherit;
  font-size: 100%;
  line-height: inherit;
  font-weight: inherit;
  font-style: inherit;
  outline: 0;
  -ms-word-wrap: break-word;
  word-wrap: break-word;
}

applet, object, iframe, video, audio,
fieldset, form, label, legend, input, textarea, button,
table, caption, tbody, tfoot, thead, tr, th, td {
  border: 0;
}

html {
  font-size: 100%;
  /*62.5%;*/
                	          		/* Corrects text resizing oddly in IE6/7 when body font-size is set using em units
									   http://clagnut.com/blog/348/#c790 */
  -webkit-text-size-adjust: 100%;
  /* Prevents iOS text size adjust after orientation change, without disabling user zoom */
  -ms-text-size-adjust: 100%;
                            	/* www.456bereastreet.com/archive/201012/
									   controlling_text_size_in_safari_for_ios_without_disabling_user_zoom/ */
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
html:not(.edit-post-visual-editor) {
  height: 100%;
  overflow-y: scroll !important;
  overflow-x: hidden;
}

html:not(.edit-post-visual-editor),
body:not(.edit-post-visual-editor) {
  margin: 0;
  padding: 0;
  width: 100%;
}

div.ui-widget,
div.ui-widget .ui-widget,
div.ui-widget .ui-widget-header,
div.ui-widget .ui-widget-content,
div.ui-accordion .ui-accordion-header,
div.ui-state-default,
div.ui-widget-content .ui-state-default,
div.ui-widget-header .ui-state-default {
  font-family: inherit;
  font-size: 1em;
  line-height: inherit;
}

div.ui-widget,
div.ui-widget .ui-widget,
div.ui-widget .ui-widget-header,
div.ui-widget .ui-widget-content,
div.ui-accordion .ui-accordion-header,
div.ui-state-default,
div.ui-widget-content .ui-state-default,
div.ui-widget-header .ui-state-default {
  color: inherit;
  background: none;
  border-style: none;
  -webkit-border-radius: 0;
  -ms-border-radius: 0;
  border-radius: 0;
}

div.ui-datepicker {
  background-color: #fff;
}

div.ui-accordion .ui-accordion-header {
  padding: 0;
}

div.ui-accordion .ui-accordion-header-icon {
  display: none;
}

div.ui-tabs,
div.ui-tabs .ui-tabs-panel,
div.ui-tabs .ui-tabs-nav {
  padding: 0;
}

div.ui-tabs .ui-tabs-nav li {
  float: none;
  margin: 0;
}

div.ui-tabs .ui-tabs-nav .ui-tabs-anchor {
  float: none;
}

/* Predefined classes for users
-------------------------------------------------------------- */
/* Round object corners */
.rounded_none {
  -webkit-border-radius: 0;
  -ms-border-radius: 0;
  border-radius: 0;
}

.rounded_tiny {
  -webkit-border-radius: 4px;
  -ms-border-radius: 4px;
  border-radius: 4px;
}

.rounded_small {
  -webkit-border-radius: 6px;
  -ms-border-radius: 6px;
  border-radius: 6px;
}

.rounded_medium {
  -webkit-border-radius: 10px;
  -ms-border-radius: 10px;
  border-radius: 10px;
}

.rounded_large {
  -webkit-border-radius: 15px;
  -ms-border-radius: 15px;
  border-radius: 15px;
}

.rounded {
  -webkit-border-radius: 50%;
  -ms-border-radius: 50%;
  border-radius: 50%;
}

/* Overflow hidden */
.overflow_hidden {
  overflow: hidden !important;
}

.overflow_x_hidden {
  overflow-x: hidden !important;
}

.overflow_y_hidden {
  overflow-y: hidden !important;
}

/*# sourceMappingURL=style.css.map */

<?php
/**
 * Plugin Name: Soberboy Presskit
 * Description: Tabbed presskit with Bio, Music, Videos (auto-populated from a folder), and Contact.
 * Version: 1.0.0
 * Author: Soberboy
 */

if (!defined('ABSPATH')) {
	exit;
}

function soberboy_presskit_assets() {
	// Inline minimal CSS; no external files needed.
	$css = '
		.soberboy-presskit { font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif; max-width: 1000px; margin: 0 auto; color: #111; }
		.soberboy-tabs { display: flex; gap: 8px; border-bottom: 1px solid #e5e7eb; margin-bottom: 16px; flex-wrap: wrap; }
		.soberboy-tab { padding: 10px 14px; border: 1px solid #e5e7eb; border-bottom: none; background: #f9fafb; cursor: pointer; border-top-left-radius: 8px; border-top-right-radius: 8px; font-weight: 600; }
		.soberboy-tab[aria-selected="true"] { background: #fff; color: #000; }
		.soberboy-panel { display: none; background: #fff; border: 1px solid #e5e7eb; border-radius: 0 8px 8px 8px; padding: 16px; }
		.soberboy-panel[aria-hidden="false"] { display: block; }
		.soberboy-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
		.soberboy-video { width: 100%; height: auto; border-radius: 8px; background: #000; }
		.soberboy-section h3 { margin: 12px 0 8px; font-size: 1.1rem; }
		.soberboy-list { columns: 2; column-gap: 24px; }
		.soberboy-list li { break-inside: avoid; margin: 4px 0; }
		@media (max-width: 640px) { .soberboy-list { columns: 1; } }
	';
	wp_register_style('soberboy-presskit-style', false);
	wp_enqueue_style('soberboy-presskit-style');
	wp_add_inline_style('soberboy-presskit-style', $css);

	$js = '
		document.addEventListener("click", function(e) {
			var tab = e.target.closest(".soberboy-tab");
			if (!tab) return;
			var container = tab.closest(".soberboy-presskit");
			container.querySelectorAll(".soberboy-tab").forEach(function(t){ t.setAttribute("aria-selected", "false"); });
			container.querySelectorAll(".soberboy-panel").forEach(function(p){ p.setAttribute("aria-hidden", "true"); });
			tab.setAttribute("aria-selected", "true");
			var target = container.querySelector("#" + tab.getAttribute("data-target"));
			if (target) target.setAttribute("aria-hidden", "false");
		});
	';
	wp_register_script('soberboy-presskit-script', false);
	wp_enqueue_script('soberboy-presskit-script');
	wp_add_inline_script('soberboy-presskit-script', $js);
}
add_action('wp_enqueue_scripts', 'soberboy_presskit_assets');

function soberboy_presskit_shortcode($atts, $content = null) {
	$atts = shortcode_atts(array(
		'dir_path' => '',  // Absolute server path to videos directory, e.g. /var/www/html/wp-content/uploads/videos
		'base_url' => '',  // Public URL to same dir, e.g. https://site.com/wp-content/uploads/videos
		'bio' => '',
	), $atts, 'soberboy_presskit');

	// Default bio if none provided
	$default_bio = "Farhad B., professionally known as Soberboy, has been a DJ and a cornerstone of the UAE\'s electronic music scene since 2008. With over a dozen residencies and 100+ performances over the years, his distinctive fusion of organic, deep and melodic house has energized venues and garnered widespread acclaim. His rise was further recognized when he was named Best Breakthrough DJ by What’s On Dubai in 2016. Collaborating with luminary acts such as BookaShade, Sandy Rivera, Pig&Dan, Behrouz, Nima Gorji, and De La Swing, Soberboy has solidified his global reputation as a skilled selector and performer.";
	$bio = trim($atts['bio']) !== '' ? wp_kses_post($atts['bio']) : esc_html($default_bio);

	$dir_path = rtrim((string)$atts['dir_path']);
	$base_url = rtrim((string)$atts['base_url'], '/');

	$videos_markup = '';
	if ($dir_path && $base_url && is_dir($dir_path) && is_readable($dir_path)) {
		$files = glob(trailingslashit($dir_path) . '*.mp4');
		natsort($files);
		if (!empty($files)) {
			$videos_markup .= '<div class="soberboy-grid">';
			foreach ($files as $file) {
				$basename = basename($file);
				$src = esc_url($base_url . '/' . rawurlencode($basename));
				$title = esc_html(pathinfo($basename, PATHINFO_FILENAME));
				$videos_markup .= '<figure><video class="soberboy-video" controls preload="metadata" src="' . $src . '"></video><figcaption>' . $title . '</figcaption></figure>';
			}
			$videos_markup .= '</div>';
		} else {
			$videos_markup .= '<p>No videos found in the specified directory.</p>';
		}
	} else {
		$videos_markup .= '<p>Configure the shortcode with dir_path and base_url to display videos.</p>';
	}

	$performances = array(
		'Miss Fish (UAE)',
		'Shady Pig (UAE)',
		'Soho Garden (UAE)',
		'Salvaje (UAE)',
		'Nikki Beach (UAE)',
		'W Hotels Dubai (UAE)',
		'Neera (UAE)',
		'Zero Gravity (UAE)',
		'Cavo (UAE)',
		'Armani Privé (UAE)',
		'Wake Up Call – Special Performance',
		'Loft Mamaia (Constanța, Romania)',
		'Mladost (Belgrade, Serbia)',
		'Unique Terrace & Lounge (Tbilisi, Georgia)',
		'Bali, Indonesia (multiple venues)',
	);

	ob_start();
	?>
	<div class="soberboy-presskit" role="region" aria-label="Soberboy Presskit">
		<div class="soberboy-tabs" role="tablist" aria-label="Presskit Sections">
			<button class="soberboy-tab" role="tab" aria-selected="true" data-target="sb-tab-bio">Bio</button>
			<button class="soberboy-tab" role="tab" aria-selected="false" data-target="sb-tab-music">Music</button>
			<button class="soberboy-tab" role="tab" aria-selected="false" data-target="sb-tab-videos">Videos</button>
			<button class="soberboy-tab" role="tab" aria-selected="false" data-target="sb-tab-contact">Contact</button>
		</div>

		<div id="sb-tab-bio" class="soberboy-panel" role="tabpanel" aria-hidden="false">
			<div class="soberboy-section">
				<h3>About Soberboy</h3>
				<p><?php echo $bio; ?></p>
				<h3>Performances</h3>
				<ul class="soberboy-list">
					<?php foreach ($performances as $p): ?>
						<li><?php echo esc_html($p); ?></li>
					<?php endforeach; ?>
				</ul>
			</div>
		</div>

		<div id="sb-tab-music" class="soberboy-panel" role="tabpanel" aria-hidden="true">
			<div class="soberboy-section">
				<h3>Music & Sets</h3>
				<p>Add embeds from SoundCloud, Mixcloud, or Spotify here.</p>
				<?php if (!empty($content)) : ?>
					<div class="soberboy-embeds">
						<?php echo do_shortcode($content); ?>
					</div>
				<?php endif; ?>
			</div>
		</div>

		<div id="sb-tab-videos" class="soberboy-panel" role="tabpanel" aria-hidden="true">
			<div class="soberboy-section">
				<h3>Videos</h3>
				<?php echo $videos_markup; ?>
			</div>
		</div>

		<div id="sb-tab-contact" class="soberboy-panel" role="tabpanel" aria-hidden="true">
			<div class="soberboy-section">
				<h3>For Bookings & Media Partnerships</h3>
				<p><strong>Email:</strong> <a href="mailto:booking@soberboymusic.com">booking@soberboymusic.com</a></p>
				<p><strong>Phone:</strong> <a href="tel:+971562850485">+971 56 285 0485</a></p>
			</div>
		</div>
	</div>
	<?php
	return ob_get_clean();
}
add_shortcode('soberboy_presskit', 'soberboy_presskit_shortcode');