<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}" dir="{{ app()->getLocale() == 'ar' ? 'rtl' : 'ltr' }}">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta name="csrf-token" content="{{ csrf_token() }}">

        <title>{{ config('app.name', 'مدار بلس') }}</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=Tajawal:wght@200;300;400;500;700;800;900&display=swap" rel="stylesheet">

        @vite(['resources/css/app.css', 'resources/js/app.js'])
        
        @stack('styles')
        
        <style>
            * { font-family: 'Tajawal', sans-serif !important; }
            .scrollbar-hide::-webkit-scrollbar { display: none; }
            .scrollbar-hide { -ms-overflow-style: none; scrollbar-width: none; }
            html, body { height: 100%; margin: 0; padding: 0; }
        </style>
    </head>
    <body class="antialiased bg-[#0a0a0a] text-white" style="margin: 0; padding: 0; height: 100%;">
        <!-- Note: This component is deprecated. Use @extends('layouts.app') instead -->
        <div style="display: flex; height: 100vh; overflow: hidden; background: #0a0a0a;">

            <!-- Main Layout Container -->
            <div style="display: flex; flex-direction: column; flex: 1; height: 100%; background: #0a0a0a; border-top-left-radius: 40px; border-bottom-left-radius: 40px; overflow: hidden;">
                
                <!-- 1. Topbar -->
                <header style="height: 80px; background: rgba(10,10,10,0.8); border-bottom: 1px solid rgba(255,255,255,0.05); flex-shrink: 0; display: flex; align-items: center;">
                    <div style="width: 70%; margin: 0 auto; display: flex; align-items: center; justify-content: space-between;">
                        <div class="flex items-center gap-6">
                            <nav class="flex items-center text-xs font-bold text-gray-500 space-x-2 rtl:space-x-reverse uppercase tracking-widest">
                                <a href="{{ route('admin.dashboard') }}" class="hover:text-[#d4af37] transition-colors">Dashboard</a>
                                <svg class="w-4 h-4 opacity-20" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path d="M9 5l7 7-7 7" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"></path></svg>
                                <span class="text-white">{{ $header_title ?? '' }}</span>
                            </nav>
                        </div>

                        <div class="flex items-center gap-8">
                            <a href="{{ route('admin.dashboard') }}" class="relative p-2 bg-white/5 rounded-xl hover:bg-white/10 transition-all group">
                                <svg class="w-5 h-5 text-gray-400 group-hover:text-[#d4af37]" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9"></path></svg>
                            </a>

                            <div class="flex items-center gap-3 text-[11px] font-black">
                                <a href="{{ route('lang.switch', 'ar') }}" class="px-3 py-1.5 rounded-lg transition-all {{ app()->getLocale() == 'ar' ? 'bg-[#d4af37] text-black shadow-lg shadow-[#d4af37]/20' : 'text-gray-500 hover:text-white' }}">AR</a>
                                <a href="{{ route('lang.switch', 'en') }}" class="px-3 py-1.5 rounded-lg transition-all {{ app()->getLocale() == 'en' ? 'bg-[#d4af37] text-black shadow-lg shadow-[#d4af37]/20' : 'text-gray-500 hover:text-white' }}">EN</a>
                            </div>
                            <div style="height: 2rem; width: 1px; background: rgba(255,255,255,0.1);"></div>
                            <div class="flex items-center gap-4">
                                <div class="flex flex-col items-start leading-none ltr:items-end">
                                    <span class="text-sm font-black text-white uppercase tracking-tight">{{ Auth::user()->name }}</span>
                                    <span class="text-[10px] font-bold text-[#d4af37] mt-1 opacity-80">Administrator</span>
                                </div>
                                <div style="width: 40px; height: 40px; border-radius: 1rem; background: #111; border: 1px solid rgba(255,255,255,0.05); display: flex; align-items: center; justify-content: center; font-size: 0.875rem; font-weight: 900; color: #d4af37;">
                                    {{ substr(Auth::user()->name, 0, 1) }}
                                </div>
                            </div>
                        </div>
                    </div>
                </header>

                <!-- 2. Content Area -->
                <div style="flex: 1; overflow: hidden; display: flex; flex-direction: column;">
                    @if (isset($header))
                        <div style="background: rgba(0,0,0,0.4); padding: 1rem; flex-shrink: 0; border-bottom: 1px solid rgba(255,255,255,0.05); overflow-y: auto;">
                            <div style="width: 70%; margin: 0 auto;">
                                {{ $header }}
                            </div>
                        </div>
                    @endif

                    <main style="flex: 1; overflow-y: auto; padding: 2rem; background: #0a0a0a;">
                        <div style="width: 100%;">
                            {{ $slot }}
                        </div>
                    </main>
                </div>
            </div>
        </div>

        @stack('scripts')
    </body>
</html>
