<style>
    /* Buton düzeltmeleri */
    .btn-upload,
    .btn-reset,
    .w-100 {
        width: 100%;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        padding: 0.625rem 1rem;
        font-size: 0.875rem;
        font-weight: 500;
        border-radius: 6px;
        cursor: pointer;
        transition: all 0.2s;
        border: none;
    }

    .btn-upload {
        background: var(--primary);
        color: white;
    }

    .btn-upload:hover {
        background: var(--primary-dark);
    }

    .btn-reset {
        background: var(--gray-600);
        color: white;
    }

    .btn-reset:hover {
        background: var(--gray-700);
    }

    /* Section Card Modern Style */
    .section-card {
        background: white;
        border: 1px solid var(--gray-200);
        border-radius: 12px;
        padding: 1.25rem;
        margin-bottom: 1rem;
        cursor: move;
        transition: all 0.2s;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    }

    .section-card:hover {
        border-color: var(--primary);
        box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
        transform: translateY(-2px);
    }

    .section-card.dragging {
        opacity: 0.5;
    }

    .section-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        margin-bottom: 1rem;
    }

    .section-header-left {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        flex: 1;
    }

    .drag-handle {
        color: var(--gray-400);
        cursor: grab;
        font-size: 1.25rem;
    }

    .drag-handle:active {
        cursor: grabbing;
    }

    .section-info {
        flex: 1;
    }

    .section-title {
        font-weight: 600;
        font-size: 0.938rem;
        color: var(--gray-900);
        margin-bottom: 0.25rem;
    }

    .section-type {
        font-size: 0.75rem;
        color: var(--gray-500);
        background: var(--gray-100);
        padding: 0.25rem 0.5rem;
        border-radius: 4px;
        display: inline-block;
    }

    .section-toggle-wrapper {
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    .section-badge {
        font-size: 0.75rem;
        font-weight: 500;
        padding: 0.25rem 0.5rem;
        border-radius: 4px;
    }

    .section-badge.hidden {
        background: var(--gray-200);
        color: var(--gray-600);
    }

    /* Toggle Switch */
    .toggle-switch {
        position: relative;
        display: inline-block;
        width: 44px;
        height: 24px;
        margin: 0;
    }

    .toggle-switch input {
        opacity: 0;
        width: 0;
        height: 0;
    }

    .toggle-slider {
        position: absolute;
        cursor: pointer;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: var(--gray-300);
        transition: 0.3s;
        border-radius: 24px;
    }

    .toggle-slider:before {
        position: absolute;
        content: "";
        height: 18px;
        width: 18px;
        left: 3px;
        bottom: 3px;
        background-color: white;
        transition: 0.3s;
        border-radius: 50%;
    }

    .toggle-switch input:checked + .toggle-slider {
        background-color: var(--success);
    }

    .toggle-switch input:checked + .toggle-slider:before {
        transform: translateX(20px);
    }

    .section-content {
        margin-bottom: 1rem;
    }

    .section-subtitle {
        font-size: 0.875rem;
        color: var(--gray-600);
        margin-bottom: 0.5rem;
    }

    .section-description {
        font-size: 0.813rem;
        color: var(--gray-500);
        line-height: 1.5;
    }

    .section-meta {
        display: flex;
        align-items: center;
        gap: 1rem;
        font-size: 0.75rem;
        color: var(--gray-500);
        padding-top: 0.75rem;
        border-top: 1px solid var(--gray-100);
    }

    .section-meta i {
        margin-right: 0.25rem;
    }

    .section-actions {
        display: flex;
        gap: 0.5rem;
        padding-top: 1rem;
        border-top: 1px solid var(--gray-100);
    }

    .action-btn {
        padding: 0.5rem 0.75rem;
        border: 1px solid var(--gray-200);
        background: white;
        border-radius: 6px;
        cursor: pointer;
        font-size: 0.875rem;
        transition: all 0.2s;
        color: var(--gray-600);
        display: inline-flex;
        align-items: center;
        gap: 0.375rem;
    }

    .action-btn:hover {
        background: var(--gray-50);
        border-color: var(--gray-300);
        color: var(--gray-900);
    }

    .action-btn.text-danger {
        color: var(--danger);
    }

    .action-btn.text-danger:hover {
        background: #FEE2E2;
        border-color: #FCA5A5;
    }

    /* Modal Butonları */
    .modal-footer {
        display: flex;
        justify-content: flex-end;
        gap: 0.75rem;
        padding: 1.25rem 1.5rem;
        border-top: 1px solid var(--gray-200);
        background: var(--gray-50);
    }

    .modal-footer .btn {
        min-width: 100px;
    }
</style>

<div class="sidebar-section">
    <h3 class="sidebar-title">Genel Site Ayarları</h3>

    <form id="pageSettingsForm">
        @csrf

        <!-- SEO Settings -->
        <h4 class="sidebar-title" style="font-size: 14px; margin-bottom: 10px;">Ana Sayfa SEO Ayarları</h4>

        <div class="form-group">
            <label class="form-label">Meta Başlık</label>
            <input type="text"
                   name="meta_title"
                   class="form-control"
                   value="{{ $page->meta_title }}"
                   placeholder="Sayfa başlığı"
                   maxlength="60">
            <small class="text-muted">Maks. 60 karakter</small>
        </div>

        <div class="form-group">
            <label class="form-label">Meta Açıklama</label>
            <textarea name="meta_description"
                      class="form-control"
                      rows="2"
                      placeholder="Sayfa açıklaması"
                      maxlength="160">{{ $page->meta_description }}</textarea>
            <small class="text-muted">Maks. 160 karakter</small>
        </div>

        <div class="form-group">
            <label class="form-label">Meta Anahtar Kelimeler</label>
            <input type="text"
                   name="meta_keywords"
                   class="form-control"
                   value="{{ $page->meta_keywords }}"
                   placeholder="anahtar, kelime, listesi">
        </div>

        <!-- Layout Settings -->
        <hr class="my-3">
        <h4 class="sidebar-title" style="font-size: 14px; margin-bottom: 10px;">Layout Ayarları</h4>

        <div class="form-group">
            <label class="form-label">Layout Stili</label>
            <input type="hidden" name="layout_style" id="layoutStyleInput" value="{{ $page->layout_style ?? 'full-width' }}">
            <div class="theme-selector-grid">
                <div class="theme-option {{ ($page->layout_style ?? 'full-width') == 'full-width' ? 'active' : '' }}"
                     data-layout="full-width"
                     onclick="selectLayoutStyle('full-width')">
                    <div class="theme-icon">
                        <i class="fas fa-arrows-alt-h"></i>
                    </div>
                    <div class="theme-info">
                        <div class="theme-name">Tam Genişlik</div>
                        <div class="theme-desc">İçerik ekran genişliğine yayılır</div>
                    </div>
                    <div class="theme-check">
                        <i class="fas fa-check-circle"></i>
                    </div>
                </div>

                <div class="theme-option {{ ($page->layout_style ?? 'full-width') == 'boxed' ? 'active' : '' }}"
                     data-layout="boxed"
                     onclick="selectLayoutStyle('boxed')">
                    <div class="theme-icon">
                        <i class="fas fa-stop"></i>
                    </div>
                    <div class="theme-info">
                        <div class="theme-name">Kutulu</div>
                        <div class="theme-desc">İçerik belirli genişlikte sınırlı</div>
                    </div>
                    <div class="theme-check">
                        <i class="fas fa-check-circle"></i>
                    </div>
                </div>
            </div>
        </div>

    </form>
</div>

<style>
    .form-check {
        display: flex;
        align-items: center;
    }

    .form-check-input {
        width: 18px;
        height: 18px;
        margin-right: 8px;
        cursor: pointer;
    }

    .form-check-label {
        font-size: 13px;
        color: #374151;
        cursor: pointer;
        user-select: none;
    }

    .image-upload-wrapper {
        border: 2px dashed #d1d5db;
        border-radius: 8px;
        padding: 12px;
        text-align: center;
    }

    .current-image img {
        max-height: 150px;
        object-fit: cover;
    }

    /* Theme Selector Modern Styles */
    .theme-selector-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.75rem;
        margin-top: 0.5rem;
    }

    .theme-option {
        position: relative;
        display: flex;
        align-items: center;
        gap: 1rem;
        padding: 1rem;
        border: 2px solid #e5e7eb;
        border-radius: 10px;
        background: white;
        cursor: pointer;
        transition: all 0.3s ease;
    }

    .theme-option:hover {
        border-color: #3b82f6;
        background: #f0f9ff;
        transform: translateX(4px);
        box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
    }

    .theme-option.active {
        border-color: #3b82f6;
        background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
        box-shadow: 0 4px 16px rgba(59, 130, 246, 0.2);
    }

    .theme-icon {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 45px;
        height: 45px;
        border-radius: 8px;
        background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
        color: white;
        font-size: 1.25rem;
        flex-shrink: 0;
        transition: all 0.3s ease;
    }

    .theme-option:hover .theme-icon {
        transform: scale(1.1) rotate(5deg);
    }

    .theme-option.active .theme-icon {
        background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
        box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
    }

    .theme-info {
        flex: 1;
    }

    .theme-name {
        font-size: 0.938rem;
        font-weight: 600;
        color: #111827;
        margin-bottom: 0.25rem;
    }

    .theme-desc {
        font-size: 0.75rem;
        color: #6b7280;
        line-height: 1.4;
    }

    .theme-check {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 24px;
        height: 24px;
        color: #d1d5db;
        font-size: 1.25rem;
        transition: all 0.3s ease;
    }

    .theme-option.active .theme-check {
        color: #3b82f6;
        transform: scale(1.2);
    }

    .theme-option.active .theme-name {
        color: #1e40af;
    }

    .theme-option.active .theme-desc {
        color: #3b82f6;
    }
</style>

<script>
    function selectLayoutStyle(layout) {
        // Update hidden input
        document.getElementById('layoutStyleInput').value = layout;

        // Update active states for layout style options only
        document.querySelectorAll('.theme-option[data-layout]').forEach(option => {
            option.classList.remove('active');
        });

        // Add active class to selected option
        const selectedOption = document.querySelector(`.theme-option[data-layout="${layout}"]`);
        if (selectedOption) {
            selectedOption.classList.add('active');
        }
    }
</script>
