<?php
/**
 * CloudForge Theme - Contact Page
 */
$pageDescription = '联系我们 - ' . SITE_NAME;
$breadcrumbItems = [['title' => '联系我们']];
?>
<?php echo breadcrumb($breadcrumbItems); ?>

<div class="main-content">
    <div class="container">
        <div class="section-header">
            <span class="section-label">// CONTACT</span>
            <h2 class="section-title">联系我们</h2>
        </div>

        <div class="contact-layout">
            <!-- Contact Info -->
            <div class="contact-info-panel">
                <h3 class="contact-panel-title">联系方式</h3>
                <div class="contact-info-list">
                    <div class="contact-info-item">
                        <div class="contact-info-icon">
                            <svg width="20" height="20" viewBox="0 0 20 20" fill="none"><path d="M3 4c0 7 6 13 13 13l1-3-4-2-2 1c-2-1-4-3-5-5l1-2-2-4-2 1z" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"/></svg>
                        </div>
                        <div class="contact-info-text">
                            <dt>联系电话</dt>
                            <dd><?php echo get_setting('contact_phone', '13874944449'); ?></dd>
                        </div>
                    </div>
                    <div class="contact-info-item">
                        <div class="contact-info-icon">
                            <svg width="20" height="20" viewBox="0 0 20 20" fill="none"><rect x="3" y="5" width="14" height="10" rx="1" stroke="currentColor" stroke-width="1.5"/><path d="M3 6l7 5 7-5" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"/></svg>
                        </div>
                        <div class="contact-info-text">
                            <dt>电子邮箱</dt>
                            <dd><?php echo get_setting('contact_email', '284795@qq.com'); ?></dd>
                        </div>
                    </div>
                    <div class="contact-info-item">
                        <div class="contact-info-icon">
                            <svg width="20" height="20" viewBox="0 0 20 20" fill="none"><path d="M10 2c3 0 5 2 5 5 0 3-5 11-5 11S5 10 5 7c0-3 2-5 5-5z" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"/><circle cx="10" cy="7" r="2" stroke="currentColor" stroke-width="1.5"/></svg>
                        </div>
                        <div class="contact-info-text">
                            <dt>公司地址</dt>
                            <dd><?php echo get_setting('contact_address', '长沙市开福区青竹湖街道湘江北路一段369号 金霞跨境产贸城'); ?></dd>
                        </div>
                    </div>
                    <?php if (get_setting('contact_qq')): ?>
                    <div class="contact-info-item">
                        <div class="contact-info-icon">
                            <svg width="20" height="20" viewBox="0 0 20 20" fill="none"><circle cx="10" cy="7" r="4" stroke="currentColor" stroke-width="1.5"/><path d="M6 13c-1 2-1 4 0 4s1-1 2-1h4c1 0 1 1 2 1s1-2 0-4" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"/></svg>
                        </div>
                        <div class="contact-info-text">
                            <dt>QQ</dt>
                            <dd><?php echo get_setting('contact_qq'); ?></dd>
                        </div>
                    </div>
                    <?php endif; ?>
                    <?php if (get_setting('contact_wechat')): ?>
                    <div class="contact-info-item">
                        <div class="contact-info-icon">
                            <svg width="20" height="20" viewBox="0 0 20 20" fill="none"><circle cx="8" cy="8" r="5" stroke="currentColor" stroke-width="1.5"/><circle cx="14" cy="13" r="4" stroke="currentColor" stroke-width="1.5"/><path d="M6 7h4M7 9h2" stroke="currentColor" stroke-width="1" stroke-linecap="round"/></svg>
                        </div>
                        <div class="contact-info-text">
                            <dt>微信</dt>
                            <dd><?php echo get_setting('contact_wechat'); ?></dd>
                        </div>
                    </div>
                    <?php endif; ?>
                </div>
            </div>

            <!-- Contact Form -->
            <div class="contact-form-panel">
                <h3 class="contact-panel-title">在线留言</h3>
                <?php echo $contactMsg ?? ''; ?>
                <form method="post" action="<?php echo cms_url('contact'); ?>" id="contactForm" class="contact-form">
                    <div class="form-row">
                        <div class="form-group">
                            <label>姓名 <span class="required">*</span></label>
                            <input type="text" name="name" required class="form-input">
                        </div>
                        <div class="form-group">
                            <label>电话 <span class="required">*</span></label>
                            <input type="tel" name="phone" required class="form-input">
                        </div>
                    </div>
                    <div class="form-row">
                        <div class="form-group">
                            <label>邮箱</label>
                            <input type="email" name="email" class="form-input">
                        </div>
                        <div class="form-group">
                            <label>公司名称</label>
                            <input type="text" name="company" class="form-input">
                        </div>
                    </div>
                    <div class="form-group">
                        <label>留言内容 <span class="required">*</span></label>
                        <textarea name="message" required class="form-input" rows="5"></textarea>
                    </div>
                    <button type="submit" name="contact_submit" class="btn btn--primary btn--lg">
                        <span>提交留言</span>
                        <svg width="16" height="16" viewBox="0 0 16 16" fill="none"><path d="M3 8h10M9 4l4 4-4 4" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>
                    </button>
                </form>
            </div>
        </div>

        <?php if (!empty($pageData['content'])): ?>
        <div class="contact-extra">
            <div class="article-content">
                <?php echo $pageData['content']; ?>
            </div>
        </div>
        <?php endif; ?>
    </div>
</div>
