<?php include __DIR__ . '/../layout/header.php'; ?>

<div class="admin-card" style="max-width: 600px;">
    <div class="admin-card-header">
        <h2 class="admin-card-title">Yeni Bayi / Mağaza Oluştur</h2>
    </div>

    <?php if (isset($error)): ?>
        <div style="background:rgba(239,68,68,0.1); border:1px solid rgba(239,68,68,0.3); color:#ef4444; padding:14px 18px; border-radius:var(--r-md); margin-bottom:24px; font-size:14px;">
            <i class="fa fa-exclamation-triangle" style="margin-right:8px;"></i> <?php echo $error; ?>
        </div>
    <?php endif; ?>

    <form action="<?php echo $baseUrl; ?>/superadmin/tenants/store" method="POST">
        
        <div class="admin-form-group">
            <label for="name">Mağaza / Bayi Adı *</label>
            <input type="text" id="name" name="name" required class="admin-input" placeholder="Örn: Bodrum Şubesi">
        </div>

        <div class="admin-form-group">
            <label for="id">Mağaza Benzersiz ID (Klasör Adı) *</label>
            <p class="hint">Sadece küçük harfler ve rakamlar kullanın. Bu değer sonradan değiştirilemez.</p>
            <input type="text" id="id" name="id" required class="admin-input" placeholder="Örn: bodrum">
        </div>

        <div class="admin-form-group">
            <label for="domain">Ana Alan Adı (Domain) *</label>
            <input type="text" id="domain" name="domain" required class="admin-input" placeholder="Örn: everestburo.com">
        </div>

        <div class="admin-form-group">
            <label for="subdomains">Alt Alan Adları (Subdomains)</label>
            <p class="hint">Birden fazla ise virgül (,) ile ayırın. Giriş hostuyla otomatik eşleşir.</p>
            <input type="text" id="subdomains" name="subdomains" class="admin-input" placeholder="Örn: bodrum, www.bodrum">
        </div>

        <hr style="border: 0; border-top: 1px solid var(--border); margin-bottom: 20px;">

        <div style="display: flex; gap: 12px; justify-content: flex-end;">
            <a href="<?php echo $baseUrl; ?>/superadmin/dashboard" class="admin-action-btn" style="width:auto; padding: 0 20px; font-weight: 600;">İptal</a>
            <button type="submit" class="admin-action-btn" style="width:auto; padding: 0 24px; background: #10b981; color: white; border: none; font-weight: 700; cursor:pointer; height:40px;">
                <i class="fa fa-plus-circle" style="margin-right:8px;"></i> Mağazayı Oluştur
            </button>
        </div>

    </form>
</div>

<?php include __DIR__ . '/../layout/footer.php'; ?>
