<?php

namespace Tests\Feature;

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

class AdminBaseCssShouldUseLightThemeTokensTest 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_should_use_light_theme_tokens(): void
    {
        $this->loginAsPlatformAdmin();

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

        // 核心：body 文本应引用 --adm-text（浅色主题为深色文字），避免仍残留暗色文字默认值
        $this->assertStringContainsString('color:var(--adm-text, #0f172a)', $css);

        // 表格分割线应引用 --adm-border-color（浅色主题为浅边框），避免仍硬编码 #334155
        $this->assertStringContainsString('border-bottom:1px solid var(--adm-border-color', $css);

        // 表单 focus 需要有主色描边（Ant Design Pro 关键交互反馈）
        $this->assertStringContainsString('box-shadow:0 0 0 3px rgba(22, 119, 255, .12)', $css);
    }
}
