/*
Theme Name: Hello Elementor Child
Description: Child theme for Hello Elementor
Author: Royhan Sajib
Author URI: https://royhansajib.com
Template: hello-elementor
Version: 1.0.0
Text Domain: hello-elementor-child
*/

  html, body {
    overflow-x: hidden !important;
  }
.rs-header {
  transition: background-color 0.3s ease;
  background-color: transparent;
}

.rs-header.scrolled {
  background-color: #16151b !important;
}

.rs-location-list ul {
  width: 320px;
  display:flex;
  flex-direction:column;
  gap:12px;
}
.rs-location-list ul li {
  padding: 0px !important;}

.rs-location-list ul li::after {
  content: "";
  width: 11px;
  height: 11px;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238c8c8c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M7 17L17 7M17 7H7M17 7V17'/></svg>") no-repeat center;
  background-size: contain;
  transform: translateY(-4px);
}
.rs-location-list ul li:last-child::after {
  transform: translateY(0px)
}

/*=============== SINGLE PHP =================*/

/* --- Single post layout --- */
.ur-single-wrap{max-width: 1280px; margin:0 auto;padding:24px;margin-top: 50px;}

.ur-hero{
  height: 350px;
  background: url('images/blog_single_bg.png') no-repeat center center;
  background-size: cover;
  color:#fff;
  padding-top: 50px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}

.ur-title{font-size:50px !important;
font-weight: 500;
line-height:1.2;
max-width: 1280px;
  margin: 0 auto;
  padding: 8px;
}
.ur-meta{ display: flex; justify-content: center; color:#fff;font-size:15.63px; line-height: 20px;}
.ur-meta a{color:inherit;text-decoration:none}
.ur-meta-sep{margin:0 8px}

/* Featured */
.ur-featured{margin:28px 0}
.ur-featured-img{width:100%;height:auto; max-height: 410px; border-radius:16px;display:block}

/* Grid: sidebar + content */
.ur-grid{display:flex;gap:28px;}
.ur-sidebar{width:342px;min-width:342px;}
.ur-card{background:#fff;border:1px solid #eee;border-radius:12px;padding:16px}
.ur-card-title{font-size:15.63px !important;font-weight:600;color:#111827; margin-top: 15px; margin-bottom: 15px;line-height: 18px;}

/* TOC area (your shortcode will output the list) */
.ur-toc ul{
    list-style:none;
    padding:0;
    margin:0;
}

.ur-toc li{
    border-top:1px solid #f4f4f4;
}

.ur-toc a{
    display:block;              /* important */
    padding:18px 0;              /* moved padding here */
    font-size:15.63px;
    font-weight:500;
    line-height:1.4;            /* reduce if still looks high */
    text-decoration:none;
    color:#111827;
}

.ur-toc a:hover{
    text-decoration:underline;
}

/* Share box */
.ur-share-title{font-size:15.63px !important;font-weight:600;color:#111827; margin-top: 15px; margin-bottom: 0px;line-height: 18px;}
.ur-share-list{list-style:none;margin:0;padding:0;display:flex;gap:10px;flex-wrap:wrap}
.ur-share-list a{display:inline-block;}

/* Content */
.ur-content .ur-entry img{max-width:100%;border-radius:12px}
.ur-content .ur-entry p{
  font-size: 14.07px;
  line-height: 1.6em;}

.ur-content .ur-entry h2{
  font-size: 18.75px;
  font-weight: 600;
  line-height: 1.6em;}
.ur-tags{margin-top:28px}
.ur-tags span{margin-right:8px;color:#6b7280}

/* Related posts */
.ur-related{margin:64px 0 24px}
.ur-related-title{font-size: 37.51px !important; text-transform:uppercase;letter-spacing:1px;margin-top:94px; margin-bottom: 60px;}
.ur-related-grid{display:flex;gap:20px;font-size:15.67px;}
.ur-related-card{background:#fff;border:1px solid #eee;border-radius:12px;overflow:hidden;display:flex;flex-direction:column}
.ur-related-thumb img{display:block;width:100%;height:auto}
.ur-related-placeholder{background:#f3f4f6;height:180px}
.ur-related-body{padding:14px}
.ur-related-meta{font-size:12px;color:#9ca3af;margin-bottom:8px}
.ur-related-title-sm{font-size:18px;line-height:1.35;margin:0 0 10px}
.ur-related-title-sm a{text-decoration:none;color:#111827}
.ur-related-read{font-size:14px;text-decoration:none}


@media (max-width: 768px) {
  .ur-hero{
    padding-top:0px;
  }
  .ur-title{font-size:30px !important;}
  .ur-grid{flex-direction:column;}
  .ur-single-wrap {margin-top:0px;}
  .ur-related-title {
  font-size:24px !important;
  margin-top:16px;
  }
  .ur-related-grid{flex-direction:column;}
  
  .ur-related-grid .pgf-post {margin:0px;}
  
}

<?php
/**
 * Add this code to your theme's functions.php file
 * or use a plugin like "Code Snippets" to add it safely
 */

// Hook into MetForm submission
add_action('metform_after_store_form_data', 'send_referral_to_google_sheet', 10, 3);

function send_referral_to_google_sheet($form_id, $form_data, $entry_id) {
    
    // Replace with your actual MetForm form ID (found in MetForm > All Forms)
    $referral_form_id = 972; // CHANGE THIS to your form ID
    
    // Only process if it's the referral form
    if ($form_id != $referral_form_id) {
        return;
    }
    
    // Replace with your Google Apps Script Web App URL
    $google_script_url = 'https://script.google.com/macros/s/AKfycbymgZcIWFjHef8F1GvDb0tR7MeIQqPCjf-nYJj74VBTua3ULTLrDlhYzdtzMOUDEJBW/exec';
    
    // Extract form field values - adjust field names to match your MetForm fields
    $data = array(
        'referring_agent_name' => isset($form_data['agent-mf-name']) ? $form_data['agent-mf-name'] : '',
        'referring_agent_email' => isset($form_data['agent-mf-email']) ? $form_data['agent-mf-email'] : '',
        'client_name' => isset($form_data['mf-client-name']) ? $form_data['mf-client-name'] : '',
        'client_email' => isset($form_data['mf-client-email']) ? $form_data['mf-client-email'] : '',
        'client_phone' => isset($form_data['mf-client-phone']) ? $form_data['mf-client-phone'] : '',
        'notes' => isset($form_data['mf-comment']) ? $form_data['mf-comment'] : '',
    );
    
    // Send data to Google Apps Script
    $response = wp_remote_post($google_script_url, array(
        'method' => 'POST',
        'timeout' => 45,
        'headers' => array(
            'Content-Type' => 'application/json',
        ),
        'body' => json_encode($data),
    ));
    
    // Log any errors (optional - for debugging)
    if (is_wp_error($response)) {
        error_log('Google Sheet submission error: ' . $response->get_error_message());
    }
}

/**
 * Helper function to find your MetForm field names
 * Add ?debug_metform=1 to your URL after submitting the form to see field names
 */
add_action('metform_after_store_form_data', 'debug_metform_fields', 10, 3);

function debug_metform_fields($form_id, $form_data, $entry_id) {
    if (isset($_GET['debug_metform']) && $_GET['debug_metform'] == '1') {
        error_log('MetForm ID: ' . $form_id);
        error_log('MetForm Data: ' . print_r($form_data, true));
    }
}
?>