<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>@yield('title', 'Admin') — Honey B</title>
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&display=swap" rel="stylesheet">
    <style>
        :root {
            --admin-bg: #0f0d0a;
            --admin-bg-main: radial-gradient(120% 80% at 50% -20%, rgba(232, 163, 23, 0.12), transparent 50%), #0f0d0a;
            --admin-sidebar: linear-gradient(180deg, #16130f 0%, #0c0a08 100%);
            --admin-border: #2e281f;
            --admin-text: #f7f2ea;
            --admin-muted: #9a8b78;
            --admin-amber: #e8a317;
            --admin-amber-soft: rgba(232, 163, 23, 0.14);
            --admin-amber-bright: #f4c14d;
            --admin-card: #18140f;
            --admin-card-hover: #1f1a14;
            --admin-danger: #d64545;
            --admin-success: #3d9b6a;
            --admin-link: #f0c86b;
        }
        * { box-sizing: border-box; }
        body {
            margin: 0;
            font-family: "DM Sans", system-ui, -apple-system, sans-serif;
            background: var(--admin-bg-main);
            color: var(--admin-text);
            min-height: 100vh;
            -webkit-font-smoothing: antialiased;
        }
        a { color: var(--admin-link); text-decoration: none; }
        a:hover { text-decoration: underline; color: var(--admin-amber-bright); }
        .admin-shell { display: grid; grid-template-columns: 272px 1fr; min-height: 100vh; }
        @media (max-width: 900px) {
            .admin-shell { grid-template-columns: 1fr; }
            .admin-sidebar { position: sticky; top: 0; z-index: 20; border-right: none; border-bottom: 1px solid var(--admin-border); }
            .admin-nav { display: flex; flex-wrap: wrap; gap: 0.25rem; padding: 0 1rem 1rem; }
            .admin-nav a, .admin-nav form { flex: 1 1 auto; min-width: 44%; }
        }
        .admin-sidebar {
            background: var(--admin-sidebar);
            border-right: 1px solid var(--admin-border);
            padding: 1.5rem 0 1rem;
            display: flex;
            flex-direction: column;
        }
        .admin-brand {
            padding: 0 1.35rem 1.35rem;
            border-bottom: 1px solid var(--admin-border);
            margin-bottom: 1rem;
        }
        .admin-brand-badge {
            width: 44px; height: 44px;
            border-radius: 12px;
            background: linear-gradient(145deg, var(--admin-amber) 0%, #a86b08 100%);
            display: flex; align-items: center; justify-content: center;
            font-size: 1.35rem;
            margin-bottom: 0.85rem;
            box-shadow: 0 4px 20px rgba(232, 163, 23, 0.25);
        }
        .admin-brand strong {
            font-size: 1.15rem;
            font-weight: 700;
            letter-spacing: -0.02em;
            display: block;
            background: linear-gradient(90deg, #fff 0%, #e8cfa0 100%);
            -webkit-background-clip: text;
            background-clip: text;
            color: transparent;
        }
        .admin-brand small { color: var(--admin-muted); font-size: 0.78rem; margin-top: 0.2rem; display: block; }
        .admin-nav { flex: 1; }
        .admin-nav a {
            display: flex;
            align-items: center;
            gap: 0.65rem;
            padding: 0.7rem 1.35rem;
            color: var(--admin-muted);
            border-left: 3px solid transparent;
            font-size: 0.92rem;
            font-weight: 500;
        }
        .admin-nav a:hover {
            background: var(--admin-amber-soft);
            color: var(--admin-text);
            border-left-color: rgba(232, 163, 23, 0.5);
            text-decoration: none;
        }
        .admin-nav a.active {
            background: var(--admin-amber-soft);
            color: var(--admin-amber-bright);
            border-left-color: var(--admin-amber);
        }
        .admin-nav .nav-icon { font-size: 1.1rem; opacity: 0.9; width: 1.35rem; text-align: center; }
        .admin-sidebar-footer {
            padding: 1rem 1.35rem 0;
            margin-top: auto;
            border-top: 1px solid var(--admin-border);
        }
        .admin-user-pill {
            display: flex;
            align-items: center;
            gap: 0.65rem;
            padding: 0.6rem 0.75rem;
            border-radius: 10px;
            background: rgba(255, 255, 255, 0.04);
            border: 1px solid var(--admin-border);
            margin-bottom: 0.75rem;
        }
        .admin-user-pill .avatar {
            width: 36px; height: 36px;
            border-radius: 9px;
            background: linear-gradient(135deg, #3d3428, #1e1a14);
            display: flex; align-items: center; justify-content: center;
            font-size: 0.85rem; font-weight: 700;
            color: var(--admin-amber-bright);
        }
        .admin-user-pill .meta { min-width: 0; }
        .admin-user-pill .meta span { display: block; font-size: 0.8rem; color: var(--admin-muted); }
        .admin-user-pill .meta strong { font-size: 0.88rem; font-weight: 600; color: var(--admin-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
        .admin-main {
            padding: 1.75rem 2rem 3.5rem;
            max-width: 1280px;
            width: 100%;
        }
        .admin-top { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.75rem; }
        .admin-top h1 { margin: 0; font-size: 1.65rem; font-weight: 700; letter-spacing: -0.03em; }
        .admin-top .sub { margin: 0.35rem 0 0; font-size: 0.95rem; color: var(--admin-muted); font-weight: 400; }
        .flash { padding: 0.85rem 1.1rem; border-radius: 10px; margin-bottom: 1.1rem; font-size: 0.92rem; }
        .flash-success { background: rgba(61, 155, 106, 0.15); border: 1px solid rgba(61, 155, 106, 0.45); color: #a8ebc8; }
        .flash-error { background: rgba(214, 69, 69, 0.12); border: 1px solid rgba(214, 69, 69, 0.45); color: #ffb4b4; }
        .card {
            background: var(--admin-card);
            border: 1px solid var(--admin-border);
            border-radius: 14px;
            padding: 1.35rem 1.5rem;
            margin-bottom: 1rem;
            box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset;
        }
        .stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.75rem; }
        .stat {
            background: var(--admin-card);
            border: 1px solid var(--admin-border);
            border-radius: 14px;
            padding: 1.2rem 1.35rem;
            position: relative;
            overflow: hidden;
        }
        .stat::before {
            content: "";
            position: absolute; top: 0; left: 0; right: 0; height: 3px;
            background: linear-gradient(90deg, var(--admin-amber), #c77d0a);
            opacity: 0.85;
        }
        .stat span { display: block; font-size: 1.85rem; font-weight: 700; letter-spacing: -0.02em; color: #fff; margin-top: 0.35rem; }
        .stat label { font-size: 0.72rem; color: var(--admin-muted); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }
        table.admin-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
        table.admin-table tbody tr { transition: background 0.12s ease; }
        table.admin-table tbody tr:hover { background: var(--admin-amber-soft); }
        table.admin-table th, table.admin-table td { padding: 0.75rem 0.85rem; text-align: left; border-bottom: 1px solid var(--admin-border); }
        table.admin-table th { color: var(--admin-muted); font-weight: 600; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; }
        .btn {
            display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
            padding: 0.55rem 1.15rem; border-radius: 10px; font-size: 0.9rem; font-weight: 600;
            border: none; cursor: pointer; text-decoration: none;
            transition: transform 0.08s ease, box-shadow 0.15s ease;
        }
        .btn:active { transform: scale(0.98); }
        .btn-primary {
            background: linear-gradient(180deg, #f0b429 0%, #c78a0a 100%);
            color: #1a1308;
            box-shadow: 0 2px 12px rgba(232, 163, 23, 0.35);
        }
        .btn-primary:hover { text-decoration: none; color: #1a1308; filter: brightness(1.06); }
        .btn-ghost {
            background: transparent;
            color: var(--admin-text);
            border: 1px solid var(--admin-border);
        }
        .btn-ghost:hover { background: rgba(255, 255, 255, 0.05); text-decoration: none; color: var(--admin-text); }
        .btn-danger { background: var(--admin-danger); color: #fff; }
        .btn-danger:hover { text-decoration: none; color: #fff; filter: brightness(1.05); }
        .form-row { margin-bottom: 1rem; }
        .form-row label { display: block; margin-bottom: 0.4rem; font-size: 0.85rem; color: var(--admin-muted); font-weight: 500; }
        .form-row input, .form-row select, .form-row textarea {
            width: 100%; max-width: 560px;
            padding: 0.55rem 0.75rem;
            border-radius: 10px;
            border: 1px solid var(--admin-border);
            background: #0c0a08;
            color: var(--admin-text);
            font-family: inherit;
            font-size: 0.95rem;
        }
        .form-row input:focus, .form-row select:focus, .form-row textarea:focus {
            outline: none;
            border-color: rgba(232, 163, 23, 0.55);
            box-shadow: 0 0 0 3px var(--admin-amber-soft);
        }
        .form-row textarea { min-height: 110px; resize: vertical; }
        .error { color: #ff9b9b; font-size: 0.85rem; margin-top: 0.25rem; }
        .thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 10px; background: var(--admin-border); border: 1px solid var(--admin-border); }
        .pagination { margin-top: 1.25rem; }
        .pagination a, .pagination span { color: var(--admin-muted); margin-right: 0.5rem; }
        .pagination .active span { color: var(--admin-amber-bright); font-weight: 600; }
        .pill-yes { color: #7dcea0; font-weight: 600; font-size: 0.85rem; }
        .pill-no { color: var(--admin-muted); font-size: 0.85rem; }
    </style>
    @stack('styles')
</head>
<body>
    <div class="admin-shell">
        <aside class="admin-sidebar">
            <div class="admin-brand">
                <div class="admin-brand-badge" aria-hidden="true">🍯</div>
                <strong>Honey B</strong>
                <small>Store administration</small>
            </div>
            <nav class="admin-nav">
                <a href="{{ route('admin.dashboard') }}" class="{{ request()->routeIs('admin.dashboard') ? 'active' : '' }}">
                    <span class="nav-icon" aria-hidden="true">◆</span> Dashboard
                </a>
                <a href="{{ route('admin.products.index') }}" class="{{ request()->routeIs('admin.products.*') ? 'active' : '' }}">
                    <span class="nav-icon" aria-hidden="true">◇</span> Products
                </a>
                <a href="{{ route('admin.categories.index') }}" class="{{ request()->routeIs('admin.categories.*') ? 'active' : '' }}">
                    <span class="nav-icon" aria-hidden="true">▫</span> Categories
                </a>
                <a href="{{ route('admin.payments.index') }}" class="{{ request()->routeIs('admin.payments.*') ? 'active' : '' }}">
                    <span class="nav-icon" aria-hidden="true">$</span> Payments
                </a>
                <a href="{{ route('admin.transactions.index') }}" class="{{ request()->routeIs('admin.transactions.*') ? 'active' : '' }}">
                    <span class="nav-icon" aria-hidden="true">≡</span> Transactions
                </a>
                <a href="{{ route('shop.index') }}" target="_blank" rel="noopener">
                    <span class="nav-icon" aria-hidden="true">↗</span> View shop
                </a>
                <a href="{{ url('/') }}">
                    <span class="nav-icon" aria-hidden="true">⌂</span> Site home
                </a>
            </nav>
            <div class="admin-sidebar-footer">
                <div class="admin-user-pill">
                    <div class="avatar">{{ strtoupper(substr(auth()->user()->name ?? 'A', 0, 1)) }}</div>
                    <div class="meta">
                        <span>Signed in</span>
                        <strong title="{{ auth()->user()->email ?? '' }}">{{ auth()->user()->name ?? 'Admin' }}</strong>
                    </div>
                </div>
                <form method="POST" action="{{ route('logout') }}">
                    @csrf
                    <button type="submit" class="btn btn-ghost" style="width:100%;">Log out</button>
                </form>
            </div>
        </aside>
        <main class="admin-main">
            @if(session('success'))
                <div class="flash flash-success">{{ session('success') }}</div>
            @endif
            @if(session('error'))
                <div class="flash flash-error">{{ session('error') }}</div>
            @endif
            @yield('content')
        </main>
    </div>
    @stack('scripts')
</body>
</html>
