@font-face {
	font-weight: normal;
	font-style: normal;
	font-family: "woodmart-font";
	src: url("//ebehtars.com/wp-content/themes/woodmart_old/fonts/woodmart-font-1-400.woff2?v=8.0.6") format("woff2");
	font-display:block;
}

:root {
	--wd-text-font: YekanBakhFaNum;
	--wd-text-font-weight: 400;
	--wd-text-color: #777777;
	--wd-text-font-size: 14px;
	--wd-title-font: YekanBakhFaNum;
	--wd-title-font-weight: 500;
	--wd-title-color: #242424;
	--wd-entities-title-font: YekanBakhFaNum;
	--wd-entities-title-font-weight: 400;
	--wd-entities-title-color: rgb(119,119,119);
	--wd-entities-title-color-hover: rgb(51 51 51 / 65%);
	--wd-alternative-font: YekanBakhFaNum;
	--wd-widget-title-font: YekanBakhFaNum;
	--wd-widget-title-font-weight: 500;
	--wd-widget-title-transform: uppercase;
	--wd-widget-title-color: rgb(119,119,119);
	--wd-widget-title-font-size: 16px;
	--wd-header-el-font: YekanBakhFaNum;
	--wd-header-el-font-weight: 500;
	--wd-header-el-transform: uppercase;
	--wd-header-el-font-size: 13px;
	--wd-primary-color: rgb(0,46,110);
	--wd-alternative-color: rgb(0,185,241);
	--wd-link-color: rgba(0,46,110,0.78);
	--wd-link-color-hover: rgb(0,46,110);
	--btn-default-bgcolor: rgb(0,46,110);
	--btn-default-bgcolor-hover: rgb(0,46,110);
	--btn-accented-bgcolor: rgb(0,46,110);
	--btn-accented-bgcolor-hover: rgb(0,46,110);
	--wd-form-brd-width: 2px;
	--notices-success-bg: #459647;
	--notices-success-color: #fff;
	--notices-warning-bg: #E0B252;
	--notices-warning-color: #fff;
	--wd-sticky-btn-height: 95px;
}
.wd-popup.wd-age-verify {
	--wd-popup-width: 500px;
}
.wd-popup.wd-promo-popup {
	background-color: rgba(255,255,255,0);
	background-image: none;
	background-repeat: no-repeat;
	background-size: contain;
	background-position: left center;
	--wd-popup-width: 1000px;
}
.header-banner {
	background-image: url(https://ebehtars.com/wp-content/uploads/2023/09/663ce17cd81d8f4a867ba37fb62e2eee308c2e14_1694942765-1-1-scaled.webp);
	background-repeat: no-repeat;
	background-size: cover;
	background-attachment: inherit;
	background-position: center top;
}
:is(.woodmart-archive-shop .wd-builder-off,.wd-wishlist-content,.related-and-upsells,.cart-collaterals,.wd-shop-product,.wd-fbt) .wd-products-with-bg, :is(.woodmart-archive-shop .wd-builder-off,.wd-wishlist-content,.related-and-upsells,.cart-collaterals,.wd-shop-product,.wd-fbt) .wd-products-with-bg :is(.wd-product,.wd-cat) {
	--wd-prod-bg:rgb(255,255,255);
	--wd-bordered-bg:rgb(255,255,255);
}
.woodmart-woocommerce-layered-nav .wd-scroll-content {
	max-height: 280px;
}
.wd-page-title {
	background-color: #0a0a0a;
	background-image: none;
	background-size: cover;
	background-position: center center;
}
.wd-footer {
	background-color: rgb(255,255,255);
	background-image: none;
}
html .product-image-summary-wrap .product_title, html .wd-single-title .product_title {
	font-family: "IRANSans", Arial, Helvetica, sans-serif;
	font-size: 14px;
}
body[class*="wrapper-boxed"] {
	background-color: rgb(246,246,246);
	background-image: none;
}
.page .wd-page-content {
	background-color: rgb(255,255,255);
	background-image: none;
}
.woodmart-archive-shop:not(.single-product) .wd-page-content {
	background-color: rgb(243,243,243);
	background-image: none;
}
.single-product .wd-page-content {
	background-color: rgb(243,243,243);
	background-image: none;
}
.woodmart-archive-blog .wd-page-content {
	background-color: rgb(243,243,243);
	background-image: none;
}
.single-post .wd-page-content {
	background-color: rgb(243,243,243);
	background-image: none;
}
.woodmart-archive-portfolio .wd-page-content {
	background-color: rgb(243,243,243);
	background-image: none;
}
.single-portfolio .wd-page-content {
	background-color: rgb(243,243,243);
	background-image: none;
}
.wd-popup.popup-quick-view {
	--wd-popup-width: 920px;
}

@media (max-width: 1024px) {
	:root {
		--wd-sticky-btn-height: 95px;
	}

}

@media (max-width: 768.98px) {
	:root {
		--wd-sticky-btn-height: 42px;
	}

}
:root{
--wd-container-w: 1350px;
--wd-form-brd-radius: 35px;
--btn-default-color: #fff;
--btn-default-color-hover: #fff;
--btn-accented-color: #fff;
--btn-accented-color-hover: #fff;
--btn-default-brd-radius: 0px;
--btn-default-box-shadow: none;
--btn-default-box-shadow-hover: none;
--btn-default-box-shadow-active: none;
--btn-default-bottom: 0px;
--btn-accented-bottom-active: -1px;
--btn-accented-brd-radius: 0px;
--btn-accented-box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .15);
--btn-accented-box-shadow-hover: inset 0 -2px 0 rgba(0, 0, 0, .15);
--wd-brd-radius: 12px;
}

