/* 
Theme Name: Hello Child
Theme URI: https://elementor-site.ir/
Description: 
Author: Elementor Site
Author URI: https://elementor-site.ir/
Template: hello-elementor
Version: 1.0.1
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
*/

.df-container .df-bg, .flipbook-main-wrapper {
	background-color:transparent !important;
	background:transparent !important;

}
.elementor-shortcode div:first-of-type {
		background:transparent !important;

}
.real3dflipbook-0_6833a27f2afbf {
	background:transparent !important;
}
/* elements glass background */
.glass-card {
  background: rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(13px);
  -webkit-backdrop-filter: blur(13px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius:5px;
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.5),
    inset 0 -1px 0 rgba(255, 255, 255, 0.1),
    inset 0 0 2px 1px rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: hidden;
}

.glass-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.8),
    transparent
  );
}

.glass-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 100%;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.8),
    transparent,
    rgba(255, 255, 255, 0.3)
  );
}
/* END OF elements glass background */







add_action('updated_user_meta', function($meta_id, $user_id, $meta_key, $_meta_value){

    // Only watch these keys
    $watched_keys = ['meeting_date', 'meeting_time', 'zoom_link', 'admin_note'];
    if ( ! in_array($meta_key, $watched_keys, true) ) return;

    $user = get_user_by('id', $user_id);
    if ( ! $user || empty($user->user_email) ) return;

    // Prevent multiple emails during one profile save
    $lock_key = 'ehm_notify_lock_' . $user_id;
    if ( get_transient($lock_key) ) return;
    set_transient($lock_key, 1, 10); // 10 seconds

    // Get latest values
    $meeting_date = get_user_meta($user_id, 'meeting_date', true);
    $meeting_time = get_user_meta($user_id, 'meeting_time', true);
    $zoom_link    = get_user_meta($user_id, 'zoom_link', true);
    $admin_note   = get_user_meta($user_id, 'admin_note', true);

    // Build email
    $subject = 'به‌روزرسانی اطلاعات جلسه شما';

    $name = trim(($user->first_name ?? '') . ' ' . ($user->last_name ?? ''));
    if (!$name) $name = $user->display_name;

    $message  = "سلام {$name}\n\n";
    $message .= "اطلاعات جلسه شما به‌روزرسانی شد:\n\n";

    if ($meeting_date) $message .= "📅 تاریخ جلسه: {$meeting_date}\n";
    if ($meeting_time) $message .= "⏰ ساعت جلسه: {$meeting_time}\n";
    if ($zoom_link)    $message .= "🔗 لینک زوم: {$zoom_link}\n";

    if ($admin_note) {
        $message .= "\n📝 یادداشت:\n{$admin_note}\n";
    }

    $message .= "\nبرای مشاهده جزئیات وارد حساب کاربری خود شوید.\n";

    wp_mail($user->user_email, $subject, $message);

}, 10, 4);
