@extends('layouts.admin')

@section('heading', 'Shop Profile')
@section('subheading', 'Update your shop name and logo — shown in your sidebar and dashboard.')

@section('content')

@include('partials.master-tabs')

@if (session('status'))
  <div class="mb-4 text-sm rounded-lg px-4 py-3" style="background:#E1F5EE; color:#0F6E56;">{{ session('status') }}</div>
@endif
@if ($errors->any())
  <div class="mb-4 text-sm rounded-lg px-4 py-3" style="background:#FCEBEB; color:#791F1F;">{{ $errors->first() }}</div>
@endif

<div class="card p-6 max-w-md">
  @if($shop->logo)
    <img src="{{ asset('storage/' . $shop->logo) }}" alt="{{ $shop->name }}"
         style="width:80px; height:80px; border-radius:12px; object-fit:cover; margin-bottom:16px;">
  @else
    <p class="text-xs mb-4" style="color:#a19a8f;">No custom logo yet — the eTailorz logo is shown by default.</p>
  @endif

  <form method="POST" action="{{ route('shop.profile.update') }}" enctype="multipart/form-data" class="space-y-3">
    @csrf

    <div>
      <label class="block text-xs mb-1" style="color:#6b6470;">Shop name</label>
      <input type="text" name="name" value="{{ old('name', $shop->name) }}" required
        class="w-full px-3 py-2 rounded-lg border text-sm outline-none" style="border-color:#e6e1d8;">
    </div>

    <div>
      <label class="block text-xs mb-1" style="color:#6b6470;">Logo (optional — leave blank to keep current)</label>
      <input type="file" name="logo" accept="image/*" class="w-full text-sm">
    </div>

    <button type="submit" class="px-4 py-2 rounded-lg text-sm font-medium text-white" style="background:#5E35B1;">Save changes</button>
  </form>
</div>

@endsection
