<?php
/**
 * Tab: Maintenance (Free)
 * @package Panelra
 */
if ( ! defined( 'ABSPATH' ) ) { exit; }
$pnlrdb_enabled = get_option( 'pnlrdb_maintenance_enabled', 0 );
$pnlrdb_title   = get_option( 'pnlrdb_maintenance_title', 'Site under maintenance' );
$pnlrdb_message = get_option( 'pnlrdb_maintenance_message', "We'll be back soon!" );
?>
<h2 class="ap773-section-title"><?php esc_html_e( 'Maintenance Mode', 'panelra-dashboard-builder' ); ?></h2>
<p class="ap773-section-desc"><?php esc_html_e( 'Show a maintenance page to visitors while you work on the site.', 'panelra-dashboard-builder' ); ?></p>

<?php if ( $pnlrdb_enabled ) : ?>
<div class="ap773-warning-banner">
	⚠️ <?php esc_html_e( 'Maintenance mode is currently ACTIVE. Visitors see the maintenance page.', 'panelra-dashboard-builder' ); ?>
</div>
<?php endif; ?>

<div class="ap773-card">
	<div class="ap773-card-title">
		<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"/></svg>
		<?php esc_html_e( 'Settings', 'panelra-dashboard-builder' ); ?>
	</div>
	<div class="ap773-field-row">
		<div><div class="ap773-label"><?php esc_html_e( 'Enable', 'panelra-dashboard-builder' ); ?></div></div>
		<div class="ap773-toggle-wrap">
			<label class="ap773-toggle">
				<input type="checkbox" name="pnlrdb_maintenance_enabled" value="1" <?php checked( $pnlrdb_enabled, 1 ); ?>>
				<span class="ap773-toggle-slider"></span>
			</label>
		</div>
	</div>
	<div class="ap773-field-row">
		<div><div class="ap773-label"><?php esc_html_e( 'Page title', 'panelra-dashboard-builder' ); ?></div></div>
		<div><input type="text" class="ap773-input" name="pnlrdb_maintenance_title" value="<?php echo esc_attr( $pnlrdb_title ); ?>"></div>
	</div>
	<div class="ap773-field-row">
		<div><div class="ap773-label"><?php esc_html_e( 'Message', 'panelra-dashboard-builder' ); ?></div></div>
		<div><textarea name="pnlrdb_maintenance_message" rows="3" class="ap773-input" style="max-width:100%;height:auto;"><?php echo esc_textarea( $pnlrdb_message ); ?></textarea></div>
	</div>
</div>

<?php do_action( 'pnlrdb_after_maintenance_settings' );
do_action( 'pnlrdb_after_maintenance_settings' ); ?>
