<?php $this->load->view("partial/header"); ?>

<style>
.report_input_page {
    padding: 40px 24px;
    font-family: 'Segoe UI', Arial, sans-serif;
    background: #f0f4ff;
    min-height: calc(100vh - 120px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.report_input_card {
    background: rgba(255,255,255,0.75);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.9);
    border-radius: 20px;
    padding: 36px 40px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.08);
    width: 100%;
    max-width: 520px;
}

.report_input_title {
    font-size: 22px;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.report_input_subtitle {
    color: #999;
    font-size: 13px;
    margin-bottom: 28px;
}

.divider {
    height: 2px;
    background: linear-gradient(90deg, #2e7d32, rgba(46,125,50,0.1));
    border-radius: 2px;
    margin-bottom: 24px;
}

.export_section {
    background: rgba(46,125,50,0.05);
    border: 1px solid rgba(46,125,50,0.15);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 24px;
}

.export_label {
    font-size: 13px;
    font-weight: 700;
    color: #2e7d32;
    margin-bottom: 14px;
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.export_options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.export_option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    background: white;
    transition: all 0.2s;
    font-size: 14px;
    color: #444;
    font-family: 'Segoe UI', Arial, sans-serif;
}

.export_option:hover {
    border-color: #2e7d32;
    background: rgba(46,125,50,0.03);
}

.export_option input[type=radio] {
    accent-color: #2e7d32;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.submit_btn {
    background: linear-gradient(135deg, #2e7d32, #1b5e20);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 14px 32px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(46,125,50,0.4);
    transition: all 0.2s;
    width: 100%;
    letter-spacing: 0.3px;
    font-family: 'Segoe UI', Arial, sans-serif;
}

.submit_btn:hover {
    background: linear-gradient(135deg, #388e3c, #2e7d32);
    box-shadow: 0 6px 20px rgba(46,125,50,0.5);
    transform: translateY(-1px);
}

.back_link {
    display: block;
    text-align: center;
    margin-top: 16px;
    color: #999;
    font-size: 13px;
    text-decoration: none;
    transition: color 0.2s;
}

.back_link:hover { color: #2e7d32; text-decoration: none; }
</style>

<div class="report_input_page">
    <div class="report_input_card">

        <div class="report_input_title">
            📦 <?php echo $this->lang->line('reports_report_input'); ?>
        </div>
        <div class="report_input_subtitle">Generate your inventory report</div>
        <div class="divider"></div>

        <?php if(isset($error)): ?>
        <div style="background:rgba(220,53,69,0.08);border:1px solid rgba(220,53,69,0.2);border-radius:8px;padding:10px 14px;color:#dc3545;font-size:13px;margin-bottom:20px;">
            <?php echo $error; ?>
        </div>
        <?php endif; ?>

        <!-- Export Options -->
        <div class="export_section">
            <span class="export_label">📊 Export Format</span>
            <div class="export_options">
                <label class="export_option">
                    <input type="radio" name="export_excel" id="export_excel_no" value="0" checked="checked" />
                    View in browser — display report on screen
                </label>
                <label class="export_option">
                    <input type="radio" name="export_excel" id="export_excel_yes" value="1" />
                    Export to Excel — download as spreadsheet
                </label>
            </div>
        </div>

        <!-- Submit -->
        <button type="button" id="generate_report" class="submit_btn">
            🔍 <?php echo $this->lang->line('common_submit'); ?>
        </button>

        <a href="<?php echo site_url('reports'); ?>" class="back_link">← Back to Reports</a>

    </div>
</div>

<?php $this->load->view("partial/footer"); ?>

<script type="text/javascript">
$(document).ready(function()
{
    $("#generate_report").click(function()
    {
        var export_excel = 0;
        if($("#export_excel_yes").is(':checked'))
        {
            export_excel = 1;
        }
        window.location = window.location + '/' + export_excel;
    });
});
</script>