<?php

namespace Tests\Feature;

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

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

        $res = $this->get('/admin/orders');
        $res->assertOk();

        // 页面仍然可以使用 section-dark 作为“强调区块”类名，但样式不应回到深色背景
        $res->assertSee('section-dark', false);

        $css = (string) file_get_contents(public_path('css/admin-base.css'));

        // 旧版硬编码深色背景：background:#0f172a
        $this->assertStringNotContainsString('background:#0f172a', $css);
        $this->assertStringContainsString('--adm-surface-tint', $css);
    }
}
