<?php
$page_title = 'Complaints / Warranty';
require_once __DIR__ . '/header.php';

// Mock submission
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $success = "Complaint registered successfully. Ticket #CMP-".rand(1000,9999)." has been generated.";
}
?>

<div style="display:flex;gap:24px;">
  <!-- Raise Complaint Form -->
  <div class="card" style="flex:2;">
    <div style="display:flex;gap:20px;border-bottom:1px solid #e2e8f0;margin-bottom:24px;">
      <h3 style="margin:0;color:#2557d6;border-bottom:3px solid #2557d6;padding-bottom:12px;font-size:1.1rem;cursor:pointer;">Raise Complaint</h3>
      <h3 style="margin:0;color:#64748b;padding-bottom:12px;font-size:1.1rem;cursor:pointer;">My Complaints</h3>
    </div>

    <?php if(isset($success)): ?><div class="badge badge-success" style="display:block;padding:12px;margin-bottom:20px;border-radius:8px;font-size:.9rem;"><?= h($success) ?></div><?php endif; ?>

    <form method="POST" style="display:flex;flex-direction:column;gap:20px;">
      <div style="display:grid;grid-template-columns:1fr 1fr;gap:20px;">
        <div>
          <label style="display:block;margin-bottom:8px;font-weight:600;font-size:.85rem;">Complaint Type *</label>
          <select required style="width:100%;padding:10px;border:1px solid #cbd5e1;border-radius:8px;outline:none;">
            <option value="">Select Type</option>
            <option>Damage Claim</option>
            <option>Short Supply Claim</option>
            <option>Product Defect</option>
            <option>Warranty Registration</option>
          </select>
        </div>
        <div>
          <label style="display:block;margin-bottom:8px;font-weight:600;font-size:.85rem;">Order ID (Optional)</label>
          <select style="width:100%;padding:10px;border:1px solid #cbd5e1;border-radius:8px;outline:none;">
            <option value="">Select Order</option>
            <option>ORD-1244</option>
            <option>ORD-1245</option>
          </select>
        </div>
      </div>
      
      <div>
        <label style="display:block;margin-bottom:8px;font-weight:600;font-size:.85rem;">Product *</label>
        <select required style="width:100%;padding:10px;border:1px solid #cbd5e1;border-radius:8px;outline:none;">
          <option value="">Select Product</option>
          <option>Premium Sink 24x18</option>
          <option>SS Faucet Standard</option>
        </select>
      </div>

      <div>
        <label style="display:block;margin-bottom:8px;font-weight:600;font-size:.85rem;">Description *</label>
        <textarea required rows="4" placeholder="Enter detailed description of the issue..." style="width:100%;padding:10px;border:1px solid #cbd5e1;border-radius:8px;outline:none;resize:vertical;"></textarea>
      </div>

      <div>
        <label style="display:block;margin-bottom:8px;font-weight:600;font-size:.85rem;">Upload Photos (Optional)</label>
        <input type="file" multiple style="width:100%;padding:10px;border:1px dashed #cbd5e1;border-radius:8px;background:#f8fafc;color:#64748b;">
      </div>

      <div style="text-align:right;">
        <button type="submit" class="btn-primary" style="padding:12px 30px;">Submit Complaint</button>
      </div>
    </form>
  </div>

  <!-- Help / Info -->
  <div class="card" style="flex:1;background:#f8fafc;border:1px dashed #cbd5e1;">
    <h4 style="margin:0 0 16px;color:#0f172a;"><i class="fas fa-info-circle" style="color:#2557d6;margin-right:8px;"></i> Support Guidelines</h4>
    <p style="font-size:.85rem;color:#475569;line-height:1.6;margin-bottom:12px;">1. Please raise damage claims within 48 hours of delivery.</p>
    <p style="font-size:.85rem;color:#475569;line-height:1.6;margin-bottom:12px;">2. Clear photos of the defective product and packaging are mandatory for damage claims.</p>
    <p style="font-size:.85rem;color:#475569;line-height:1.6;margin-bottom:12px;">3. Normal resolution time is 3-5 working days.</p>
    
    <div style="margin-top:24px;padding-top:16px;border-top:1px solid #e2e8f0;">
      <h5 style="margin:0 0 8px;color:#0f172a;">Customer Care</h5>
      <p style="margin:0;font-size:.85rem;color:#475569;"><i class="fas fa-phone-alt" style="margin-right:8px;"></i> +91 78706 26467</p>
    </div>
  </div>
</div>

<?php require_once __DIR__ . '/footer.php'; ?>
