<?php
// Apple Refund Request Form - PHP Version
?>
<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8" />
    <link rel="icon" type="image/png" href="public/apple-logo-icon.png" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Apple Refund Request Form</title>
    <link rel="stylesheet" href="css/index.css">
    <link rel="stylesheet" href="css/header.css">
    <link rel="stylesheet" href="css/form.css">
</head>
<body>
    <div id="root">
        <!-- Header -->
        <header class="header">
            <div class="header-content">
                <div class="logo-section">
                    <img src="public/apple-logo-icon.png" alt="Apple Logo" class="logo" />
                    <h1>Apple Refund Request Form</h1>
                </div>
            </div>
        </header>

        <!-- Main Form Container -->
        <div class="page">
            <div class="refund-form-container">
                <form id="refundForm" class="refund-form">

                    <!-- DEVICE INFORMATION SECTION -->
                    <div class="form-section">
                        <h2>Device Information</h2>
                        <div class="form-group">
                            <label for="userOS">Operating System</label>
                            <input type="text" id="userOS" name="userOS" readonly value="">
                        </div>
                    </div>

                    <!-- CUSTOMER INFORMATION SECTION -->
                    <div class="form-section">
                        <h2>Customer Information</h2>

                        <div class="form-row form-row-top">
                            <div class="form-group">
                                <label for="fullLegalName">Full Legal Name *</label>
                                <input type="text" id="fullLegalName" name="fullLegalName" required>
                                <span class="error-message" id="error-fullLegalName"></span>
                            </div>
                        </div>

                        <div class="form-row">
                            <div class="form-group">
                                <label for="dateOfBirth">Date of Birth *</label>
                                <div class="date-field">
                                    <input type="date" id="dateOfBirth" name="dateOfBirth" required>
                                    <button type="button" class="date-field-icon" onclick="document.getElementById('dateOfBirth').showPicker()">
                                        <svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true">
                                            <rect x="2" y="3" width="12" height="11" rx="1.5" stroke="#64748B" stroke-width="1.3" />
                                            <path d="M2 6.5H14" stroke="#64748B" stroke-width="1.3" />
                                            <path d="M5 1.5V4" stroke="#64748B" stroke-width="1.3" stroke-linecap="round" />
                                            <path d="M11 1.5V4" stroke="#64748B" stroke-width="1.3" stroke-linecap="round" />
                                        </svg>
                                    </button>
                                </div>
                                <span class="error-message" id="error-dateOfBirth"></span>
                            </div>
                            <div class="form-group">
                                <label for="appleAccountICloud">Apple Account / iCloud *</label>
                                <input type="email" id="appleAccountICloud" name="appleAccountICloud" required>
                                <span class="error-message" id="error-appleAccountICloud"></span>
                            </div>
                        </div>

                        <div class="form-row">
                            <div class="form-group">
                                <label for="alternateEmail">Alternate Email</label>
                                <input type="email" id="alternateEmail" name="alternateEmail">
                                <span class="error-message" id="error-alternateEmail"></span>
                            </div>
                            <div class="form-group">
                                <label for="phoneNumber">Phone Number</label>
                                <input type="tel" id="phoneNumber" name="phoneNumber">
                                <span class="error-message" id="error-phoneNumber"></span>
                            </div>
                        </div>

                        <div class="form-row">
                            <div class="form-group">
                                <label for="billingAddress">Billing Address</label>
                                <input type="text" id="billingAddress" name="billingAddress">
                                <span class="error-message" id="error-billingAddress"></span>
                            </div>
                        </div>

                        <div class="form-row">
                            <div class="form-group">
                                <label for="customerType">Customer Type *</label>
                                <select id="customerType" name="customerType" required>
                                    <option value="">Select customer type</option>
                                    <option value="individual">Individual</option>
                                    <option value="business">Business</option>
                                    <option value="educational">Educational Institution</option>
                                    <option value="government">Government</option>
                                </select>
                                <span class="error-message" id="error-customerType"></span>
                            </div>
                        </div>
                    </div>

                    <!-- PURCHASE DETAILS SECTION -->
                    <div class="form-section">
                        <h2>Purchase Details</h2>

                        <div class="form-row">
                            <div class="form-group">
                                <label for="productServiceName">Product / Service Name *</label>
                                <input type="text" id="productServiceName" name="productServiceName" required>
                                <span class="error-message" id="error-productServiceName"></span>
                            </div>
                            <div class="form-group">
                                <label for="skuLicenseId">SKU / License ID</label>
                                <input type="text" id="skuLicenseId" name="skuLicenseId">
                                <span class="error-message" id="error-skuLicenseId"></span>
                            </div>
                        </div>

                        <div class="form-row">
                            <div class="form-group">
                                <label for="orderInvoiceNumber">Order / Invoice Number</label>
                                <input type="text" id="orderInvoiceNumber" name="orderInvoiceNumber">
                                <span class="error-message" id="error-orderInvoiceNumber"></span>
                            </div>
                            <div class="form-group">
                                <label for="purchaseChannel">Purchase Channel *</label>
                                <select id="purchaseChannel" name="purchaseChannel" required>
                                    <option value="">Select channel</option>
                                    <option value="apple-store">Apple Store (Physical)</option>
                                    <option value="apple-online">Apple Online Store</option>
                                    <option value="app-store">App Store</option>
                                    <option value="itunes">iTunes</option>
                                    <option value="third-party">Third Party Retailer</option>
                                    <option value="other">Other</option>
                                </select>
                                <span class="error-message" id="error-purchaseChannel"></span>
                            </div>
                        </div>

                        <div class="form-row">
                            <div class="form-group">
                                <label for="productCategory">Product Category *</label>
                                <select id="productCategory" name="productCategory" required>
                                    <option value="">Select category</option>
                                    <option value="hardware">Hardware (iPhone, iPad, Mac, etc.)</option>
                                    <option value="software">Software / Apps</option>
                                    <option value="services">Services (AppleCare, Subscriptions)</option>
                                    <option value="digital">Digital Content (Music, Books, Movies)</option>
                                    <option value="other">Other</option>
                                </select>
                                <span class="error-message" id="error-productCategory"></span>
                            </div>
                        </div>

                        <div class="form-row">
                            <div class="form-group">
                                <label for="purchaseDate">Purchase Date</label>
                                <div class="date-field">
                                    <input type="date" id="purchaseDate" name="purchaseDate">
                                    <button type="button" class="date-field-icon" onclick="document.getElementById('purchaseDate').showPicker()">
                                        <svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true">
                                            <rect x="2" y="3" width="12" height="11" rx="1.5" stroke="#64748B" stroke-width="1.3" />
                                            <path d="M2 6.5H14" stroke="#64748B" stroke-width="1.3" />
                                            <path d="M5 1.5V4" stroke="#64748B" stroke-width="1.3" stroke-linecap="round" />
                                            <path d="M11 1.5V4" stroke="#64748B" stroke-width="1.3" stroke-linecap="round" />
                                        </svg>
                                    </button>
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="amountPaid">Amount Paid</label>
                                <input type="number" id="amountPaid" name="amountPaid" step="0.01">
                                <span class="error-message" id="error-amountPaid"></span>
                            </div>
                        </div>

                        <div class="form-row">
                            <div class="form-group">
                                <label for="currency">Currency *</label>
                                <select id="currency" name="currency" required>
                                    <option value="">Select currency</option>
                                    <option value="USD">USD - US Dollar</option>
                                    <option value="EUR">EUR - Euro</option>
                                    <option value="GBP">GBP - British Pound</option>
                                    <option value="JPY">JPY - Japanese Yen</option>
                                    <option value="AUD">AUD - Australian Dollar</option>
                                    <option value="CAD">CAD - Canadian Dollar</option>
                                    <option value="CHF">CHF - Swiss Franc</option>
                                    <option value="CNY">CNY - Chinese Yuan</option>
                                    <option value="INR">INR - Indian Rupee</option>
                                    <option value="MXN">MXN - Mexican Peso</option>
                                </select>
                                <span class="error-message" id="error-currency"></span>
                            </div>
                            <div class="form-group">
                                <label for="paymentMethod">Payment Method *</label>
                                <select id="paymentMethod" name="paymentMethod" required>
                                    <option value="">Select method</option>
                                    <option value="credit-card">Credit Card</option>
                                    <option value="debit-card">Debit Card</option>
                                    <option value="bank-transfer">Bank Transfer</option>
                                    <option value="apple-pay">Apple Pay</option>
                                    <option value="paypal">PayPal</option>
                                    <option value="gift-card">Apple Gift Card</option>
                                    <option value="other">Other</option>
                                </select>
                                <span class="error-message" id="error-paymentMethod"></span>
                            </div>
                        </div>
                    </div>

                    <!-- REFUND REQUEST DETAILS SECTION -->
                    <div class="form-section">
                        <h2>Refund Request Details</h2>

                        <div class="form-row">
                            <div class="form-group">
                                <label for="bankName">Bank Name *</label>
                                <input type="text" id="bankName" name="bankName" required>
                                <span class="error-message" id="error-bankName"></span>
                            </div>
                            <div class="form-group">
                                <label for="refundAmountRequested">Refund Amount Requested *</label>
                                <input type="number" id="refundAmountRequested" name="refundAmountRequested" step="0.01" required>
                                <span class="error-message" id="error-refundAmountRequested"></span>
                            </div>
                        </div>

                        <div class="form-row">
                            <div class="form-group">
                                <label>Refund Reasons *</label>
                                <div class="checkbox-list">
                                    <label class="checkbox-item">
                                        <input type="checkbox" name="refundReasons" value="accidental">
                                        <span>Accidental Purchase</span>
                                    </label>
                                    <label class="checkbox-item">
                                        <input type="checkbox" name="refundReasons" value="duplicate">
                                        <span>Duplicate Charge</span>
                                    </label>
                                    <label class="checkbox-item">
                                        <input type="checkbox" name="refundReasons" value="not-as-described">
                                        <span>Product Not as Described</span>
                                    </label>
                                    <label class="checkbox-item">
                                        <input type="checkbox" name="refundReasons" value="technical">
                                        <span>Technical Issues</span>
                                    </label>
                                    <label class="checkbox-item">
                                        <input type="checkbox" name="refundReasons" value="subscription">
                                        <span>Subscription Cancellation</span>
                                    </label>
                                    <label class="checkbox-item">
                                        <input type="checkbox" name="refundReasons" value="billing">
                                        <span>Billing Error</span>
                                    </label>
                                    <label class="checkbox-item">
                                        <input type="checkbox" name="refundReasons" value="other">
                                        <span>Other (explain below)</span>
                                    </label>
                                </div>
                                <span class="error-message" id="error-refundReasons"></span>
                            </div>
                        </div>

                        <div class="form-row">
                            <div class="form-group">
                                <label for="refundExplanation">Detailed Explanation of Refund Request</label>
                                <textarea id="refundExplanation" name="refundExplanation" placeholder="Please provide additional details..."></textarea>
                                <span class="error-message" id="error-refundExplanation"></span>
                            </div>
                        </div>
                    </div>

                    <!-- DECLARATION SECTION -->
                    <div class="form-section">
                        <h2>Declaration</h2>

                        <div class="checkbox-list">
                            <label class="checkbox-item">
                                <input type="checkbox" id="policyAcknowledged" name="policyAcknowledged" required>
                                <span>I acknowledge that I have read and understand the refund policy *</span>
                            </label>
                            <span class="error-message" id="error-policyAcknowledged"></span>
                        </div>

                        <div class="checkbox-list">
                            <label class="checkbox-item">
                                <input type="checkbox" id="declarationConfirmed" name="declarationConfirmed" required>
                                <span>I confirm that all information provided is accurate and complete *</span>
                            </label>
                            <span class="error-message" id="error-declarationConfirmed"></span>
                        </div>

                        <div class="form-row">
                            <div class="form-group">
                                <label for="customerSignature">Customer Signature (Name)</label>
                                <input type="text" id="customerSignature" name="customerSignature" placeholder="Sign with your name">
                                <span class="error-message" id="error-customerSignature"></span>
                            </div>
                            <div class="form-group">
                                <label for="declarationDate">Declaration Date</label>
                                <div class="date-field">
                                    <input type="date" id="declarationDate" name="declarationDate">
                                    <button type="button" class="date-field-icon" onclick="document.getElementById('declarationDate').showPicker()">
                                        <svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true">
                                            <rect x="2" y="3" width="12" height="11" rx="1.5" stroke="#64748B" stroke-width="1.3" />
                                            <path d="M2 6.5H14" stroke="#64748B" stroke-width="1.3" />
                                            <path d="M5 1.5V4" stroke="#64748B" stroke-width="1.3" stroke-linecap="round" />
                                            <path d="M11 1.5V4" stroke="#64748B" stroke-width="1.3" stroke-linecap="round" />
                                        </svg>
                                    </button>
                                </div>
                            </div>
                        </div>

                        <div class="form-row">
                            <div class="form-group">
                                <label for="customerNamePrinted">Customer Name (Printed) *</label>
                                <input type="text" id="customerNamePrinted" name="customerNamePrinted" required>
                                <span class="error-message" id="error-customerNamePrinted"></span>
                            </div>
                        </div>
                    </div>

                    <!-- SPECIALIST INFORMATION SECTION -->
                    <div class="form-section">
                        <h2>Specialist Information (Optional)</h2>

                        <div class="form-row">
                            <div class="form-group">
                                <label for="specialistName">Specialist Name</label>
                                <input type="text" id="specialistName" name="specialistName">
                                <span class="error-message" id="error-specialistName"></span>
                            </div>
                            <div class="form-group">
                                <label for="employeeId">Employee ID</label>
                                <input type="text" id="employeeId" name="employeeId">
                                <span class="error-message" id="error-employeeId"></span>
                            </div>
                        </div>
                    </div>

                    <!-- BUTTONS -->
                    <div class="button-group">
                        <button type="submit" class="btn btn-primary" id="submitBtn">
                            <span id="btnText">Submit Refund Request</span>
                            <span id="loadingSpinner" style="display: none;">Submitting...</span>
                        </button>
                        <button type="button" class="btn btn-secondary" onclick="resetForm()">Clear Form</button>
                    </div>

                    <!-- Reference Number Display -->
                    <div id="successMessage" class="success-message" style="display: none;">
                        <h3>✅ Form Submitted Successfully</h3>
                        <p>Your refund request has been submitted.</p>
                        <p><strong>Reference Number:</strong> <span id="refNumber"></span></p>
                        <p>We will review your request and contact you within 5-7 business days.</p>
                    </div>
                </form>
            </div>
        </div>
    </div>

    <script src="js/app.js"></script>
</body>
</html>
