<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?>
<script src="https://www.paypalobjects.com/api/checkout.js"></script>
<script>
    paypal.Button.render({
        env: 'sandbox', // Or 'sandbox',

        commit: false, // Show a 'Pay Now' button

        payment: function() {
            // Set up the payment here
        },

        onAuthorize: function(data, actions) {
            // Execute the payment here
        }

    }, '#pay-paypal-btn');
</script>

<form action="javascript:void(0)">
    <h2><?= lang('donate_title') ?></h2>
    <p><?= lang('donate_subheader') ?></p>
    <div id="donationmessage">
        <h3><?= lang('donate_catchphrase') ?></h3>
    </div>
    <div id="donationicons">
        <span title="€1" class="fa fa-lemon">€1</span>
        <p><?= lang('donate_level1') ?></p>
        <span title="€2" class="fa fa-terminal">€2</span>
        <p><?= lang('donate_level2') ?></p>
        <span title="€5" class="fa fa-desktop">€5</span>
        <p><?= lang('donate_level3') ?></p>
        <span title="€10" class="fa fa-hourglass-half selected">€10</span>
        <p><?= lang('donate_level4') ?></p>
        <span title="€15" class="fa fa-hdd">€15</span>
        <p><?= lang('donate_level5') ?></p>
        <span title="€20" class="fa fa-server">€20</span>
        <p><?= lang('donate_level6') ?></p>
        <span title="€25" class="fa fa-copyright">€25</span>
        <p><?= lang('donate_level7') ?></p>
        <span title="€30" class="fab fa-google-play">€30</span>
        <p><?= lang('donate_level8') ?></p>
        <span title="€50" class="fa fa-hand-holding-usd">€50</span>
        <p><?= lang('donate_level9') ?></p>
        <span title="€100" class="fa fa-certificate best">€100</span>
        <p><?= lang('donate_level10') ?></p>
    </div>
    <input type="range" min="0" max="9" step="1" value="3" list="donations" id="donationvalue">
    <div id="submission">
        <div id="pay-paypal-btn"><input type="submit" value="<?= lang('donate_btn') ?>"></div>
        <output for="donationvalue" id="donationoutput">10</output>
    </div>
</form>

