﻿{{-- resources/views/components/dashboard-sidebar.blade.php --}}

<!-- Mobile Toggle Checkbox -->
<input type="checkbox" id="sidebar-toggle" class="hidden peer" />

<!-- Mobile Overlay -->
<label for="sidebar-toggle"
    class="fixed inset-0 bg-black/50 z-30 hidden peer-checked:block md:hidden transition-opacity"></label>

<!-- Mobile Toggle Button -->
<label for="sidebar-toggle"
    class="fixed top-4 left-4 z-50 w-10 h-10 bg-white border border-gray-200 rounded-lg flex items-center justify-center cursor-pointer md:hidden shadow-md hover:bg-gray-50 transition-colors">
    <svg class="w-5 h-5 text-gray-700" fill="none" stroke="currentColor" viewBox="0 0 24 24">
        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16" />
    </svg>
</label>

<!-- Sidebar -->
<aside class="md:w-[20%] w-[70%] fixed inset-y-0 left-0 w-64 bg-white border-r border-gray-100 flex flex-col overflow-y-auto
    transform -translate-x-full peer-checked:translate-x-0 md:translate-x-0 transition-transform duration-300 ease-in-out z-40">

    {{-- Logo --}}
    <div class="p-6 flex items-center gap-2 shrink-0">
         <a href="{{ url('/') }}" class="md:pl-0 pl-[40px] flex items-center">
            <img src="{{ asset('logo.png') }}" alt="{{ config('app.name', 'Laravel') }}" class="h-6 w-auto">
        </a>
    </div>

    {{-- User Profile Card --}}
    <nav class="flex-1 px-4 pb-6">
        <a href="{{ route('profile.index') }}" class="block mb-6 group">
            <div class="p-3 bg-white rounded-xl border border-gray-200 shadow-sm flex items-center gap-3 group-hover:border-[#2F3D7E]/30 group-hover:shadow-md transition-all">
                <img src="https://ui-avatars.com/api/?name={{ auth()->user()->name }}&background=2F3D7E&color=fff"
                    alt="Profile" class="h-10 w-10 rounded-full border border-gray-100">
                <div class="min-w-0 text-left flex-1">
                    <p class="font-semibold text-sm text-gray-900 truncate group-hover:text-[#2F3D7E] transition-colors">
                        {{ auth()->user()->name }}
                    </p>
                    <p class="text-xs text-gray-500 truncate">{{ auth()->user()->email }}</p>
                </div>
            </div>
        </a>

        {{-- Main Section --}}
        <div class="px-4 mt-6 mb-2">
            <p class="text-xs font-semibold text-gray-400 uppercase tracking-wider">Main</p>
        </div>

        <a href="{{ route('dashboard.index') }}"
            class="flex items-center gap-3 px-4 py-3 rounded-xl transition-all mb-1 {{ request()->routeIs('dashboard.index') ? 'bg-[#2F3D7E] text-white shadow-md' : 'text-gray-500 hover:bg-gray-50 hover:text-gray-900' }}">
            <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6" />
            </svg>
            <span class="text-sm font-medium whitespace-nowrap">Home</span>
        </a>

        {{-- <a href="#"
            class="flex items-center gap-3 px-4 py-3 rounded-xl transition-all mb-1 {{ request()->routeIs('dashboard.notifications') ? 'bg-[#2F3D7E] text-white shadow-md' : 'text-gray-500 hover:bg-gray-50 hover:text-gray-900' }}">
            <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
            </svg>
            <div class="flex items-center justify-between flex-1">
                <span class="font-medium">Notifications</span>
                <span title="0 New notifications"
                    class="flex items-center justify-center bg-[#2F3D7E] text-white text-[10px] font-bold px-2 h-5 rounded-full shadow-sm">
                    <span class="xl:inline hidden">0</span>
                    <span class="xl:hidden inline">0</span>
                </span>
            </div>
        </a> --}}

        {{-- <a href="#"
            class="flex items-center gap-3 px-4 py-3 rounded-xl transition-all mb-1 {{ request()->routeIs('dashboard.messages') ? 'bg-[#2F3D7E] text-white shadow-md' : 'text-gray-500 hover:bg-gray-50 hover:text-gray-900' }}">
            <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 10h.01M12 10h.01M16 10h.01M9 16H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-5l-5 5v-5z" />
            </svg>
            <span class="text-sm font-medium whitespace-nowrap">Messages</span>
        </a> --}}

        <a href="{{ route('communities.index') }}"
            class="flex items-center gap-3 px-4 py-3 rounded-xl transition-all mb-1 {{ request()->routeIs('communities.*') || request()->routeIs('rate-my-pay.*') ? 'bg-[#2F3D7E] text-white shadow-md' : 'text-gray-500 hover:bg-gray-50 hover:text-gray-900' }}">
            <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z" />
            </svg>
            <span class="text-sm font-medium whitespace-nowrap">Community</span>
        </a>
        <a href="{{ route('dashboard.job-descriptions.index') }}"
            class="flex items-center gap-3 px-4 py-3 rounded-xl transition-all mb-1 {{ request()->routeIs('dashboard.job-descriptions.*') ? 'bg-[#2F3D7E] text-white shadow-md' : 'text-gray-500 hover:bg-gray-50 hover:text-gray-900' }}">
            <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
            </svg>
            <span class="text-sm font-medium whitespace-nowrap">Job Description Wizard</span>
        </a>

        {{-- Salary Section --}}
        <div class="px-4 mt-6 mb-2">
            <p class="text-xs font-semibold text-gray-400 uppercase tracking-wider">Compensations</p>
        </div>

        <a href="{{ route('dashboard.job-experiences.index') }}"
            class="flex items-center gap-3 px-4 py-3 rounded-xl transition-all mb-1 {{ request()->routeIs('dashboard.job-experiences.*') ? 'bg-[#2F3D7E] text-white shadow-md' : 'text-gray-500 hover:bg-gray-50 hover:text-gray-900' }}">
            <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
            </svg>
            <span class="text-sm font-medium whitespace-nowrap">Job Experiences</span>
        </a>

        {{-- Analytics Section --}}
        {{-- <div class="px-4 mt-6 mb-2">
            <p class="text-xs font-semibold text-gray-400 uppercase tracking-wider">Analytics</p>
        </div> --}}

        {{-- <a href="#"
            class="flex items-center gap-3 px-4 py-3 rounded-xl transition-all mb-1 {{ request()->routeIs('dashboard.reports') ? 'bg-[#2F3D7E] text-white shadow-md' : 'text-gray-500 hover:bg-gray-50 hover:text-gray-900' }}">
            <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z" />
            </svg>
            <span class="text-sm font-medium whitespace-nowrap">Reports & Insights</span>
        </a> --}}

        {{-- System Section --}}
        <div class="px-4 mt-6 mb-2">
            <p class="text-xs font-semibold text-gray-400 uppercase tracking-wider">System</p>
        </div>

        <a href="{{ route('settings.index') }}"
            class="flex items-center gap-3 px-4 py-3 rounded-xl transition-all mb-1 {{ request()->routeIs('settings.*') ? 'bg-[#2F3D7E] text-white shadow-md' : 'text-gray-500 hover:bg-gray-50 hover:text-gray-900' }}">
            <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z" />
                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
            </svg>
            <span class="text-sm font-medium whitespace-nowrap">Settings</span>
        </a>
    </nav>

    {{-- Sign Out Button --}}
    <div class="p-4 border-t border-gray-100 shrink-0">
        <form method="POST" action="{{ route('logout') }}" class="w-full">
            @csrf
            <button type="submit"
                class="flex items-center gap-3 px-4 py-3 w-full rounded-xl text-gray-500 hover:bg-red-50 hover:text-red-600 transition-colors">
                <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1" />
                </svg>
                <span class="text-sm font-medium whitespace-nowrap">Sign Out</span>
            </button>
        </form>
    </div>
