<?php

namespace Tests\Feature;

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

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

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

        // 顶部导航必须走浅色主题基线（Ant Design Pro-ish），避免回退到深色 header。
        $this->assertStringContainsString('.sidebar.topnav{', $css);
        $this->assertStringContainsString('background:var(--adm-bg-header, #ffffff)', $css);
        $this->assertStringContainsString('border-bottom:1px solid var(--adm-border-color, #e5e7eb)', $css);

        // 下拉必须是白底容器 + 浅色边框。
        $this->assertStringContainsString('.topnav-dropdown{', $css);
        $this->assertStringContainsString('background:var(--adm-bg-container, #ffffff)', $css);
        $this->assertStringContainsString('border:1px solid var(--adm-border-color, #e5e7eb)', $css);

        // 顶部导航链接默认应是 secondary 文本色（灰），hover 才变深。
        $this->assertStringContainsString('color:var(--adm-text-secondary, #64748b)', $css);
    }
}
