<?php
// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- False positive: locally-scoped variables (template view-vars via TemplateLoader::render() extract+include within a method, or closure locals), not plugin globals.
defined( 'ABSPATH' ) || exit;

/**
 * Email header partial.
 *
 * Expected variables:
 * - Optional: $bookaro_preheader (string)
 */
$bookaro_brand_color = '#0f766e';
if ( function_exists( 'bookaro_get_option' ) ) {
    $configured_color = sanitize_hex_color( (string) bookaro_get_option( 'appearance_primary_color', '' ) );
    if ( is_string( $configured_color ) && $configured_color !== '' ) {
        $bookaro_brand_color = $configured_color;
    }
}
$bookaro_site_name = get_bloginfo( 'name' );
$bookaro_preheader = isset( $bookaro_preheader ) && is_string( $bookaro_preheader ) ? trim( $bookaro_preheader ) : '';
?>
<!doctype html>
<html lang="<?php echo esc_attr( get_bloginfo( 'language' ) ); ?>">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <style>
        body, table, td, p, h1, h2, h3, a {
            font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Arial, sans-serif;
            margin: 0;
            padding: 0;
        }
        .email-wrapper {
            width: 100%;
            background: #edf2f7;
            padding: 24px 10px;
        }
        .email-container {
            max-width: 640px;
            margin: 0 auto;
            background: #ffffff;
            border-radius: 14px;
            border: 1px solid #dbe3ed;
            box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
            overflow: hidden;
        }
        .email-header {
            background: linear-gradient(135deg, <?php echo esc_attr( $bookaro_brand_color ); ?> 0%, #0b5f59 100%);
            padding: 22px 24px;
            text-align: left;
        }
        .email-header h1 {
            color: #ffffff;
            font-size: 24px;
            font-weight: 700;
            line-height: 1.2;
        }
        .email-header p {
            margin-top: 6px;
            color: #dffaf4;
            font-size: 13px;
        }
        .email-body {
            padding: 24px;
            color: #0f172a;
            font-size: 15px;
            line-height: 1.6;
        }
        .bookaro-email-intro p {
            margin-bottom: 12px;
        }
        .bookaro-email-subheading {
            margin: 18px 0 8px;
            font-size: 14px;
            font-weight: 700;
            color: #0f172a;
        }
        .bookaro-meta-note {
            margin: 10px 0 14px;
            font-size: 13px;
            color: #334155;
        }
        .btn {
            display: inline-block;
            padding: 10px 18px;
            background: <?php echo esc_attr( $bookaro_brand_color ); ?>;
            color: #ffffff !important;
            text-decoration: none;
            border-radius: 8px;
            font-weight: 600;
            margin: 6px 6px 0 0;
        }
        .btn--secondary {
            background: #ffffff;
            color: <?php echo esc_attr( $bookaro_brand_color ); ?> !important;
            border: 1px solid <?php echo esc_attr( $bookaro_brand_color ); ?>;
        }
        .details-table td {
            padding: 8px 10px;
            border-bottom: 1px solid #e5e7eb;
            vertical-align: top;
        }
        .details-table td:first-child {
            background: #f8fafc;
            font-weight: 600;
            width: 35%;
        }
        .bookaro-policy-snippet {
            margin: 12px 0 16px;
            padding: 10px 12px;
            border-radius: 10px;
            background: #f8fafc;
            border: 1px solid #e2e8f0;
        }
        .bookaro-policy-list {
            margin: 0;
            padding-left: 18px;
            color: #334155;
            font-size: 13px;
        }
    </style>
</head>
<body>
<?php if ( $bookaro_preheader !== '' ) : ?>
    <div style="display:none;max-height:0;max-width:0;opacity:0;overflow:hidden;mso-hide:all;">
        <?php echo esc_html( $bookaro_preheader ); ?>
    </div>
<?php endif; ?>
<div class="email-wrapper">
    <div class="email-container">
        <div class="email-header">
            <h1><?php echo esc_html( $bookaro_site_name ); ?></h1>
            <p><?php esc_html_e( 'Booking notifications from MyBookaro', 'mybookaro' ); ?></p>
        </div>
        <div class="email-body">