<style>
    .xcomponent-outlet {
        width: 170px;
        height: 40px;
        top: -40px;
        left: -67px;
        opacity: 0;
    }
    form {
        text-align: center;
        max-width: 1000px;
        margin: 25px auto;
        padding: 25px 50px;
    }
    #donationmessage {
        margin: 50px auto 0 auto;
        height: 70px;
        border-radius: 3px;
        box-shadow: 0 0 25px rgba(0, 0, 0, 0.15) inset;
    }
    #donationmessage h3 {
        padding-top: 10px;
    }
    #donationicons {
        position: relative;
        margin: 20px auto 0;
        display: -webkit-box;
        display: -ms-flexbox;
        display: flex;
        -webkit-box-pack: justify;
        -ms-flex-pack: justify;
        justify-content: space-between;
    }
    #donationicons > span + p {
        opacity: 0;
        width: 100%;
        position: absolute;
        top: 0;
        left: 0;
        margin-top: -50px;
        font-style: italic;
        -webkit-transition: opacity 0.25s 0s ease;
        transition: opacity 0.25s 0s ease;
    }
    #donationicons > span + p span {
        color: #88B1E1;
        display: inline-block;
    }
    #donationicons > span + p span::first-letter {
        vertical-align: super;
        font-size: 75%;
    }
    #donationicons > span.selected + p {
        opacity: 1;
        -webkit-transition: opacity 0.25s 0.25s ease;
        transition: opacity 0.25s 0.25s ease;
    }
    #donationicons > span.selected::before {
        color: #2272ff;
        text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    }
    #donationicons > span.selected::after {
        border-bottom: 7px solid #2272ff;
    }
    #donationicons > span.best::before {
        color: #FFD621;
    }
    #donationicons > span {
        width: 75px;
        height: 70px;
        margin-bottom: -30px;
        font-size: 0;
        display: inline-block;
    }
    #donationicons > span::before {
        font-size: 28px;
        color: #222;
        /* this creates the "inset" text shadow */
        -webkit-transition: color 0.5s ease;
        transition: color 0.5s ease;
    }
    #donationicons > span::after {
        display: block;
        content: '';
        margin-left: 30px;
        margin-top: 6px;
        width: 0;
        border-bottom: 7px solid #222;
        border-left: 7px solid transparent;
        border-right: 7px solid transparent;
    }
    input {
        outline: none !important;
    }

    input[type=range] {
        -webkit-appearance: none;
        background-color: #222;
        width: 100%;
        height: 30px;
        border-radius: 3px;
        padding: 5px 0;
        margin: 0 auto 25px auto;
        display: block;
    }

    input[type=range]::-webkit-slider-runnable-track {
        height: 30px;
        background-color: #222;
        border: none;
        border-radius: 3px;
    }

    input[type=range]::-moz-range-track {
        height: 30px;
        background-color: #222;
        border: none;
        border-radius: 3px;
    }

    input[type="range"]::-ms-track {
        height: 30px;
        background-color: #222;
        border: none;
        border-radius: 3px;
        color: transparent;
    }

    input[type="range"]::-ms-fill-lower {
        background: transparent;
    }

    input[type="range"]::-ms-tooltip {
        display: none;
    }

    input[type=range]::-webkit-slider-thumb {
        -webkit-appearance: none;
        width: 75px;
        height: 30px;
        border-radius: 3px;
        background: #2272FF;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
        border: none;
        transition: box-shadow .2s;
    }
    input[type=range]::-webkit-slider-thumb:hover, input[type=range]::-webkit-slider-thumb:active {
        background: #418eff;
        box-shadow: 0 2px 5px rgba(0,0,0,.5);
    }

    input[type=range]::-moz-range-thumb {
        width: 75px;
        height: 30px;
        border-radius: 3px;
        background: #2272FF;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
        border: none;
        transition: box-shadow .2s;
    }
    input[type=range]::-moz-range-thumb:hover, input[type=range]::-moz-range-thumb:active {
        background: #418eff;
        box-shadow: 0 2px 5px rgba(0,0,0,.5);
    }

    input[type=range]::-moz-range-thumb {
        width: 75px;
        height: 30px;
        border-radius: 3px;
        background: #2272FF;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
        border: none;
        transition: box-shadow .2s;
    }
    input[type=range]::-moz-range-thumb:hover, input[type=range]::-moz-range-thumb:active {
        background: #418eff;
        box-shadow: 0 2px 5px rgba(0,0,0,.5);
    }

    input[type=range]::-moz-range-thumb {
        width: 75px;
        height: 30px;
        border-radius: 3px;
        background: #2272FF;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
        border: none;
    }
    input[type=range]::-moz-range-thumb:hover, input[type=range]::-moz-range-thumb:active {
        background: #418eff;
    }

    input[type=range]::-ms-thumb {
        width: 75px;
        height: 30px;
        border-radius: 3px;
        background: #2272FF;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
        border: none;
    }
    input[type=range]::-ms-thumb:hover, input[type=range]::-ms-thumb:active {
        background: #418eff;
    }

    #submission {
        margin: 0 auto;
        border-radius: 5px;
        background-color: #222;
        width: 35%;
        height: 50px;
    }
    #submission input[type="submit"] {
        float: left;
        margin-top: 5px;
        margin-left: 5px;
        background: #2272ff;
        font-size: 24px;
        font-weight: bold;
        width: 170px;
        height: 40px;
        border-radius: 3px;
        color: #fff;
        border: 0;
    }
    #submission output {
        position: relative;
        display: block;
        float: right;
        margin-top: 5px;
        margin-right: 5px;
        background-color: #fff;
        font-size: 24px;
        font-weight: bold;
        text-align: right;
        padding-right: 25px;
        line-height: 40px;
        width: 100px;
        height: 40px;
        border-radius: 3px;
        top: -83px;
    }
    #submission output::before {
        display: inline-block;
        content: '€';
        float: left;
        margin-left: 8px;
        color: #aaa;
        font-weight: normal;
    }
    #submission output::after {
        display: block;
        content: '';
        position: absolute;
        top: 15px;
        right: 100px;
        width: 0;
        height: 0;
        border-right: 5px solid #fff;
        border-top: 5px solid transparent;
        border-bottom: 5px solid transparent;
    }
</style>