/* ============================================================
🌆 ASTRA CHILD THEME — PROPERTY CARD SYSTEM (v7.0)
By: Shalabh & ChatGPT — Modular, Editable, & Clean
============================================================ */


/* ============================================================
1️⃣ LAYOUT & GRID STRUCTURE
============================================================ */
.property-slider-wrapper {
  position: relative;
  max-width: 1200px;
  margin: 0 auto;
  padding: 60px 20px;
  overflow: hidden;
}

.property-listing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}

.property-listing-grid::-webkit-scrollbar { display: none; }
.property-listing-grid { scrollbar-width: none; }



/* ============================================================
2️⃣ PROPERTY CARD CONTAINER
============================================================ */
.property-card {
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  box-shadow:
    0 10px 25px rgba(0, 0, 0, 0.12),
    0 4px 10px rgba(0, 0, 0, 0.08),
    0 0 0 1px rgba(0, 0, 0, 0.03); /* fine border definition */
  transition: transform 0.35s ease, box-shadow 0.35s ease;
}

.property-card:hover {
  transform: translateY(-10px);
  box-shadow:
    0 15px 35px rgba(0, 0, 0, 0.18),
    0 8px 25px rgba(0, 0, 0, 0.12),
    0 0 0 1px rgba(0, 0, 0, 0.04);
}



/* ============================================================
3️⃣ IMAGE & GRADIENT OVERLAY
============================================================ */
.property-thumb {
  position: relative;
  overflow: hidden;
}

.property-thumb img {
  width: 100%;
  height: 440px;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.property-card:hover .property-thumb img {
  transform: scale(1.04);
}

/* Strong cinematic overlay */
.property-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 70%;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 1) 0%,
    rgba(0, 0, 0, 0.95) 40%,
    rgba(0, 0, 0, 0.6) 70%,
    rgba(0, 0, 0, 0) 100%
  );
  z-index: 2;
  pointer-events: none;
}

/* Soft fade shadow at top for more depth */
.property-thumb::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 30%;
  background: linear-gradient(to bottom, rgba(0,0,0,0.25), rgba(0,0,0,0));
  z-index: 2;
  pointer-events: none;
}



/* ============================================================
4️⃣ TAGS (PROPERTY TYPE & FEATURED LABEL)
============================================================ */
.property-tags {
  position: absolute;
  top: 18px;
  left: 18px;
  z-index: 3;
  display: flex;
  gap: 8px;
}

.property-tag {
  background: rgba(255, 255, 255, 0.9);
  color: #000;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 20px;
}

.property-featured {
  background: #007bff;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 20px;
}



/* ============================================================
5️⃣ INFO BLOCK (TITLE, DEVELOPER, LOCATION, PRICE)
============================================================ */
.property-info {
  position: absolute;
  bottom: 25px;
  left: 25px;
  right: 25px;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  color: #fff;
}

.property-info-text {
  max-width: 68%;
  line-height: 1.35;
}

.property-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
  line-height: 1.3;
}

.property-developer,
.property-location {
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.95rem;
  margin-bottom: 4px;
  line-height: 1.3;
}

.property-finish {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.8);
  margin-top: 4px;
}

.property-finish strong {
  color: #c29b45;
  font-weight: 600;
}

.property-price {
  color: #c29b45;
  font-weight: 600;
  font-size: 1rem;
  margin-top: 5px;
  line-height: 1.3;
}



/* ============================================================
6️⃣ VIEW PROPERTY BUTTON
============================================================ */
.property-view-btn {
  background: #c29b45;
  color: #fff;
  padding: 10px 22px;
  border-radius: 6px;
  text-decoration: none !important;
  font-size: 15px;
  font-weight: 500;
  transition: all 0.3s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  white-space: nowrap;
}

.property-view-btn:hover {
  background: #a88330;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}



/* ============================================================
7️⃣ SLIDER NAVIGATION ARROWS
============================================================ */
.slider-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  border: none;
  padding: 10px 16px;
  cursor: pointer;
  font-size: 22px;
  border-radius: 50%;
  z-index: 10;
  display: none;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  opacity: 0.8;
}