@media (min-width: 1367px) {
.platform-Windows .wd-section-stretch > .elementor-container {
margin-left: auto;
margin-right: auto;
}
}

@media (min-width: 1350px) {
html:not(.platform-Windows) .wd-section-stretch > .elementor-container {
margin-left: auto;
margin-right: auto;
}
}

rs-slides :is([data-type=text],[data-type=button]) {
font-family: YekanBakhFaNum !important;
}
rs-slides :is(h1,h2,h3,h4,h5,h6)[data-type=text] {
font-family: YekanBakhFaNum !important;
}

<?php
/**
 * Enqueue script and styles for child theme
 */
function woodmart_child_enqueue_styles() {
    wp_enqueue_style( 'child-style', get_stylesheet_directory_uri() . '/style.css', array( 'woodmart-style' ), woodmart_get_theme_info( 'Version' ) );
}
add_action( 'wp_enqueue_scripts', 'woodmart_child_enqueue_styles', 10010 );

// ۱. ایجاد شورت‌کد برای نمایش فرم [custom_auth_form]
add_shortcode('custom_auth_form', 'render_custom_auth_form');
function render_custom_auth_form() {
    if (is_user_logged_in()) {
        return '<p>شما قبلاً وارد شده‌اید. <a href="'.wp_logout_url(home_url()).'">خروج</a></p>';
    }
    
    ob_start(); ?>
    <div class="auth-container">
        <div class="auth-tabs">
            <button class="tab-btn active" data-tab="login-box">ورود</button>
            <button class="tab-btn" data-tab="register-box">ثبت‌نام</button>
        </div>

        <div class="auth-content">
            <div id="login-box" class="auth-box active">
                <form id="custom-login-form">
                    <div class="input-group">
                        <label>نام کاربری یا ایمیل</label>
                        <input type="text" name="username" required>
                    </div>
                    <div class="input-group">
                        <label>رمز عبور</label>
                        <input type="password" name="password" required>
                    </div>
                    <?php wp_nonce_field('ajax-login-nonce', 'security_login'); ?>
                    <button type="submit" class="auth-submit-btn">ورود به حساب</button>
                    <div class="form-message"></div>
                </form>
            </div>

            <div id="register-box" class="auth-box">
                <form id="custom-register-form">
                    <div class="input-group">
                        <label>نام کاربری</label>
                        <input type="text" name="reg_username" required>
                    </div>
                    <div class="input-group">
                        <label>ایمیل</label>
                        <input type="email" name="reg_email" required>
                    </div>
                    <div class="input-group">
                        <label>رمز عبور</label>
                        <input type="password" name="reg_password" required>
                    </div>
                    <?php wp_nonce_field('ajax-register-nonce', 'security_register'); ?>
                    <button type="submit" class="auth-submit-btn">ثبت نام</button>
                    <div class="form-message"></div>
                </form>
            </div>
        </div>
    </div>
    <?php
    return ob_get_clean();
}

// ۲. پردازش درخواست ورود (AJAX)
add_action('wp_ajax_nopriv_custom_ajax_login', 'custom_ajax_login_handler');
function custom_ajax_login_handler() {
    check_ajax_referer('ajax-login-nonce', 'security_login');

    $info = array();
    $info['user_login'] = sanitize_user($_POST['username']);
    $info['user_password'] = $_POST['password'];
    $info['remember'] = true;

    $user_signon = wp_signon($info, false);

    if (is_wp_error($user_signon)) {
        wp_send_json_error(array('message' => 'نام کاربری یا رمز عبور اشتباه است.'));
    } else {
        wp_send_json_success(array('message' => 'ورود موفقیت‌آمیز بود! در حال انتقال...', 'redirect' => wc_get_page_permalink('myaccount')));
    }
}

// ۳. پردازش درخواست ثبت‌نام (AJAX)
add_action('wp_ajax_nopriv_custom_ajax_register', 'custom_ajax_register_handler');
function custom_ajax_register_handler() {
    check_ajax_referer('ajax-register-nonce', 'security_register');

    $username = sanitize_user($_POST['reg_username']);
    $email    = sanitize_email($_POST['reg_email']);
    $password = $_POST['reg_password'];

    if (username_exists($username) || !validate_username($username)) {
        wp_send_json_error(array('message' => 'این نام کاربری معتبر نیست یا قبلاً گرفته شده است.'));
    }
    if (email_exists($email)) {
        wp_send_json_error(array('message' => 'این ایمیل قبلاً ثبت نام کرده است.'));
    }

    $user_id = wp_create_user($username, $password, $email);

    if (is_wp_error($user_id)) {
        wp_send_json_error(array('message' => 'خطایی در ثبت نام رخ داد، دوباره تلاش کنید.'));
    } else {
        wp_set_current_user($user_id);
        wp_set_auth_cookie($user_id);
        wp_send_json_success(array('message' => 'ثبت نام با موفقیت انجام شد!', 'redirect' => wc_get_page_permalink('myaccount')));
    }
}

// ۴. اتصال متغیرهای محلی برای جاوااسکریپت
add_action('wp_enqueue_scripts', 'enqueue_auth_ajax_script');
function enqueue_auth_ajax_script() {
    wp_localize_script('jquery', 'ajax_auth_object', array(
        'ajaxurl' => admin_url('admin-ajax.php')
    ));
}