/* 
Theme Name: Hello Elementor Child
Theme URI: https://github.com/elementor/hello-theme-child/
Description: Hello Elementor Child is a child theme of Hello Elementor, created by Elementor team
Author: Elementor Team
Author URI: https://elementor.com/
Template: hello-elementor
Version: 2.0.0
Text Domain: hello-elementor-child
License: GNU General Public License v3 or later.
License URI: https://www.gnu.org/licenses/gpl-3.0.html
Tags: flexible-header, custom-colors, custom-menu, custom-logo, editor-style, featured-images, rtl-language-support, threaded-comments, translation-ready
*/

/* Add your custom styles here */




.custom-file-wrapper {
  background: #EDF4FF !important;
  border: none !important;
  border-radius: 15px !important;
  padding: 0 12px !important;
  display: flex !important;
  align-items: center !important;
  width: 100% !important;
  box-sizing: border-box !important;
  margin-top: 8px !important;
  height: 56px !important;
  flex-direction: row-reverse !important; /* همین خط مهم است */
}

.custom-file-btn {
  display: inline-block !important;
  padding: 8px 20px !important;
  cursor: pointer !important;
  border-radius: 12px !important;
  background: #396bb3 !important;
  border: none !important;
  font-family: inherit !important;
  font-size: 1rem !important;
  color: #fff !important;
  transition: background 0.2s !important;
  margin-right: 0 !important;
  margin-left: 12px !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  box-shadow: none !important;
  vertical-align: middle !important;
  height: 40px !important;
  line-height: 24px !important;
}


.form-row input[type=text], .form-row input[type=email], .form-row input[type=password], .form-row input[type=tel]{
  background: #EDF4FF !important;
  border: none !important;
  border-radius: 15px !important;
  padding: 0 12px !important;
  display: flex !important;
  align-items: center !important;
  width: 100% !important;
  box-sizing: border-box !important;
  margin-top: 8px !important;
  height: 56px !important;
}

.woocommerce-input-wrapper textarea#order_comments{
  background: #EDF4FF !important;
  border: none !important;
  border-radius: 15px !important;
}

.custom-file-btn:hover {
  background: #162774 !important;
}

.form-row input[type="submit"], input.woo-add-to-wallet{
    background-color: #36CF75 !important;
    color: #fff !important;
    padding: 0px 48px !important;
    border-radius: 12px !important;
    border: none;
	transition: background-color 0.3s ease;
	height: 56px !important;
	margin-top: 8px !important;
}
    

.custom-file-name {
  display: inline-block !important;
  margin-left: 0 !important;
  margin-right: 12px !important;
  font-size: 1rem !important;
  color: #353945 !important;
  vertical-align: middle !important;
  height: 40px !important;
  line-height: 40px !important;
  flex: 1;
  text-align: right;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}


.elementor-widget-woocommerce-my-account .e-my-account-tab__dashboard:not(.e-my-account-tab__dashboard--custom) .woocommerce-MyAccount-content-wrapper, .elementor-widget-woocommerce-my-account .e-my-account-tab__downloads .woocommerce-MyAccount-content-wrapper, .elementor-widget-woocommerce-my-account .e-my-account-tab__edit-account .woocommerce-MyAccount-content-wrapper, .elementor-widget-woocommerce-my-account .e-my-account-tab__edit-address .woocommerce-MyAccount-content-wrapper, .elementor-widget-woocommerce-my-account .e-my-account-tab__orders .woocommerce-MyAccount-content-wrapper, .elementor-widget-woocommerce-my-account .e-my-account-tab__payment-methods .woocommerce-MyAccount-content-wrapper{
	border-radius : 15px !important;
	padding: 24px !important;
	border: none !important;
}


.elementor-widget-woocommerce-my-account .e-my-account-tab:not(.e-my-account-tab__dashboard--custom) .woocommerce .shop_table .button {
  border-radius: 12px !important;
}

.woo-wallet-my-wallet-container {
    max-width: 100%;
    overflow: hidden;
    border: none;
	border-radius: 15px !important;
    display: flex;
	background-color: #fff !important;
}

h3.woo-wallet-sidebar-heading a {
    color: #183969!important;
}

.woo-wallet-my-wallet-container .woo-wallet-sidebar {
	background-color: #EDF4FF;
}

.woo-wallet-sidebar ul li.card {
	border-radius: 8px;
}

.woo-wallet-sidebar ul li a {
	color: #3b6bb3 !important;
}















