<main class="container bg-light shadow-sm rounded border my-2">
    <div class="row">
        <!-- Start Main Container -->
        <div class="col-12 col-lg-8">
            <div id="details">
                <?php echo getAds($AdsPath . '/preview_before'); ?>
                <?php echo $breadhtml; ?>
                <h1 class="p-2 mb-3 text-dark text-truncate fs-5 fw-normal text-uppercase border-bottom">
                    <?php echo $file['name'] . ' Mp3 Song Download'; ?></h1>
                <div class="row bg-album border shadow-sm">
                    <div class="col-12 col-md-4">
                        <div class="mt-2">
                            <div class="img-over-text">
                                <img data-bs-toggle="tooltip" title="<?php echo $file['name']; ?>" src="<?php echo APP_URL . '/assets/images/music.svg'; ?>" data-src="<?php echo $thumb; ?>" alt="<?php echo $file['name']; ?>" class="lazy mx-auto d-block rounded" width="<?php echo $thumbWH[0]; ?>" height="<?php echo $thumbWH[1]; ?>">
                                <div class="over-centered text-white"><span class="fav"><span class="favo fa fa-heart<?php echo (is_favourite($file['id'], @$AuthUser['id'])) ? ' active' : ''; ?>" onclick="addFav(this.id);" id="file_<?php echo $file['id']; ?>"></span></span></div>
                            </div>
                            <p class="text-center mt-4">Uploaded by <strong><?php if ($file['user_name']) echo '<a id="user_link" href="' . APP_URL . '/user/' . $file['user_name'] . $endRoute . '">@' . $file['user_fullname'] . '</a>';
                                                                            else echo '@Admin'; ?></strong></p>
                        </div>
                    </div>
                    <div class="col-12 col-md-8">
                        <h2 class="text-center p-2 mb-2 text-truncate fs-6 fw-normal border-bottom">
                            <?php echo $file['name']; ?></h2>
                        <div class="card card-body p-0 movie-show-i fw-light">
                            <p><i class="fa fa-clock-o" aria-hidden="true"></i> Duration:
                                <?php echo $file['duration']; ?> <span class="small">Min</span></p>
                            <p><i class="fa fa-calendar" aria-hidden="true"></i> Added On:
                                <?php echo $releasedate; ?></p>
                            <p><i class="fa fa-user-o" aria-hidden="true"></i> Artist:
                                <?php echo $arists ? $arists : 'Unknown' ?></p>
                            <p><i class="fa fa-film" aria-hidden="true"></i> <?php echo $catLabel; ?>:
                                <?php echo '<a href="' . APP_URL . '/' . $catRoute . '/' . $file['category_slug'] . $endRoute  . '">' . $cNameYear . '</a>'; ?>
                            </p>
                            <p><i class="fa fa-download" aria-hidden="true"></i> Download:
                                <?php echo $file['download']; ?>+</p>
                        </div>
                        <div class="d-flex m-2 justify-content-between">
                        <?php if ($isLogged || (GOOGLE_APP_ID || FACEBOOK_APP_ID)) : ?>
                            <div class="dropdown">
                                <button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton1" data-bs-toggle="dropdown" aria-expanded="false">
                                    Options
                                </button>
                                <ul class="dropdown-menu" aria-labelledby="dropdownMenuButton1">
                                    <?php if ($isLogged && $AuthUser['id'] == $file['user_id']) : ?>
                                        <li><a class="dropdown-item" href="#" onclick="return editSong();"><i class="fa fa-edit"></i> Edit</a></li>
                                        <li><a class="dropdown-item" href="#" onclick="return deleteSong(<?php echo $file['id']; ?>);"><i class="fa fa-trash"></i> Delete</a></li>
                                    <?php endif; ?>
                                    <li><a class="dropdown-item" href="#" onclick="return ReportSong(<?php echo $isLogged; ?>);"><i class="fa fa-flag"></i> Report</a></li>
                                </ul>
                            </div>
                            <?php
                            endif;
                            if ($downLink) {
                                echo '<button type="button" onclick="openlink(this);" value="' . $file['id'] . '" class="btn btn-danger"><i class="fa fa-download" aria-hidden="true"></i> Download</button>';
                            }
                            echo '<button type="button" id="share" onclick="share();" class="btn btn-success"><i class="fa fa-share" aria-hidden="true"></i> Share</button>';
                            ?>
                        </div>
                    </div>
                </div>
                <?php
                echo getAds($AdsPath . '/preview_between'); ?>
                <h3 class="d-inline"><i class="fa fa-play-circle" aria-hidden="true"></i> Play</h3>
                <div id="player" data-value="<?php echo $media_source; ?>">
                </div>
                <?php if ($file['des']) {
                    echo '<div class="card card-body p-2 my-2 rounded fw-light">
        <span class="text-secondary">Description/Story: </span>' . $file['des'] . '
      </div>';
                }
                echo getAds($AdsPath . '/preview_after');
                ?>
            </div>
            <div id="reletedSongs">
                <h3><i class="fa fa-music" aria-hidden="true"></i> Releted Songs</h3>
                <?php
                $files = $ReletedFiles;
                require __DIR__ . '/_files_list.php';
                unset($ReletedFiles);
                ?>
            </div>
            <div id="reletedAlbums">
                <h3><i class="fa fa-film" aria-hidden="true"></i> Releted Album</h3>
                <?php
                $categories = $ReletedAlbums;
                require __DIR__ . '/_category_list.php';
                unset($ReletedAlbums);
                ?>
            </div>
        </div>
        <!-- End Main Container -->
        <!-- Start Sidebar -->
        <div class="col-12 col-lg-4">
            <aside>
                <div id="youMayAlso">
                    <?php echo getAds($AdsPath . '/sidebar_before'); ?>
                    <h3><i class="fa fa-random" aria-hidden="true"></i> You May Also Like</h3>
                    <ul class="list-group sb-list">
                        <?php
                        $listitems = $YouMayFiles;
                        require __DIR__ . '/_list_item.php';
                        unset($YouMayMovies);
                        ?>
                    </ul>
                </div>
                <div id="reletedArtist">
                    <h3><i class="fa fa-user-o" aria-hidden="true"></i> Releted Artists</h3>
                    <ul class="list-group sb-list">
                        <?php
                        $listitems = $ReletedArists;
                        $list_href = 'artist';
                        include __DIR__ . '/_list_itemExtra.php';
                        unset($mostviewed);
                        ?>
                    </ul>
                </div>
            </aside>
        </div>
        <!-- End Sidebar -->
    </div>

    <p class="card card-body p-2 my-2 fw-light"><?php echo $autotags; ?></p>
    <!-- Modal -->
    <div class="modal fade" id="modalDialog" tabindex="-1" aria-labelledby="modalDialogLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title" id="modalDialogLabel"><i class="fa fa-share" aria-hidden="true"></i> Share
                    </h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                    <div id="sharemovie"></div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
                </div>
            </div>
        </div>
    </div>
    <?php if ($isLogged && $AuthUser['id'] == $file['user_id']) : ?>
        <div class="modal fade" id="modalEditSong" tabindex="-1" aria-labelledby="modalEditSongLabel" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <h5 class="modal-title" id="modalEditSongLabel"><i class="fa fa-edit" aria-hidden="true"></i> #Edit Song
                        </h5>
                        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                    </div>
                    <div class="modal-body">
                        <form id="editFileform">
                            <input type="text" name="file_id" value="<?php echo $file['id']; ?>" style="display: none;">
                            <div class="form-group">
                                <label>Title: </label>
                                <input type="text" name="file_name" value="<?php echo $file['name']; ?>" class="form-control">
                            </div>
                            <div class="form-group">
                                <label>Thumbnail: </label>
                                <input type="file" name="thumb" class="form-control" id="">
                            </div>
                        </form>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
                            <button type="button" onclick="submitEditSong();" id="submitFileForm" class="btn btn-primary">Save Changes</button>

                        </div>
                    </div>
                </div>
            </div>
        </div>
    <?php endif;
    if ($isLogged) : ?>
        <div class="modal fade" id="modalReportSong" tabindex="-1" aria-labelledby="modalReportSongLabel" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <h5 class="modal-title" id="modalReportSongLabel"><i class="fa fa-flag" aria-hidden="true"></i> #Report Song
                        </h5>
                        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                    </div>
                    <div class="modal-body">
                        <form id="ReportForm">
                            <input type="text" name="file_id" value="<?php echo $file['id']; ?>" style="display: none;">
                            <div class="form-group">
                                <label>Subject: </label>
                                <input type="text" name="subject" value="" class="form-control">
                            </div>
                            <div class="form-group">
                                <label>Body: </label>
                                <textarea name="body" class="form-control" rows="5"></textarea>
                            </div>
                        </form>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
                            <button type="button" onclick="submitReport();" class="btn btn-primary">Submit</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    <?php endif; ?>
</main>