.slider-btn:hover {
  background: rgba(0, 0, 0, 0.8);
  opacity: 1;
}

.slider-btn.prev { left: 15px; }
.slider-btn.next { right: 15px; }

.property-slider-wrapper:hover .slider-btn {
  display: flex;
}



/* ============================================================
8️⃣ RESPONSIVE DESIGN — TABLET & MOBILE
============================================================ */
@media (max-width: 991px) {
  .property-listing-grid {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
  }

  .property-card {
    flex: 0 0 85%;
    scroll-snap-align: start;
  }

  .slider-btn {
    display: flex;
    opacity: 0.9;
  }
}

@media (max-width: 600px) {
  .property-thumb img {
    height: 420px; /* taller for better readability */
  }

  .property-overlay {
    height: 80%;
    background: linear-gradient(
      to top,
      rgba(0, 0, 0, 1) 0%,
      rgba(0, 0, 0, 0.95) 40%,
      rgba(0, 0, 0, 0.7) 70%,
      rgba(0, 0, 0, 0) 100%
    );
  }

  .property-info {
    bottom: 30px;
    left: 20px;
    right: 20px;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .property-info-text {
    max-width: 90%;
    line-height: 1.4;
  }

  .property-title {
    font-size: 1.2rem;
  }

  .property-view-btn {
    align-self: flex-start;
    padding: 10px 20px;
  }
}



/* ============================================================
9️⃣ (OPTIONAL) VISUAL ENHANCEMENTS
============================================================ */
/* Luxury glow animation on button hover */
.property-view-btn:hover {
  box-shadow: 0 0 10px rgba(194, 155, 69, 0.8), 0 0 20px rgba(194, 155, 69, 0.6);
}

/* Featured tag subtle shimmer */
.property-featured {
  background: linear-gradient(90deg, #007bff, #66a3ff);
  background-size: 200% 100%;
  animation: shimmer 3s infinite linear;
}

@keyframes shimmer {
  0% { background-position: 0 0; }
  100% { background-position: -200% 0; }
}


/* ============================================================
🏙️ ACF Dynamic Background Hero Section
============================================================ */



/* ============================================================
🏙️ Dynamic Hero Section with Background + Contact Form
============================================================ */

.acf-hero-wrapper {
  position: relative;
  width: 100vw;
  height: 100vh;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: #fff;
}

/* Gradient overlay for dark contrast */
.acf-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to right,
    rgba(0, 0, 0, 0.85) 0%,
    rgba(0, 0, 0, 0.6) 40%,
    rgba(0, 0, 0, 0.3) 100%
  );
  z-index: 1;
}

/* Inner Flex container */
.acf-hero-inner {
  position: relative;
  z-index: 2;
  display: flex;
  width: 90%;
  max-width: 1300px;
  justify-content: space-between;
  align-items: center;
  gap: 40px;
}

/* Left side content */
.acf-hero-left {
  flex: 1;
  max-width: 55%;
}

.acf-hero-title {
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: #fff;
}

.acf-hero-location,
.acf-hero-quarter {
  font-size: 1.1rem;
  opacity: 0.9;
  margin-bottom: 6px;
}

.acf-hero-price {
  font-size: 1.2rem;
  color: #c29b45;
  margin: 15px 0 25px;
}

.acf-hero-btn {
  display: inline-block;
  background: #c29b45;
  color: #fff;
  padding: 12px 28px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s ease;
}

.acf-hero-btn:hover {
  background: #a88330;
  transform: translateY(-2px);
}

/* Right side: form container */
.acf-hero-right {
  flex: 1;
  max-width: 400px;
}

.acf-hero-form {
  background: rgba(255, 255, 255, 0.08);
  padding: 30px 25px;
  border-radius: 10px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.25);
  backdrop-filter: blur(6px);
}

.acf-hero-form h3 {
  color: #fff;
  margin-bottom: 8px;
  font-size: 1.6rem;
  font-weight: 600;
}

.acf-hero-form p {
  color: rgba(255,255,255,0.9);
  font-size: 0.95rem;
  margin-bottom: 20px;
}

