<?php

if (! defined('ABSPATH')) exit; // Exit if accessed directly

?>
<!-- PDF setting -->
<div class="ipb-section ipb-pdf-settings-layout">
 <div class="ipb-section-header">
    <h3>PDF Settings</h3>
</div>
<div class="ipb-section-content" data-section="display">
<div class="design_background">
    <div class="ipb_background_wrapper">

        <div class="background_field ipb-pdf-row ipb-pdf-row-toggle">
            <div class="label">Allow Download</div>
            <div class="input toggle switch">
                <input type="checkbox" name="pdf_allow_download" id="pdf_allow_download" value="yes">
                <span class="slider round"></span>
            </div>
        </div>

        <div class="background_field ipb-pdf-row ipb-pdf-row-toggle">
            <div class="label">Require Login</div>
            <div class="input toggle switch">
                <input type="checkbox" name="pdf_require_login" id="pdf_require_login" value="yes">
                <span class="slider round"></span>
            </div>
        </div>

        <div class="background_field ipb-pdf-row ipb-pdf-row-toggle">
            <div class="label">Show Fullscreen Button</div>
            <div class="input toggle switch">
                <input type="checkbox" name="pdf_allow_fullscreen" id="pdf_allow_fullscreen" value="yes">
                <span class="slider round"></span>
            </div>
        </div>

        <div class="background_field ipb-pdf-row ipb-pdf-row-toggle">
            <div class="label">Show Toolbar</div>
            <div class="input toggle switch">
                <input type="checkbox" name="pdf_show_toolbar" id="pdf_show_toolbar" value="yes">
                <span class="slider round"></span>
            </div>
        </div>

        <div class="background_field ipb-pdf-row">
            <div class="label">PDF Height (px)</div>
            <div class="input">
                <input type="number" name="pdf_height" id="pdf_height" value="600" min="300" max="1200" placeholder="600">
                <small class="ipb-pdf-helper">Fixed height in pixels (leave empty to use minimum height)</small>
            </div>
        </div>

        <div class="background_field ipb-pdf-row">
            <div class="label">Minimum Height (% of screen)</div>
            <div class="input">
                <input type="number" name="pdf_min_height_percent" id="pdf_min_height_percent" value="75" min="30" max="95" placeholder="75">
                <small class="ipb-pdf-helper">Minimum height as percentage of viewport (default: 75%)</small>
            </div>
        </div>

        <div class="background_field ipb-pdf-row">
            <div class="label">Height Mode</div>
            <div class="input">
                <select name="pdf_height_mode" id="pdf_height_mode">
                    <option value="responsive" selected>Responsive (use minimum height %)</option>
                    <option value="fixed">Fixed (use exact pixels)</option>
                </select>
                <small class="ipb-pdf-helper">Choose how to handle PDF popup height</small>
            </div>
        </div>

        <div class="background_field ipb-pdf-row">
            <div class="label">Zoom Level</div>
            <div class="input">
                <select name="pdf_zoom_level" id="pdf_zoom_level">
                    <option value="auto">Auto</option>
                    <option value="50">50%</option>
                    <option value="75">75%</option>
                    <option value="100" selected>100%</option>
                    <option value="125">125%</option>
                    <option value="150">150%</option>
                    <option value="200">200%</option>
                </select>
            </div>
        </div>

        <div class="background_field ipb-pdf-row ipb-pdf-row-toggle">
            <div class="label">Auto Open First Page</div>
            <div class="input toggle switch">
                <input type="checkbox" name="pdf_auto_open" id="pdf_auto_open" value="yes">
                <span class="slider round"></span>
            </div>
        </div>

    </div>
</div>
</div>
</div>

<style>
.ipb-pdf-settings-layout .ipb-section-content {
    padding: 16px;
}

.ipb-pdf-settings-layout .ipb_background_wrapper {
    margin: 0;
    padding: 0;
}

.ipb-pdf-settings-layout .ipb-pdf-row {
    display: grid;
    grid-template-columns: minmax(240px, 280px) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
    margin: 0 0 16px;
    width: 100%;
}

.ipb-pdf-settings-layout .ipb-pdf-row:last-child {
    margin-bottom: 0;
}

.ipb-pdf-settings-layout .ipb-pdf-row .label {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    color: #1d2327;
}

.ipb-pdf-settings-layout .ipb-pdf-row .input {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.ipb-pdf-settings-layout .ipb-pdf-row-toggle .input.toggle.switch {
    margin-top: 2px;
}

.ipb-pdf-settings-layout #pdf_height_mode {
    min-width: 320px;
    width: min(420px, 100%);
}

.ipb-pdf-settings-layout #pdf_height,
.ipb-pdf-settings-layout #pdf_min_height_percent,
.ipb-pdf-settings-layout #pdf_zoom_level {
    min-width: 140px;
    width: min(180px, 100%);
}

.ipb-pdf-settings-layout .ipb-pdf-helper {
    display: block;
    margin-top: 0;
    color: #646970;
    font-size: 12px;
    line-height: 1.4;
}

@media (max-width: 782px) {
    .ipb-pdf-settings-layout .ipb-pdf-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .ipb-pdf-settings-layout #pdf_height_mode,
    .ipb-pdf-settings-layout #pdf_height,
    .ipb-pdf-settings-layout #pdf_min_height_percent,
    .ipb-pdf-settings-layout #pdf_zoom_level {
        min-width: 0;
        width: 100%;
    }
}
</style>
