<?php

namespace Tests\Feature;

use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;

class AdminBaseCssSidebarHoverAndInputFocusShouldUsePrimaryTokensTest extends TestCase
{
    use RefreshDatabase;

    protected function loginAsPlatformAdmin(): void
    {
        $this->seed();

        $this->post('/admin/login', [
            'email' => 'platform.admin@demo.local',
            'password' => 'Platform@123456',
        ])->assertRedirect('/admin');
    }

    public function test_admin_base_css_sidebar_hover_and_input_focus_should_use_primary_tokens(): void
    {
        $this->loginAsPlatformAdmin();

        $css = file_get_contents(public_path('css/admin-base.css'));
        $this->assertIsString($css);

        // 左侧菜单 hover 高亮必须走 primary tint token。
        $this->assertStringContainsString('.sidebar:not(.topnav) a:hover', $css);
        $this->assertStringContainsString('background:var(--adm-primary-tint-08', $css);

        // input focus ring 必须走 focus-ring token。
        $this->assertStringContainsString('box-shadow:0 0 0 3px var(--adm-primary-focus-ring', $css);
    }
}
