<?php
/**
 * قالب فوتر Dima Shop
 * نسخه: 1.0.0
 * 
 * نحوه استفاده:
 * [dima_footer]
 */
if (!defined('ABSPATH')) exit;

$store_name = get_option('dima_store_name', get_bloginfo('name'));
$store_description = get_option('dima_store_description', get_bloginfo('description'));
$store_phone = get_option('dima_store_phone', '');
$store_email = get_option('dima_store_email', get_option('admin_email'));
$store_address = get_option('dima_store_address', '');
$store_city = get_option('dima_store_city', '');
$store_instagram = get_option('dima_store_instagram', '');
$store_telegram = get_option('dima_store_telegram', '');
$store_whatsapp = get_option('dima_store_whatsapp', '');
$store_twitter = get_option('dima_store_twitter', '');
$store_linkedin = get_option('dima_store_linkedin', '');

$shop_page = get_permalink(get_option('dima_shop_page'));
$cart_page = get_permalink(get_option('dima_cart_page'));
$account_page = get_permalink(get_option('dima_account_page'));
?>

<footer class="dima-shop-footer" dir="rtl">
    
    <div class="footer-main">
        <div class="container">
            <div class="footer-grid">
                
                <!-- درباره ما -->
                <div class="footer-col about-col">
                    <div class="footer-logo">
                        <span class="logo-icon">️</span>
                        <span class="logo-text"><?php echo esc_html($store_name); ?></span>
                    </div>
                    <p class="footer-description">
                        <?php echo esc_html($store_description ?: 'فروشگاه آنلاین ' . $store_name); ?>
                    </p>
                    
                    <?php if ($store_phone || $store_email): ?>
                    <div class="footer-contact-mini">
                        <?php if ($store_phone): ?>
                            <a href="tel:<?php echo esc_attr($store_phone); ?>" class="contact-mini">
                                <span class="contact-icon">📱</span>
                                <span><?php echo esc_html($store_phone); ?></span>
                            </a>
                        <?php endif; ?>
                        <?php if ($store_email): ?>
                            <a href="mailto:<?php echo esc_attr($store_email); ?>" class="contact-mini">
                                <span class="contact-icon">️</span>
                                <span><?php echo esc_html($store_email); ?></span>
                            </a>
                        <?php endif; ?>
                    </div>
                    <?php endif; ?>
                </div>
                
                <!-- لینک‌های سریع -->
                <div class="footer-col links-col">
                    <h4 class="footer-title">دسترسی سریع</h4>
                    <ul class="footer-links">
                        <li><a href="<?php echo esc_url($shop_page); ?>">🛍️ فروشگاه</a></li>
                        <li><a href="<?php echo esc_url($cart_page); ?>">🛒 سبد خرید</a></li>
                        <li><a href="<?php echo esc_url($account_page); ?>">👤 حساب کاربری</a></li>
                        <li><a href="<?php echo esc_url(home_url('/contact-us/')); ?>">📞 تماس با ما</a></li>
                        <li><a href="<?php echo esc_url(home_url('/about-us/')); ?>">ℹ️ درباره ما</a></li>
                    </ul>
                </div>
                
                <!-- اطلاعات تماس -->
                <?php if ($store_address || $store_city): ?>
                <div class="footer-col contact-col">
                    <h4 class="footer-title">اطلاعات تماس</h4>
                    <ul class="footer-contact-list">
                        <?php if ($store_city): ?>
                        <li>
                            <span class="contact-icon">📍</span>
                            <span><?php echo esc_html($store_city); ?></span>
                        </li>
                        <?php endif; ?>
                        <?php if ($store_address): ?>
                        <li>
                            <span class="contact-icon">🏢</span>
                            <span><?php echo esc_html($store_address); ?></span>
                        </li>
                        <?php endif; ?>
                        <?php if ($store_phone): ?>
                        <li>
                            <span class="contact-icon">📱</span>
                            <a href="tel:<?php echo esc_attr($store_phone); ?>"><?php echo esc_html($store_phone); ?></a>
                        </li>
                        <?php endif; ?>
                        <?php if ($store_email): ?>
                        <li>
                            <span class="contact-icon">✉️</span>
                            <a href="mailto:<?php echo esc_attr($store_email); ?>"><?php echo esc_html($store_email); ?></a>
                        </li>
                        <?php endif; ?>
                    </ul>
                </div>
                <?php endif; ?>
                
                <!-- شبکه‌های اجتماعی -->
                <?php 
                $socials = array_filter(array(
                    'instagram' => $store_instagram,
                    'telegram' => $store_telegram,
                    'whatsapp' => $store_whatsapp,
                    'twitter' => $store_twitter,
                    'linkedin' => $store_linkedin
                ));
                
                if (!empty($socials)):
                ?>
                <div class="footer-col social-col">
                    <h4 class="footer-title">ما را دنبال کنید</h4>
                    <div class="footer-social">
                        <?php foreach ($socials as $network => $url): 
                            $icons = array(
                                'instagram' => '📷',
                                'telegram' => '✈️',
                                'whatsapp' => '💬',
                                'twitter' => '🐦',
                                'linkedin' => '💼'
                            );
                            $names = array(
                                'instagram' => 'اینستاگرام',
                                'telegram' => 'تلگرام',
                                'whatsapp' => 'واتساپ',
                                'twitter' => 'توییتر',
                                'linkedin' => 'لینکدین'
                            );
                        ?>
                            <a href="<?php echo esc_url($url); ?>" target="_blank" rel="noopener noreferrer" 
                               class="social-btn <?php echo esc_attr($network); ?>"
                               title="<?php echo esc_attr($names[$network]); ?>">
                                <span class="social-icon"><?php echo $icons[$network]; ?></span>
                            </a>
                        <?php endforeach; ?>
                    </div>
                </div>
                <?php endif; ?>
                
            </div>
        </div>
    </div>
    
    <!-- فوتر پایین -->
    <div class="footer-bottom">
        <div class="container">
            <div class="footer-bottom-content">
                <div class="copyright">
                    © <?php echo date('Y'); ?> <?php echo esc_html($store_name); ?>. تمامی حقوق محفوظ است.
                    <span class="powered-by">
                        طراحی و توسعه با <span class="heart">❤️</span> توسط 
                        <a href="https://dimashop.ir" target="_blank">Dima Shop</a>
                    </span>
                </div>
                <div class="footer-badges">
                    <span class="badge-item">🔒 پرداخت امن</span>
                    <span class="badge-item"> ارسال سریع</span>
                    <span class="badge-item">✅ ضمانت اصالت</span>
                </div>
            </div>
        </div>
    </div>
    