/* Form fields styling (for CF7 default) */
.acf-hero-form input,
.acf-hero-form textarea {
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 4px;
  margin-bottom: 10px;
  background: rgba(255,255,255,0.15);
  color: #fff;
}

.acf-hero-form input::placeholder,
.acf-hero-form textarea::placeholder {
  color: rgba(255,255,255,0.8);
}

.acf-hero-form input[type="submit"] {
  background: #c29b45;
  color: #fff;
  border: none;
  font-weight: 500;
  padding: 12px 20px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.acf-hero-form input[type="submit"]:hover {
  background: #a88330;
}

/* ============================================================
📱 Responsive Layout
============================================================ */
@media(max-width: 991px) {
  .acf-hero-inner {
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    gap: 40px;
  }
  .acf-hero-left {
    max-width: 100%;
  }
  .acf-hero-right {
    width: 100%;
    max-width: 100%;
  }
  .acf-hero-wrapper {
    height: auto;
    padding: 80px 20px;
  }
}

@media(max-width: 600px) {
  .acf-hero-title { font-size: 2rem; }
  .acf-hero-form { padding: 25px 20px; }
}



/* ============================================================
ACF HERO — full clean block (edge-to-edge, overlay, white form)
============================================================ */

/* make the section truly edge-to-edge inside Elementor */
.elementor-section .acf-hero-wrapper {
  width: 100vw;
  position: relative;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
  padding: 0 !important;
  overflow: hidden;
}

/* ============================================================
🎯 Hero Full Width & Center Alignment Fix (Final Version)
============================================================ */

/* Force hero to span full viewport width inside any Elementor section */
/* ============================================================
🌆 ACF Hero Full-Width Fix + Proper Inner Alignment (Final)
============================================================ */

/* Make hero full width + remove ALL theme padding */
.single-property .acf-hero-wrapper {
  position: relative;
  width: 100vw;
  min-height: 100vh;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  margin-top: 0 !important;
  padding: 0 !important;
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: #fff;
}

/* Remove unwanted top margin from Elementor or theme */
.single-property .elementor,
.single-property .site-content,
.single-property main,
.single-property .container,
.single-property #primary {
  padding: 0 !important;
  margin: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
}

/* Overlay */
.acf-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to right,
    rgba(0,0,0,0.9) 0%,
    rgba(0,0,0,0.5) 50%,
    rgba(0,0,0,0.2) 100%
  );
  z-index: 1;
}

/* Inner Content */
.acf-hero-inner {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 90%;
  max-width: 1300px;
  margin: 0 auto;
  gap: 40px;
  box-sizing: border-box;
}

/* Left Column */
.acf-hero-left {
  flex: 1;
  max-width: 55%;
}
.acf-hero-title {
  font-size: 3rem;
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 12px;
}
.acf-hero-location,
.acf-hero-quarter {
  font-size: 1.05rem;
  color: rgba(255,255,255,0.9);
}
.acf-hero-price {
  margin: 18px 0;
  color: #c29b45;
  font-weight: 700;
}
.acf-hero-btn {
  display: inline-block;
  background: #c29b45;
  color: #fff;
  padding: 12px 26px;
  border-radius: 6px;
  font-weight: 600;
  text-decoration: none;
}
.acf-hero-btn:hover {
  background: #a88330;
  transform: translateY(-2px);
}

/* Right Column (Form Box) */
.acf-hero-right {
  flex: 0 0 380px;
  max-width: 380px;
}
.acf-hero-form {
  background: #fff;
  border-radius: 16px;
  padding: 30px 26px;
  color: #222;
  box-shadow: 0 12px 30px rgba(0,0,0,0.15);
}
.acf-hero-form h3 {
  margin: 0 0 8px;
  font-size: 1.25rem;
  color: #000;
}
.acf-hero-form p {
  color: #444;
  margin-bottom: 14px;
}

/* Form Fields (CF7) */
.acf-hero-form input[type="text"],
.acf-hero-form input[type="email"],
.acf-hero-form input[type="tel"],
.acf-hero-form textarea,
.acf-hero-form select {
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 10px;
  border-radius: 6px;
  border: 1px solid #ddd;
  background: #fafafa;
  color: #333;
  font-size: 0.95rem;
}
.acf-hero-form input[type="submit"],
.acf-hero-form button {
  width: 100%;
  background: #c29b45;
  color: #fff;
  padding: 12px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-weight: 600;
}
.acf-hero-form input[type="submit"]:hover {
  background: #a88330;
}

