<?php
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

$noesia_swa_rem_today_label = date_i18n( get_option( 'date_format' ) );
$noesia_swa_rem_today_ymd   = current_time( 'Y-m-d' );
?>

<?php do_action( 'noesia_swa_reminders_before_content', $noesia_swa_rem_today_label, $noesia_swa_rem_today_ymd ); ?>

<div id="noesia-swa-reminders-app" class="noesia-swa-reminders-app" data-noesia-swa-reminders-module="1">
	<div class="noesia-swa-reminders-app__header-bar">
		<div class="noesia-swa-reminders-app__header-copy">
			<span class="noesia-swa-reminders-app__eyebrow"><?php esc_html_e( 'Workflow & Planning', 'noesia-smart-waiter' ); ?></span>
			<h2 class="noesia-swa-reminders-app__page-title"><?php esc_html_e( 'Reminders Workspace', 'noesia-smart-waiter' ); ?></h2>
			<p class="noesia-swa-reminders-app__page-subtitle"><?php esc_html_e( 'Switch between the classic layout and a modern reminder grid without changing how reminders work.', 'noesia-smart-waiter' ); ?></p>
		</div>

		<div class="noesia-swa-reminders-app__header-tools">
			<label class="noesia-swa-reminders-app__view-switch" for="noesia-swa-reminders-view-mode">
				<span class="noesia-swa-reminders-app__view-switch-copy">
					<strong><?php esc_html_e( 'Grid View', 'noesia-smart-waiter' ); ?></strong>
					<span><?php esc_html_e( 'Modern card mode', 'noesia-smart-waiter' ); ?></span>
				</span>
				<input type="checkbox" id="noesia-swa-reminders-view-mode" class="noesia-swa-reminders-app__view-switch-input" />
				<span class="noesia-swa-reminders-app__view-switch-ui" aria-hidden="true"></span>
			</label>
		</div>
	</div>

	<div class="noesia-swa-reminders-layout">
		<section class="noesia-swa-card noesia-swa-reminders-inbox-card">
			<div id="noesia-swa-reminders-ui">
				<div class="noesia-swa-card-header noesia-swa-reminders-inbox-card__header">
					<div>
						<div class="noesia-swa-kicker"><?php esc_html_e( 'INBOX', 'noesia-smart-waiter' ); ?></div>
						<h3>
							<span class="dashicons dashicons-email-alt2" aria-hidden="true"></span>
							<?php esc_html_e( 'Inbox', 'noesia-smart-waiter' ); ?>
						</h3>
						<p class="noesia-swa-muted">
							<?php esc_html_e( 'Filter, search and manage reminder items from one focused column.', 'noesia-smart-waiter' ); ?>
						</p>
					</div>
				</div>

				<div id="noesia-swa-reminders-msg" class="noesia-swa-muted">
					<?php esc_html_e( 'No reminders yet. Use Create Reminder to add your first reminder.', 'noesia-smart-waiter' ); ?>
				</div>

				<div id="noesia-swa-reminders-items" class="noesia-swa-reminders-items">
					<div class="noesia-swa-card noesia-swa-rem-empty">
						<strong><?php esc_html_e( 'No reminders yet', 'noesia-smart-waiter' ); ?></strong>
						<p class="noesia-swa-muted"><?php esc_html_e( 'Your reminder list will appear here.', 'noesia-smart-waiter' ); ?></p>
					</div>
				</div>
			</div>
		</section>

		<div class="noesia-swa-reminders-right">
			<section class="noesia-swa-card noesia-swa-reminders-intro-card">
				<div class="noesia-swa-card-header">
					<div>
						<div class="noesia-swa-kicker"><?php esc_html_e( 'REMINDERS', 'noesia-smart-waiter' ); ?></div>
						<h3>
							<span class="dashicons dashicons-bell" aria-hidden="true"></span>
							<?php esc_html_e( 'Reminders', 'noesia-smart-waiter' ); ?>
						</h3>
						<p class="noesia-swa-muted">
							<?php esc_html_e( 'Create, track, and complete reminders for your daily workflow.', 'noesia-smart-waiter' ); ?>
						</p>
					</div>

					<div class="noesia-swa-inline-actions">
						<button type="button" class="button button-primary" data-noesia-swa-rem-focus-create="1">
							<span class="dashicons dashicons-plus-alt2" aria-hidden="true"></span>
							<?php esc_html_e( 'Create Reminder', 'noesia-smart-waiter' ); ?>
						</button>
					</div>
				</div>
			</section>

			<section class="noesia-swa-card noesia-swa-reminders-control-card">
				<div class="noesia-swa-card-header">
					<div>
						<div class="noesia-swa-kicker"><?php esc_html_e( 'INBOX CONTROL', 'noesia-smart-waiter' ); ?></div>
						<h3>
							<span class="dashicons dashicons-screenoptions" aria-hidden="true"></span>
							<?php esc_html_e( 'Filter and overview', 'noesia-smart-waiter' ); ?>
						</h3>
						<p class="noesia-swa-muted">
							<?php esc_html_e( 'Compact filters and reminder activity in one modern control box.', 'noesia-smart-waiter' ); ?>
						</p>
					</div>
					<div class="noesia-swa-reminders-control-card__today-chip">
						<span class="noesia-swa-reminders-control-card__today-kicker"><?php esc_html_e( 'Today', 'noesia-smart-waiter' ); ?></span>
						<strong><?php echo esc_html( $noesia_swa_rem_today_label ); ?></strong>
					</div>
				</div>

				<div class="noesia-swa-reminders-control-card__body">
					<div class="noesia-swa-section-grid">
						<div class="noesia-swa-card">
							<label for="noesia-swa-reminders-filter-status"><strong><?php esc_html_e( 'Status', 'noesia-smart-waiter' ); ?></strong></label>
							<select id="noesia-swa-reminders-filter-status" class="widefat">
								<option value="open"><?php esc_html_e( 'Open', 'noesia-smart-waiter' ); ?></option>
								<option value="completed"><?php esc_html_e( 'Completed', 'noesia-smart-waiter' ); ?></option>
								<option value="all"><?php esc_html_e( 'All', 'noesia-smart-waiter' ); ?></option>
							</select>
						</div>

						<div class="noesia-swa-card">
							<label for="noesia-swa-reminders-filter-due"><strong><?php esc_html_e( 'Due', 'noesia-smart-waiter' ); ?></strong></label>
							<select id="noesia-swa-reminders-filter-due" class="widefat">
								<option value="all"><?php esc_html_e( 'All', 'noesia-smart-waiter' ); ?></option>
								<option value="today"><?php esc_html_e( 'Today', 'noesia-smart-waiter' ); ?></option>
								<option value="overdue"><?php esc_html_e( 'Overdue', 'noesia-smart-waiter' ); ?></option>
								<option value="next7"><?php esc_html_e( 'Next 7 days', 'noesia-smart-waiter' ); ?></option>
							</select>
						</div>
					</div>

					<div class="noesia-swa-card">
						<label for="noesia-swa-reminders-search"><strong><?php esc_html_e( 'Search', 'noesia-smart-waiter' ); ?></strong></label>
						<input
							type="text"
							id="noesia-swa-reminders-search"
							class="widefat"
							placeholder="<?php echo esc_attr__( 'Search reminders…', 'noesia-smart-waiter' ); ?>"
						/>
					</div>

					<div class="noesia-swa-reminders-overview-card__compact-head">
						<div>
							<div class="noesia-swa-kicker"><?php esc_html_e( 'REMINDER OVERVIEW', 'noesia-smart-waiter' ); ?></div>
							<h4><?php esc_html_e( 'Reminder overview', 'noesia-smart-waiter' ); ?></h4>
						</div>
					</div>

					<div class="noesia-swa-mini-stats noesia-swa-mini-stats--compact">
						<div>
							<strong><?php esc_html_e( 'Overdue', 'noesia-smart-waiter' ); ?></strong>
							<span id="noesia-swa-rem-kpi-overdue"><?php esc_html_e( '0', 'noesia-smart-waiter' ); ?></span>
						</div>

						<div>
							<strong><?php esc_html_e( 'Due today', 'noesia-smart-waiter' ); ?></strong>
							<span id="noesia-swa-rem-kpi-today"><?php esc_html_e( '0', 'noesia-smart-waiter' ); ?></span>
						</div>

						<div>
							<strong><?php esc_html_e( 'Upcoming (7d)', 'noesia-smart-waiter' ); ?></strong>
							<span id="noesia-swa-rem-kpi-upcoming"><?php esc_html_e( '0', 'noesia-smart-waiter' ); ?></span>
						</div>

						<div>
							<strong><?php esc_html_e( 'Completed', 'noesia-smart-waiter' ); ?></strong>
							<span id="noesia-swa-rem-kpi-completed"><?php esc_html_e( '0', 'noesia-smart-waiter' ); ?></span>
						</div>
					</div>
				</div>
			</section>
		</div>
	</div>

	<?php do_action( 'noesia_swa_reminders_create_before', $noesia_swa_rem_today_label, $noesia_swa_rem_today_ymd ); ?>

	<div class="noesia-swa-reminders-modal" id="noesia-swa-reminders-modal" hidden>
		<div class="noesia-swa-reminders-modal__backdrop" data-noesia-swa-rem-close-modal="1"></div>
		<div class="noesia-swa-reminders-modal__dialog" role="dialog" aria-modal="true" aria-labelledby="noesia-swa-reminders-modal-title">
			<div class="noesia-swa-reminders-modal__header">
				<div>
					<div class="noesia-swa-kicker"><?php esc_html_e( 'TODAY', 'noesia-smart-waiter' ); ?></div>
					<h3 id="noesia-swa-reminders-modal-title">
						<span class="dashicons dashicons-calendar" aria-hidden="true"></span>
						<?php echo esc_html( $noesia_swa_rem_today_label ); ?>
					</h3>
					<p class="noesia-swa-muted">
						<?php esc_html_e( 'Quick create panel for new reminder items.', 'noesia-smart-waiter' ); ?>
					</p>
				</div>

				<button type="button" class="button button-secondary noesia-swa-reminders-modal__close" data-noesia-swa-rem-close-modal="1" aria-label="<?php esc_attr_e( 'Close reminder modal', 'noesia-smart-waiter' ); ?>">
					<span class="dashicons dashicons-no-alt" aria-hidden="true"></span>
				</button>
			</div>

			<div class="noesia-swa-reminders-modal__body" id="noesia-swa-reminders-create-anchor">
				<input type="hidden" id="noesia-swa-rem-id" value="" />

				<div class="noesia-swa-reminders-modal__layout">
					<div class="noesia-swa-reminders-modal__meta-grid">
						<div class="noesia-swa-card noesia-swa-reminders-modal__field-card noesia-swa-reminders-modal__field-card--type">
							<label for="noesia-swa-rem-type"><strong><?php esc_html_e( 'Type', 'noesia-smart-waiter' ); ?></strong></label>
							<input
								type="text"
								id="noesia-swa-rem-type"
								class="widefat"
								placeholder="<?php echo esc_attr__( 'e.g. Supplier call / shift prep / stock check', 'noesia-smart-waiter' ); ?>"
							/>
						</div>

						<div class="noesia-swa-card noesia-swa-reminders-modal__field-card noesia-swa-reminders-modal__field-card--date">
							<label for="noesia-swa-rem-due-date"><strong><?php esc_html_e( 'Due date', 'noesia-smart-waiter' ); ?></strong></label>
							<input
								type="date"
								id="noesia-swa-rem-due-date"
								class="widefat"
								value="<?php echo esc_attr( $noesia_swa_rem_today_ymd ); ?>"
							/>
						</div>

						<div class="noesia-swa-card noesia-swa-reminders-modal__field-card noesia-swa-reminders-modal__field-card--time">
							<label for="noesia-swa-rem-due-time"><strong><?php esc_html_e( 'Due time', 'noesia-smart-waiter' ); ?></strong></label>
							<input
								type="time"
								id="noesia-swa-rem-due-time"
								class="widefat"
								value=""
								step="60"
							/>
						</div>

						<div class="noesia-swa-card noesia-swa-reminders-modal__field-card noesia-swa-reminders-modal__field-card--related">
							<label for="noesia-swa-rem-related"><strong><?php esc_html_e( 'Related to', 'noesia-smart-waiter' ); ?></strong></label>
							<input
								type="text"
								id="noesia-swa-rem-related"
								class="widefat"
								placeholder="<?php echo esc_attr__( 'Table / supplier / order / staff / anything…', 'noesia-smart-waiter' ); ?>"
							/>
						</div>
					</div>

					<div class="noesia-swa-card noesia-swa-reminders-modal__field-card noesia-swa-reminders-modal__message-card">
						<label for="noesia-swa-rem-message"><strong><?php esc_html_e( 'Message', 'noesia-smart-waiter' ); ?></strong></label>
						<textarea
							id="noesia-swa-rem-message"
							class="widefat"
							rows="5"
							placeholder="<?php echo esc_attr__( 'Write a short reminder…', 'noesia-smart-waiter' ); ?>"
						></textarea>
					</div>
				</div>
			</div>

			<div class="noesia-swa-reminders-modal__footer noesia-swa-inline-actions">
				<button type="button" class="button button-primary" data-noesia-swa-rem-save="1">
					<span class="dashicons dashicons-saved" aria-hidden="true"></span>
					<?php esc_html_e( 'Save Reminder', 'noesia-smart-waiter' ); ?>
				</button>

				<button type="button" class="button" id="noesia-swa-rem-cancel">
					<?php esc_html_e( 'Cancel', 'noesia-smart-waiter' ); ?>
				</button>

				<button type="button" class="button" id="noesia-swa-rem-delete" hidden>
					<?php esc_html_e( 'Delete', 'noesia-smart-waiter' ); ?>
				</button>
			</div>
		</div>
	</div>

	<?php do_action( 'noesia_swa_reminders_create_after', $noesia_swa_rem_today_label, $noesia_swa_rem_today_ymd ); ?>
</div>

<?php do_action( 'noesia_swa_reminders_after_content', $noesia_swa_rem_today_label, $noesia_swa_rem_today_ymd ); ?>
