<?php $__env->startSection('title', 'Site Settings'); ?>

<?php $__env->startSection('content'); ?>
<div class="dashboard-header" style="margin-bottom: 24px; display: flex; justify-content: space-between; align-items: center;">
    <div>
        <h1 style="font-family:'Oswald',sans-serif; font-size:2rem; color:var(--primary); margin:0;">Site Settings</h1>
        <p style="color:var(--text-muted); font-size:0.88rem; margin:4px 0 0;">Configure your website's appearance and information.</p>
    </div>
</div>

<!-- Tab Navigation -->
<div style="display:flex; gap:8px; margin-bottom:24px; flex-wrap:wrap;">
    <button type="button" class="tab-btn active" onclick="switchSettingsTab('logo', this)"
            style="padding:10px 20px; font-weight:600; font-size:0.85rem; border:none; background:var(--primary); color:white; border-radius:8px; cursor:pointer; transition:var(--transition);">
        <i class="fas fa-globe" style="margin-right:6px;"></i> General & Logo
    </button>
    <button type="button" class="tab-btn" onclick="switchSettingsTab('contact', this)"
            style="padding:10px 20px; font-weight:600; font-size:0.85rem; border:none; background:var(--surface); color:var(--text-muted); border-radius:8px; cursor:pointer; transition:var(--transition); border:1px solid var(--border-color);">
        <i class="fas fa-address-book" style="margin-right:6px;"></i> Contact & Socials
    </button>
    <button type="button" class="tab-btn" onclick="switchSettingsTab('footer', this)"
            style="padding:10px 20px; font-weight:600; font-size:0.85rem; border:none; background:var(--surface); color:var(--text-muted); border-radius:8px; cursor:pointer; transition:var(--transition); border:1px solid var(--border-color);">
        <i class="fas fa-align-left" style="margin-right:6px;"></i> Footer & Menus
    </button>
    <button type="button" class="tab-btn" onclick="switchSettingsTab('stats', this)"
            style="padding:10px 20px; font-weight:600; font-size:0.85rem; border:none; background:var(--surface); color:var(--text-muted); border-radius:8px; cursor:pointer; transition:var(--transition); border:1px solid var(--border-color);">
        <i class="fas fa-chart-bar" style="margin-right:6px;"></i> Statistics Offsets
    </button>
</div>

