<?php

namespace Tests\Feature;

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

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

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

        // filter-error 属于错误提示组件，应引用主题错误令牌（便于全站统一风格）
        $this->assertStringContainsString('.filter-error{', $css);
        $this->assertStringContainsString('background:var(--adm-error-bg', $css);
        $this->assertStringContainsString('color:var(--adm-error', $css);

        // 不应再硬编码旧的暗红色文本（#991b1b）
        $this->assertStringNotContainsString('#991b1b', $css);
    }
}
