<?php
$pageTitle = "Get A Free Quote | MK Construction & Builder";
$pageDesc = "Get a free quote today! MK Construction offers premium building, architectural, and interior design services in Krishnagiri. Professional and transparent estimates.";
include 'includes/header.php';
?>

<div class="quote-page-wrapper">
    <div class="container hero-container">
        <div class="row justify-content-center">
            <!-- Center Column: Form Card -->
            <div class="col-lg-8 form-side">
                <div class="premium-form-card">
                    <div class="form-header text-center mb-5">
                        <h1 class="main-title">Get A Free Quote Today!</h1>
                        <p class="sub-text">Fill up the form and our team will get back to you within 24 hours.</p>
                    </div>

                    <?php if (isset($_GET['success'])): ?>
                        <div class="alert alert-success premium-alert">
                            <i class="fa-solid fa-circle-check"></i>
                            <span>Sent Successfully! We'll contact you soon.</span>
                        </div>
                    <?php endif; ?>

                    <?php if (isset($_GET['error'])): ?>
                        <div class="alert alert-danger premium-alert">
                            <i class="fa-solid fa-circle-exclamation"></i>
                            <span>Failed to send. Please try again.</span>
                        </div>
                    <?php endif; ?>

                    <form action="admin/includes/process_enquiry.php" method="POST">
                        <input type="hidden" name="source" value="quote_page">
                        
                        <div class="row">
                            <div class="col-md-6 mb-3">
                                <label class="field-label">First Name*</label>
                                <input type="text" name="first_name" class="form-input" placeholder="Eg: John" required>
                            </div>
                            <div class="col-md-6 mb-3">
                                <label class="field-label">Last Name*</label>
                                <input type="text" name="last_name" class="form-input" placeholder="Eg: Smith" required>
                            </div>
                        </div>

                        <div class="row">
                            <div class="col-md-6 mb-3">
                                <label class="field-label">Phone Number*</label>
                                <input type="tel" name="phone" id="phone" class="form-input" placeholder="Enter Phone Number" required>
                            </div>
                            <div class="col-md-6 mb-3">
                                <label class="field-label">Email*</label>
                                <input type="email" name="email" class="form-input" placeholder="jane.doe@example.com" required>
                            </div>
                        </div>

                        <div class="mb-4">
                            <label class="field-label">I am Interested In *</label>
                            <div class="service-chips">
                                <label class="chip">
                                    <input type="radio" name="subject" value="Architectural Design" required>
                                    <span>Architectural Design</span>
                                </label>
                                <label class="chip">
                                    <input type="radio" name="subject" value="Interior Designing">
                                    <span>Interior Designing</span>
                                </label>
                                <label class="chip">
                                    <input type="radio" name="subject" value="House Construction">
                                    <span>House Construction</span>
                                </label>
                                <label class="chip">
                                    <input type="radio" name="subject" value="House Renovation">
                                    <span>House Renovation</span>
                                </label>
                                <label class="chip">
                                    <input type="radio" name="subject" value="Others">
                                    <span>Others (specify below)</span>
                                </label>
                            </div>
                        </div>

                        <div class="mb-4">
                            <label class="field-label">Message*</label>
                            <textarea name="message" class="form-textarea" placeholder="Your Message..." required></textarea>
                        </div>

                        <p class="privacy-note">By clicking the submit button, you agree with MK CONSTRUCTION to store & progress the information for contact purposes.</p>

                        <div class="form-footer text-center">
                            <button type="submit" class="submit-btn w-100">Submit</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

<style>
/* Simplified Quote Page Specific Styles */
.quote-page-wrapper {
    background: linear-gradient(rgba(15, 23, 42, 0.8), rgba(15, 23, 42, 0.8)), url('assets/images/bg/construction-bg.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    min-height: 85vh;
    padding: 100px 0;
    font-family: 'Montserrat', sans-serif;
}

/* Fallback background if image missing */
@supports not (background: url('')) {
    .quote-page-wrapper {
        background: radial-gradient(circle at center, #1e293b, #0f172a);
    }
}

.main-title {
    font-size: 3rem;
    font-weight: 800;
    color: #ffd700;
    margin-bottom: 15px;
}

.sub-text {
    font-size: 1.1rem;
    color: #cbd5e1;
    max-width: 600px;
    margin: 0 auto;
}

/* Form Card Styles */
.premium-form-card {
    background: #ffffff;
    padding: 60px 50px;
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.field-label {
    display: block;
    font-weight: 700;
    font-size: 0.95rem;
    color: #1e293b;
    margin-bottom: 8px;
    text-align: left;
}

.form-input {
    width: 100%;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    padding: 14px 20px;
    border-radius: 12px;
    outline: none;
    transition: all 0.3s;
    font-size: 1rem;
    color: #0f172a;
}

.form-input:focus {
    border-color: #ffd700;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(255, 215, 0, 0.1);
}

.service-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

.chip {
    cursor: pointer;
}

.chip input {
    display: none;
}

.chip span {
    display: block;
    padding: 12px 22px;
    background: #f1f5f9;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 700;
    color: #64748b;
    transition: all 0.3s;
}

.chip input:checked + span {
    background: #0f172a;
    border-color: #0f172a;
    color: #fff;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.form-textarea {
    width: 100%;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    padding: 15px 20px;
    border-radius: 12px;
    min-height: 140px;
    outline: none;
    transition: all 0.3s;
    font-size: 1rem;
    color: #0f172a;
}

.form-textarea:focus {
    border-color: #ffd700;
    background: #fff;
}

.privacy-note {
    font-size: 0.85rem;
    color: #64748b;
    line-height: 1.6;
    margin-bottom: 30px;
    text-align: center;
}

.submit-btn {
    background: #ffd700;
    color: #0f172a;
    border: none;
    padding: 18px 50px;
    border-radius: 12px;
    font-weight: 800;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.submit-btn:hover {
    background: #e6c200;
    transform: translateY(-3px);
    box-shadow: 0 12px 25px rgba(255, 215, 0, 0.3);
}

/* Response Fixes */
@media (max-width: 991px) {
    .premium-form-card {
        padding: 40px 30px;
    }
    .main-title {
        font-size: 2.2rem;
    }
}

@media (max-width: 576px) {
    .quote-page-wrapper {
        padding: 60px 0;
    }
    .premium-form-card {
        padding: 30px 20px;
        border-radius: 16px;
    }
    .main-title {
        font-size: 1.8rem;
    }
    .sub-text {
        font-size: 1rem;
    }
    .chip span {
        padding: 10px 15px;
        font-size: 0.8rem;
    }
}

/* International Phone Input Overrides */
.iti { width: 100%; display: block; }
.iti__country-list { z-index: 100; }
.form-input.iti__tel-input { padding-left: 50px !important; }
</style>

<?php include 'includes/footer.php'; ?>

<!-- International Phone Input CSS & JS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/intl-tel-input@24.5.0/build/css/intlTelInput.css">
<script src="https://cdn.jsdelivr.net/npm/intl-tel-input@24.5.0/build/js/intlTelInput.min.js"></script>
<script>
    const phoneInput = document.querySelector("#phone");
    const iti = window.intlTelInput(phoneInput, {
        initialCountry: "in",
        separateDialCode: true,
        utilsScript: "https://cdn.jsdelivr.net/npm/intl-tel-input@24.5.0/build/js/utils.js",
    });
</script>