</aside>

{{-- Main Content Wrapper - Fixed margin to match sidebar width --}}
<div class="md:w-[20%] w-[0%] min-h-screen bg-gray-50">
    <div class="md:hidden fixed top-0 left-0 right-0 bg-white border-b border-gray-100 z-20 px-4 h-16 flex items-center justify-left">
        <div class="md:pl-0 pl-12 md:mt-0 mt-[10px] flex items-center gap-2">
            <a href="{{ url('/') }}" class="flex items-center">
                    <img src="{{ asset('logo.png') }}" alt="{{ config('app.name', 'Laravel') }}" class="h-6 w-auto">
            </a>
        </div>
    </div>
</div>

<style>
    /* Ensure the peer checkbox works correctly */
    #sidebar-toggle:checked ~ aside {
        transform: translateX(0);
    }

    #sidebar-toggle:checked ~ label[for="sidebar-toggle"]:first-of-type {
        display: block;
    }

    /* Smooth sidebar animation */
    aside {
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    /* Active link gradient */
    .bg-\[\#2F3D7E\] {
        /* background: linear-gradient(135deg, #2F3D7E 0%, #1E2858 100%); */
    }

    /* Prevent body scroll when sidebar is open on mobile */
    @media (max-width: 767px) {
        #sidebar-toggle:checked ~ body {
            overflow: hidden;
        }
    }
</styl