// افزودن کلاس ایمیل سفارشی به ووکامرس
add_filter('woocommerce_email_classes', 'add_custom_order_email_class');
function add_custom_order_email_class($email_classes) {
    require_once plugin_dir_path(__FILE__) . 'includes/class-wc-email-custom-card-to-card.php';
    $email_classes['WC_Email_Custom_Card_To_Card'] = new WC_Email_Custom_Card_To_Card();
    return $email_classes;
}

// کلاس ایمیل سفارشی
class WC_Email_Custom_Card_To_Card extends WC_Email {

    public function __construct() {
        $this->id          = 'custom_card_to_card_email';
        $this->title       = 'ایمیل وضعیت کارت به کارت';
        $this->description = 'ارسال ایمیل وضعیت‌های خاص کارت به کارت.';
        $this->heading     = 'وضعیت سفارش شما تغییر کرد';
        $this->subject     = 'وضعیت سفارش شما: در انتظار کارت به کارت';
        $this->template_html = 'emails/custom-card-to-card-email.php';
        $this->template_plain = 'emails/plain/custom-card-to-card-email.php';
        
        parent::__construct();
    }

    public function trigger($order_id) {
        if (!$order_id) return;
        $this->object = wc_get_order($order_id);
        $this->recipient = $this->object->get_billing_email();
        if (!$this->is_enabled() || !$this->get_recipient()) return;
        $this->send($this->get_recipient(), $this->get_subject(), $this->get_content(), $this->get_headers(), $this->get_attachments());
    }

    public function get_content_html() {
        ob_start();
        wc_get_template($this->template_html, array(
            'order' => $this->object,
            'email_heading' => $this->get_heading(),
            'sent_to_admin' => false,
            'plain_text' => false,
            'email' => $this,
        ));
        return ob_get_clean();
    }

    public function get_content_plain() {
        return strip_tags($this->get_content_html());
    }
}





/* استایل‌های آپلود فایل */
.custom-file-wrapper {
    display: flex !important;
    flex-direction: row-reverse !important; /* معکوس کردن ترتیب: دکمه‌ها راست، نام فایل چپ */
    align-items: center !important;
    gap: 0.3rem !important;
    width: 100% !important;
    max-width: 100% !important;
    position: relative !important;
    justify-content: flex-end !important; /* چیدمان از راست */
}

.custom-file-name {
    flex: 1 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    padding: 0.1rem !important;
    border-radius: 4px !important;
    font-size: 0.9rem !important;
    min-width: 150px !important;
    max-width: 70% !important;
    display: inline-block !important;
    margin-left: 0.5rem !important;  تغییر margin-right به margin-left */
    visibility: visible !important;
    opacity: 1 !important;
    z-index: 1000 !important;
}

.btn-wrapper {
    display: flex !important;
    flex-direction: row !important; /* چیدمان افقی برای دکمه‌ها */
    gap: 0.1rem !important;
    width: auto !important;
    max-width: 100px !important; /* عرض برای دو دکمه */
    justify-content: flex-end !important; /* دکمه‌ها از راست */
}

.custom-file-btn {
    padding: 0.5rem 0.5rem !important;
    cursor: pointer !important;
    border: none !important;
    border-radius: 8px !important;
    font-size: 0.9rem !important;
    background: #3B6BB3 !important;
    color: white !important;
}

.custom-file-clear {
    padding: 0 !important; /* عرض دکمه X */
    cursor: pointer !important;
    border: none !important;
    border-radius: 4px !important;
    font-size: 0.8rem !important;
    background: transparent !important; /* رنگ قرمز برای دکمه X */
    color: #ff4d4d !important;
}

@media (max-width: 768px) {
    .custom-file-wrapper {
        flex-direction: row-reverse !important; /* معکوس کردن ترتیب در موبایل */
        gap: 0.1em !important;
        justify-content: flex-end !important; /* چیدمان از راست */
    }
    .custom-file-name {
        max-width: 60% !important;
        margin-left: 0.3rem !important; /* تغییر margin-right به margin-left */
    }
    .btn-wrapper {
        max-width: 80px !important; /* تنظیم عرض برای دو دکمه */
        justify-content: flex-start !important; /* دکمه‌ها از راست */
    }
    .custom-file-btn, .custom-file-clear {
        width: 100% !important;
        min-width: auto !important;
    }
    .custom-file-clear {
        min-width: 2vw !important; /* عرض دکمه X در موبایل */
    }
}