/* Responsive */
@media (max-width: 991px) {
  .acf-hero-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 25px;
  }
  .acf-hero-left,
  .acf-hero-right {
    max-width: 100%;
  }
  .acf-hero-wrapper {
    min-height: 80vh;
  }
}
-sizing: border-box;
}

/* left column */
.acf-hero-left { flex: 1; max-width: 60%; }
.acf-hero-title {
  font-size: 3rem;
  font-weight: 700;
  margin: 0 0 12px 0;
  color: #fff;
  line-height: 1.05;
}
.acf-hero-location,
.acf-hero-quarter {
  font-size: 1.05rem;
  color: rgba(255,255,255,0.92);
  margin: 4px 0;
}
.acf-hero-price {
  color: #c29b45;
  font-weight: 700;
  margin: 14px 0;
}
.acf-hero-btn {
  display: inline-block;
  background: #c29b45;
  color: #fff;
  padding: 10px 22px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
}
.acf-hero-btn:hover { background: #a88330; transform: translateY(-1px); }

/* right column (white form) */
.acf-hero-right { flex: 0 0 380px; max-width: 380px; }
.acf-hero-form {
  background: #fff;
  color: #222;
  border-radius: 12px;
  padding: 26px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.15);
}
.acf-hero-form h3 { margin: 0 0 8px; font-size: 1.25rem; color: #111; }
.acf-hero-form p { color: #444; margin-bottom: 14px; }

/* CF7/Input styling */
.acf-hero-form input[type="text"],
.acf-hero-form input[type="email"],
.acf-hero-form input[type="tel"],
.acf-hero-form textarea,
.acf-hero-form select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid #e6e6e6;
  background: #fafafa;
  margin-bottom: 10px;
  color: #222;
  box-sizing: border-box;
}
.acf-hero-form input[type="submit"],
.acf-hero-form button {
  width: 100%;
  background: #c29b45;
  color: #fff;
  padding: 12px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-weight: 600;
}
.acf-hero-form input[type="submit"]:hover { background: #a88330; }

/* responsive */
@media (max-width: 991px) {
  .elementor-section .acf-hero-wrapper { left: 0; margin-left: 0; margin-right: 0; width: 100%; }
  .acf-hero-inner { flex-direction: column; align-items: flex-start; padding: 30px 0; }
  .acf-hero-left { max-width: 100%; }
  .acf-hero-right { max-width: 100%; width: 100%; }
  .acf-hero-wrapper { min-height: 80vh; }
}
@media (max-width: 600px) {
  .acf-hero-title { font-size: 1.8rem; }
  .acf-hero-wrapper { min-height: 70vh; }
  .acf-hero-form { padding: 18px; }
}


/* ============================================================
🧱 Fix Property Template Container Offset (Full Width Alignment)
============================================================ */
.single-property #primary,
.single-property .ast-container,
.single-property .elementor-section-wrap,
.single-property .site-content,
.single-property main,
.single-property .container {
  max-width: 100% !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  margin: 0 !important;
  width: 100% !important;
}

/* Ensure Elementor canvas takes full width */
.single-property .elementor-section {
  padding-left: 0 !important;
  padding-right: 0 !important;
  margin: 0 !important;
}




/* ============================================================
   🏠 Compact Property Enquiry Form – Hero Section
============================================================ */
/* ============================================================
🏠 Ultra Compact Property Enquiry Form (Hero Section)
============================================================ */
.property-enquiry-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Hide labels for minimal layout */
.property-enquiry-form label {
  display: none;
}

/* Input fields */
.property-enquiry-form input,
.property-enquiry-form textarea {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 0.9rem;
  background: #fafafa;
  transition: border-color 0.3s, background 0.3s;
}

/* Smaller textarea */
.property-enquiry-form textarea {
  min-height: 45px;   /* ⬅️ Reduced from 70px */
  max-height: 60px;
  resize: none;       /* Prevent resizing to keep layout consistent */
}

.property-enquiry-form input:focus,
.property-enquiry-form textarea:focus {
  border-color: #c29b45;
  background: #fff;
  outline: none;
}

/* Submit button */
.property-form-submit {
  margin-top: 6px;
  text-align: center;
}

.property-enquiry-form input[type="submit"] {
  background: #c29b45;
  color: #fff;
  border: none;
  padding: 7px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.3s ease;
}

.property-enquiry-form input[type="submit"]:hover {
  background: #a88330;
  transform: translateY(-1px);
}

/* Form container */
.acf-hero-form {
  background: #fff;
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
  max-width: 310px;
}

.acf-hero-form h3 {
  font-size: 1rem;
  margin-bottom: 5px;
  color: #111;
  line-height: 1.2;
}

.acf-hero-form p {
  font-size: 0.8rem;
  color: #666;
  margin-bottom: 8px;
  line-height: 1.2;
}



/* ============================================================
🏙️ Amenities Grid Design (No Repeater)
============================================================ */
.property-amenities-section {
  max-width: 1200px;
  margin: 70px auto;
  padding: 0 20px;
  font-family: 'Poppins', sans-serif;
}

.property-amenities-section .section-title {
  font-size: 1.8rem;
  font-weight: 700;
  color: #111;
  margin-bottom: 30px;
}

.amenities-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px 40px;
}

.amenity-item {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1rem;
  color: #333;
  line-height: 1.6;
  font-weight: 500;
}

.amenity-icon {
  font-size: 20px;
  line-height: 1;
  width: 24px;
  text-align: center;
}

.amenity-name {
  color: #222;
}

@media (max-width: 768px) {
  .amenities-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }
}










