from pathlib import Path

ROOT = Path(__file__).resolve().parents[1]


def read(path: str) -> str:
    return (ROOT / path).read_text(encoding="utf-8")


def test_opportunity_detail_keeps_two_column_context_left_operation_right_layout():
    opps = read("app/admin_ui/pages/opportunities.py")
    assert "cf-opp-detail-grid" in opps
    assert "grid-template-columns:minmax(0,1fr) minmax(320px,400px)" in opps
    assert "grid-template-areas:'context operation'" in opps
    assert "cf-opp-operation-column" in opps
    assert "cf-opp-context-column" in opps
    assert "Operação" in opps
    assert "Contexto e evidência" in opps


def test_opportunity_detail_places_context_left_and_operation_right_on_desktop():
    opps = read("app/admin_ui/pages/opportunities.py")
    assert "grid-area:context" in opps
    assert "grid-area:operation" in opps
    assert "Desktop: context/evidence on the left" in opps
    assert "grid-template-areas:'operation' 'context'" in opps
    assert "O que fazer agora?" in opps
    assert "Tarefa ativa" in opps
    assert "Corrigir associação operacional" in opps
    assert "Documentos Jasmin" in opps
    assert "Mensagens Chatwoot" in opps