</footer>

<style>
.dima-shop-footer {
    background: linear-gradient(180deg, #1f2937 0%, #111827 100%);
    color: #d1d5db;
    font-family: 'Vazir', Tahoma, sans-serif;
    margin-top: 60px;
}

.footer-main {
    padding: 50px 0 30px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 40px;
}

@media (max-width: 968px) {
    .footer-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 640px) {
    .footer-grid {
        grid-template-columns: 1fr;
    }
}

.footer-col h4.footer-title {
    color: white;
    font-size: 18px;
    margin: 0 0 20px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #6366f1;
    display: inline-block;
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.logo-icon {
    font-size: 32px;
}

.logo-text {
    font-size: 24px;
    font-weight: 900;
    color: white;
}

.footer-description {
    color: #9ca3af;
    line-height: 1.8;
    margin-bottom: 20px;
}

.footer-contact-mini {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.contact-mini {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #d1d5db;
    text-decoration: none;
    font-size: 14px;
}

.contact-mini:hover {
    color: #6366f1;
}

.contact-icon {
    font-size: 18px;
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links li {
    margin-bottom: 10px;
}

.footer-links a {
    color: #d1d5db;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
    display: inline-block;
}

.footer-links a:hover {
    color: #6366f1;
    transform: translateX(-5px);
}

.footer-contact-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-contact-list li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 12px;
    font-size: 14px;
    color: #d1d5db;
}

.footer-contact-list a {
    color: #d1d5db;
    text-decoration: none;
}

.footer-contact-list a:hover {
    color: #6366f1;
}

.footer-social {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.social-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 20px;
    transition: all 0.3s;
}

.social-btn:hover {
    background: #6366f1;
    transform: translateY(-3px);
}

.footer-bottom {
    background: rgba(0,0,0,0.3);
    padding: 20px 0;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.footer-bottom-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.copyright {
    font-size: 14px;
    color: #9ca3af;
}

.powered-by {
    display: block;
    margin-top: 5px;
    font-size: 12px;
}

.heart {
    color: #ef4444;
    animation: heartbeat 1.5s ease infinite;
}

@keyframes heartbeat {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.powered-by a {
    color: #6366f1;
    text-decoration: none;
    font-weight: 600;
}

.footer-badges {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.badge-item {
    background: rgba(255,255,255,0.1);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    color: #d1d5db;
}
</style>