// AJAX handler for Contact Advisor
add_action('wp_ajax_bip_contact_advisor', 'bip_contact_advisor_handler');
add_action('wp_ajax_nopriv_bip_contact_advisor', 'bip_contact_advisor_handler');

function bip_contact_advisor_handler() {
    // basic nonce check optional (if you add one)
    // if( ! isset($_POST['nonce']) || ! wp_verify_nonce($_POST['nonce'], 'bip_contact_nonce') ) {
    //     wp_send_json_error('Invalid request (security).');
    // }

    $name = isset($_POST['name']) ? sanitize_text_field($_POST['name']) : '';
    $email = isset($_POST['email']) ? sanitize_email($_POST['email']) : '';
    $mobile = isset($_POST['mobile']) ? sanitize_text_field($_POST['mobile']) : '';
    $interest = isset($_POST['interest']) ? sanitize_text_field($_POST['interest']) : '';
    $property_id = isset($_POST['property_id']) ? intval($_POST['property_id']) : 0;

    if( empty($name) || empty($email) || empty($mobile) ) {
        wp_send_json_error('Please fill all required fields.');
    }

    // Build email
    $to = get_option('admin_email'); // change to sales@yourdomain if required
    $subject = 'Contact Advisor Request: ' . ($property_id ? 'Property #' . $property_id : 'General');
    $body = "Name: $name\nEmail: $email\nMobile: $mobile\nProperty ID: $property_id\nInterest: $interest\n\nSent from: " . home_url();
    $headers = array('Content-Type: text/plain; charset=UTF-8');

    $sent = wp_mail($to, $subject, $body, $headers);

    if($sent) {
        wp_send_json_success('Thanks! Your request has been sent.');
    } else {
        wp_send_json_error('Unable to send email. Please try again later.');
    }
}

// Enqueue and localize bip AJAX scripts
function bip_enqueue_frontend_assets(){
    // only enqueue on pages where property list or search exists (optional check)
    wp_enqueue_script('bip-frontend', get_stylesheet_directory_uri() . '/js/bip-frontend.js', array(), '1.0', true);
    wp_localize_script('bip-frontend', 'bip_ajax', array(
        'ajax_url' => admin_url('admin-ajax.php'),
        'nonce'    => wp_create_nonce('bip_contact_nonce'),
    ));
}
add_action('wp_enqueue_scripts', 'bip_enqueue_frontend_assets');