<form method="POST" action="<?php echo e(route('admin.settings.update')); ?>" enctype="multipart/form-data">
    <?php echo csrf_field(); ?>

    <!-- ==================== TAB 1: GENERAL & LOGO ==================== -->
    <div id="tab-settings-logo" class="settings-tab-content" style="display:block;">
        <div class="admin-card">
            <div class="admin-card-header">
                <span class="admin-card-title"><i class="fas fa-globe" style="color:var(--primary);margin-right:8px;"></i> General & Logo Settings</span>
            </div>
            <div class="admin-card-body">
                <div style="display:grid; gap:20px;">
                    <div class="form-group" style="margin-bottom:0;">
                        <label class="form-label">Site Title</label>
                        <input type="text" name="site_title" class="form-control"
                               value="<?php echo e(old('site_title', $settings['site_title'] ?? '')); ?>"
                               placeholder="e.g. Lumbini Province Taekwondo Association">
                    </div>
                    <div style="display:grid; grid-template-columns:1fr 1fr; gap:16px;">
                        <div class="form-group" style="margin-bottom:0;">
                            <label class="form-label">Header Logo Text</label>
                            <input type="text" name="header_logo_text" class="form-control"
                                   value="<?php echo e(old('header_logo_text', $settings['header_logo_text'] ?? 'LPTA')); ?>">
                        </div>
                        <div class="form-group" style="margin-bottom:0;">
                            <label class="form-label">Header Logo Tagline</label>
                            <input type="text" name="header_logo_tagline" class="form-control"
                                   value="<?php echo e(old('header_logo_tagline', $settings['header_logo_tagline'] ?? 'Lumbini Province Taekwondo')); ?>">
                        </div>
                    </div>
                    <div style="display:grid; grid-template-columns:1fr 2fr; gap:16px; align-items:start;">
                        <div class="form-group" style="margin-bottom:0;">
                            <label class="form-label">Logo Emoji Icon</label>
                            <input type="text" name="header_logo_icon" class="form-control"
                                   value="<?php echo e(old('header_logo_icon', $settings['header_logo_icon'] ?? '🥋')); ?>">
                            <small style="color:var(--text-muted); display:block; margin-top:4px; font-size:0.78rem;">Used if no Logo Image is uploaded.</small>
                        </div>
                        <div class="form-group" style="margin-bottom:0;">
                            <label class="form-label">Logo Image (optional override)</label>
                            <?php if(!empty($settings['header_logo_img'])): ?>
                            <div style="margin-bottom:10px; display:flex; align-items:center; gap:10px;">
                                <span style="font-size:0.8rem; color:var(--text-muted);">Current:</span>
                                <img src="<?php echo e(asset($settings['header_logo_img'])); ?>"
                                     style="height:38px; border-radius:4px; background:var(--primary); padding:4px;">
                            </div>
                            <?php endif; ?>
                            <input type="file" name="header_logo_img" class="form-control" accept="image/*">
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- ==================== TAB 2: CONTACT & SOCIALS ==================== -->
    <div id="tab-settings-contact" class="settings-tab-content" style="display:none;">
        <div class="admin-card">
            <div class="admin-card-header">
                <span class="admin-card-title"><i class="fas fa-address-book" style="color:var(--primary);margin-right:8px;"></i> Contact Information & Social Links</span>
            </div>
            <div class="admin-card-body">
                <div style="display:grid; gap:20px;">
                    <div style="display:grid; grid-template-columns:1fr 1fr; gap:16px;">
                        <div class="form-group" style="margin-bottom:0;">
                            <label class="form-label">Contact Email</label>
                            <input type="email" name="contact_email" class="form-control"
                                   value="<?php echo e(old('contact_email', $settings['contact_email'] ?? '')); ?>"
                                   placeholder="info@lpta.org.np">
                        </div>
                        <div class="form-group" style="margin-bottom:0;">
                            <label class="form-label">Contact Phone</label>
                            <input type="text" name="contact_phone" class="form-control"
                                   value="<?php echo e(old('contact_phone', $settings['contact_phone'] ?? '')); ?>"
                                   placeholder="+977 ...">
                        </div>
                    </div>
                    <div class="form-group" style="margin-bottom:0;">
                        <label class="form-label">Contact Address</label>
                        <input type="text" name="contact_address" class="form-control"
                               value="<?php echo e(old('contact_address', $settings['contact_address'] ?? '')); ?>"
                               placeholder="Butwal, Rupandehi, Lumbini Province, Nepal">
                    </div>

                    <div style="padding-top:8px; border-top:1px solid var(--border-color);">
                        <p style="font-size:0.85rem; color:var(--text-muted); font-weight:600; margin-bottom:16px; text-transform:uppercase; letter-spacing:0.5px;">
                            <i class="fas fa-share-alt" style="margin-right:6px;"></i> Social Media Links
                        </p>
                        <div style="display:grid; grid-template-columns:1fr 1fr; gap:16px;">
                            <div class="form-group" style="margin-bottom:0;">
                                <label class="form-label"><i class="fab fa-facebook" style="color:#1877F2; margin-right:6px;"></i> Facebook URL</label>
                                <input type="url" name="social_facebook" class="form-control"
                                       value="<?php echo e(old('social_facebook', $settings['social_facebook'] ?? '')); ?>"
                                       placeholder="https://facebook.com/...">
                            </div>
                            <div class="form-group" style="margin-bottom:0;">
                                <label class="form-label"><i class="fab fa-youtube" style="color:#FF0000; margin-right:6px;"></i> YouTube URL</label>
                                <input type="url" name="social_youtube" class="form-control"
                                       value="<?php echo e(old('social_youtube', $settings['social_youtube'] ?? '')); ?>"
                                       placeholder="https://youtube.com/...">
                            </div>
                            <div class="form-group" style="margin-bottom:0;">
                                <label class="form-label"><i class="fab fa-instagram" style="color:#E1306C; margin-right:6px;"></i> Instagram URL</label>
                                <input type="url" name="social_instagram" class="form-control"
                                       value="<?php echo e(old('social_instagram', $settings['social_instagram'] ?? '')); ?>"
                                       placeholder="https://instagram.com/...">
                            </div>
                            <div class="form-group" style="margin-bottom:0;">
                                <label class="form-label"><i class="fab fa-tiktok" style="margin-right:6px;"></i> TikTok URL</label>
                                <input type="url" name="social_tiktok" class="form-control"
                                       value="<?php echo e(old('social_tiktok', $settings['social_tiktok'] ?? '')); ?>"
                                       placeholder="https://tiktok.com/@...">
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- ==================== TAB 3: FOOTER & MENUS ==================== -->
    <div id="tab-settings-footer" class="settings-tab-content" style="display:none;">
        <div class="admin-card">
            <div class="admin-card-header">
                <span class="admin-card-title"><i class="fas fa-align-left" style="color:var(--primary);margin-right:8px;"></i> Footer Text & Custom Menu Links</span>
            </div>
            <div class="admin-card-body">
                <div style="display:grid; gap:20px;">
                    <div class="form-group" style="margin-bottom:0;">
                        <label class="form-label">Footer Description Text</label>
                        <textarea name="footer_about" class="form-control" rows="3"
                                  placeholder="Brief paragraph about LPTA in footer..."><?php echo e(old('footer_about', $settings['footer_about'] ?? '')); ?></textarea>
                    </div>
                    <div class="form-group" style="margin-bottom:0;">
                        <label class="form-label">Footer Copyright Text</label>
                        <input type="text" name="footer_copyright" class="form-control"
                               value="<?php echo e(old('footer_copyright', $settings['footer_copyright'] ?? '')); ?>"
                               placeholder="&copy; 2026 Lumbini Province Taekwondo Association.">
                    </div>
                    <div class="form-group" style="margin-bottom:0;">
                        <label class="form-label">Header Navigation Menu (JSON Format)</label>
                        <textarea name="nav_menu_json" class="form-control" rows="8"
                                  style="font-family: monospace; font-size:0.85rem;"
                                  placeholder='[{"label": "Home", "route": "home"}, {"label": "About", "route": "about"}]'><?php echo e(old('nav_menu_json', $settings['nav_menu_json'] ?? '')); ?></textarea>
                        <small style="color:var(--text-muted); display:block; margin-top:6px; font-size:0.78rem;">
                            Format: JSON array. Leave empty to use default menu.<br>
                            Example: <code>[{"label": "Home", "route": "home"}, {"label": "Custom", "url": "https://example.com"}]</code>
                        </small>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- ==================== TAB 4: STATISTICS ==================== -->
    <div id="tab-settings-stats" class="settings-tab-content" style="display:none;">
        <div class="admin-card">
            <div class="admin-card-header">
                <span class="admin-card-title"><i class="fas fa-chart-bar" style="color:var(--primary);margin-right:8px;"></i> Statistics Counter Offsets</span>
            </div>
            <div class="admin-card-body">
                <p style="font-size:0.88rem; color:var(--text-muted); margin-bottom:20px;">
                    Add offset values to displayed counts on the website to reflect historical records beyond the database.
                </p>
                <div style="display:grid; grid-template-columns:1fr 1fr; gap:20px;">
                    <div class="form-group" style="margin-bottom:0;">
                        <label class="form-label"><i class="fas fa-users" style="color:var(--primary); margin-right:6px;"></i> Members Offset</label>
                        <input type="number" name="stats_members_offset" class="form-control"
                               value="<?php echo e(old('stats_members_offset', $settings['stats_members_offset'] ?? 0)); ?>">
                    </div>
                    <div class="form-group" style="margin-bottom:0;">
                        <label class="form-label"><i class="fas fa-building" style="color:var(--primary); margin-right:6px;"></i> Clubs Offset</label>
                        <input type="number" name="stats_clubs_offset" class="form-control"
                               value="<?php echo e(old('stats_clubs_offset', $settings['stats_clubs_offset'] ?? 0)); ?>">
                    </div>
                    <div class="form-group" style="margin-bottom:0;">
                        <label class="form-label"><i class="fas fa-dumbbell" style="color:var(--primary); margin-right:6px;"></i> Coaches Offset</label>
                        <input type="number" name="stats_coaches_offset" class="form-control"
                               value="<?php echo e(old('stats_coaches_offset', $settings['stats_coaches_offset'] ?? 0)); ?>">
                    </div>
                    <div class="form-group" style="margin-bottom:0;">
                        <label class="form-label"><i class="fas fa-gavel" style="color:var(--primary); margin-right:6px;"></i> Referees Offset</label>
                        <input type="number" name="stats_referees_offset" class="form-control"
                               value="<?php echo e(old('stats_referees_offset', $settings['stats_referees_offset'] ?? 0)); ?>">
                    </div>
                    <div class="form-group" style="margin-bottom:0;">
                        <label class="form-label">🥇 Gold Medals Offset</label>
                        <input type="number" name="stats_gold_offset" class="form-control"
                               value="<?php echo e(old('stats_gold_offset', $settings['stats_gold_offset'] ?? 0)); ?>">
                    </div>
                    <div class="form-group" style="margin-bottom:0;">
                        <label class="form-label">🥈 Silver Medals Offset</label>
                        <input type="number" name="stats_silver_offset" class="form-control"
                               value="<?php echo e(old('stats_silver_offset', $settings['stats_silver_offset'] ?? 0)); ?>">
                    </div>
                    <div class="form-group" style="margin-bottom:0;">
                        <label class="form-label">🥉 Bronze Medals Offset</label>
                        <input type="number" name="stats_bronze_offset" class="form-control"
                               value="<?php echo e(old('stats_bronze_offset', $settings['stats_bronze_offset'] ?? 0)); ?>">
                    </div>
                    <div class="form-group" style="margin-bottom:0;">
                        <label class="form-label"><i class="fas fa-map" style="color:var(--primary); margin-right:6px;"></i> Districts Offset</label>
                        <input type="number" name="stats_districts_offset" class="form-control"
                               value="<?php echo e(old('stats_districts_offset', $settings['stats_districts_offset'] ?? 0)); ?>">
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- Save Actions -->
    <div style="display:flex; gap:10px; justify-content:flex-end; margin-top:8px;">
        <a href="<?php echo e(route('admin.dashboard')); ?>" class="btn btn-outline">Cancel</a>
        <button type="submit" class="btn btn-primary" style="padding:12px 32px;">
            <i class="fas fa-save"></i> Save Settings
        </button>
    </div>
</form>

<?php $__env->stopSection(); ?>

<?php $__env->startSection('scripts'); ?>
<script>
function switchSettingsTab(tabId, btn) {
    // Hide all tab content
    document.querySelectorAll('.settings-tab-content').forEach(t => t.style.display = 'none');

    // Reset all tab buttons
    document.querySelectorAll('.tab-btn').forEach(b => {
        b.style.background = 'var(--surface)';
        b.style.color = 'var(--text-muted)';
        b.style.border = '1px solid var(--border-color)';
        b.classList.remove('active');
    });

    // Show selected tab
    document.getElementById('tab-settings-' + tabId).style.display = 'block';
    btn.style.background = 'var(--primary)';
    btn.style.color = 'white';
    btn.style.border = '1px solid var(--primary)';
    btn.classList.add('active');
}
</script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.admin', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\xampp\htdocs\Tekendow\resources\views/admin/settings.blade.php ENDPATH**/ ?>